os/textandloc/charconvfw/charconv_fw/test/rtest/tsrc/utf/tjava.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 1997-2009 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 <utf.h>
sl@0
    24
#include "t_java.h"
sl@0
    25
sl@0
    26
#define test(cond)                                          \
sl@0
    27
    {                                                       \
sl@0
    28
    TBool __bb = (cond);                                    \
sl@0
    29
    TEST(__bb);                                             \
sl@0
    30
    if (!__bb)                                              \
sl@0
    31
        {                                                   \
sl@0
    32
        ERR_PRINTF1(_L("ERROR: Test Failed"));              \
sl@0
    33
        User::Leave(1);                                     \
sl@0
    34
        }                                                   \
sl@0
    35
    }
sl@0
    36
sl@0
    37
///////////////////////////////////////////////////////////////////////////////////////
sl@0
    38
///////////////////////////////////////////////////////////////////////////////////////
sl@0
    39
/**
sl@0
    40
@SYMTestCaseID          SYSLIB-CHARCONV-CT-0571
sl@0
    41
@SYMTestCaseDesc        CnvUtfConverter class functionality test
sl@0
    42
@SYMTestPriority        Medium
sl@0
    43
@SYMTestActions        	Checking that Java-conformant UTF-8 is generated and handled correctly
sl@0
    44
@SYMTestExpectedResults Test must not fail
sl@0
    45
@SYMREQ                 REQ0000
sl@0
    46
*/
sl@0
    47
void CT_JAVA::Test_JAVA()
sl@0
    48
	{
sl@0
    49
	RFs fileServerSession;
sl@0
    50
	CleanupClosePushL(fileServerSession);
sl@0
    51
	User::LeaveIfError(fileServerSession.Connect());
sl@0
    52
	CCnvCharacterSetConverter* characterSetConverter=CCnvCharacterSetConverter::NewLC();
sl@0
    53
	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0571 Checking that Java-conformant UTF-8 is generated and handled correctly "));
sl@0
    54
	test(characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierJavaConformantUtf8, fileServerSession)==CCnvCharacterSetConverter::EAvailable);
sl@0
    55
	TBuf16<32> unicode;
sl@0
    56
	TBuf16<32> generatedUnicode;
sl@0
    57
	TBuf8<64> generatedUtf8;
sl@0
    58
	TInt convertToUnicodeState = CCnvCharacterSetConverter::KStateDefault;
sl@0
    59
sl@0
    60
	//
sl@0
    61
	INFO_PRINTF1(_L("Testing the behaviour of the Unicode character 0x0000"));
sl@0
    62
sl@0
    63
	unicode.Format(_L16("%c"), 0x0000);
sl@0
    64
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
    65
	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
    66
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
    67
	test(generatedUnicode==unicode);
sl@0
    68
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
    69
	test(generatedUtf8==_L8("\xc0\x80"));
sl@0
    70
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
    71
	test(generatedUnicode==unicode);
sl@0
    72
sl@0
    73
	unicode.Format(_L16("%c%c"), 0x0000, 0x0026);
sl@0
    74
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
    75
	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
    76
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
    77
	test(generatedUnicode==unicode);
sl@0
    78
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
    79
	test(generatedUtf8==_L8("\xc0\x80\x26"));
sl@0
    80
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
    81
	test(generatedUnicode==unicode);
sl@0
    82
sl@0
    83
	unicode.Format(_L16("%c%c"), 0x0000, 0x05d9);
sl@0
    84
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
    85
	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
    86
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
    87
	test(generatedUnicode==unicode);
sl@0
    88
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
    89
	test(generatedUtf8==_L8("\xc0\x80\xd7\x99"));
sl@0
    90
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
    91
	test(generatedUnicode==unicode);
sl@0
    92
sl@0
    93
	unicode.Format(_L16("%c%c"), 0x0000, 0x81ea);
sl@0
    94
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
    95
	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
    96
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
    97
	test(generatedUnicode==unicode);
sl@0
    98
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
    99
	test(generatedUtf8==_L8("\xc0\x80\xe8\x87\xaa"));
sl@0
   100
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   101
	test(generatedUnicode==unicode);
sl@0
   102
sl@0
   103
	unicode.Format(_L16("%c%c%c"), 0x0000, 0xd9e0, 0xdda3);
sl@0
   104
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   105
	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
   106
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   107
	test(generatedUnicode==unicode);
