Merge pull request #209 from extrafu/master

Latest OpenChange changes from Zentyal
This commit is contained in:
extrafu committed 2016-05-17 13:57:57 -04:00
commit f1bb581dcc
79 files changed
+3222 -1986

No files matched your search

+1
View File
@@ -0,0 +1 @@
{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch37\stshfhich37\stshfbi37\deflang3082\deflangfe3082\themelang3082\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}{\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f39\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f40\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f42\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f43\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f44\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f45\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f46\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f47\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f39\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f40\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f42\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f43\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f44\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f45\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f46\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f47\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f409\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\f410\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\f412\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\f413\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\f416\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\f417\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f31558\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f31561\fbidi \froman\fcharset161\fprq2 Times New RoLine truncated
@@ -0,0 +1 @@
{\rtf1\adeflang1025\ansi\ansicpg1251\uc1\adeff0\deff0\stshfdbch0\stshfloch37\stshfhich37\stshfbi37\deflang1049\deflangfe1049\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}{\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f179\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f180\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f182\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f183\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f184\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f185\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f186\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f187\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f179\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f180\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f182\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f183\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f184\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f185\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f186\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f187\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f549\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\f550\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\f552\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\f553\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\f556\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\f557\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f31558\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f31561\fbidi \froman\fcharset161\fpLine truncated
+1
View File
@@ -24,6 +24,7 @@ $(TEST_TOOL)_OBJC_FILES += \
TestNGMimeAddressHeaderFieldGenerator.m \
TestNGMimeHeaderFieldGenerator.m \
TestNGMimeMessageGenerator.m \
TestNGMimeType.m \
\
TestNSData+Crypto.m \
TestNSString+Crypto.m \
@@ -83,6 +83,15 @@
@" =?utf-8?q?=D1=8C=D1=8C=D1=8C=D1=8C=D1=8C=D1=8C=D1=8C=D1=8C=D1=8C=D1=8C=D1=8C?=\n"
@" =?utf-8?q?=D1=8C=D1=8C=D1=8C=D1=8C=D1=8C=D1=8C=D1=8C=D1=8C=D1=8C=D1=8C=D1=8C?=\n"
@" =?utf-8?q?=D1=8C=D1=8C=D1=8C?=", nil],
[NSArray arrayWithObjects:
@"aжжжжжжжжжжж",
@"=?utf-8?q?a=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6?=\n"
@" =?utf-8?q?=D0=B6=D0=B6?=", nil],
[NSArray arrayWithObjects:
@"aжжжжжжжжжжжжжжжжжжжжж",
@"=?utf-8?q?a=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6?=\n"
@" =?utf-8?q?=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6=D0=B6?=\n"
@" =?utf-8?q?=D0=B6?=", nil],
nil
];
NSArray *caseData;
+101
View File
@@ -0,0 +1,101 @@
/* TestNGMimeAddressHeaderFieldGenerator.m - this file is part of SOGo
*
* Copyright (C) 2016
*
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <NGMime/NGMimeType.h>
#import <NGExtensions/NSString+Encoding.h>
#import "SOGoTest.h"
#include <stdio.h>
@interface TestNGMimeType : SOGoTest
@end
@implementation TestNGMimeType
- (void) test_EncodingForCharset
{
int i;
NSArray *cases = [NSArray arrayWithObjects:
@"utf8",
[NSNumber numberWithInt: NSUTF8StringEncoding],
[NSNumber numberWithInt: NSUTF8StringEncoding],
@"utf-8",
[NSNumber numberWithInt: NSUTF8StringEncoding],
[NSNumber numberWithInt: NSUTF8StringEncoding],
@"ascii",
[NSNumber numberWithInt: NSASCIIStringEncoding],
[NSNumber numberWithInt: NSASCIIStringEncoding],
@"us-ascii",
[NSNumber numberWithInt: NSASCIIStringEncoding],
[NSNumber numberWithInt: NSASCIIStringEncoding],
@"iso-8859-5",
[NSNumber numberWithInt: NSISOCyrillicStringEncoding],
[NSNumber numberWithInt: NSISOCyrillicStringEncoding],
@"windows-1251",
[NSNumber numberWithInt: NSWindowsCP1251StringEncoding],
[NSNumber numberWithInt: NSWindowsCP1251StringEncoding],
@"inexistent_encoding",
[NSNumber numberWithInt: NSISOLatin1StringEncoding],
[NSNumber numberWithInt: 0],
@"nil",
[NSNumber numberWithInt: [NSString defaultCStringEncoding]],
[NSNumber numberWithInt: 0],
@"",
[NSNumber numberWithInt: [NSString defaultCStringEncoding]],
[NSNumber numberWithInt: 0],
nil];
for (i=0; i < [cases count]; i+=3)
{
NSStringEncoding fromNGMimeType, fromNSString;
NSString *charset = [cases objectAtIndex: i];
NSStringEncoding fromNGMimeTypeExpected = [[cases objectAtIndex: i+1] intValue];
NSStringEncoding fromNSStringExpected = [[cases objectAtIndex: i+2] intValue];
NSString *error;
if ([charset isEqualToString: @"nil"])
charset = nil;
fromNGMimeType = [NGMimeType stringEncodingForCharset: charset];
error = [NSString
stringWithFormat:
@"[NGMimeType stringEncodingForCharset: %@]=%i expected: %i",
charset, fromNGMimeType, fromNGMimeTypeExpected];
testWithMessage(fromNGMimeType == fromNGMimeTypeExpected, error);
fromNSString = [NSString stringEncodingForEncodingNamed: charset];
error = [NSString
stringWithFormat:
@"[NSString stringEncodingForEncodingNamed: %@]=%i expected: %i",
charset, fromNSString, fromNSStringExpected];
testWithMessage(fromNSString == fromNSStringExpected, error);
}
}
@end
+22 -12
View File
@@ -44,26 +44,18 @@
return nil;
RTFHandler *handler = [[RTFHandler alloc] initWithData: rtf];
NSMutableData *data2 = [handler parse];
if (data2 == nil)
NSMutableData *data = [handler parse];
if (data == nil)
{
NSString *error = [NSString stringWithFormat: @"Couldn't parse RTF data:\n %s",
(char *)[rtf bytes]];
testWithMessage(NO, error);
}
html = [[NSString alloc] initWithData: data2 encoding: NSUTF8StringEncoding];
html = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];
if (html == nil)
{
html = [[NSString alloc] initWithData: data2 encoding: NSASCIIStringEncoding];
}
if (html == nil)
{
html = [[NSString alloc] initWithData: data2 encoding: NSISOLatin1StringEncoding];
}
if (html == nil)
{
NSString *error = [NSString stringWithFormat: @"Couldn't convert parsed data"];
NSString *error = [NSString stringWithFormat: @"Couldn't convert parsed data to UTF8 string"];
testWithMessage(NO, error);
}
return html;
@@ -305,4 +297,22 @@
againstExpectedHTML: expected];
}
- (void) test_cyr_event_ru_editor
{
NSString *file =@"cyr_event_ru_editor.rtf";
NSString *expected=@"<html><meta charset='utf-8'><body><font face=\"Calibri\"><font face=\"Calibri Cyr\"><font color=\"#000000\">йчсмй</font></font><font color=\"#000000\"><br></font></font></body></html>";
[self checkHTMLConversionOfRTFFile: file
againstExpectedHTML: expected];
}
- (void) test_bad_hex_and_cr
{
NSString *file =@"bad_hex_and_cr.rtf";
NSString *expected=@"<html><meta charset='utf-8'><body><font face=\"Calibri\"><font face=\"Calibri Cyr\"><font color=\"#000000\">Good hex:H Bad1Hex: Bad2Hex: Ignored Carriadge Return</font></font></font></body></html>";
[self checkHTMLConversionOfRTFFile: file
againstExpectedHTML: expected];
}
@end