sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <e32std.h>
|
sl@0
|
20 |
#include <e32base.h>
|
sl@0
|
21 |
#include <f32file.h>
|
sl@0
|
22 |
#include <charconv.h>
|
sl@0
|
23 |
#include "t_builtin.h"
|
sl@0
|
24 |
|
sl@0
|
25 |
/**
|
sl@0
|
26 |
* Work around for DEF063276.
|
sl@0
|
27 |
* This literal is now loaded from a z:\test\data\KOriginalSms7Bit.dat
|
sl@0
|
28 |
* Bullseye Coverage corrupts this literal at position \x1b\x30 to \x1b\x37
|
sl@0
|
29 |
* to avoid this literal is stored in a file as to not be touched by Bullseye Coverage.
|
sl@0
|
30 |
*/
|
sl@0
|
31 |
|
sl@0
|
32 |
/*
|
sl@0
|
33 |
_LIT8(KOriginalSms7Bit, "\
|
sl@0
|
34 |
\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\
|
sl@0
|
35 |
\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a \x1c\x1d\x1e\x1f\
|
sl@0
|
36 |
\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\
|
sl@0
|
37 |
\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\
|
sl@0
|
38 |
\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\
|
sl@0
|
39 |
\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\
|
sl@0
|
40 |
\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\
|
sl@0
|
41 |
\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\
|
sl@0
|
42 |
\x1b\x00\x1b\x01\x1b\x02\x1b\x03\x1b\x04\x1b\x05\x1b\x06\x1b\x07\x1b\x08\x1b\x09\x1b\x0a\x1b\x0b\x1b\x0c\x1b\x0d\x1b\x0e\x1b\x0f\
|
sl@0
|
43 |
\x1b\x10\x1b\x11\x1b\x12\x1b\x13\x1b\x14\x1b\x15\x1b\x16\x1b\x17\x1b\x18\x1b\x19\x1b\x1a\x1b\x1b\x1b\x1c\x1b\x1d\x1b\x1e\x1b\x1f\
|
sl@0
|
44 |
\x1b\x20\x1b\x21\x1b\x22\x1b\x23\x1b\x24\x1b\x25\x1b\x26\x1b\x27\x1b\x28\x1b\x29\x1b\x2a\x1b\x2b\x1b\x2c\x1b\x2d\x1b\x2e\x1b\x2f\
|
sl@0
|
45 |
\x1b\x30\x1b\x31\x1b\x32\x1b\x33\x1b\x34\x1b\x35\x1b\x36\x1b\x37\x1b\x38\x1b\x39\x1b\x3a\x1b\x3b\x1b\x3c\x1b\x3d\x1b\x3e\x1b\x3f\
|
sl@0
|
46 |
\x1b\x40\x1b\x41\x1b\x42\x1b\x43\x1b\x44\x1b\x45\x1b\x46\x1b\x47\x1b\x48\x1b\x49\x1b\x4a\x1b\x4b\x1b\x4c\x1b\x4d\x1b\x4e\x1b\x4f\
|
sl@0
|
47 |
\x1b\x50\x1b\x51\x1b\x52\x1b\x53\x1b\x54\x1b\x55\x1b\x56\x1b\x57\x1b\x58\x1b\x59\x1b\x5a\x1b\x5b\x1b\x5c\x1b\x5d\x1b\x5e\x1b\x5f\
|
sl@0
|
48 |
\x1b\x60\x1b\x61\x1b\x62\x1b\x63\x1b\x64\x1b\x65\x1b\x67\x1b\x67\x1b\x68\x1b\x69\x1b\x6a\x1b\x6b\x1b\x6c\x1b\x6d\x1b\x6e\x1b\x6f\
|
sl@0
|
49 |
\x1b\x70\x1b\x71\x1b\x72\x1b\x73\x1b\x74\x1b\x75\x1b\x76\x1b\x77\x1b\x78\x1b\x79\x1b\x7a\x1b\x7b\x1b\x7c\x1b\x7d\x1b\x7e\x1b\x7f");
|
sl@0
|
50 |
*/
|
sl@0
|
51 |
|
sl@0
|
52 |
|
sl@0
|
53 |
_LIT8(KExpectedSms7Bit, "\
|
sl@0
|
54 |
\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\
|
sl@0
|
55 |
\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a \x1c\x1d\x1e\x1f\
|
sl@0
|
56 |
\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\
|
sl@0
|
57 |
\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\
|
sl@0
|
58 |
\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\
|
sl@0
|
59 |
\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\
|
sl@0
|
60 |
\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\
|
sl@0
|
61 |
\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\
|
sl@0
|
62 |
\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x1b\x0a\x0b\x0c\x0d\x0e\x0f\
|
sl@0
|
63 |
\x10\x11\x12\x13\x1b\x14\x15\x16\x17\x18\x19\x1a\x3f\x1c\x1d\x1e\x1f\
|
sl@0
|
64 |
\x20\x21\x22\x23\x24\x25\x26\x27\x1b\x28\x1b\x29\x2a\x2b\x2c\x2d\x2e\x1b\x2f\
|
sl@0
|
65 |
\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x1b\x3c\x1b\x3d\x1b\x3e\x3f\
|
sl@0
|
66 |
\x1b\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\
|
sl@0
|
67 |
\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\
|
sl@0
|
68 |
\x60\x61\x62\x63\x64\x1b\x65\x67\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\
|
sl@0
|
69 |
\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f");
|
sl@0
|
70 |
_LIT16(KExpectedUnicodeFromSms7Bit, "\
|
sl@0
|
71 |
\x0040\x00a3$\x00a5\x00e8\x00e9\x00f9\x00ec\x00f2\x00e7\x000a\x00d8\x00f8\x000d\x00c5\x00e5\
|
sl@0
|
72 |
\x0394\x005f\x03a6\x0393\x039b\x03a9\x03a0\x03a8\x03a3\x0398\x039e \x00c6\x00e6\x00df\x00c9\
|
sl@0
|
73 |
\x0020!\"#\x00a4%&'()*+,-./0123456789:;<=>?\
|
sl@0
|
74 |
\x00a1\x0041\x0042\x0043\x0044\x0045\x0046GHIJKLMNOPQRSTUVWXYZ\x00c4\x00d6\x00d1\x00dc\x00a7\
|
sl@0
|
75 |
\x00bf\x0061\x0062\x0063\x0064\x0065\x0066ghijklmnopqrstuvwxyz\x00e4\x00f6\x00f1\x00fc\x00e0\
|
sl@0
|
76 |
\x0040\x00a3$\x00a5\x00e8\x00e9\x00f9\x00ec\x00f2\x00c7\x000c\x00d8\x00f8\x000d\x00c5\x00e5\
|
sl@0
|
77 |
\x0394\x005f\x03a6\x0393\x005e\x03a9\x03a0\x03a8\x03a3\x0398\x039e\xfffd\x00c6\x00e6\x00df\x00c9\
|
sl@0
|
78 |
\x0020!\"#\x00a4%&'{}*+,-.\\0123456789:;[~]?\
|
sl@0
|
79 |
|\x0041\x0042\x0043\x0044\x0045\x0046GHIJKLMNOPQRSTUVWXYZ\x00c4\x00d6\x00d1\x00dc\x00a7\
|
sl@0
|
80 |
\x00bf\x0061\x0062\x0063\x0064\x20ac\x0067ghijklmnopqrstuvwxyz\x00e4\x00f6\x00f1\x00fc\x00e0");
|
sl@0
|
81 |
|
sl@0
|
82 |
|
sl@0
|
83 |
|
sl@0
|
84 |
// 1 line of the original defect data from email in unicode
|
sl@0
|
85 |
_LIT16(KEmailToConvert, "\
|
sl@0
|
86 |
\x006C\x0069\x006E\x0065\x0020\x0065\x006E\x0064\x0073\x0020\x0069\
|
sl@0
|
87 |
\x006E\x0020\x006A\x0061\x0070\x0061\x006E\x0065\x0073\x0065\x0020\
|
sl@0
|
88 |
\x3075\x3064\x3059\x3057\x306B\x3072\x3080\x000d\x000a");
|
sl@0
|
89 |
|
sl@0
|
90 |
|
sl@0
|
91 |
|
sl@0
|
92 |
// the expected result when converted to ISO2022JP
|
sl@0
|
93 |
_LIT8(KExpectedIso2022jp, "\
|
sl@0
|
94 |
\x6C\x69\x6E\x65\x20\x65\x6E\x64\x73\x20\x69\x6E\x20\
|
sl@0
|
95 |
\x6A\x61\x70\x61\x6E\x65\x73\x65\x20\x1B\x24\x42\x24\x55\x24\x44\
|
sl@0
|
96 |
\x24\x39\x24\x37\x24\x4B\x24\x52\x24\x60\x1B\x28\x42\x0D\x0A");
|
sl@0
|
97 |
//\x1B\x28\x4A");
|
sl@0
|
98 |
|
sl@0
|
99 |
// 1 line of the original defect data from email in unicode
|
sl@0
|
100 |
_LIT16(KEmailEndingInJapanese, "\
|
sl@0
|
101 |
\x006C\x0069\x006E\x0065\x0020\x0065\x006E\x0064\x0073\x0020\x0069\
|
sl@0
|
102 |
\x006E\x0020\x006A\x0061\x0070\x0061\x006E\x0065\x0073\x0065\x0020\
|
sl@0
|
103 |
\x3075\x3064\x3059\x3057\x306B\x3072\x3080");
|
sl@0
|
104 |
|
sl@0
|
105 |
// the expected result when converted to ISO2022JP
|
sl@0
|
106 |
_LIT8(KExpectedEmailEndingInJapanese, "\
|
sl@0
|
107 |
\x6C\x69\x6E\x65\x20\x65\x6E\x64\x73\x20\x69\x6E\x20\
|
sl@0
|
108 |
\x6A\x61\x70\x61\x6E\x65\x73\x65\x20\x1B\x24\x42\x24\x55\x24\x44\
|
sl@0
|
109 |
\x24\x39\x24\x37\x24\x4B\x24\x52\x24\x60\x1B\x28\x42");
|
sl@0
|
110 |
|
sl@0
|
111 |
_LIT(KOriginalSms7BitFile, "z:\\test\\data\\KOriginalSms7Bit.dat");
|
sl@0
|
112 |
|
sl@0
|
113 |
#define test(cond) \
|
sl@0
|
114 |
{ \
|
sl@0
|
115 |
TBool __bb = (cond); \
|
sl@0
|
116 |
TEST(__bb); \
|
sl@0
|
117 |
if (!__bb) \
|
sl@0
|
118 |
{ \
|
sl@0
|
119 |
ERR_PRINTF1(_L("ERROR: Test Failed")); \
|
sl@0
|
120 |
User::Leave(1); \
|
sl@0
|
121 |
} \
|
sl@0
|
122 |
}
|
sl@0
|
123 |
|
sl@0
|
124 |
|
sl@0
|
125 |
// this is the test plugin implementation ID in rather than KCharacterSetIdentifierShiftJis
|
sl@0
|
126 |
const TUint KCharacterSetTestShiftJisKddiau=0x01000001;
|
sl@0
|
127 |
|
sl@0
|
128 |
/**
|
sl@0
|
129 |
* Utility for DEF063276 fix.
|
sl@0
|
130 |
*/
|
sl@0
|
131 |
|
sl@0
|
132 |
void CT_BUILTIN::ReadDesc(TDes8& aDes, const TDesC& aFilename, RFs& aFs)
|
sl@0
|
133 |
{
|
sl@0
|
134 |
RFile file;
|
sl@0
|
135 |
TInt err = file.Open(aFs, aFilename, EFileRead);
|
sl@0
|
136 |
test(err == KErrNone);
|
sl@0
|
137 |
CleanupClosePushL(file);
|
sl@0
|
138 |
|
sl@0
|
139 |
err = file.Read(aDes);
|
sl@0
|
140 |
test(err == KErrNone);
|
sl@0
|
141 |
CleanupStack::PopAndDestroy(&file);
|
sl@0
|
142 |
}
|
sl@0
|
143 |
|
sl@0
|
144 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
145 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
146 |
/**
|
sl@0
|
147 |
@SYMTestCaseID SYSLIB-CHARCONV-CT-0499
|
sl@0
|
148 |
@SYMTestCaseDesc Tests for conversion of SMS 7 bit data to Unicode, and from Unicode to original data
|
sl@0
|
149 |
@SYMTestPriority Medium
|
sl@0
|
150 |
@SYMTestActions Tests for CCnvCharacterSetConverter::ConvertToUnicode(),CCnvCharacterSetConverter::ConvertFromUnicode()
|
sl@0
|
151 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
152 |
@SYMREQ REQ0000
|
sl@0
|
153 |
*/
|
sl@0
|
154 |
void CT_BUILTIN::TestFix_EDNJJUN_4RWH2A(CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFileServerSession, CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aArrayOfCharacterSetsAvailable)
|
sl@0
|
155 |
{
|
sl@0
|
156 |
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0499 "));
|
sl@0
|
157 |
TBuf16<300> generatedUnicode;
|
sl@0
|
158 |
TBuf8<300> generatedSms7Bit;
|
sl@0
|
159 |
TRAPD(errCode, aCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetIdentifierSms7Bit, aArrayOfCharacterSetsAvailable, aFileServerSession));
|
sl@0
|
160 |
test(errCode == KErrNone);
|
sl@0
|
161 |
TInt state=CCnvCharacterSetConverter::KStateDefault;
|
sl@0
|
162 |
|
sl@0
|
163 |
// Fix for DEF063276.
|
sl@0
|
164 |
|
sl@0
|
165 |
TBuf8<400> buf;
|
sl@0
|
166 |
ReadDesc(buf, KOriginalSms7BitFile, aFileServerSession);
|
sl@0
|
167 |
|
sl@0
|
168 |
test(aCharacterSetConverter.ConvertToUnicode(generatedUnicode, buf, state)==0);
|
sl@0
|
169 |
// End fix.
|
sl@0
|
170 |
|
sl@0
|
171 |
test(generatedUnicode.Length()==259);
|
sl@0
|
172 |
test(generatedUnicode==KExpectedUnicodeFromSms7Bit);
|
sl@0
|
173 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
174 |
test(aCharacterSetConverter.ConvertFromUnicode(generatedSms7Bit, generatedUnicode)==0);
|
sl@0
|
175 |
test(generatedSms7Bit.Length()==269);
|
sl@0
|
176 |
test(generatedSms7Bit==KExpectedSms7Bit);
|
sl@0
|
177 |
}
|
sl@0
|
178 |
|
sl@0
|
179 |
/**
|
sl@0
|
180 |
Test_DEF049749 test code for DEF049749 - Char convs don t handle correcly Shift JIS emoji
|
sl@0
|
181 |
|
sl@0
|
182 |
@SYMTestCaseID SYSLIB-CHARCONV-CT-0500
|
sl@0
|
183 |
@SYMTestCaseDesc Tests for defect number DEF049749
|
sl@0
|
184 |
@SYMTestPriority Medium
|
sl@0
|
185 |
@SYMTestActions Tests for conversion from Shift JIS Emoji character set to Unicode
|
sl@0
|
186 |
Tests for CCnvCharacterSetConverter::EErrorIllFormedInput error flag
|
sl@0
|
187 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
188 |
@SYMREQ REQ0000
|
sl@0
|
189 |
*/
|
sl@0
|
190 |
void CT_BUILTIN::Test_DEF049749(CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFileServerSession, CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aArrayOfCharacterSetsAvailable)
|
sl@0
|
191 |
{
|
sl@0
|
192 |
// original defect data
|
sl@0
|
193 |
_LIT8(KCodeToConvert, "\xF8\x9F\xF8\x9F\x81\x40\x3B\x3B\x3B\x3B");
|
sl@0
|
194 |
_LIT16(KExpectedUnicode, "\xFFFD\xFFFD\x3000\x003b\x003b\x003b\x003b");
|
sl@0
|
195 |
TBuf16<300> generatedUnicode;
|
sl@0
|
196 |
|
sl@0
|
197 |
// check now able to convert the original defect data
|
sl@0
|
198 |
TRAPD(errCode, aCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetTestShiftJisKddiau, aArrayOfCharacterSetsAvailable, aFileServerSession));
|
sl@0
|
199 |
test(errCode == KErrNone);
|
sl@0
|
200 |
TInt state=CCnvCharacterSetConverter::KStateDefault;
|
sl@0
|
201 |
TInt ret = aCharacterSetConverter.ConvertToUnicode(generatedUnicode, KCodeToConvert, state);
|
sl@0
|
202 |
|
sl@0
|
203 |
// in DEF049749 CCnvCharacterSetConverter::EErrorIllFormedInput was incorrectly returned.
|
sl@0
|
204 |
// rather than the number of unconverted bytes left, which should be 0
|
sl@0
|
205 |
test(ret ==0);
|
sl@0
|
206 |
test(generatedUnicode==KExpectedUnicode);
|
sl@0
|
207 |
|
sl@0
|
208 |
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0500 User-defined ShiftJIS region->FFFD "));
|
sl@0
|
209 |
/* check the user defined region (ref CJKV Ken Lunde page206)
|
sl@0
|
210 |
F040-F97E and F080-F9FC */
|
sl@0
|
211 |
TBuf8<300> sampleUserDefined;
|
sl@0
|
212 |
for (TInt leadByte = 0xF0; leadByte != 0xF9; leadByte++)
|
sl@0
|
213 |
{
|
sl@0
|
214 |
// a leadbyte missing the trail byte then another character
|
sl@0
|
215 |
sampleUserDefined.Format(_L8("%c\x3F"), leadByte);
|
sl@0
|
216 |
_LIT16(KExpectedUnicode4, "\xFFFD\x3F");
|
sl@0
|
217 |
TRAP(errCode, aCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetTestShiftJisKddiau, aArrayOfCharacterSetsAvailable, aFileServerSession));
|
sl@0
|
218 |
test(errCode == KErrNone);
|
sl@0
|
219 |
ret = aCharacterSetConverter.ConvertToUnicode(generatedUnicode, sampleUserDefined, state);
|
sl@0
|
220 |
test(ret ==0);
|
sl@0
|
221 |
test(generatedUnicode==KExpectedUnicode4);
|
sl@0
|
222 |
|
sl@0
|
223 |
// a single leadbyte missing the trail byte
|
sl@0
|
224 |
sampleUserDefined.Format(_L8("%c"), leadByte);
|
sl@0
|
225 |
TRAP(errCode, aCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetTestShiftJisKddiau, aArrayOfCharacterSetsAvailable, aFileServerSession));
|
sl@0
|
226 |
test(errCode == KErrNone);
|
sl@0
|
227 |
ret = aCharacterSetConverter.ConvertToUnicode(generatedUnicode, sampleUserDefined, state);
|
sl@0
|
228 |
test(ret == CCnvCharacterSetConverter::EErrorIllFormedInput);
|
sl@0
|
229 |
|
sl@0
|
230 |
// Default version of Shift-JIS converter now contains mappings for ezweb private use
|
sl@0
|
231 |
// in range 0xF7BC to 0xF7FC so following tests would fail in this area - JG 30/06/2005
|
sl@0
|
232 |
if ((leadByte < 0xF3) || (leadByte > 0xF7))
|
sl@0
|
233 |
{
|
sl@0
|
234 |
for (TInt trailbyte = 0x40; trailbyte != 0xFD;
|
sl@0
|
235 |
trailbyte += (trailbyte == 0x7E? 2 : 1))
|
sl@0
|
236 |
{
|
sl@0
|
237 |
TInt errCode = KErrNone;
|
sl@0
|
238 |
|
sl@0
|
239 |
// emoji character on its own
|
sl@0
|
240 |
sampleUserDefined.Format(_L8("%c%c"), leadByte, trailbyte);
|
sl@0
|
241 |
_LIT16(KExpectedUnicode1, "\xFFFD");
|
sl@0
|
242 |
TRAP(errCode, aCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetTestShiftJisKddiau, aArrayOfCharacterSetsAvailable, aFileServerSession));
|
sl@0
|
243 |
test(errCode == KErrNone);
|
sl@0
|
244 |
ret = aCharacterSetConverter.ConvertToUnicode(generatedUnicode, sampleUserDefined, state);
|
sl@0
|
245 |
test(ret ==0);
|
sl@0
|
246 |
test(generatedUnicode==KExpectedUnicode1);
|
sl@0
|
247 |
|
sl@0
|
248 |
// followed by a single character
|
sl@0
|
249 |
sampleUserDefined.Format(_L8("%c%cx"), leadByte, trailbyte);
|
sl@0
|
250 |
_LIT16(KExpectedUnicode2, "\xFFFDx");
|
sl@0
|
251 |
TRAP(errCode, aCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetTestShiftJisKddiau, aArrayOfCharacterSetsAvailable, aFileServerSession));
|
sl@0
|
252 |
test(errCode == KErrNone);
|
sl@0
|
253 |
ret = aCharacterSetConverter.ConvertToUnicode(generatedUnicode, sampleUserDefined, state);
|
sl@0
|
254 |
test(ret ==0);
|
sl@0
|
255 |
test(generatedUnicode==KExpectedUnicode2);
|
sl@0
|
256 |
|
sl@0
|
257 |
// preceeded by a single character
|
sl@0
|
258 |
sampleUserDefined.Format(_L8("x%c%c"), leadByte, trailbyte);
|
sl@0
|
259 |
_LIT16(KExpectedUnicode3, "x\xFFFD");
|
sl@0
|
260 |
TRAP(errCode, aCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetTestShiftJisKddiau, aArrayOfCharacterSetsAvailable, aFileServerSession));
|
sl@0
|
261 |
test(errCode == KErrNone);
|
sl@0
|
262 |
ret = aCharacterSetConverter.ConvertToUnicode(generatedUnicode, sampleUserDefined, state);
|
sl@0
|
263 |
test(ret ==0);
|
sl@0
|
264 |
test(generatedUnicode==KExpectedUnicode3);
|
sl@0
|
265 |
}
|
sl@0
|
266 |
}
|
sl@0
|
267 |
}
|
sl@0
|
268 |
|
sl@0
|
269 |
INFO_PRINTF1(_L("All double-byte characters convert to single Unicode"));
|
sl@0
|
270 |
TText8 LeadBytes[] = { 0x81, 0x9F, 0xE0, 0xEA, 0xEB, 0xF9, 0xFA, 0xFC };
|
sl@0
|
271 |
TText8 TrailBytes[] = { 0x40, 0x7E, 0x80, 0xFC };
|
sl@0
|
272 |
TText8* leadp;
|
sl@0
|
273 |
for (leadp = LeadBytes;
|
sl@0
|
274 |
leadp != LeadBytes + sizeof(LeadBytes)/sizeof(LeadBytes[0]);
|
sl@0
|
275 |
++leadp)
|
sl@0
|
276 |
{
|
sl@0
|
277 |
// a single leadbyte missing the trail byte
|
sl@0
|
278 |
sampleUserDefined.Format(_L8("%c"), *leadp);
|
sl@0
|
279 |
TRAP(errCode, aCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetTestShiftJisKddiau, aArrayOfCharacterSetsAvailable, aFileServerSession));
|
sl@0
|
280 |
test(errCode == KErrNone);
|
sl@0
|
281 |
ret = aCharacterSetConverter.ConvertToUnicode(generatedUnicode, sampleUserDefined, state);
|
sl@0
|
282 |
test(ret == CCnvCharacterSetConverter::EErrorIllFormedInput);
|
sl@0
|
283 |
|
sl@0
|
284 |
// lead byte then illegal trail byte, which is a legal byte on its own
|
sl@0
|
285 |
sampleUserDefined.Format(_L8("%c%c"), *leadp, 0x3F);
|
sl@0
|
286 |
TRAP(errCode, aCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetTestShiftJisKddiau, aArrayOfCharacterSetsAvailable, aFileServerSession));
|
sl@0
|
287 |
test(errCode == KErrNone);
|
sl@0
|
288 |
ret = aCharacterSetConverter.ConvertToUnicode(generatedUnicode, sampleUserDefined, state);
|
sl@0
|
289 |
test(ret == 0);
|
sl@0
|
290 |
test(generatedUnicode == _L16("\xFFFD\x3F"));
|
sl@0
|
291 |
|
sl@0
|
292 |
for (TText8* trailp = TrailBytes;
|
sl@0
|
293 |
trailp != TrailBytes + sizeof(TrailBytes)/sizeof(TrailBytes[0]);
|
sl@0
|
294 |
++trailp)
|
sl@0
|
295 |
{
|
sl@0
|
296 |
sampleUserDefined.Format(_L8("%c%c"), *leadp, *trailp);
|
sl@0
|
297 |
TRAP(errCode, aCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetTestShiftJisKddiau, aArrayOfCharacterSetsAvailable, aFileServerSession));
|
sl@0
|
298 |
test(errCode == KErrNone);
|
sl@0
|
299 |
ret = aCharacterSetConverter.ConvertToUnicode(generatedUnicode, sampleUserDefined, state);
|
sl@0
|
300 |
test(ret == 0);
|
sl@0
|
301 |
test(generatedUnicode.Length() == 1);
|
sl@0
|
302 |
}
|
sl@0
|
303 |
}
|
sl@0
|
304 |
|
sl@0
|
305 |
INFO_PRINTF1(_L("All single-byte characters convert to single Unicode"));
|
sl@0
|
306 |
TText8 SingleBytes[] = { 0, 0x7F, 0x80, 0xA0, 0xA1, 0xFD, 0xFE, 0xFF };
|
sl@0
|
307 |
for (TText8* singlep = SingleBytes;
|
sl@0
|
308 |
singlep != SingleBytes + sizeof(SingleBytes)/sizeof(SingleBytes[0]);
|
sl@0
|
309 |
++singlep)
|
sl@0
|
310 |
{
|
sl@0
|
311 |
// a single leadbyte missing the trail byte
|
sl@0
|
312 |
sampleUserDefined.Format(_L8("%c"), *singlep);
|
sl@0
|
313 |
TRAP(errCode, aCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetTestShiftJisKddiau, aArrayOfCharacterSetsAvailable, aFileServerSession));
|
sl@0
|
314 |
test(errCode == KErrNone);
|
sl@0
|
315 |
ret = aCharacterSetConverter.ConvertToUnicode(generatedUnicode, sampleUserDefined, state);
|
sl@0
|
316 |
test(ret == 0);
|
sl@0
|
317 |
test(generatedUnicode.Length() == 1);
|
sl@0
|
318 |
}
|
sl@0
|
319 |
|
sl@0
|
320 |
INFO_PRINTF1(_L("Valid lead byte + invalid trail byte -> FFFD + something"));
|
sl@0
|
321 |
TText8 NotTrailBytes[] = { 0x3F, 0x7F, 0xFD, 0xFE, 0xFF };
|
sl@0
|
322 |
for (leadp = LeadBytes;
|
sl@0
|
323 |
leadp != LeadBytes + sizeof(LeadBytes)/sizeof(LeadBytes[0]);
|
sl@0
|
324 |
++leadp)
|
sl@0
|
325 |
{
|
sl@0
|
326 |
for (TText8* trailp = NotTrailBytes;
|
sl@0
|
327 |
trailp != NotTrailBytes + sizeof(NotTrailBytes)/sizeof(NotTrailBytes[0]);
|
sl@0
|
328 |
++trailp)
|
sl@0
|
329 |
{
|
sl@0
|
330 |
sampleUserDefined.Format(_L8("%c%c"), *leadp, *trailp);
|
sl@0
|
331 |
TRAP(errCode, aCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetTestShiftJisKddiau, aArrayOfCharacterSetsAvailable, aFileServerSession));
|
sl@0
|
332 |
test(errCode == KErrNone);
|
sl@0
|
333 |
ret = aCharacterSetConverter.ConvertToUnicode(generatedUnicode, sampleUserDefined, state);
|
sl@0
|
334 |
test(ret == 0);
|
sl@0
|
335 |
test(generatedUnicode.Length() == 2);
|
sl@0
|
336 |
test(generatedUnicode[0] == 0xFFFD);
|
sl@0
|
337 |
}
|
sl@0
|
338 |
}
|
sl@0
|
339 |
}
|
sl@0
|
340 |
|
sl@0
|
341 |
/**
|
sl@0
|
342 |
Test_DEF053900 test code for DEF053900 - Problems encoding Japanese emails to ISO-2022-JP
|
sl@0
|
343 |
|
sl@0
|
344 |
@SYMTestCaseID SYSLIB-CHARCONV-CT-1306
|
sl@0
|
345 |
@SYMTestCaseDesc Tests for defect number DEF053900
|
sl@0
|
346 |
@SYMTestPriority Medium
|
sl@0
|
347 |
@SYMTestActions Attempt for converting from Japanese character set email to Unicode.
|
sl@0
|
348 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
349 |
@SYMREQ REQ0000
|
sl@0
|
350 |
*/
|
sl@0
|
351 |
void CT_BUILTIN::Test_DEF053900(CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFileServerSession, CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aArrayOfCharacterSetsAvailable)
|
sl@0
|
352 |
{
|
sl@0
|
353 |
// check now able to convert the original defect data
|
sl@0
|
354 |
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-1306 "));
|
sl@0
|
355 |
TBuf8<300> generatedIso2022;
|
sl@0
|
356 |
TRAPD(errCode, aCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetIdentifierIso2022Jp, aArrayOfCharacterSetsAvailable, aFileServerSession));
|
sl@0
|
357 |
test(errCode == KErrNone);
|
sl@0
|
358 |
TInt state=CCnvCharacterSetConverter::KStateDefault;
|
sl@0
|
359 |
TInt ret = aCharacterSetConverter.ConvertFromUnicode(generatedIso2022, KEmailToConvert, state);
|
sl@0
|
360 |
// check the converted data is as expected
|
sl@0
|
361 |
test(ret ==0);
|
sl@0
|
362 |
test(generatedIso2022==KExpectedIso2022jp);
|
sl@0
|
363 |
ret = aCharacterSetConverter.ConvertFromUnicode(generatedIso2022, KEmailEndingInJapanese, state);
|
sl@0
|
364 |
test(ret ==0);
|
sl@0
|
365 |
test(generatedIso2022==KExpectedEmailEndingInJapanese);
|
sl@0
|
366 |
}
|
sl@0
|
367 |
|
sl@0
|
368 |
/**
|
sl@0
|
369 |
@SYMTestCaseID SYSLIB-CHARCONV-CT-0501
|
sl@0
|
370 |
@SYMTestCaseDesc Tests for CCnvCharacterSetConverter class
|
sl@0
|
371 |
@SYMTestPriority Medium
|
sl@0
|
372 |
@SYMTestActions Tests for conversion from empty descriptors to different character sets
|
sl@0
|
373 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
374 |
@SYMREQ REQ0000
|
sl@0
|
375 |
*/
|
sl@0
|
376 |
void CT_BUILTIN::DoE32MainL()
|
sl@0
|
377 |
{
|
sl@0
|
378 |
RFs fileServerSession;
|
sl@0
|
379 |
CleanupClosePushL(fileServerSession);
|
sl@0
|
380 |
User::LeaveIfError(fileServerSession.Connect());
|
sl@0
|
381 |
CCnvCharacterSetConverter* characterSetConverter=CCnvCharacterSetConverter::NewLC();
|
sl@0
|
382 |
CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* arrayOfCharacterSetsAvailable=CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableLC(fileServerSession);
|
sl@0
|
383 |
INFO_PRINTF1(_L("Available:\n"));
|
sl@0
|
384 |
for (TInt i=arrayOfCharacterSetsAvailable->Count()-1; i>=0; --i)
|
sl@0
|
385 |
{
|
sl@0
|
386 |
const CCnvCharacterSetConverter::SCharacterSet& charactersSet=(*arrayOfCharacterSetsAvailable)[i];
|
sl@0
|
387 |
characterSetConverter->PrepareToConvertToOrFromL(charactersSet.Identifier(), *arrayOfCharacterSetsAvailable, fileServerSession);
|
sl@0
|
388 |
TPtrC charactersSetName(charactersSet.Name());
|
sl@0
|
389 |
if (charactersSet.NameIsFileName())
|
sl@0
|
390 |
{
|
sl@0
|
391 |
charactersSetName.Set(TParsePtrC(charactersSetName).Name());
|
sl@0
|
392 |
}
|
sl@0
|
393 |
INFO_PRINTF2(_L(" %S\n"), &charactersSetName);
|
sl@0
|
394 |
}
|
sl@0
|
395 |
TBuf16<128> originalUnicode;
|
sl@0
|
396 |
TBuf8<128> generatedForeign;
|
sl@0
|
397 |
TBuf16<128> generatedUnicode;
|
sl@0
|
398 |
TInt state=CCnvCharacterSetConverter::KStateDefault;
|
sl@0
|
399 |
TUint characterCode;
|
sl@0
|
400 |
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0501 Testing empty descriptors (Code Page 1252) "));
|
sl@0
|
401 |
characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierCodePage1252, *arrayOfCharacterSetsAvailable, fileServerSession);
|
sl@0
|
402 |
originalUnicode=KNullDesC16;
|
sl@0
|
403 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
404 |
test(generatedForeign==KNullDesC8);
|
sl@0
|
405 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
406 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
407 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
408 |
INFO_PRINTF1(_L("Testing empty descriptors (ISO-8859-1)"));
|
sl@0
|
409 |
characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierIso88591, *arrayOfCharacterSetsAvailable, fileServerSession);
|
sl@0
|
410 |
originalUnicode=KNullDesC16;
|
sl@0
|
411 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
412 |
test(generatedForeign==KNullDesC8);
|
sl@0
|
413 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
414 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
415 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
416 |
INFO_PRINTF1(_L("Testing empty descriptors (ASCII)"));
|
sl@0
|
417 |
characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierAscii, *arrayOfCharacterSetsAvailable, fileServerSession);
|
sl@0
|
418 |
originalUnicode=KNullDesC16;
|
sl@0
|
419 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
420 |
test(generatedForeign==KNullDesC8);
|
sl@0
|
421 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
422 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
423 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
424 |
INFO_PRINTF1(_L("Testing empty descriptors (SMS 7-bit)"));
|
sl@0
|
425 |
characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierSms7Bit, *arrayOfCharacterSetsAvailable, fileServerSession);
|
sl@0
|
426 |
originalUnicode=KNullDesC16;
|
sl@0
|
427 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
428 |
test(generatedForeign==KNullDesC8);
|
sl@0
|
429 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
430 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
431 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
432 |
INFO_PRINTF1(_L("Testing exhaustive single-character Code Page 1252 round trips"));
|
sl@0
|
433 |
characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierCodePage1252, *arrayOfCharacterSetsAvailable, fileServerSession);
|
sl@0
|
434 |
for (characterCode=0x00; characterCode<=0x7f; ++characterCode)
|
sl@0
|
435 |
{
|
sl@0
|
436 |
originalUnicode.Format(_L16("%c"), characterCode);
|
sl@0
|
437 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
438 |
TBuf8<1> expectedForeign;
|
sl@0
|
439 |
expectedForeign.Format(_L8("%c"), characterCode);
|
sl@0
|
440 |
test(generatedForeign==expectedForeign);
|
sl@0
|
441 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
442 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
443 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
444 |
}
|
sl@0
|
445 |
originalUnicode.Format(_L16("%c"), 0x20ac);
|
sl@0
|
446 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
447 |
test(generatedForeign==_L8("\x80"));
|
sl@0
|
448 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
449 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
450 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
451 |
originalUnicode.Format(_L16("%c"), 0x201a);
|
sl@0
|
452 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
453 |
test(generatedForeign==_L8("\x82"));
|
sl@0
|
454 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
455 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
456 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
457 |
originalUnicode.Format(_L16("%c"), 0x0192);
|
sl@0
|
458 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
459 |
test(generatedForeign==_L8("\x83"));
|
sl@0
|
460 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
461 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
462 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
463 |
originalUnicode.Format(_L16("%c"), 0x201e);
|
sl@0
|
464 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
465 |
test(generatedForeign==_L8("\x84"));
|
sl@0
|
466 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
467 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
468 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
469 |
originalUnicode.Format(_L16("%c"), 0x2026);
|
sl@0
|
470 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
471 |
test(generatedForeign==_L8("\x85"));
|
sl@0
|
472 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
473 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
474 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
475 |
originalUnicode.Format(_L16("%c"), 0x2020);
|
sl@0
|
476 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
477 |
test(generatedForeign==_L8("\x86"));
|
sl@0
|
478 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
479 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
480 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
481 |
originalUnicode.Format(_L16("%c"), 0x2021);
|
sl@0
|
482 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
483 |
test(generatedForeign==_L8("\x87"));
|
sl@0
|
484 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
485 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
486 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
487 |
originalUnicode.Format(_L16("%c"), 0x02c6);
|
sl@0
|
488 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
489 |
test(generatedForeign==_L8("\x88"));
|
sl@0
|
490 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
491 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
492 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
493 |
originalUnicode.Format(_L16("%c"), 0x2030);
|
sl@0
|
494 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
495 |
test(generatedForeign==_L8("\x89"));
|
sl@0
|
496 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
497 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
498 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
499 |
originalUnicode.Format(_L16("%c"), 0x0160);
|
sl@0
|
500 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
501 |
test(generatedForeign==_L8("\x8a"));
|
sl@0
|
502 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
503 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
504 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
505 |
originalUnicode.Format(_L16("%c"), 0x2039);
|
sl@0
|
506 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
507 |
test(generatedForeign==_L8("\x8b"));
|
sl@0
|
508 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
509 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
510 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
511 |
originalUnicode.Format(_L16("%c"), 0x0152);
|
sl@0
|
512 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
513 |
test(generatedForeign==_L8("\x8c"));
|
sl@0
|
514 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
515 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
516 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
517 |
originalUnicode.Format(_L16("%c"), 0x017d);
|
sl@0
|
518 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
519 |
test(generatedForeign==_L8("\x8e"));
|
sl@0
|
520 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
521 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
522 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
523 |
originalUnicode.Format(_L16("%c"), 0x017e);
|
sl@0
|
524 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
525 |
test(generatedForeign==_L8("\x9e"));
|
sl@0
|
526 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
527 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
528 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
529 |
originalUnicode.Format(_L16("%c"), 0x2018);
|
sl@0
|
530 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
531 |
test(generatedForeign==_L8("\x91"));
|
sl@0
|
532 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
533 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
534 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
535 |
originalUnicode.Format(_L16("%c"), 0x2019);
|
sl@0
|
536 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
537 |
test(generatedForeign==_L8("\x92"));
|
sl@0
|
538 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
539 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
540 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
541 |
originalUnicode.Format(_L16("%c"), 0x201c);
|
sl@0
|
542 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
543 |
test(generatedForeign==_L8("\x93"));
|
sl@0
|
544 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
545 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
546 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
547 |
originalUnicode.Format(_L16("%c"), 0x201d);
|
sl@0
|
548 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
549 |
test(generatedForeign==_L8("\x94"));
|
sl@0
|
550 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
551 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
552 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
553 |
originalUnicode.Format(_L16("%c"), 0x2022);
|
sl@0
|
554 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
555 |
test(generatedForeign==_L8("\x95"));
|
sl@0
|
556 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
557 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
558 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
559 |
originalUnicode.Format(_L16("%c"), 0x2013);
|
sl@0
|
560 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
561 |
test(generatedForeign==_L8("\x96"));
|
sl@0
|
562 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
563 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
564 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
565 |
originalUnicode.Format(_L16("%c"), 0x2014);
|
sl@0
|
566 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
567 |
test(generatedForeign==_L8("\x97"));
|
sl@0
|
568 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
569 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
570 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
571 |
originalUnicode.Format(_L16("%c"), 0x02dc);
|
sl@0
|
572 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
573 |
test(generatedForeign==_L8("\x98"));
|
sl@0
|
574 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
575 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
576 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
577 |
originalUnicode.Format(_L16("%c"), 0x2122);
|
sl@0
|
578 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
579 |
test(generatedForeign==_L8("\x99"));
|
sl@0
|
580 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
581 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
582 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
583 |
originalUnicode.Format(_L16("%c"), 0x0161);
|
sl@0
|
584 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
585 |
test(generatedForeign==_L8("\x9a"));
|
sl@0
|
586 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
587 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
588 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
589 |
originalUnicode.Format(_L16("%c"), 0x203a);
|
sl@0
|
590 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
591 |
test(generatedForeign==_L8("\x9b"));
|
sl@0
|
592 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
593 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
594 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
595 |
originalUnicode.Format(_L16("%c"), 0x0153);
|
sl@0
|
596 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
597 |
test(generatedForeign==_L8("\x9c"));
|
sl@0
|
598 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
599 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
600 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
601 |
originalUnicode.Format(_L16("%c"), 0x0178);
|
sl@0
|
602 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
603 |
test(generatedForeign==_L8("\x9f"));
|
sl@0
|
604 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
605 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
606 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
607 |
for (characterCode=0xa0; characterCode<0xff; ++characterCode)
|
sl@0
|
608 |
{
|
sl@0
|
609 |
originalUnicode.Format(_L16("%c"), characterCode);
|
sl@0
|
610 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
611 |
TBuf8<1> expectedForeign;
|
sl@0
|
612 |
expectedForeign.Format(_L8("%c"), characterCode);
|
sl@0
|
613 |
test(generatedForeign==expectedForeign);
|
sl@0
|
614 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
615 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
616 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
617 |
}
|
sl@0
|
618 |
INFO_PRINTF1(_L("Testing exhaustive single-character ISO-8859-1 round trips"));
|
sl@0
|
619 |
characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierIso88591, *arrayOfCharacterSetsAvailable, fileServerSession);
|
sl@0
|
620 |
for (characterCode=0x00; characterCode<=0xff; ++characterCode)
|
sl@0
|
621 |
{
|
sl@0
|
622 |
const TBool unconvertibleCharacter=(characterCode==0x80);
|
sl@0
|
623 |
TInt numberOfUnconvertibleCharacters;
|
sl@0
|
624 |
TInt indexOfFirstUnconvertibleCharacter;
|
sl@0
|
625 |
originalUnicode.Format(_L16("%c"), characterCode);
|
sl@0
|
626 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode, numberOfUnconvertibleCharacters, indexOfFirstUnconvertibleCharacter)==0);
|
sl@0
|
627 |
if (characterCode != 0x80)
|
sl@0
|
628 |
test(numberOfUnconvertibleCharacters==(unconvertibleCharacter? 1: 0));
|
sl@0
|
629 |
if (numberOfUnconvertibleCharacters>0)
|
sl@0
|
630 |
{
|
sl@0
|
631 |
test(indexOfFirstUnconvertibleCharacter==0);
|
sl@0
|
632 |
}
|
sl@0
|
633 |
TBuf8<1> expectedForeign;
|
sl@0
|
634 |
expectedForeign.Format(_L8("%c"), unconvertibleCharacter? 0x1a: characterCode);
|
sl@0
|
635 |
test(generatedForeign==expectedForeign);
|
sl@0
|
636 |
TBuf8<1> originalForeign;
|
sl@0
|
637 |
originalForeign.Format(_L8("%c"), characterCode);
|
sl@0
|
638 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, originalForeign, state, numberOfUnconvertibleCharacters, indexOfFirstUnconvertibleCharacter)==0);
|
sl@0
|
639 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
640 |
if (characterCode != 0x80)
|
sl@0
|
641 |
test(numberOfUnconvertibleCharacters==(unconvertibleCharacter? 1: 0));
|
sl@0
|
642 |
if (numberOfUnconvertibleCharacters>0)
|
sl@0
|
643 |
{
|
sl@0
|
644 |
test(indexOfFirstUnconvertibleCharacter==0);
|
sl@0
|
645 |
}
|
sl@0
|
646 |
if (unconvertibleCharacter)
|
sl@0
|
647 |
{
|
sl@0
|
648 |
test(generatedUnicode.Length()==1);
|
sl@0
|
649 |
if (characterCode==0x80)
|
sl@0
|
650 |
{
|
sl@0
|
651 |
test(generatedUnicode[0]==0x20ac);
|
sl@0
|
652 |
}
|
sl@0
|
653 |
else
|
sl@0
|
654 |
{
|
sl@0
|
655 |
test(generatedUnicode[0]==0xfffd);
|
sl@0
|
656 |
}
|
sl@0
|
657 |
}
|
sl@0
|
658 |
else
|
sl@0
|
659 |
{
|
sl@0
|
660 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
661 |
}
|
sl@0
|
662 |
}
|
sl@0
|
663 |
INFO_PRINTF1(_L("Testing exhaustive single-character ASCII round trips"));
|
sl@0
|
664 |
characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierAscii, *arrayOfCharacterSetsAvailable, fileServerSession);
|
sl@0
|
665 |
for (characterCode=0x00; characterCode<=0xff; ++characterCode)
|
sl@0
|
666 |
{
|
sl@0
|
667 |
const TBool unconvertibleCharacter=(characterCode>=0x80);
|
sl@0
|
668 |
TInt numberOfUnconvertibleCharacters;
|
sl@0
|
669 |
originalUnicode.Format(_L16("%c"), characterCode);
|
sl@0
|
670 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode, numberOfUnconvertibleCharacters)==0);
|
sl@0
|
671 |
test(numberOfUnconvertibleCharacters==(unconvertibleCharacter? 1: 0));
|
sl@0
|
672 |
TBuf8<1> expectedForeign;
|
sl@0
|
673 |
expectedForeign.Format(_L8("%c"), unconvertibleCharacter? 0x1a: characterCode);
|
sl@0
|
674 |
test(generatedForeign==expectedForeign);
|
sl@0
|
675 |
TBuf8<1> originalForeign;
|
sl@0
|
676 |
originalForeign.Format(_L8("%c"), characterCode);
|
sl@0
|
677 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, originalForeign, state, numberOfUnconvertibleCharacters)==0);
|
sl@0
|
678 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
679 |
test(numberOfUnconvertibleCharacters==(unconvertibleCharacter? 1: 0));
|
sl@0
|
680 |
if (unconvertibleCharacter)
|
sl@0
|
681 |
{
|
sl@0
|
682 |
test(generatedUnicode.Length()==1);
|
sl@0
|
683 |
test(generatedUnicode[0]==0xfffd);
|
sl@0
|
684 |
}
|
sl@0
|
685 |
else
|
sl@0
|
686 |
{
|
sl@0
|
687 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
688 |
}
|
sl@0
|
689 |
}
|
sl@0
|
690 |
INFO_PRINTF1(_L("Testing exhaustive SMS 7-bit round trip (default table)"));
|
sl@0
|
691 |
characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierSms7Bit, fileServerSession);
|
sl@0
|
692 |
originalUnicode.SetLength(0);
|
sl@0
|
693 |
const TPtrC16 formatOfSixteenCharacters=_L16("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c");
|
sl@0
|
694 |
originalUnicode.AppendFormat(formatOfSixteenCharacters, 0x0040, 0x00a3, 0x0024, 0x00a5, 0x00e8, 0x00e9, 0x00f9, 0x00ec, 0x00f2, 0x00e7, 0x000a, 0x00d8, 0x00f8, 0x000d, 0x00c5, 0x00e5);
|
sl@0
|
695 |
originalUnicode.AppendFormat(formatOfSixteenCharacters, 0x0394, 0x005f, 0x03a6, 0x0393, 0x039b, 0x03a9, 0x03a0, 0x03a8, 0x03a3, 0x0398, 0x039e, '!', 0x00c6, 0x00e6, 0x00df, 0x00c9);
|
sl@0
|
696 |
originalUnicode.AppendFormat(formatOfSixteenCharacters, 0x0020, 0x0021, 0x0022, 0x0023, 0x00a4, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f);
|
sl@0
|
697 |
originalUnicode.AppendFormat(formatOfSixteenCharacters, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f);
|
sl@0
|
698 |
originalUnicode.AppendFormat(formatOfSixteenCharacters, 0x00a1, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f);
|
sl@0
|
699 |
originalUnicode.AppendFormat(formatOfSixteenCharacters, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00c4, 0x00d6, 0x00d1, 0x00dc, 0x00a7);
|
sl@0
|
700 |
originalUnicode.AppendFormat(formatOfSixteenCharacters, 0x00bf, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f);
|
sl@0
|
701 |
originalUnicode.AppendFormat(formatOfSixteenCharacters, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00e4, 0x00f6, 0x00f1, 0x00fc, 0x00e0);
|
sl@0
|
702 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
703 |
test(generatedForeign.Length()==0x80);
|
sl@0
|
704 |
for (characterCode=0x00; characterCode<0x80; ++characterCode)
|
sl@0
|
705 |
{
|
sl@0
|
706 |
test(generatedForeign[characterCode]==(characterCode==0x1b)? '!': characterCode);
|
sl@0
|
707 |
}
|
sl@0
|
708 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
709 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
710 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
711 |
INFO_PRINTF1(_L("Testing Greek range of SMS 7-bit"));
|
sl@0
|
712 |
characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierSms7Bit, *arrayOfCharacterSetsAvailable, fileServerSession);
|
sl@0
|
713 |
TBuf16<16> expectedUnicode;
|
sl@0
|
714 |
originalUnicode.Format(formatOfSixteenCharacters.Left(7*2), 0x0386, 0x0388, 0x0389, 0x038a, 0x038c, 0x038e, 0x038f);
|
sl@0
|
715 |
expectedUnicode.Format(formatOfSixteenCharacters.Left(7*2), 0x0041, 0x0045, 0x0048, 0x0049, 0x004f, 0x0059, 0x03a9);
|
sl@0
|
716 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
717 |
test(generatedForeign==_L8("\x41\x45\x48\x49\x4f\x59\x15"));
|
sl@0
|
718 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
719 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
720 |
test(generatedUnicode==expectedUnicode);
|
sl@0
|
721 |
originalUnicode.Format(formatOfSixteenCharacters, 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f);
|
sl@0
|
722 |
expectedUnicode.Format(formatOfSixteenCharacters, 0x0049, 0x0041, 0x0042, 0x0393, 0x0394, 0x0045, 0x005a, 0x0048, 0x0398, 0x0049, 0x004b, 0x039b, 0x004d, 0x004e, 0x039e, 0x004f);
|
sl@0
|
723 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
724 |
test(generatedForeign==_L8("\x49\x41\x42\x13\x10\x45\x5a\x48\x19\x49\x4b\x14\x4d\x4e\x1a\x4f"));
|
sl@0
|
725 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
726 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
727 |
test(generatedUnicode==expectedUnicode);
|
sl@0
|
728 |
originalUnicode.Format(formatOfSixteenCharacters.Left(15*2), 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af);
|
sl@0
|
729 |
expectedUnicode.Format(formatOfSixteenCharacters.Left(15*2), 0x03a0, 0x0050, 0x03a3, 0x0054, 0x0059, 0x03a6, 0x0058, 0x03a8, 0x03a9, 0x0049, 0x0059, 0x0041, 0x0045, 0x0048, 0x0049);
|
sl@0
|
730 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
731 |
test(generatedForeign==_L8("\x16\x50\x18\x54\x59\x12\x58\x17\x15\x49\x59\x41\x45\x48\x49"));
|
sl@0
|
732 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
733 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
734 |
test(generatedUnicode==expectedUnicode);
|
sl@0
|
735 |
originalUnicode.Format(formatOfSixteenCharacters, 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf);
|
sl@0
|
736 |
expectedUnicode.Format(formatOfSixteenCharacters, 0x0059, 0x0041, 0x0042, 0x0393, 0x0394, 0x0045, 0x005a, 0x0048, 0x0398, 0x0049, 0x004b, 0x039b, 0x004d, 0x004e, 0x039e, 0x004f);
|
sl@0
|
737 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
738 |
test(generatedForeign==_L8("\x59\x41\x42\x13\x10\x45\x5a\x48\x19\x49\x4b\x14\x4d\x4e\x1a\x4f"));
|
sl@0
|
739 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
740 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
741 |
test(generatedUnicode==expectedUnicode);
|
sl@0
|
742 |
originalUnicode.Format(formatOfSixteenCharacters.Left(15*2), 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce);
|
sl@0
|
743 |
expectedUnicode.Format(formatOfSixteenCharacters.Left(15*2), 0x03a0, 0x0050, 0x03a3, 0x03a3, 0x0054, 0x0059, 0x03a6, 0x0058, 0x03a8, 0x03a9, 0x0049, 0x0059, 0x004f, 0x0059, 0x03a9);
|
sl@0
|
744 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
745 |
test(generatedForeign==_L8("\x16\x50\x18\x18\x54\x59\x12\x58\x17\x15\x49\x59\x4f\x59\x15"));
|
sl@0
|
746 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
747 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
748 |
test(generatedUnicode==expectedUnicode);
|
sl@0
|
749 |
originalUnicode.Format(formatOfSixteenCharacters.Left(6*2), 0x03d0, 0x03d1, 0x03d2, 0x03d3, 0x03d4, 0x03d5);
|
sl@0
|
750 |
expectedUnicode.Format(formatOfSixteenCharacters.Left(6*2), 0x0042, 0x0398, 0x0059, 0x0059, 0x0059, 0x03a6);
|
sl@0
|
751 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
752 |
test(generatedForeign==_L8("\x42\x19\x59\x59\x59\x12"));
|
sl@0
|
753 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
754 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
755 |
test(generatedUnicode==expectedUnicode);
|
sl@0
|
756 |
{
|
sl@0
|
757 |
INFO_PRINTF1(_L("Testing converting from Internet-standard names to UIDs"));
|
sl@0
|
758 |
test(characterSetConverter->ConvertStandardNameOfCharacterSetToIdentifierL(_L8("US-ASCII"), fileServerSession)==KCharacterSetIdentifierAscii);
|
sl@0
|
759 |
HBufC8* standardName=characterSetConverter->ConvertCharacterSetIdentifierToStandardNameL(KCharacterSetIdentifierAscii, fileServerSession);
|
sl@0
|
760 |
test(*standardName==_L8("US-ASCII"));
|
sl@0
|
761 |
delete standardName;
|
sl@0
|
762 |
}
|
sl@0
|
763 |
{
|
sl@0
|
764 |
INFO_PRINTF1(_L("Testing fix for defect EDNEMUA-4KGFEY in \"Symbian Defect Tracking v3.0\""));
|
sl@0
|
765 |
CCnvCharacterSetConverter* characterSetConverter2=CCnvCharacterSetConverter::NewLC();
|
sl@0
|
766 |
characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierSms7Bit, *arrayOfCharacterSetsAvailable, fileServerSession);
|
sl@0
|
767 |
characterSetConverter2->PrepareToConvertToOrFromL(KCharacterSetIdentifierSms7Bit, *arrayOfCharacterSetsAvailable, fileServerSession);
|
sl@0
|
768 |
characterSetConverter2->SetDowngradeForExoticLineTerminatingCharacters(CCnvCharacterSetConverter::EDowngradeExoticLineTerminatingCharactersToJustLineFeed);
|
sl@0
|
769 |
originalUnicode.Format(_L16("Line1%cLine2%cLine3\x0aLine4\x0d\x0a"), 0x2029, 0x2028);
|
sl@0
|
770 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
771 |
test(generatedForeign==_L8("Line1\x0d\x0aLine2\x0d\x0aLine3\x0aLine4\x0d\x0a"));
|
sl@0
|
772 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
773 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
774 |
test(generatedUnicode==_L16("Line1\x0d\x0aLine2\x0d\x0aLine3\x0aLine4\x0d\x0a"));
|
sl@0
|
775 |
test(characterSetConverter2->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
776 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
777 |
test(generatedUnicode==_L16("Line1\x0d\x0aLine2\x0d\x0aLine3\x0aLine4\x0d\x0a"));
|
sl@0
|
778 |
test(characterSetConverter2->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
779 |
test(generatedForeign==_L8("Line1\x0aLine2\x0aLine3\x0aLine4\x0d\x0a"));
|
sl@0
|
780 |
test(characterSetConverter2->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
781 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
782 |
test(generatedUnicode==_L16("Line1\x0aLine2\x0aLine3\x0aLine4\x0d\x0a"));
|
sl@0
|
783 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
784 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
785 |
test(generatedUnicode==_L16("Line1\x0aLine2\x0aLine3\x0aLine4\x0d\x0a"));
|
sl@0
|
786 |
CleanupStack::PopAndDestroy(); // characterSetConverter2
|
sl@0
|
787 |
}
|
sl@0
|
788 |
{
|
sl@0
|
789 |
INFO_PRINTF1(_L("Testing fix for defect EDNPSTN-4L5K2G in \"Symbian Defect Tracking v3.0\" (i.e. the extension table)"));
|
sl@0
|
790 |
characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierSms7Bit, *arrayOfCharacterSetsAvailable, fileServerSession);
|
sl@0
|
791 |
originalUnicode.Format(_L16("%c^{}\\abc[~]|%c"), 0x000c, 0x20ac);
|
sl@0
|
792 |
test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode)==0);
|
sl@0
|
793 |
test(generatedForeign==_L8("\x1b\x0a\x1b\x14\x1b\x28\x1b\x29\x1b\x2f""abc\x1b\x3c\x1b\x3d\x1b\x3e\x1b\x40\x1b\x65"));
|
sl@0
|
794 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state)==0);
|
sl@0
|
795 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
796 |
test(generatedUnicode==originalUnicode);
|
sl@0
|
797 |
}
|
sl@0
|
798 |
{
|
sl@0
|
799 |
INFO_PRINTF1(_L("Testing fix for defect EDNJJUN-4RWH2A in \"Symbian Defect Tracking v3.0\" (SMS 7-bit [0x1b, 0x41] should be converted to 0x0041, etc.)"));
|
sl@0
|
800 |
TestFix_EDNJJUN_4RWH2A(*characterSetConverter, fileServerSession, *arrayOfCharacterSetsAvailable);
|
sl@0
|
801 |
}
|
sl@0
|
802 |
|
sl@0
|
803 |
//
|
sl@0
|
804 |
INFO_PRINTF1(_L("Testing fix for defect DEF049749"));
|
sl@0
|
805 |
Test_DEF049749(*characterSetConverter, fileServerSession, *arrayOfCharacterSetsAvailable);
|
sl@0
|
806 |
|
sl@0
|
807 |
INFO_PRINTF1(_L("Testing fix for defect DEF053900"));
|
sl@0
|
808 |
Test_DEF053900(*characterSetConverter, fileServerSession, *arrayOfCharacterSetsAvailable);
|
sl@0
|
809 |
|
sl@0
|
810 |
CleanupStack::PopAndDestroy(3); // arrayOfCharacterSetsAvailable and characterSetConverter and fileServerSession
|
sl@0
|
811 |
}
|
sl@0
|
812 |
|
sl@0
|
813 |
CT_BUILTIN::CT_BUILTIN()
|
sl@0
|
814 |
{
|
sl@0
|
815 |
SetTestStepName(KTestStep_T_BUILTIN);
|
sl@0
|
816 |
}
|
sl@0
|
817 |
|
sl@0
|
818 |
TVerdict CT_BUILTIN::doTestStepL()
|
sl@0
|
819 |
{
|
sl@0
|
820 |
SetTestStepResult(EFail);
|
sl@0
|
821 |
|
sl@0
|
822 |
__UHEAP_MARK;
|
sl@0
|
823 |
TRAPD(error1, DoE32MainL());
|
sl@0
|
824 |
__UHEAP_MARKEND;
|
sl@0
|
825 |
|
sl@0
|
826 |
if(error1 == KErrNone)
|
sl@0
|
827 |
{
|
sl@0
|
828 |
SetTestStepResult(EPass);
|
sl@0
|
829 |
}
|
sl@0
|
830 |
|
sl@0
|
831 |
return TestStepResult();
|
sl@0
|
832 |
}
|