sl@0
   108
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   109
	test(generatedUtf8==_L8("\xc0\x80\xed\xa7\xa0\xed\xb6\xa3"));
sl@0
   110
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   111
	test(generatedUnicode.Length()==7);
sl@0
   112
	test(generatedUnicode[0]==0x0000);
sl@0
   113
	test(generatedUnicode[1]==0xFFFD);
sl@0
   114
	test(generatedUnicode[2]==0xFFFD);
sl@0
   115
	test(generatedUnicode[3]==0xFFFD);
sl@0
   116
	test(generatedUnicode[4]==0xFFFD);
sl@0
   117
	test(generatedUnicode[5]==0xFFFD);
sl@0
   118
	test(generatedUnicode[6]==0xFFFD);
sl@0
   119
sl@0
   120
	unicode.Format(_L16("%c%c"), 0x0071, 0x0000);
sl@0
   121
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   122
	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
   123
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   124
	test(generatedUnicode==unicode);
sl@0
   125
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   126
	test(generatedUtf8==_L8("\x71\xc0\x80"));
sl@0
   127
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   128
	test(generatedUnicode==unicode);
sl@0
   129
sl@0
   130
	unicode.Format(_L16("%c%c"), 0x06aa, 0x0000);
sl@0
   131
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   132
	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
   133
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   134
	test(generatedUnicode==unicode);
sl@0
   135
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   136
	test(generatedUtf8==_L8("\xda\xaa\xc0\x80"));
sl@0
   137
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   138
	test(generatedUnicode==unicode);
sl@0
   139
sl@0
   140
	unicode.Format(_L16("%c%c"), 0xc427, 0x0000);
sl@0
   141
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   142
	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
   143
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   144
	test(generatedUnicode==unicode);
sl@0
   145
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   146
	test(generatedUtf8==_L8("\xec\x90\xa7\xc0\x80"));
sl@0
   147
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   148
	test(generatedUnicode==unicode);
sl@0
   149
sl@0
   150
	unicode.Format(_L16("%c%c%c"), 0xd801, 0xdef1, 0x0000);
sl@0
   151
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   152
	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
   153
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   154
	test(generatedUnicode==unicode);
sl@0
   155
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   156
	test(generatedUtf8==_L8("\xed\xa0\x81\xed\xbb\xb1\xc0\x80"));
sl@0
   157
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   158
	test(generatedUnicode.Length()==7);
sl@0
   159
	test(generatedUnicode[0]==0xFFFD);
sl@0
   160
	test(generatedUnicode[1]==0xFFFD);
sl@0
   161
	test(generatedUnicode[2]==0xFFFD);
sl@0
   162
	test(generatedUnicode[3]==0xFFFD);
sl@0
   163
	test(generatedUnicode[4]==0xFFFD);
sl@0
   164
	test(generatedUnicode[5]==0xFFFD);
sl@0
   165
	test(generatedUnicode[6]==0x0000);
sl@0
   166
sl@0
   167
	INFO_PRINTF1(_L("Testing the generation of UTF-8 from surrogate pairs"));
sl@0
   168
	unicode.Format(_L16("%c"), 0xd7ff);
sl@0
   169
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   170
	test(generatedUtf8==_L8("\xed\x9f\xbf"));
sl@0
   171
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   172
	test(generatedUnicode==unicode);
sl@0
   173
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   174
	test(generatedUtf8==_L8("\xed\x9f\xbf"));
sl@0
   175
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   176
	test(generatedUnicode==unicode);
sl@0
   177
sl@0
   178
	unicode.Format(_L16("%c"), 0xe000);
sl@0
   179
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   180
	test(generatedUtf8==_L8("\xee\x80\x80"));
sl@0
   181
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   182
	test(generatedUnicode==unicode);
sl@0
   183
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   184
	test(generatedUtf8==_L8("\xee\x80\x80"));
sl@0
   185
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   186
	test(generatedUnicode==unicode);
sl@0
   187
sl@0
   188
	unicode.Format(_L16("%c%c"), 0xd800, 0xdc00);
sl@0
   189
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   190
	test(generatedUtf8==_L8("\xf0\x90\x80\x80"));
sl@0
   191
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   192
	test(generatedUnicode==unicode);
sl@0
   193
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   194
	test(generatedUtf8==_L8("\xed\xa0\x80\xed\xb0\x80"));
