os/textandloc/charconvfw/charconv_fw/test/rtest/tsrc/utf/tjava.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/charconvfw/charconv_fw/test/rtest/tsrc/utf/tjava.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,404 @@
     1.4 +/*
     1.5 +* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#include <e32std.h>
    1.23 +#include <e32base.h>
    1.24 +#include <f32file.h>
    1.25 +#include <charconv.h>
    1.26 +#include <utf.h>
    1.27 +#include "t_java.h"
    1.28 +
    1.29 +#define test(cond)                                          \
    1.30 +    {                                                       \
    1.31 +    TBool __bb = (cond);                                    \
    1.32 +    TEST(__bb);                                             \
    1.33 +    if (!__bb)                                              \
    1.34 +        {                                                   \
    1.35 +        ERR_PRINTF1(_L("ERROR: Test Failed"));              \
    1.36 +        User::Leave(1);                                     \
    1.37 +        }                                                   \
    1.38 +    }
    1.39 +
    1.40 +///////////////////////////////////////////////////////////////////////////////////////
    1.41 +///////////////////////////////////////////////////////////////////////////////////////
    1.42 +/**
    1.43 +@SYMTestCaseID          SYSLIB-CHARCONV-CT-0571
    1.44 +@SYMTestCaseDesc        CnvUtfConverter class functionality test
    1.45 +@SYMTestPriority        Medium
    1.46 +@SYMTestActions        	Checking that Java-conformant UTF-8 is generated and handled correctly
    1.47 +@SYMTestExpectedResults Test must not fail
    1.48 +@SYMREQ                 REQ0000
    1.49 +*/
    1.50 +void CT_JAVA::Test_JAVA()
    1.51 +	{
    1.52 +	RFs fileServerSession;
    1.53 +	CleanupClosePushL(fileServerSession);
    1.54 +	User::LeaveIfError(fileServerSession.Connect());
    1.55 +	CCnvCharacterSetConverter* characterSetConverter=CCnvCharacterSetConverter::NewLC();
    1.56 +	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0571 Checking that Java-conformant UTF-8 is generated and handled correctly "));
    1.57 +	test(characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierJavaConformantUtf8, fileServerSession)==CCnvCharacterSetConverter::EAvailable);
    1.58 +	TBuf16<32> unicode;
    1.59 +	TBuf16<32> generatedUnicode;
    1.60 +	TBuf8<64> generatedUtf8;
    1.61 +	TInt convertToUnicodeState = CCnvCharacterSetConverter::KStateDefault;
    1.62 +
    1.63 +	//
    1.64 +	INFO_PRINTF1(_L("Testing the behaviour of the Unicode character 0x0000"));
    1.65 +
    1.66 +	unicode.Format(_L16("%c"), 0x0000);
    1.67 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
    1.68 +	test(generatedUtf8==TPtrC8(REINTERPRET_CAST(const TText8*, "\x00"), 1)); // can't use _L8 as that gets the length by assuming it's a zero-terminated string
    1.69 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
    1.70 +	test(generatedUnicode==unicode);
    1.71 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
    1.72 +	test(generatedUtf8==_L8("\xc0\x80"));
    1.73 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
    1.74 +	test(generatedUnicode==unicode);
    1.75 +
    1.76 +	unicode.Format(_L16("%c%c"), 0x0000, 0x0026);
    1.77 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
    1.78 +	test(generatedUtf8==TPtrC8(REINTERPRET_CAST(const TText8*, "\x00\x26"), 2)); // can't use _L8 as that gets the length by assuming it's a zero-terminated string
    1.79 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
    1.80 +	test(generatedUnicode==unicode);
    1.81 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
    1.82 +	test(generatedUtf8==_L8("\xc0\x80\x26"));
    1.83 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
    1.84 +	test(generatedUnicode==unicode);
    1.85 +
    1.86 +	unicode.Format(_L16("%c%c"), 0x0000, 0x05d9);
    1.87 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
    1.88 +	test(generatedUtf8==TPtrC8(REINTERPRET_CAST(const TText8*, "\x00\xd7\x99"), 3)); // can't use _L8 as that gets the length by assuming it's a zero-terminated string
    1.89 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
    1.90 +	test(generatedUnicode==unicode);
    1.91 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
    1.92 +	test(generatedUtf8==_L8("\xc0\x80\xd7\x99"));
    1.93 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
    1.94 +	test(generatedUnicode==unicode);
    1.95 +
    1.96 +	unicode.Format(_L16("%c%c"), 0x0000, 0x81ea);
    1.97 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
    1.98 +	test(generatedUtf8==TPtrC8(REINTERPRET_CAST(const TText8*, "\x00\xe8\x87\xaa"), 4)); // can't use _L8 as that gets the length by assuming it's a zero-terminated string
    1.99 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.100 +	test(generatedUnicode==unicode);
   1.101 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.102 +	test(generatedUtf8==_L8("\xc0\x80\xe8\x87\xaa"));
   1.103 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.104 +	test(generatedUnicode==unicode);
   1.105 +
   1.106 +	unicode.Format(_L16("%c%c%c"), 0x0000, 0xd9e0, 0xdda3);
   1.107 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.108 +	test(generatedUtf8==TPtrC8(REINTERPRET_CAST(const TText8*, "\x00\xf2\x88\x86\xa3"), 5)); // can't use _L8 as that gets the length by assuming it's a zero-terminated string
   1.109 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.110 +	test(generatedUnicode==unicode);
   1.111 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.112 +	test(generatedUtf8==_L8("\xc0\x80\xed\xa7\xa0\xed\xb6\xa3"));
   1.113 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.114 +	test(generatedUnicode.Length()==7);
   1.115 +	test(generatedUnicode[0]==0x0000);
   1.116 +	test(generatedUnicode[1]==0xFFFD);
   1.117 +	test(generatedUnicode[2]==0xFFFD);
   1.118 +	test(generatedUnicode[3]==0xFFFD);
   1.119 +	test(generatedUnicode[4]==0xFFFD);
   1.120 +	test(generatedUnicode[5]==0xFFFD);
   1.121 +	test(generatedUnicode[6]==0xFFFD);
   1.122 +
   1.123 +	unicode.Format(_L16("%c%c"), 0x0071, 0x0000);
   1.124 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.125 +	test(generatedUtf8==TPtrC8(REINTERPRET_CAST(const TText8*, "\x71\x00"), 2)); // can't use _L8 as that gets the length by assuming it's a zero-terminated string
   1.126 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.127 +	test(generatedUnicode==unicode);
   1.128 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.129 +	test(generatedUtf8==_L8("\x71\xc0\x80"));
   1.130 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.131 +	test(generatedUnicode==unicode);
   1.132 +
   1.133 +	unicode.Format(_L16("%c%c"), 0x06aa, 0x0000);
   1.134 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.135 +	test(generatedUtf8==TPtrC8(REINTERPRET_CAST(const TText8*, "\xda\xaa\x00"), 3)); // can't use _L8 as that gets the length by assuming it's a zero-terminated string
   1.136 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.137 +	test(generatedUnicode==unicode);
   1.138 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.139 +	test(generatedUtf8==_L8("\xda\xaa\xc0\x80"));
   1.140 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.141 +	test(generatedUnicode==unicode);
   1.142 +
   1.143 +	unicode.Format(_L16("%c%c"), 0xc427, 0x0000);
   1.144 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.145 +	test(generatedUtf8==TPtrC8(REINTERPRET_CAST(const TText8*, "\xec\x90\xa7\x00"), 4)); // can't use _L8 as that gets the length by assuming it's a zero-terminated string
   1.146 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.147 +	test(generatedUnicode==unicode);
   1.148 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.149 +	test(generatedUtf8==_L8("\xec\x90\xa7\xc0\x80"));
   1.150 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.151 +	test(generatedUnicode==unicode);
   1.152 +
   1.153 +	unicode.Format(_L16("%c%c%c"), 0xd801, 0xdef1, 0x0000);
   1.154 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.155 +	test(generatedUtf8==TPtrC8(REINTERPRET_CAST(const TText8*, "\xf0\x90\x9b\xb1\x00"), 5)); // can't use _L8 as that gets the length by assuming it's a zero-terminated string
   1.156 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.157 +	test(generatedUnicode==unicode);
   1.158 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.159 +	test(generatedUtf8==_L8("\xed\xa0\x81\xed\xbb\xb1\xc0\x80"));
   1.160 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.161 +	test(generatedUnicode.Length()==7);
   1.162 +	test(generatedUnicode[0]==0xFFFD);
   1.163 +	test(generatedUnicode[1]==0xFFFD);
   1.164 +	test(generatedUnicode[2]==0xFFFD);
   1.165 +	test(generatedUnicode[3]==0xFFFD);
   1.166 +	test(generatedUnicode[4]==0xFFFD);
   1.167 +	test(generatedUnicode[5]==0xFFFD);
   1.168 +	test(generatedUnicode[6]==0x0000);
   1.169 +
   1.170 +	INFO_PRINTF1(_L("Testing the generation of UTF-8 from surrogate pairs"));
   1.171 +	unicode.Format(_L16("%c"), 0xd7ff);
   1.172 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.173 +	test(generatedUtf8==_L8("\xed\x9f\xbf"));
   1.174 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.175 +	test(generatedUnicode==unicode);
   1.176 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.177 +	test(generatedUtf8==_L8("\xed\x9f\xbf"));
   1.178 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.179 +	test(generatedUnicode==unicode);
   1.180 +
   1.181 +	unicode.Format(_L16("%c"), 0xe000);
   1.182 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.183 +	test(generatedUtf8==_L8("\xee\x80\x80"));
   1.184 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.185 +	test(generatedUnicode==unicode);
   1.186 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.187 +	test(generatedUtf8==_L8("\xee\x80\x80"));
   1.188 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.189 +	test(generatedUnicode==unicode);
   1.190 +
   1.191 +	unicode.Format(_L16("%c%c"), 0xd800, 0xdc00);
   1.192 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.193 +	test(generatedUtf8==_L8("\xf0\x90\x80\x80"));
   1.194 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.195 +	test(generatedUnicode==unicode);
   1.196 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.197 +	test(generatedUtf8==_L8("\xed\xa0\x80\xed\xb0\x80"));
   1.198 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.199 +	test(generatedUnicode.Length()==6);
   1.200 +	test(generatedUnicode[0]==0xFFFD);
   1.201 +	test(generatedUnicode[1]==0xFFFD);
   1.202 +	test(generatedUnicode[2]==0xFFFD);
   1.203 +	test(generatedUnicode[3]==0xFFFD);
   1.204 +	test(generatedUnicode[4]==0xFFFD);
   1.205 +	test(generatedUnicode[5]==0xFFFD);
   1.206 +
   1.207 +	unicode.Format(_L16("%c%c"), 0xd800, 0xdfff);
   1.208 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.209 +	test(generatedUtf8==_L8("\xf0\x90\x8f\xbf"));
   1.210 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.211 +	test(generatedUnicode==unicode);
   1.212 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.213 +	test(generatedUtf8==_L8("\xed\xa0\x80\xed\xbf\xbf"));
   1.214 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.215 +	test(generatedUnicode.Length()==6);
   1.216 +	test(generatedUnicode[0]==0xFFFD);
   1.217 +	test(generatedUnicode[1]==0xFFFD);
   1.218 +	test(generatedUnicode[2]==0xFFFD);
   1.219 +	test(generatedUnicode[3]==0xFFFD);
   1.220 +	test(generatedUnicode[4]==0xFFFD);
   1.221 +	test(generatedUnicode[5]==0xFFFD);
   1.222 +
   1.223 +	unicode.Format(_L16("%c%c"), 0xdbff, 0xdc00);
   1.224 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.225 +	test(generatedUtf8==_L8("\xf4\x8f\xb0\x80"));
   1.226 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.227 +	test(generatedUnicode==unicode);
   1.228 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.229 +	test(generatedUtf8==_L8("\xed\xaf\xbf\xed\xb0\x80"));
   1.230 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.231 +	test(generatedUnicode.Length()==6);
   1.232 +	test(generatedUnicode[0]==0xFFFD);
   1.233 +	test(generatedUnicode[1]==0xFFFD);
   1.234 +	test(generatedUnicode[2]==0xFFFD);
   1.235 +	test(generatedUnicode[3]==0xFFFD);
   1.236 +	test(generatedUnicode[4]==0xFFFD);
   1.237 +	test(generatedUnicode[5]==0xFFFD);
   1.238 +
   1.239 +	unicode.Format(_L16("%c%c"), 0xdbff, 0xdfff);
   1.240 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.241 +	test(generatedUtf8==_L8("\xf4\x8f\xbf\xbf"));
   1.242 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.243 +	test(generatedUnicode==unicode);
   1.244 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.245 +	test(generatedUtf8==_L8("\xed\xaf\xbf\xed\xbf\xbf"));
   1.246 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.247 +	test(generatedUnicode.Length()==6);
   1.248 +	test(generatedUnicode[0]==0xFFFD);
   1.249 +	test(generatedUnicode[1]==0xFFFD);
   1.250 +	test(generatedUnicode[2]==0xFFFD);
   1.251 +	test(generatedUnicode[3]==0xFFFD);
   1.252 +	test(generatedUnicode[4]==0xFFFD);
   1.253 +	test(generatedUnicode[5]==0xFFFD);
   1.254 +
   1.255 +	unicode.Format(_L16("%c%c"), 0xd8e9, 0xdcd4);
   1.256 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.257 +	test(generatedUtf8==_L8("\xf1\x8a\x93\x94"));
   1.258 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.259 +	test(generatedUnicode==unicode);
   1.260 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.261 +	test(generatedUtf8==_L8("\xed\xa3\xa9\xed\xb3\x94"));
   1.262 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.263 +	test(generatedUnicode.Length()==6);
   1.264 +	test(generatedUnicode[0]==0xFFFD);
   1.265 +	test(generatedUnicode[1]==0xFFFD);
   1.266 +	test(generatedUnicode[2]==0xFFFD);
   1.267 +	test(generatedUnicode[3]==0xFFFD);
   1.268 +	test(generatedUnicode[4]==0xFFFD);
   1.269 +	test(generatedUnicode[5]==0xFFFD);
   1.270 +
   1.271 +	unicode.Format(_L16("%c%c%c"), 0xd8e9, 0xdcd4, 0x003e);
   1.272 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.273 +	test(generatedUtf8==_L8("\xf1\x8a\x93\x94\x3e"));
   1.274 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.275 +	test(generatedUnicode==unicode);
   1.276 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.277 +	test(generatedUtf8==_L8("\xed\xa3\xa9\xed\xb3\x94\x3e"));
   1.278 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.279 +	test(generatedUnicode.Length()==7);
   1.280 +	test(generatedUnicode[0]==0xFFFD);
   1.281 +	test(generatedUnicode[1]==0xFFFD);
   1.282 +	test(generatedUnicode[2]==0xFFFD);
   1.283 +	test(generatedUnicode[3]==0xFFFD);
   1.284 +	test(generatedUnicode[4]==0xFFFD);
   1.285 +	test(generatedUnicode[5]==0xFFFD);
   1.286 +	test(generatedUnicode[6]==0x003e);
   1.287 +
   1.288 +	unicode.Format(_L16("%c%c%c"), 0xd8e9, 0xdcd4, 0x01e9);
   1.289 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.290 +	test(generatedUtf8==_L8("\xf1\x8a\x93\x94\xc7\xa9"));
   1.291 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.292 +	test(generatedUnicode==unicode);
   1.293 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.294 +	test(generatedUtf8==_L8("\xed\xa3\xa9\xed\xb3\x94\xc7\xa9"));
   1.295 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.296 +	test(generatedUnicode.Length()==7);
   1.297 +	test(generatedUnicode[0]==0xFFFD);
   1.298 +	test(generatedUnicode[1]==0xFFFD);
   1.299 +	test(generatedUnicode[2]==0xFFFD);
   1.300 +	test(generatedUnicode[3]==0xFFFD);
   1.301 +	test(generatedUnicode[4]==0xFFFD);
   1.302 +	test(generatedUnicode[5]==0xFFFD);
   1.303 +	test(generatedUnicode[6]==0x01e9);
   1.304 +
   1.305 +	unicode.Format(_L16("%c%c%c"), 0xd8e9, 0xdcd4, 0x1f9a);
   1.306 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.307 +	test(generatedUtf8==_L8("\xf1\x8a\x93\x94\xe1\xbe\x9a"));
   1.308 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.309 +	test(generatedUnicode==unicode);
   1.310 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.311 +	test(generatedUtf8==_L8("\xed\xa3\xa9\xed\xb3\x94\xe1\xbe\x9a"));
   1.312 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.313 +	test(generatedUnicode.Length()==7);
   1.314 +	test(generatedUnicode[0]==0xFFFD);
   1.315 +	test(generatedUnicode[1]==0xFFFD);
   1.316 +	test(generatedUnicode[2]==0xFFFD);
   1.317 +	test(generatedUnicode[3]==0xFFFD);
   1.318 +	test(generatedUnicode[4]==0xFFFD);
   1.319 +	test(generatedUnicode[5]==0xFFFD);
   1.320 +	test(generatedUnicode[6]==0x1f9a);
   1.321 +
   1.322 +	unicode.Format(_L16("%c%c%c"), 0x0025, 0xd8e9, 0xdcd4);
   1.323 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.324 +	test(generatedUtf8==_L8("\x25\xf1\x8a\x93\x94"));
   1.325 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.326 +	test(generatedUnicode==unicode);
   1.327 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.328 +	test(generatedUtf8==_L8("\x25\xed\xa3\xa9\xed\xb3\x94"));
   1.329 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.330 +	test(generatedUnicode.Length()==7);
   1.331 +	test(generatedUnicode[0]==0x0025);
   1.332 +	test(generatedUnicode[1]==0xFFFD);
   1.333 +	test(generatedUnicode[2]==0xFFFD);
   1.334 +	test(generatedUnicode[3]==0xFFFD);
   1.335 +	test(generatedUnicode[4]==0xFFFD);
   1.336 +	test(generatedUnicode[5]==0xFFFD);
   1.337 +	test(generatedUnicode[6]==0xFFFD);
   1.338 +
   1.339 +	unicode.Format(_L16("%c%c%c"), 0x00a5, 0xd8e9, 0xdcd4);
   1.340 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.341 +	test(generatedUtf8==_L8("\xc2\xa5\xf1\x8a\x93\x94"));
   1.342 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.343 +	test(generatedUnicode==unicode);
   1.344 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.345 +	test(generatedUtf8==_L8("\xc2\xa5\xed\xa3\xa9\xed\xb3\x94"));
   1.346 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.347 +	test(generatedUnicode.Length()==7);
   1.348 +	test(generatedUnicode[0]==0x00a5);
   1.349 +	test(generatedUnicode[1]==0xFFFD);
   1.350 +	test(generatedUnicode[2]==0xFFFD);
   1.351 +	test(generatedUnicode[3]==0xFFFD);
   1.352 +	test(generatedUnicode[4]==0xFFFD);
   1.353 +	test(generatedUnicode[5]==0xFFFD);
   1.354 +	test(generatedUnicode[6]==0xFFFD);
   1.355 +
   1.356 +	unicode.Format(_L16("%c%c%c"), 0x0ca6, 0xd8e9, 0xdcd4);
   1.357 +	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
   1.358 +	test(generatedUtf8==_L8("\xe0\xb2\xa6\xf1\x8a\x93\x94"));
   1.359 +	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
   1.360 +	test(generatedUnicode==unicode);
   1.361 +	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
   1.362 +	test(generatedUtf8==_L8("\xe0\xb2\xa6\xed\xa3\xa9\xed\xb3\x94"));
   1.363 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
   1.364 +	test(generatedUnicode.Length()==7);
   1.365 +	test(generatedUnicode[0]==0x0ca6);
   1.366 +	test(generatedUnicode[1]==0xFFFD);
   1.367 +	test(generatedUnicode[2]==0xFFFD);
   1.368 +	test(generatedUnicode[3]==0xFFFD);
   1.369 +	test(generatedUnicode[4]==0xFFFD);
   1.370 +	test(generatedUnicode[5]==0xFFFD);
   1.371 +	test(generatedUnicode[6]==0xFFFD);
   1.372 +
   1.373 +	// Additional tests added for INC117111...
   1.374 +
   1.375 +	generatedUtf8.Format(_L8("\xe0\xb2\xa6\xc0"));
   1.376 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==1);
   1.377 +	test(generatedUnicode[0]==0x0ca6);
   1.378 +
   1.379 +	generatedUtf8.Format(_L8("\xc0"));
   1.380 +	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==CnvUtfConverter::EErrorIllFormedInput);
   1.381 +
   1.382 +	CleanupStack::PopAndDestroy(2); // characterSetConverter and fileServerSession
   1.383 +	}
   1.384 +
   1.385 +
   1.386 +CT_JAVA::CT_JAVA()
   1.387 +    {
   1.388 +    SetTestStepName(KTestStep_T_JAVA);
   1.389 +    }
   1.390 +
   1.391 +TVerdict CT_JAVA::doTestStepL()
   1.392 +    {
   1.393 +    SetTestStepResult(EFail);
   1.394 +
   1.395 +    __UHEAP_MARK;
   1.396 +
   1.397 +    TRAPD(error1, Test_JAVA());
   1.398 +
   1.399 +    __UHEAP_MARKEND;
   1.400 +
   1.401 +    if(error1 == KErrNone )
   1.402 +        {
   1.403 +        SetTestStepResult(EPass);
   1.404 +        }
   1.405 +
   1.406 +    return TestStepResult();
   1.407 +    }