|
1 /* |
|
2 * Copyright (c) 1997-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 #include <e32std.h> |
|
26 #include <e32test.h> |
|
27 #include <utf.h> |
|
28 |
|
29 /////////////////////////////////////////////////////////////////////////////////////// |
|
30 |
|
31 RTest TheTest(_L("TNewLin7")); |
|
32 |
|
33 /////////////////////////////////////////////////////////////////////////////////////// |
|
34 /////////////////////////////////////////////////////////////////////////////////////// |
|
35 //Tests macroses and functions. |
|
36 static void Check(TInt aValue, TInt aLine) |
|
37 { |
|
38 if(!aValue) |
|
39 { |
|
40 TheTest(EFalse, aLine); |
|
41 } |
|
42 } |
|
43 #define TEST(arg) ::Check((arg), __LINE__) |
|
44 |
|
45 /////////////////////////////////////////////////////////////////////////////////////// |
|
46 /////////////////////////////////////////////////////////////////////////////////////// |
|
47 /** |
|
48 @SYMTestCaseID SYSLIB-CHARCONV-CT-0570 |
|
49 @SYMTestCaseDesc Testing base64 sequences combined with line-breaks |
|
50 @SYMTestPriority Medium |
|
51 @SYMTestActions Tests for conversion from UTF-7 to Unicode with line-breaks |
|
52 @SYMTestExpectedResults Test must not fail |
|
53 @SYMREQ REQ0000 |
|
54 */ |
|
55 GLDEF_C TInt E32Main() |
|
56 { |
|
57 TheTest.Title(); |
|
58 TheTest.Start(_L("Testing base64 sequences combined with line-breaks")); |
|
59 TBuf16<256> unicode; |
|
60 TBuf8<256> utf7; |
|
61 TInt state=CnvUtfConverter::KStateDefault; |
|
62 utf7=_L8("+U0E\nU0E"); |
|
63 TEST(CnvUtfConverter::ConvertToUnicodeFromUtf7(unicode, utf7, state)==0); |
|
64 TEST(state==CnvUtfConverter::KStateDefault); |
|
65 TEST(unicode.Length()==5); |
|
66 TEST(unicode[0]==0x5341); |
|
67 TEST(unicode[1]==0x000a); |
|
68 TEST(unicode[2]==0x0055); |
|
69 TEST(unicode[3]==0x0030); |
|
70 TEST(unicode[4]==0x0045); |
|
71 unicode=_L16(")\n)\n*\n*\n+\n+\n)\n)\n*\n*\n+\n+"); |
|
72 TEST(CnvUtfConverter::ConvertFromUnicodeToUtf7(utf7, unicode, ETrue)==0); |
|
73 TEST(utf7==_L8(")\n)\n+ACo-\n+ACo-\n+-\n+-\n)\n)\n+ACo-\n+ACo-\n+-\n+-")); |
|
74 TEST(CnvUtfConverter::ConvertFromUnicodeToUtf7(utf7, unicode, EFalse)==0); |
|
75 TEST(utf7==_L8(")\n)\n*\n*\n+-\n+-\n)\n)\n*\n*\n+-\n+-")); |
|
76 TheTest.End(); |
|
77 TheTest.Close(); |
|
78 return KErrNone; |
|
79 } |
|
80 |