sl@0
   195
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   196
	test(generatedUnicode.Length()==6);
sl@0
   197
	test(generatedUnicode[0]==0xFFFD);
sl@0
   198
	test(generatedUnicode[1]==0xFFFD);
sl@0
   199
	test(generatedUnicode[2]==0xFFFD);
sl@0
   200
	test(generatedUnicode[3]==0xFFFD);
sl@0
   201
	test(generatedUnicode[4]==0xFFFD);
sl@0
   202
	test(generatedUnicode[5]==0xFFFD);
sl@0
   203
sl@0
   204
	unicode.Format(_L16("%c%c"), 0xd800, 0xdfff);
sl@0
   205
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   206
	test(generatedUtf8==_L8("\xf0\x90\x8f\xbf"));
sl@0
   207
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   208
	test(generatedUnicode==unicode);
sl@0
   209
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   210
	test(generatedUtf8==_L8("\xed\xa0\x80\xed\xbf\xbf"));
sl@0
   211
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   212
	test(generatedUnicode.Length()==6);
sl@0
   213
	test(generatedUnicode[0]==0xFFFD);
sl@0
   214
	test(generatedUnicode[1]==0xFFFD);
sl@0
   215
	test(generatedUnicode[2]==0xFFFD);
sl@0
   216
	test(generatedUnicode[3]==0xFFFD);
sl@0
   217
	test(generatedUnicode[4]==0xFFFD);
sl@0
   218
	test(generatedUnicode[5]==0xFFFD);
sl@0
   219
sl@0
   220
	unicode.Format(_L16("%c%c"), 0xdbff, 0xdc00);
sl@0
   221
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   222
	test(generatedUtf8==_L8("\xf4\x8f\xb0\x80"));
sl@0
   223
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   224
	test(generatedUnicode==unicode);
sl@0
   225
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   226
	test(generatedUtf8==_L8("\xed\xaf\xbf\xed\xb0\x80"));
sl@0
   227
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   228
	test(generatedUnicode.Length()==6);
sl@0
   229
	test(generatedUnicode[0]==0xFFFD);
sl@0
   230
	test(generatedUnicode[1]==0xFFFD);
sl@0
   231
	test(generatedUnicode[2]==0xFFFD);
sl@0
   232
	test(generatedUnicode[3]==0xFFFD);
sl@0
   233
	test(generatedUnicode[4]==0xFFFD);
sl@0
   234
	test(generatedUnicode[5]==0xFFFD);
sl@0
   235
sl@0
   236
	unicode.Format(_L16("%c%c"), 0xdbff, 0xdfff);
sl@0
   237
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   238
	test(generatedUtf8==_L8("\xf4\x8f\xbf\xbf"));
sl@0
   239
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   240
	test(generatedUnicode==unicode);
sl@0
   241
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   242
	test(generatedUtf8==_L8("\xed\xaf\xbf\xed\xbf\xbf"));
sl@0
   243
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   244
	test(generatedUnicode.Length()==6);
sl@0
   245
	test(generatedUnicode[0]==0xFFFD);
sl@0
   246
	test(generatedUnicode[1]==0xFFFD);
sl@0
   247
	test(generatedUnicode[2]==0xFFFD);
sl@0
   248
	test(generatedUnicode[3]==0xFFFD);
sl@0
   249
	test(generatedUnicode[4]==0xFFFD);
sl@0
   250
	test(generatedUnicode[5]==0xFFFD);
sl@0
   251
sl@0
   252
	unicode.Format(_L16("%c%c"), 0xd8e9, 0xdcd4);
sl@0
   253
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   254
	test(generatedUtf8==_L8("\xf1\x8a\x93\x94"));
sl@0
   255
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   256
	test(generatedUnicode==unicode);
sl@0
   257
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   258
	test(generatedUtf8==_L8("\xed\xa3\xa9\xed\xb3\x94"));
sl@0
   259
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   260
	test(generatedUnicode.Length()==6);
sl@0
   261
	test(generatedUnicode[0]==0xFFFD);
sl@0
   262
	test(generatedUnicode[1]==0xFFFD);
sl@0
   263
	test(generatedUnicode[2]==0xFFFD);
sl@0
   264
	test(generatedUnicode[3]==0xFFFD);
sl@0
   265
	test(generatedUnicode[4]==0xFFFD);
