diff -r 000000000000 -r bde4ae8d615e os/textandloc/charconvfw/charconvplugins/test/rtest/tsrc/main/t_big5.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os/textandloc/charconvfw/charconvplugins/test/rtest/tsrc/main/t_big5.cpp Fri Jun 15 03:10:57 2012 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include +#include +#include +#include +#include "t_big5.h" + +#define test(cond) \ + { \ + TBool __bb = (cond); \ + TEST(__bb); \ + if (!__bb) \ + { \ + ERR_PRINTF1(_L("ERROR: Test Failed")); \ + User::Leave(1); \ + } \ + } + +/** +@SYMTestCaseID SYSLIB-CHARCONV-CT-0515 +@SYMTestCaseDesc Tests for defect number EDNSHAY-45VJAU +@SYMTestPriority Medium +@SYMTestActions Tests for CCnvCharacterSetConverter::ConvertToUnicode() function +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void CT_BIG5::DoE32MainL() + { + RFs fileServerSession; + CleanupClosePushL(fileServerSession); + User::LeaveIfError(fileServerSession.Connect()); + CCnvCharacterSetConverter* characterSetConverter=CCnvCharacterSetConverter::NewLC(); + CArrayFix* arrayOfCharacterSetsAvailable=CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableLC(fileServerSession); + INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0515 Available:\n ")); + for (TInt i=arrayOfCharacterSetsAvailable->Count()-1; i>=0; --i) + { + const CCnvCharacterSetConverter::SCharacterSet& charactersSet=(*arrayOfCharacterSetsAvailable)[i]; + characterSetConverter->PrepareToConvertToOrFromL(charactersSet.Identifier(), *arrayOfCharacterSetsAvailable, fileServerSession); + TPtrC charactersSetName(charactersSet.Name()); + if (charactersSet.NameIsFileName()) + { + charactersSetName.Set(TParsePtrC(charactersSetName).Name()); + } + INFO_PRINTF2(_L(" %S\n"), &charactersSetName); + } + TInt state=CCnvCharacterSetConverter::KStateDefault; + INFO_PRINTF1(_L("Testing fix for defect number EDNSHAY-45VJAU")); + characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierBig5, *arrayOfCharacterSetsAvailable, fileServerSession); + TBuf16<28> generatedUnicode; + test(characterSetConverter->ConvertToUnicode(generatedUnicode, _L8("++ ZAC"), state)==0); + test(state==CCnvCharacterSetConverter::KStateDefault); + CleanupStack::PopAndDestroy(3); // arrayOfCharacterSetsAvailable and characterSetConverter and fileServerSession + } + +CT_BIG5::CT_BIG5() + { + SetTestStepName(KTestStep_T_BIG5); + } + +TVerdict CT_BIG5::doTestStepL() + { + SetTestStepResult(EFail); + + __UHEAP_MARK; + TRAPD(error1, DoE32MainL()); + __UHEAP_MARKEND; + + if(error1 == KErrNone) + { + SetTestStepResult(EPass); + } + + return TestStepResult(); + } +