sl@0: /* sl@0: * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "t_java.h" sl@0: sl@0: #define test(cond) \ sl@0: { \ sl@0: TBool __bb = (cond); \ sl@0: TEST(__bb); \ sl@0: if (!__bb) \ sl@0: { \ sl@0: ERR_PRINTF1(_L("ERROR: Test Failed")); \ sl@0: User::Leave(1); \ sl@0: } \ sl@0: } sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////////////// sl@0: /////////////////////////////////////////////////////////////////////////////////////// sl@0: /** sl@0: @SYMTestCaseID SYSLIB-CHARCONV-CT-0571 sl@0: @SYMTestCaseDesc CnvUtfConverter class functionality test sl@0: @SYMTestPriority Medium sl@0: @SYMTestActions Checking that Java-conformant UTF-8 is generated and handled correctly sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: void CT_JAVA::Test_JAVA() sl@0: { sl@0: RFs fileServerSession; sl@0: CleanupClosePushL(fileServerSession); sl@0: User::LeaveIfError(fileServerSession.Connect()); sl@0: CCnvCharacterSetConverter* characterSetConverter=CCnvCharacterSetConverter::NewLC(); sl@0: INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0571 Checking that Java-conformant UTF-8 is generated and handled correctly ")); sl@0: test(characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierJavaConformantUtf8, fileServerSession)==CCnvCharacterSetConverter::EAvailable); sl@0: TBuf16<32> unicode; sl@0: TBuf16<32> generatedUnicode; sl@0: TBuf8<64> generatedUtf8; sl@0: TInt convertToUnicodeState = CCnvCharacterSetConverter::KStateDefault; sl@0: sl@0: // sl@0: INFO_PRINTF1(_L("Testing the behaviour of the Unicode character 0x0000")); sl@0: sl@0: unicode.Format(_L16("%c"), 0x0000); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: 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 sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xc0\x80")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode==unicode); sl@0: sl@0: unicode.Format(_L16("%c%c"), 0x0000, 0x0026); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: 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 sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xc0\x80\x26")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode==unicode); sl@0: sl@0: unicode.Format(_L16("%c%c"), 0x0000, 0x05d9); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: 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 sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xc0\x80\xd7\x99")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode==unicode); sl@0: sl@0: unicode.Format(_L16("%c%c"), 0x0000, 0x81ea); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: 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 sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xc0\x80\xe8\x87\xaa")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode==unicode); sl@0: sl@0: unicode.Format(_L16("%c%c%c"), 0x0000, 0xd9e0, 0xdda3); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: 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 sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xc0\x80\xed\xa7\xa0\xed\xb6\xa3")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode.Length()==7); sl@0: test(generatedUnicode[0]==0x0000); sl@0: test(generatedUnicode[1]==0xFFFD); sl@0: test(generatedUnicode[2]==0xFFFD); sl@0: test(generatedUnicode[3]==0xFFFD); sl@0: test(generatedUnicode[4]==0xFFFD); sl@0: test(generatedUnicode[5]==0xFFFD); sl@0: test(generatedUnicode[6]==0xFFFD); sl@0: sl@0: unicode.Format(_L16("%c%c"), 0x0071, 0x0000); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: 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 sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\x71\xc0\x80")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode==unicode); sl@0: sl@0: unicode.Format(_L16("%c%c"), 0x06aa, 0x0000); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: 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 sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xda\xaa\xc0\x80")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode==unicode); sl@0: sl@0: unicode.Format(_L16("%c%c"), 0xc427, 0x0000); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: 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 sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xec\x90\xa7\xc0\x80")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode==unicode); sl@0: sl@0: unicode.Format(_L16("%c%c%c"), 0xd801, 0xdef1, 0x0000); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: 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 sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xed\xa0\x81\xed\xbb\xb1\xc0\x80")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode.Length()==7); sl@0: test(generatedUnicode[0]==0xFFFD); sl@0: test(generatedUnicode[1]==0xFFFD); sl@0: test(generatedUnicode[2]==0xFFFD); sl@0: test(generatedUnicode[3]==0xFFFD); sl@0: test(generatedUnicode[4]==0xFFFD); sl@0: test(generatedUnicode[5]==0xFFFD); sl@0: test(generatedUnicode[6]==0x0000); sl@0: sl@0: INFO_PRINTF1(_L("Testing the generation of UTF-8 from surrogate pairs")); sl@0: unicode.Format(_L16("%c"), 0xd7ff); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xed\x9f\xbf")); sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xed\x9f\xbf")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode==unicode); sl@0: sl@0: unicode.Format(_L16("%c"), 0xe000); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xee\x80\x80")); sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xee\x80\x80")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode==unicode); sl@0: sl@0: unicode.Format(_L16("%c%c"), 0xd800, 0xdc00); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xf0\x90\x80\x80")); sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xed\xa0\x80\xed\xb0\x80")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode.Length()==6); sl@0: test(generatedUnicode[0]==0xFFFD); sl@0: test(generatedUnicode[1]==0xFFFD); sl@0: test(generatedUnicode[2]==0xFFFD); sl@0: test(generatedUnicode[3]==0xFFFD); sl@0: test(generatedUnicode[4]==0xFFFD); sl@0: test(generatedUnicode[5]==0xFFFD); sl@0: sl@0: unicode.Format(_L16("%c%c"), 0xd800, 0xdfff); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xf0\x90\x8f\xbf")); sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xed\xa0\x80\xed\xbf\xbf")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode.Length()==6); sl@0: test(generatedUnicode[0]==0xFFFD); sl@0: test(generatedUnicode[1]==0xFFFD); sl@0: test(generatedUnicode[2]==0xFFFD); sl@0: test(generatedUnicode[3]==0xFFFD); sl@0: test(generatedUnicode[4]==0xFFFD); sl@0: test(generatedUnicode[5]==0xFFFD); sl@0: sl@0: unicode.Format(_L16("%c%c"), 0xdbff, 0xdc00); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xf4\x8f\xb0\x80")); sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xed\xaf\xbf\xed\xb0\x80")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode.Length()==6); sl@0: test(generatedUnicode[0]==0xFFFD); sl@0: test(generatedUnicode[1]==0xFFFD); sl@0: test(generatedUnicode[2]==0xFFFD); sl@0: test(generatedUnicode[3]==0xFFFD); sl@0: test(generatedUnicode[4]==0xFFFD); sl@0: test(generatedUnicode[5]==0xFFFD); sl@0: sl@0: unicode.Format(_L16("%c%c"), 0xdbff, 0xdfff); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xf4\x8f\xbf\xbf")); sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xed\xaf\xbf\xed\xbf\xbf")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode.Length()==6); sl@0: test(generatedUnicode[0]==0xFFFD); sl@0: test(generatedUnicode[1]==0xFFFD); sl@0: test(generatedUnicode[2]==0xFFFD); sl@0: test(generatedUnicode[3]==0xFFFD); sl@0: test(generatedUnicode[4]==0xFFFD); sl@0: test(generatedUnicode[5]==0xFFFD); sl@0: sl@0: unicode.Format(_L16("%c%c"), 0xd8e9, 0xdcd4); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xf1\x8a\x93\x94")); sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xed\xa3\xa9\xed\xb3\x94")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode.Length()==6); sl@0: test(generatedUnicode[0]==0xFFFD); sl@0: test(generatedUnicode[1]==0xFFFD); sl@0: test(generatedUnicode[2]==0xFFFD); sl@0: test(generatedUnicode[3]==0xFFFD); sl@0: test(generatedUnicode[4]==0xFFFD); sl@0: test(generatedUnicode[5]==0xFFFD); sl@0: sl@0: unicode.Format(_L16("%c%c%c"), 0xd8e9, 0xdcd4, 0x003e); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xf1\x8a\x93\x94\x3e")); sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xed\xa3\xa9\xed\xb3\x94\x3e")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode.Length()==7); sl@0: test(generatedUnicode[0]==0xFFFD); sl@0: test(generatedUnicode[1]==0xFFFD); sl@0: test(generatedUnicode[2]==0xFFFD); sl@0: test(generatedUnicode[3]==0xFFFD); sl@0: test(generatedUnicode[4]==0xFFFD); sl@0: test(generatedUnicode[5]==0xFFFD); sl@0: test(generatedUnicode[6]==0x003e); sl@0: sl@0: unicode.Format(_L16("%c%c%c"), 0xd8e9, 0xdcd4, 0x01e9); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xf1\x8a\x93\x94\xc7\xa9")); sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xed\xa3\xa9\xed\xb3\x94\xc7\xa9")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode.Length()==7); sl@0: test(generatedUnicode[0]==0xFFFD); sl@0: test(generatedUnicode[1]==0xFFFD); sl@0: test(generatedUnicode[2]==0xFFFD); sl@0: test(generatedUnicode[3]==0xFFFD); sl@0: test(generatedUnicode[4]==0xFFFD); sl@0: test(generatedUnicode[5]==0xFFFD); sl@0: test(generatedUnicode[6]==0x01e9); sl@0: sl@0: unicode.Format(_L16("%c%c%c"), 0xd8e9, 0xdcd4, 0x1f9a); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xf1\x8a\x93\x94\xe1\xbe\x9a")); sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xed\xa3\xa9\xed\xb3\x94\xe1\xbe\x9a")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode.Length()==7); sl@0: test(generatedUnicode[0]==0xFFFD); sl@0: test(generatedUnicode[1]==0xFFFD); sl@0: test(generatedUnicode[2]==0xFFFD); sl@0: test(generatedUnicode[3]==0xFFFD); sl@0: test(generatedUnicode[4]==0xFFFD); sl@0: test(generatedUnicode[5]==0xFFFD); sl@0: test(generatedUnicode[6]==0x1f9a); sl@0: sl@0: unicode.Format(_L16("%c%c%c"), 0x0025, 0xd8e9, 0xdcd4); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\x25\xf1\x8a\x93\x94")); sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\x25\xed\xa3\xa9\xed\xb3\x94")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode.Length()==7); sl@0: test(generatedUnicode[0]==0x0025); sl@0: test(generatedUnicode[1]==0xFFFD); sl@0: test(generatedUnicode[2]==0xFFFD); sl@0: test(generatedUnicode[3]==0xFFFD); sl@0: test(generatedUnicode[4]==0xFFFD); sl@0: test(generatedUnicode[5]==0xFFFD); sl@0: test(generatedUnicode[6]==0xFFFD); sl@0: sl@0: unicode.Format(_L16("%c%c%c"), 0x00a5, 0xd8e9, 0xdcd4); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xc2\xa5\xf1\x8a\x93\x94")); sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xc2\xa5\xed\xa3\xa9\xed\xb3\x94")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode.Length()==7); sl@0: test(generatedUnicode[0]==0x00a5); sl@0: test(generatedUnicode[1]==0xFFFD); sl@0: test(generatedUnicode[2]==0xFFFD); sl@0: test(generatedUnicode[3]==0xFFFD); sl@0: test(generatedUnicode[4]==0xFFFD); sl@0: test(generatedUnicode[5]==0xFFFD); sl@0: test(generatedUnicode[6]==0xFFFD); sl@0: sl@0: unicode.Format(_L16("%c%c%c"), 0x0ca6, 0xd8e9, 0xdcd4); sl@0: test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xe0\xb2\xa6\xf1\x8a\x93\x94")); sl@0: test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0); sl@0: test(generatedUnicode==unicode); sl@0: test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0); sl@0: test(generatedUtf8==_L8("\xe0\xb2\xa6\xed\xa3\xa9\xed\xb3\x94")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0); sl@0: test(generatedUnicode.Length()==7); sl@0: test(generatedUnicode[0]==0x0ca6); sl@0: test(generatedUnicode[1]==0xFFFD); sl@0: test(generatedUnicode[2]==0xFFFD); sl@0: test(generatedUnicode[3]==0xFFFD); sl@0: test(generatedUnicode[4]==0xFFFD); sl@0: test(generatedUnicode[5]==0xFFFD); sl@0: test(generatedUnicode[6]==0xFFFD); sl@0: sl@0: // Additional tests added for INC117111... sl@0: sl@0: generatedUtf8.Format(_L8("\xe0\xb2\xa6\xc0")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==1); sl@0: test(generatedUnicode[0]==0x0ca6); sl@0: sl@0: generatedUtf8.Format(_L8("\xc0")); sl@0: test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==CnvUtfConverter::EErrorIllFormedInput); sl@0: sl@0: CleanupStack::PopAndDestroy(2); // characterSetConverter and fileServerSession sl@0: } sl@0: sl@0: sl@0: CT_JAVA::CT_JAVA() sl@0: { sl@0: SetTestStepName(KTestStep_T_JAVA); sl@0: } sl@0: sl@0: TVerdict CT_JAVA::doTestStepL() sl@0: { sl@0: SetTestStepResult(EFail); sl@0: sl@0: __UHEAP_MARK; sl@0: sl@0: TRAPD(error1, Test_JAVA()); sl@0: sl@0: __UHEAP_MARKEND; sl@0: sl@0: if(error1 == KErrNone ) sl@0: { sl@0: SetTestStepResult(EPass); sl@0: } sl@0: sl@0: return TestStepResult(); sl@0: }