sl@0
   266
	test(generatedUnicode[5]==0xFFFD);
sl@0
   267
sl@0
   268
	unicode.Format(_L16("%c%c%c"), 0xd8e9, 0xdcd4, 0x003e);
sl@0
   269
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   270
	test(generatedUtf8==_L8("\xf1\x8a\x93\x94\x3e"));
sl@0
   271
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   272
	test(generatedUnicode==unicode);
sl@0
   273
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   274
	test(generatedUtf8==_L8("\xed\xa3\xa9\xed\xb3\x94\x3e"));
sl@0
   275
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   276
	test(generatedUnicode.Length()==7);
sl@0
   277
	test(generatedUnicode[0]==0xFFFD);
sl@0
   278
	test(generatedUnicode[1]==0xFFFD);
sl@0
   279
	test(generatedUnicode[2]==0xFFFD);
sl@0
   280
	test(generatedUnicode[3]==0xFFFD);
sl@0
   281
	test(generatedUnicode[4]==0xFFFD);
sl@0
   282
	test(generatedUnicode[5]==0xFFFD);
sl@0
   283
	test(generatedUnicode[6]==0x003e);
sl@0
   284
sl@0
   285
	unicode.Format(_L16("%c%c%c"), 0xd8e9, 0xdcd4, 0x01e9);
sl@0
   286
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   287
	test(generatedUtf8==_L8("\xf1\x8a\x93\x94\xc7\xa9"));
sl@0
   288
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   289
	test(generatedUnicode==unicode);
sl@0
   290
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   291
	test(generatedUtf8==_L8("\xed\xa3\xa9\xed\xb3\x94\xc7\xa9"));
sl@0
   292
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   293
	test(generatedUnicode.Length()==7);
sl@0
   294
	test(generatedUnicode[0]==0xFFFD);
sl@0
   295
	test(generatedUnicode[1]==0xFFFD);
sl@0
   296
	test(generatedUnicode[2]==0xFFFD);
sl@0
   297
	test(generatedUnicode[3]==0xFFFD);
sl@0
   298
	test(generatedUnicode[4]==0xFFFD);
sl@0
   299
	test(generatedUnicode[5]==0xFFFD);
sl@0
   300
	test(generatedUnicode[6]==0x01e9);
sl@0
   301
sl@0
   302
	unicode.Format(_L16("%c%c%c"), 0xd8e9, 0xdcd4, 0x1f9a);
sl@0
   303
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   304
	test(generatedUtf8==_L8("\xf1\x8a\x93\x94\xe1\xbe\x9a"));
sl@0
   305
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   306
	test(generatedUnicode==unicode);
sl@0
   307
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   308
	test(generatedUtf8==_L8("\xed\xa3\xa9\xed\xb3\x94\xe1\xbe\x9a"));
sl@0
   309
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   310
	test(generatedUnicode.Length()==7);
sl@0
   311
	test(generatedUnicode[0]==0xFFFD);
sl@0
   312
	test(generatedUnicode[1]==0xFFFD);
sl@0
   313
	test(generatedUnicode[2]==0xFFFD);
sl@0
   314
	test(generatedUnicode[3]==0xFFFD);
sl@0
   315
	test(generatedUnicode[4]==0xFFFD);
sl@0
   316
	test(generatedUnicode[5]==0xFFFD);
sl@0
   317
	test(generatedUnicode[6]==0x1f9a);
sl@0
   318
sl@0
   319
	unicode.Format(_L16("%c%c%c"), 0x0025, 0xd8e9, 0xdcd4);
sl@0
   320
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   321
	test(generatedUtf8==_L8("\x25\xf1\x8a\x93\x94"));
sl@0
   322
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   323
	test(generatedUnicode==unicode);
sl@0
   324
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   325
	test(generatedUtf8==_L8("\x25\xed\xa3\xa9\xed\xb3\x94"));
sl@0
   326
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   327
	test(generatedUnicode.Length()==7);
sl@0
   328
	test(generatedUnicode[0]==0x0025);
sl@0
   329
	test(generatedUnicode[1]==0xFFFD);
sl@0
   330
	test(generatedUnicode[2]==0xFFFD);
sl@0
   331
	test(generatedUnicode[3]==0xFFFD);
sl@0
   332
	test(generatedUnicode[4]==0xFFFD);
sl@0
   333
	test(generatedUnicode[5]==0xFFFD);
