os/textandloc/charconvfw/charconvplugins/test/rtest/tsrc/main/t_jis.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/charconvfw/charconvplugins/test/rtest/tsrc/main/t_jis.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,319 @@
     1.4 +/*
     1.5 +* Copyright (c) 2000-2010 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 "t_jis.h"
    1.27 +
    1.28 +#define test(cond)                                  \
    1.29 +    {                                               \
    1.30 +    TBool __bb = (cond);                            \
    1.31 +    TEST(__bb);                                     \
    1.32 +    if (!__bb)                                      \
    1.33 +        {                                           \
    1.34 +        ERR_PRINTF1(_L("ERROR: Test Failed"));      \
    1.35 +        User::Leave(1);                             \
    1.36 +        }                                           \
    1.37 +    }
    1.38 +
    1.39 +const TInt KBufferLength=100;
    1.40 +/**
    1.41 +@SYMTestCaseID          SYSLIB-CHARCONV-CT-0529
    1.42 +@SYMTestCaseDesc        Tests for truncated conversion from Unicode to JIS
    1.43 +@SYMTestPriority        Medium
    1.44 +@SYMTestActions         Tests for truncated conversion from Unicode to JIS and back to Unicode
    1.45 +@SYMTestExpectedResults Test must not fail
    1.46 +@SYMREQ                 REQ0000
    1.47 +*/
    1.48 +void CT_JIS::TestTruncatedConversionFromUnicodeToJis(CCnvCharacterSetConverter& aCharacterSetConverter, const TDesC16& aOriginalUnicode)
    1.49 +	{
    1.50 +	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0529 "));
    1.51 +	for (TInt i=aOriginalUnicode.Length(); i>=0; --i)
    1.52 +		{
    1.53 +		TBuf8<KBufferLength> generatedJis;
    1.54 +		test(aCharacterSetConverter.ConvertFromUnicode(generatedJis, aOriginalUnicode.Left(i))>=0);
    1.55 +		TBuf8<KBufferLength> generatedsecondPartOfJis;
    1.56 +		test(aCharacterSetConverter.ConvertFromUnicode(generatedsecondPartOfJis, aOriginalUnicode.Mid(i))==0);
    1.57 +		generatedJis.Append(generatedsecondPartOfJis);
    1.58 +		TInt state=CCnvCharacterSetConverter::KStateDefault;
    1.59 +		TBuf16<KBufferLength> generatedUnicode;
    1.60 +		test(aCharacterSetConverter.ConvertToUnicode(generatedUnicode, generatedJis, state)==0);
    1.61 +		test(generatedUnicode==aOriginalUnicode);
    1.62 +		}
    1.63 +	}
    1.64 +/**
    1.65 +@SYMTestCaseID          SYSLIB-CHARCONV-CT-0530
    1.66 +@SYMTestCaseDesc        Splitting and converting from Unicode to JIS test
    1.67 +@SYMTestPriority        Medium
    1.68 +@SYMTestActions         Tests for conversion after splitting, from Unicode to JIS and back to Unicode
    1.69 +@SYMTestExpectedResults Test must not fail
    1.70 +@SYMREQ                 REQ0000
    1.71 +*/
    1.72 +void CT_JIS::TestSplittingConvertingFromUnicodeToJis(CCnvCharacterSetConverter& aCharacterSetConverter, TInt aMaximumLengthLowerLimit, TInt aMaximumLengthUpperLimit, TInt aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit, const TDesC8& aExpectedFirstPartOfJis, const TDesC8& aExpectedSecondPartOfJis, const TDesC16& aOriginalUnicode)
    1.73 +	{
    1.74 +	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0530 "));
    1.75 +	test(aMaximumLengthLowerLimit<=aMaximumLengthUpperLimit);
    1.76 +	test(aMaximumLengthUpperLimit<=KBufferLength);
    1.77 +	TUint8 jisBuffer[KBufferLength];
    1.78 +	for (TInt i=aMaximumLengthLowerLimit; i<=aMaximumLengthUpperLimit; ++i)
    1.79 +		{
    1.80 +		TPtr8 generatedFirstPartOfJis(jisBuffer, i);
    1.81 +		test(aCharacterSetConverter.ConvertFromUnicode(generatedFirstPartOfJis, aOriginalUnicode)==aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit);
    1.82 +		test(generatedFirstPartOfJis==aExpectedFirstPartOfJis);
    1.83 +		TBuf8<KBufferLength> generatedSecondPartOfJis;
    1.84 +		test(aCharacterSetConverter.ConvertFromUnicode(generatedSecondPartOfJis, aOriginalUnicode.Right(aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit))==0);
    1.85 +		test(generatedSecondPartOfJis==aExpectedSecondPartOfJis);
    1.86 +		TInt state=CCnvCharacterSetConverter::KStateDefault;
    1.87 +		TBuf16<KBufferLength> generatedUnicode;
    1.88 +		test(aCharacterSetConverter.ConvertToUnicode(generatedUnicode, generatedFirstPartOfJis, state)==0);
    1.89 +		TBuf16<KBufferLength> generatedSecondPartOfUnicode;
    1.90 +		test(aCharacterSetConverter.ConvertToUnicode(generatedSecondPartOfUnicode, generatedSecondPartOfJis, state)==0);
    1.91 +		generatedUnicode.Append(generatedSecondPartOfUnicode);
    1.92 +		test(generatedUnicode==aOriginalUnicode);
    1.93 +		}
    1.94 +	}
    1.95 +/**
    1.96 +@SYMTestCaseID          SYSLIB-CHARCONV-CT-0531
    1.97 +@SYMTestCaseDesc        Tests for truncated conversion from JIS to Unicode
    1.98 +@SYMTestPriority        Medium
    1.99 +@SYMTestActions         Tests for truncated conversion from JIS to Unicode and back to JIS
   1.100 +@SYMTestExpectedResults Test must not fail
   1.101 +@SYMREQ                 REQ0000
   1.102 +*/
   1.103 +void CT_JIS::TestTruncatedConversionToUnicodeFromJis(CCnvCharacterSetConverter& aCharacterSetConverter, const TDesC16& aExpectedUnicode, const TDesC8& aOriginalJis)
   1.104 +	{
   1.105 +	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0531 "));
   1.106 +	for (TInt i=aOriginalJis.Length(); i>=6; --i) // 6 is the length of JIS' longest escape sequence
   1.107 +		{
   1.108 +		TInt state=CCnvCharacterSetConverter::KStateDefault;
   1.109 +		TBuf16<KBufferLength> generatedUnicode;
   1.110 +		const TInt returnValue=aCharacterSetConverter.ConvertToUnicode(generatedUnicode, aOriginalJis.Left(i), state);
   1.111 +		test(returnValue>=0);
   1.112 +		TBuf16<KBufferLength> generatedsecondPartOfUnicode;
   1.113 +		test(aCharacterSetConverter.ConvertToUnicode(generatedsecondPartOfUnicode, aOriginalJis.Mid(i-returnValue), state)==0);
   1.114 +		generatedUnicode.Append(generatedsecondPartOfUnicode);
   1.115 +		test(generatedUnicode==aExpectedUnicode);
   1.116 +		}
   1.117 +	}
   1.118 +/**
   1.119 +@SYMTestCaseID          SYSLIB-CHARCONV-CT-0532
   1.120 +@SYMTestCaseDesc        Splitting and converting from JIS to Unicode test
   1.121 +@SYMTestPriority        Medium
   1.122 +@SYMTestActions         Tests for conversion after splitting, from JIS to Unicode and back to JIS
   1.123 +@SYMTestExpectedResults Test must not fail
   1.124 +@SYMREQ                 REQ0000
   1.125 +*/
   1.126 +void CT_JIS::TestSplittingConvertingToUnicodeFromJis(CCnvCharacterSetConverter& aCharacterSetConverter, TInt aMaximumLengthLowerLimit, TInt aMaximumLengthUpperLimit, TInt aExpectedNumberOfJisBytesNotConvertedAtSplit, TInt aExpectedLengthOfFirstPartOfUnicode, const TDesC16& aExpectedUnicode, const TDesC8& aOriginalJis)
   1.127 +	{
   1.128 +	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0532 "));
   1.129 +	test(aMaximumLengthLowerLimit<=aMaximumLengthUpperLimit);
   1.130 +	test(aMaximumLengthUpperLimit<=KBufferLength);
   1.131 +	TUint16 unicodeBuffer[KBufferLength];
   1.132 +	for (TInt i=aMaximumLengthLowerLimit; i<=aMaximumLengthUpperLimit; ++i)
   1.133 +		{
   1.134 +		TPtr16 generatedFirstPartOfUnicode(unicodeBuffer, i);
   1.135 +		TInt state=CCnvCharacterSetConverter::KStateDefault;
   1.136 +		const TInt returnValue=aCharacterSetConverter.ConvertToUnicode(generatedFirstPartOfUnicode, aOriginalJis, state);
   1.137 +		test(generatedFirstPartOfUnicode==aExpectedUnicode.Left(aExpectedLengthOfFirstPartOfUnicode));
   1.138 +		test(returnValue==aExpectedNumberOfJisBytesNotConvertedAtSplit);
   1.139 +		TBuf16<KBufferLength> generatedSecondPartOfUnicode;
   1.140 +		test(aCharacterSetConverter.ConvertToUnicode(generatedSecondPartOfUnicode, aOriginalJis.Right(aExpectedNumberOfJisBytesNotConvertedAtSplit), state)==0);
   1.141 +		test(generatedSecondPartOfUnicode==aExpectedUnicode.Mid(aExpectedLengthOfFirstPartOfUnicode));
   1.142 +		TBuf8<KBufferLength> generatedJis;
   1.143 +		test(aCharacterSetConverter.ConvertFromUnicode(generatedJis, generatedFirstPartOfUnicode)==0);
   1.144 +		TBuf8<KBufferLength> generatedSecondPartOfJis;
   1.145 +		test(aCharacterSetConverter.ConvertFromUnicode(generatedSecondPartOfJis, generatedSecondPartOfUnicode)==0);
   1.146 +		generatedJis.Append(generatedSecondPartOfJis);
   1.147 +		TBuf16<KBufferLength> regeneratedUnicode;
   1.148 +		state=CCnvCharacterSetConverter::KStateDefault;
   1.149 +		test(aCharacterSetConverter.ConvertToUnicode(regeneratedUnicode, generatedJis, state)==0);
   1.150 +		test(regeneratedUnicode==aExpectedUnicode);
   1.151 +		state=CCnvCharacterSetConverter::KStateDefault;
   1.152 +		test(aCharacterSetConverter.ConvertToUnicode(regeneratedUnicode, aOriginalJis, state)==0);
   1.153 +		test(regeneratedUnicode==aExpectedUnicode);
   1.154 +		}
   1.155 +	}
   1.156 +/**
   1.157 +@SYMTestCaseID          SYSLIB-CHARCONV-CT-0533
   1.158 +@SYMTestCaseDesc        Conversion of bad JIS format to Unicode test
   1.159 +@SYMTestPriority        Medium
   1.160 +@SYMTestActions         Tests to convert bad formatted JIS input to Unicode.
   1.161 +@SYMTestExpectedResults Test must not fail
   1.162 +@SYMREQ                 REQ0000
   1.163 +*/
   1.164 +void CT_JIS::TestIsIllFormedJis(CCnvCharacterSetConverter& aCharacterSetConverter, const TDesC8& aJis)
   1.165 +	{
   1.166 +	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0533 "));
   1.167 +	TBuf16<50> generatedUnicode;
   1.168 +	TInt state=CCnvCharacterSetConverter::KStateDefault;
   1.169 +	TPtrC8 remainderOfJis(aJis);
   1.170 +	TInt lastReturnValue=KMaxTInt;
   1.171 +	FOREVER
   1.172 +		{
   1.173 +		const TInt returnValue=aCharacterSetConverter.ConvertToUnicode(generatedUnicode, remainderOfJis, state);
   1.174 +		if (returnValue==CCnvCharacterSetConverter::EErrorIllFormedInput)
   1.175 +			{
   1.176 +			break;
   1.177 +			}
   1.178 +		test(returnValue>0);
   1.179 +		test(returnValue<lastReturnValue);
   1.180 +		lastReturnValue=returnValue;
   1.181 +		remainderOfJis.Set(remainderOfJis.Right(returnValue));
   1.182 +		}
   1.183 +	}
   1.184 +
   1.185 +/**
   1.186 +* Utility for DEF063276 fix.
   1.187 +*/
   1.188 +
   1.189 +_LIT(KOriginalJisFilename, "z:\\test\\data\\originalJis.dat");
   1.190 +
   1.191 +void CT_JIS::ReadDesc(TDes8& aDes, const TDesC& aFilename, RFs& aFs)
   1.192 +	{
   1.193 +	RFile file;
   1.194 +	TInt err = file.Open(aFs, aFilename, EFileRead);
   1.195 +	test(err == KErrNone);
   1.196 +	CleanupClosePushL(file);
   1.197 +
   1.198 +	err = file.Read(aDes);
   1.199 +	test(err == KErrNone);
   1.200 +	CleanupStack::PopAndDestroy(&file);
   1.201 +	}
   1.202 +
   1.203 +/**
   1.204 +@SYMTestCaseID          SYSLIB-CHARCONV-CT-0534
   1.205 +@SYMTestCaseDesc        JIS to Unicode and Unicode to JIS conversion tests
   1.206 +@SYMTestPriority        Medium
   1.207 +@SYMTestActions         Calls up all conversion test functions from JIS to Unicode
   1.208 +@SYMTestExpectedResults Test must not fail
   1.209 +@SYMREQ                 REQ0000
   1.210 +*/
   1.211 +
   1.212 +void CT_JIS::DoE32MainL()
   1.213 +	{
   1.214 +	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0534 "));
   1.215 +	RFs fileServerSession;
   1.216 +	CleanupClosePushL(fileServerSession);
   1.217 +	User::LeaveIfError(fileServerSession.Connect());
   1.218 +	CCnvCharacterSetConverter* characterSetConverter=CCnvCharacterSetConverter::NewLC();
   1.219 +	CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* arrayOfCharacterSetsAvailable=CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableLC(fileServerSession);
   1.220 +	INFO_PRINTF1(_L("Available:\n"));
   1.221 +	TInt i;
   1.222 +	for (i=arrayOfCharacterSetsAvailable->Count()-1; i>=0; --i)
   1.223 +		{
   1.224 +		const CCnvCharacterSetConverter::SCharacterSet& charactersSet=(*arrayOfCharacterSetsAvailable)[i];
   1.225 +		characterSetConverter->PrepareToConvertToOrFromL(charactersSet.Identifier(), *arrayOfCharacterSetsAvailable, fileServerSession);
   1.226 +		TPtrC charactersSetName(charactersSet.Name());
   1.227 +		if (charactersSet.NameIsFileName())
   1.228 +			{
   1.229 +			charactersSetName.Set(TParsePtrC(charactersSetName).Name());
   1.230 +			}
   1.231 +		INFO_PRINTF2(_L("    %S\n"), &charactersSetName);
   1.232 +		}
   1.233 +	INFO_PRINTF1(_L("Testing JIS conversions"));
   1.234 +	characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierJis, *arrayOfCharacterSetsAvailable, fileServerSession);
   1.235 +	//
   1.236 +	INFO_PRINTF1(_L("Empty descriptor"));
   1.237 +	TestSplittingConvertingFromUnicodeToJis(*characterSetConverter, 0, 10, 0, KNullDesC8, KNullDesC8, KNullDesC16);
   1.238 +	TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, 0, 10, 0, 0, KNullDesC16, KNullDesC8);
   1.239 +	INFO_PRINTF1(_L("Testing converting to JIS"));
   1.240 +	TBuf16<50> originalUnicode;
   1.241 +	originalUnicode.Format(_L16("I %c%c%c%c%c%c%c%c"), 0x611b, 0x3059, 0x308b, 0xff74, 0xff9a, 0xff68, 0xff9d, 0x4e04);
   1.242 +	TestTruncatedConversionFromUnicodeToJis(*characterSetConverter, originalUnicode);
   1.243 +	TestSplittingConvertingFromUnicodeToJis(*characterSetConverter, 0, 3, 10, KNullDesC8, _L8("\x1b\x28\x4aI \x1b\x24\x42\x30\x26\x24\x39\x24\x6b\x1b\x28\x49\x34\x5a\x28\x5d\x1b\x24\x28\x44\x30\x22"), originalUnicode);
   1.244 +	TestSplittingConvertingFromUnicodeToJis(*characterSetConverter, 4, 4, 9, _L8("\x1b\x28\x4aI"), _L8("\x1b\x28\x4a \x1b\x24\x42\x30\x26\x24\x39\x24\x6b\x1b\x28\x49\x34\x5a\x28\x5d\x1b\x24\x28\x44\x30\x22"), originalUnicode);
   1.245 +	TestSplittingConvertingFromUnicodeToJis(*characterSetConverter, 5, 9, 8, _L8("\x1b\x28\x4aI "), _L8("\x1b\x24\x42\x30\x26\x24\x39\x24\x6b\x1b\x28\x49\x34\x5a\x28\x5d\x1b\x24\x28\x44\x30\x22"), originalUnicode);
   1.246 +	TestSplittingConvertingFromUnicodeToJis(*characterSetConverter, 10, 11, 7, _L8("\x1b\x28\x4aI \x1b\x24\x42\x30\x26"), _L8("\x1b\x24\x42\x24\x39\x24\x6b\x1b\x28\x49\x34\x5a\x28\x5d\x1b\x24\x28\x44\x30\x22"), originalUnicode);
   1.247 +	TestSplittingConvertingFromUnicodeToJis(*characterSetConverter, 12, 13, 6, _L8("\x1b\x28\x4aI \x1b\x24\x42\x30\x26\x24\x39"), _L8("\x1b\x24\x42\x24\x6b\x1b\x28\x49\x34\x5a\x28\x5d\x1b\x24\x28\x44\x30\x22"), originalUnicode);
   1.248 +	TestSplittingConvertingFromUnicodeToJis(*characterSetConverter, 14, 17, 5, _L8("\x1b\x28\x4aI \x1b\x24\x42\x30\x26\x24\x39\x24\x6b"), _L8("\x1b\x28\x49\x34\x5a\x28\x5d\x1b\x24\x28\x44\x30\x22"), originalUnicode);
   1.249 +	TestSplittingConvertingFromUnicodeToJis(*characterSetConverter, 18, 18, 4, _L8("\x1b\x28\x4aI \x1b\x24\x42\x30\x26\x24\x39\x24\x6b\x1b\x28\x49\x34"), _L8("\x1b\x28\x49\x5a\x28\x5d\x1b\x24\x28\x44\x30\x22"), originalUnicode);
   1.250 +	TestSplittingConvertingFromUnicodeToJis(*characterSetConverter, 19, 19, 3, _L8("\x1b\x28\x4aI \x1b\x24\x42\x30\x26\x24\x39\x24\x6b\x1b\x28\x49\x34\x5a"), _L8("\x1b\x28\x49\x28\x5d\x1b\x24\x28\x44\x30\x22"), originalUnicode);
   1.251 +	TestSplittingConvertingFromUnicodeToJis(*characterSetConverter, 20, 20, 2, _L8("\x1b\x28\x4aI \x1b\x24\x42\x30\x26\x24\x39\x24\x6b\x1b\x28\x49\x34\x5a\x28"), _L8("\x1b\x28\x49\x5d\x1b\x24\x28\x44\x30\x22"), originalUnicode);
   1.252 +	TestSplittingConvertingFromUnicodeToJis(*characterSetConverter, 21, 26, 1, _L8("\x1b\x28\x4aI \x1b\x24\x42\x30\x26\x24\x39\x24\x6b\x1b\x28\x49\x34\x5a\x28\x5d"), _L8("\x1b\x24\x28\x44\x30\x22"), originalUnicode);
   1.253 +	TestSplittingConvertingFromUnicodeToJis(*characterSetConverter, 27, 40, 0, _L8("\x1b\x28\x4aI \x1b\x24\x42\x30\x26\x24\x39\x24\x6b\x1b\x28\x49\x34\x5a\x28\x5d\x1b\x24\x28\x44\x30\x22"), KNullDesC8, originalUnicode);
   1.254 +	INFO_PRINTF1(_L("Testing converting to Unicode"));
   1.255 +
   1.256 +	/**
   1.257 +	* Work around for DEF063276.
   1.258 +	* This literal is now loaded from a z:\test\data\originalJis.dat
   1.259 +	* Bullseye Coverage corrupts this literal to avoid this it is stored in a file as to not be touched by Bullseye Coverage.
   1.260 +	*/
   1.261 +	// const TPtrC8 originalJis(_S8("\\\x1b\x28\x42\\\xb4\\\x0e\x31\x0f\\\x0e\x4a\x5e\x1b\x26\x40\x1b\x24\x42\x30\x24\x1b\x24\x28\x44\x30\x24\x1b\x28\x49\x21\x0e\x22\x0f\x30\x24\x0e"));
   1.262 +
   1.263 +	TBuf8<64> buf;
   1.264 +	ReadDesc(buf, KOriginalJisFilename, fileServerSession);
   1.265 +
   1.266 +	TBuf16<50> expectedUnicode;
   1.267 +	expectedUnicode.Format(_L16("\xa5\\%c\xa5%c\xa5%c%c%c%c%c%c0$"), 0xff74, 0xff71, 0xff8a, 0xff9e, 0x963f, 0x4e0c, 0xff61, 0xff62);
   1.268 +	TestTruncatedConversionToUnicodeFromJis(*characterSetConverter, expectedUnicode, buf);
   1.269 +	TestTruncatedConversionToUnicodeFromJis(*characterSetConverter, _L16(" Hello"), _L8("\x1b\x24\x42\x1b\x28\x4a\x1b\x24\x42\x1b\x28\x4a\x1b\x26\x40\x1b\x24\x42\x1b\x28\x4a Hello"));
   1.270 +	TestTruncatedConversionToUnicodeFromJis(*characterSetConverter, _L16(" Hello"), _L8("\x1b\x26\x40\x1b\x24\x42\x1b\x28\x4a Hello"));
   1.271 +	TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, 0, 0, 38, 0, expectedUnicode, buf);
   1.272 +	TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, 1, 1, 34, 1, expectedUnicode, buf);
   1.273 +	TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, 2, 2, 33, 2, expectedUnicode, buf);
   1.274 +	TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, 3, 3, 32, 3, expectedUnicode, buf);
   1.275 +	TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, 4, 4, 30, 4, expectedUnicode, buf);
   1.276 +	TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, 5, 5, 28, 5, expectedUnicode, buf);
   1.277 +	TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, 6, 6, 26, 6, expectedUnicode, buf);
   1.278 +	TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, 7, 7, 25, 7, expectedUnicode, buf);
   1.279 +	TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, 8, 8, 24, 8, expectedUnicode, buf);
   1.280 +	TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, 9, 9, 12, 9, expectedUnicode, buf);
   1.281 +	TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, 10, 10, 7, 10, expectedUnicode, buf);
   1.282 +	TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, 11, 11, 5, 11, expectedUnicode, buf);
   1.283 +	TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, 12, 12, 3, 12, expectedUnicode, buf);
   1.284 +	TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, 13, 13, 2, 13, expectedUnicode, buf);
   1.285 +	TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, 14, 30, 0, 14, expectedUnicode, buf);
   1.286 +
   1.287 +	// End fix
   1.288 +	INFO_PRINTF1(_L("Testing the default JIS state"));
   1.289 +	for (i=0; i<=6; ++i)
   1.290 +		{
   1.291 +		TestSplittingConvertingToUnicodeFromJis(*characterSetConverter, i, i, 6-i, i, _L16("Hello\xa5"), _L8("Hello\\"));
   1.292 +		}
   1.293 +	INFO_PRINTF1(_L("Testing ill-formed JIS"));
   1.294 +	TestIsIllFormedJis(*characterSetConverter, _L8("abc \x1b\x26\x40\x1b\x24\x42\x21\x1b\x28\x4a def"));
   1.295 +	TestIsIllFormedJis(*characterSetConverter, _L8("abc \x1b\x26\x40\x1b\x24\x42\x21\x21\x21\x1b\x28\x4a def"));
   1.296 +	TestIsIllFormedJis(*characterSetConverter, _L8("abc \x1b\x26\x40\x1b\x24\x42\x21\x21\x21\x21\x21\x1b\x28\x4a def"));
   1.297 +	TestIsIllFormedJis(*characterSetConverter, _L8("abc \x1b"));
   1.298 +	TestIsIllFormedJis(*characterSetConverter, _L8("abc \x1b\x24"));
   1.299 +	TestIsIllFormedJis(*characterSetConverter, _L8("abc \x1b\x24\xff"));
   1.300 +	CleanupStack::PopAndDestroy(3); // arrayOfCharacterSetsAvailable and characterSetConverter and fileServerSession
   1.301 +	}
   1.302 +
   1.303 +CT_JIS::CT_JIS()
   1.304 +    {
   1.305 +    SetTestStepName(KTestStep_T_JIS);
   1.306 +    }
   1.307 +
   1.308 +TVerdict CT_JIS::doTestStepL()
   1.309 +    {
   1.310 +    SetTestStepResult(EFail);
   1.311 +
   1.312 +    __UHEAP_MARK;
   1.313 +    TRAPD(error1, DoE32MainL());    
   1.314 +    __UHEAP_MARKEND;
   1.315 +
   1.316 +    if(error1 == KErrNone)
   1.317 +        {
   1.318 +        SetTestStepResult(EPass);
   1.319 +        }
   1.320 +
   1.321 +    return TestStepResult();
   1.322 +    }