First public contribution.
2 * Copyright (c) 2000-2010 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
23 #include "tiso8859x.h"
24 #include "t_iso8859x.h"
28 TBool __bb = (cond); \
32 ERR_PRINTF1(_L("ERROR: Test Failed")); \
39 @SYMTestCaseID SYSLIB-CHARCONV-CT-0541
40 @SYMTestCaseDesc Tests for conversion from ISO 8859 to Unicode
41 @SYMTestPriority Medium
42 @SYMTestActions Tests for a filename and then convert to Unicode from ISO8859X
43 @SYMTestExpectedResults Test must not fail
46 void CT_ISO8859X::test1L()
48 INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0541 "));
49 RFs fileServerSession;
50 CleanupClosePushL(fileServerSession);
51 User::LeaveIfError(fileServerSession.Connect());
52 CCnvCharacterSetConverter* characterSetConverter=CCnvCharacterSetConverter::NewLC();
53 CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* arrayOfCharacterSetsAvailable=CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableLC(fileServerSession);
54 INFO_PRINTF1(_L("Available:\n"));
56 for (i=arrayOfCharacterSetsAvailable->Count()-1; i>=0; --i)
58 const CCnvCharacterSetConverter::SCharacterSet& charactersSet=(*arrayOfCharacterSetsAvailable)[i];
59 characterSetConverter->PrepareToConvertToOrFromL(charactersSet.Identifier(), *arrayOfCharacterSetsAvailable, fileServerSession);
60 TPtrC charactersSetName(charactersSet.Name());
61 if (charactersSet.NameIsFileName())
63 charactersSetName.Set(TParsePtrC(charactersSetName).Name());
65 INFO_PRINTF2(_L(" %S\n"), &charactersSetName);
67 TInt state=CCnvCharacterSetConverter::KStateDefault;
68 for (i=0; i<iso8859TestData.iNumberOfItems; ++i)
70 INFO_PRINTF2(_L("Testing ISO 8859-%d"), iso8859TestData.iItems[i].iX);
71 characterSetConverter->PrepareToConvertToOrFromL(iso8859TestData.iItems[i].iCharacterSetIdentifier, *arrayOfCharacterSetsAvailable, fileServerSession);
72 TPtrC16 originalUnicode(iso8859TestData.iItems[i].iUnicode, iso8859TestData.iItems[i].iTextLength);
73 TPtrC8 expectedIso8859(iso8859TestData.iItems[i].iIso8859, iso8859TestData.iItems[i].iTextLength);
74 TBuf16<256> generatedUnicode;
75 test(characterSetConverter->ConvertToUnicode(generatedUnicode, expectedIso8859, state)==0);
76 test(generatedUnicode==originalUnicode);
77 TBuf8<256> generatedIso8859;
78 test(characterSetConverter->ConvertFromUnicode(generatedIso8859, originalUnicode)==0);
79 test(state==CCnvCharacterSetConverter::KStateDefault);
80 test(generatedIso8859==expectedIso8859);
82 CleanupStack::PopAndDestroy(3); // arrayOfCharacterSetsAvailable and characterSetConverter and fileServerSession
86 Test code for INC042690 - Bi-directional MIME types are not supported in Charconv
87 The bi-directional MIME types only indicate how to treat the layout of the mail,
88 the actual character conversion should be the same as for the exisiting ISO-8859-6/ISO-8859-8 plugins
90 @SYMTestCaseID SYSLIB-CHARCONV-CT-0542
91 @SYMTestCaseDesc Tests the Bi-directional MIME
92 @SYMTestPriority Medium
93 @SYMTestActions Tests for conversions of ISO_8859-6 UID to MIB
94 @SYMTestExpectedResults Test must not fail
97 void CT_ISO8859X::testInc042690L()
99 INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0542 Test for INC042690 "));
101 RFs fileServerSession;
102 CleanupClosePushL(fileServerSession);
103 User::LeaveIfError(fileServerSession.Connect());
104 CCnvCharacterSetConverter* characterSetConverter=CCnvCharacterSetConverter::NewLC();
106 // check that the character set value of '81' is converted to the ISO_8859-6 UID (0x10008a29)
107 test(characterSetConverter->ConvertMibEnumOfCharacterSetToIdentifierL(81,fileServerSession)==KCharacterSetIdentifierIso88596);
108 INFO_PRINTF1(_L("\nMIB 81->Char Set ISO_8859-6 UID - OK"));
110 // check that the character set value of '82' is converted to the ISO_8859-6 UID (0x10008a29)
111 test(characterSetConverter->ConvertMibEnumOfCharacterSetToIdentifierL(82,fileServerSession)==KCharacterSetIdentifierIso88596);
112 INFO_PRINTF1(_L("\nMIB 82->Char Set ISO_8859-6 UID - OK"));
114 // check that the character set value of '84' is converted to the ISO_8859-8 UID (0x10008a2a)
115 test(characterSetConverter->ConvertMibEnumOfCharacterSetToIdentifierL(84,fileServerSession)==KCharacterSetIdentifierIso88598);
116 INFO_PRINTF1(_L("\nMIB 84->Char Set ISO_8859-8 UID - OK"));
118 // check that the character set value of '85' is converted to the ISO_8859-8 UID (0x10008a2a)
119 test(characterSetConverter->ConvertMibEnumOfCharacterSetToIdentifierL(85,fileServerSession)==KCharacterSetIdentifierIso88598);
120 INFO_PRINTF1(_L("\nMIB 85->Char Set ISO_8859-8 UID - OK"));
122 // check that the ISO_8859-6 UID (0x10008a29) is converted to the character set value of '9'
123 test(characterSetConverter->ConvertCharacterSetIdentifierToMibEnumL(KCharacterSetIdentifierIso88596,fileServerSession)==9);
124 INFO_PRINTF1(_L("\nChar Set ISO_8859-6 UID->MIB - OK"));
126 // check that the ISO_8859-8 UID (0x10008a2a) is converted to the character set value of '11'
127 test(characterSetConverter->ConvertCharacterSetIdentifierToMibEnumL(KCharacterSetIdentifierIso88598,fileServerSession)==11);
128 INFO_PRINTF1(_L("\nChar Set ISO_8859-8 UID->MIB - OK"));
130 INFO_PRINTF1(_L("\nTest for INC042690 complete:\n"));
131 CleanupStack::PopAndDestroy(2); // characterSetConverter and fileServerSession
134 Test code for INC043911 - IANAMib 1014 not supported
136 @SYMTestCaseID SYSLIB-CHARCONV-CT-0543
137 @SYMTestCaseDesc Tests for CCnvCharacterSetConverter::ConvertMibEnumOfCharacterSetToIdentifierL() function
138 @SYMTestPriority Medium
139 @SYMTestActions Tests for a conversions of MIB to UTF-16BE UID
140 @SYMTestExpectedResults Test must not fail
143 void CT_ISO8859X::testInc043911L()
145 INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0543 Test for INC043911 "));
147 RFs fileServerSession;
148 CleanupClosePushL(fileServerSession);
149 User::LeaveIfError(fileServerSession.Connect());
150 CCnvCharacterSetConverter* characterSetConverter=CCnvCharacterSetConverter::NewLC();
152 // check that the character set value of '1013' is converted to the UTF-16BE UID (0x101f4052)
153 test(characterSetConverter->ConvertMibEnumOfCharacterSetToIdentifierL(1013,fileServerSession)==KCharacterSetIdentifierUnicodeBig);
154 INFO_PRINTF1(_L("\nMIB 1013->Char Set UTF-16BE UID - OK"));
156 // check that the character set value of '1014' is converted to the UTF-16LE UID (0x101f3fae)
157 test(characterSetConverter->ConvertMibEnumOfCharacterSetToIdentifierL(1014,fileServerSession)==KCharacterSetIdentifierUnicodeLittle);
158 INFO_PRINTF1(_L("\nMIB 1014->Char Set UTF-16LE UID - OK"));
160 // check that the character set value of '1015' is converted to the UTF-16 UID (0x101ff492)
161 test(characterSetConverter->ConvertMibEnumOfCharacterSetToIdentifierL(1015,fileServerSession)==KCharacterSetIdentifierUcs2);
162 INFO_PRINTF1(_L("\nMIB 1015->Char Set UTF-16 UID - OK"));
165 INFO_PRINTF1(_L("\nTest for INC043911 complete:\n"));
166 CleanupStack::PopAndDestroy(2); // characterSetConverter and fileServerSession
169 Test code for DEF050040 - Propagated: Baltic (ISO8859-13) missing in Basic.txt
171 @SYMTestCaseID SYSLIB-CHARCONV-CT-0544
172 @SYMTestCaseDesc Tests for defect number DEF050040
173 @SYMTestPriority Medium
174 @SYMTestActions Tests for CCnvCharacterSetConverter::ConvertMibEnumOfCharacterSetToIdentifierL()
175 Tests for a conversions of MIB to ISO-8859-13 UID
176 @SYMTestExpectedResults Test must not fail
179 void CT_ISO8859X::testDef050040L()
181 INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0544 Test for DEF050040 "));
183 RFs fileServerSession;
184 CleanupClosePushL(fileServerSession);
185 User::LeaveIfError(fileServerSession.Connect());
186 CCnvCharacterSetConverter* characterSetConverter=CCnvCharacterSetConverter::NewLC();
188 // check that the character set value of '109' is converted to the ISO-8859-13 UID (0x10008a2c)
189 test(characterSetConverter->ConvertMibEnumOfCharacterSetToIdentifierL(109,fileServerSession)==KCharacterSetIdentifierIso885913);
190 INFO_PRINTF1(_L("\nMIB 109->Char Set ISO-8859-13 UID - OK"));
192 INFO_PRINTF1(_L("\nTest for DEF050040 complete:\n"));
193 CleanupStack::PopAndDestroy(2); // characterSetConverter and fileServerSession
196 @SYMTestCaseID SYSLIB-CHARCONV-CT-0545
197 @SYMTestCaseDesc Tests for conversion of ISO8859 to Unicode
198 @SYMTestPriority Medium
199 @SYMTestActions Calls up conversion test functions of ISO8859 to Unicode
200 @SYMTestExpectedResults Test must not fail
203 void CT_ISO8859X::DoE32MainL()
205 INFO_PRINTF1(_L("@SYMTestCaseID:SYSLIB-CHARCONV-CT-0545 Tests for conversion of ISO8859 to Unicode"));
212 CT_ISO8859X::CT_ISO8859X()
214 SetTestStepName(KTestStep_T_ISO8859X);
217 TVerdict CT_ISO8859X::doTestStepL()
219 SetTestStepResult(EFail);
222 TRAPD(error1, DoE32MainL());
225 if(error1 == KErrNone)
227 SetTestStepResult(EPass);
230 return TestStepResult();