sl@0
   334
	test(generatedUnicode[6]==0xFFFD);
sl@0
   335
sl@0
   336
	unicode.Format(_L16("%c%c%c"), 0x00a5, 0xd8e9, 0xdcd4);
sl@0
   337
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   338
	test(generatedUtf8==_L8("\xc2\xa5\xf1\x8a\x93\x94"));
sl@0
   339
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   340
	test(generatedUnicode==unicode);
sl@0
   341
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   342
	test(generatedUtf8==_L8("\xc2\xa5\xed\xa3\xa9\xed\xb3\x94"));
sl@0
   343
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   344
	test(generatedUnicode.Length()==7);
sl@0
   345
	test(generatedUnicode[0]==0x00a5);
sl@0
   346
	test(generatedUnicode[1]==0xFFFD);
sl@0
   347
	test(generatedUnicode[2]==0xFFFD);
sl@0
   348
	test(generatedUnicode[3]==0xFFFD);
sl@0
   349
	test(generatedUnicode[4]==0xFFFD);
sl@0
   350
	test(generatedUnicode[5]==0xFFFD);
sl@0
   351
	test(generatedUnicode[6]==0xFFFD);
sl@0
   352
sl@0
   353
	unicode.Format(_L16("%c%c%c"), 0x0ca6, 0xd8e9, 0xdcd4);
sl@0
   354
	test(CnvUtfConverter::ConvertFromUnicodeToUtf8(generatedUtf8, unicode)==0);
sl@0
   355
	test(generatedUtf8==_L8("\xe0\xb2\xa6\xf1\x8a\x93\x94"));
sl@0
   356
	test(CnvUtfConverter::ConvertToUnicodeFromUtf8(generatedUnicode, generatedUtf8)==0);
sl@0
   357
	test(generatedUnicode==unicode);
sl@0
   358
	test(characterSetConverter->ConvertFromUnicode(generatedUtf8, unicode)==0);
sl@0
   359
	test(generatedUtf8==_L8("\xe0\xb2\xa6\xed\xa3\xa9\xed\xb3\x94"));
sl@0
   360
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==0);
sl@0
   361
	test(generatedUnicode.Length()==7);
sl@0
   362
	test(generatedUnicode[0]==0x0ca6);
sl@0
   363
	test(generatedUnicode[1]==0xFFFD);
sl@0
   364
	test(generatedUnicode[2]==0xFFFD);
sl@0
   365
	test(generatedUnicode[3]==0xFFFD);
sl@0
   366
	test(generatedUnicode[4]==0xFFFD);
sl@0
   367
	test(generatedUnicode[5]==0xFFFD);
sl@0
   368
	test(generatedUnicode[6]==0xFFFD);
sl@0
   369
sl@0
   370
	// Additional tests added for INC117111...
sl@0
   371
sl@0
   372
	generatedUtf8.Format(_L8("\xe0\xb2\xa6\xc0"));
sl@0
   373
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==1);
sl@0
   374
	test(generatedUnicode[0]==0x0ca6);
sl@0
   375
sl@0
   376
	generatedUtf8.Format(_L8("\xc0"));
sl@0
   377
	test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf8, convertToUnicodeState)==CnvUtfConverter::EErrorIllFormedInput);
sl@0
   378
sl@0
   379
	CleanupStack::PopAndDestroy(2); // characterSetConverter and fileServerSession
sl@0
   380
	}
sl@0
   381
sl@0
   382
sl@0
   383
CT_JAVA::CT_JAVA()
sl@0
   384
    {
sl@0
   385
    SetTestStepName(KTestStep_T_JAVA);
sl@0
   386
    }
sl@0
   387
sl@0
   388
TVerdict CT_JAVA::doTestStepL()
sl@0
   389
    {
sl@0
   390
    SetTestStepResult(EFail);
sl@0
   391
sl@0
   392
    __UHEAP_MARK;
sl@0
   393
sl@0
   394
    TRAPD(error1, Test_JAVA());
sl@0
   395
sl@0
   396
    __UHEAP_MARKEND;
sl@0
   397
sl@0
   398
    if(error1 == KErrNone )
sl@0
   399
        {
sl@0
   400
        SetTestStepResult(EPass);
sl@0
   401
        }
sl@0
   402
sl@0
   403
    return TestStepResult();
sl@0
   404
    }