sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 1997-2010 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 "t_big5.h"
|
sl@0
|
24 |
|
sl@0
|
25 |
#define test(cond) \
|
sl@0
|
26 |
{ \
|
sl@0
|
27 |
TBool __bb = (cond); \
|
sl@0
|
28 |
TEST(__bb); \
|
sl@0
|
29 |
if (!__bb) \
|
sl@0
|
30 |
{ \
|
sl@0
|
31 |
ERR_PRINTF1(_L("ERROR: Test Failed")); \
|
sl@0
|
32 |
User::Leave(1); \
|
sl@0
|
33 |
} \
|
sl@0
|
34 |
}
|
sl@0
|
35 |
|
sl@0
|
36 |
/**
|
sl@0
|
37 |
@SYMTestCaseID SYSLIB-CHARCONV-CT-0515
|
sl@0
|
38 |
@SYMTestCaseDesc Tests for defect number EDNSHAY-45VJAU
|
sl@0
|
39 |
@SYMTestPriority Medium
|
sl@0
|
40 |
@SYMTestActions Tests for CCnvCharacterSetConverter::ConvertToUnicode() function
|
sl@0
|
41 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
42 |
@SYMREQ REQ0000
|
sl@0
|
43 |
*/
|
sl@0
|
44 |
void CT_BIG5::DoE32MainL()
|
sl@0
|
45 |
{
|
sl@0
|
46 |
RFs fileServerSession;
|
sl@0
|
47 |
CleanupClosePushL(fileServerSession);
|
sl@0
|
48 |
User::LeaveIfError(fileServerSession.Connect());
|
sl@0
|
49 |
CCnvCharacterSetConverter* characterSetConverter=CCnvCharacterSetConverter::NewLC();
|
sl@0
|
50 |
CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* arrayOfCharacterSetsAvailable=CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableLC(fileServerSession);
|
sl@0
|
51 |
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0515 Available:\n "));
|
sl@0
|
52 |
for (TInt i=arrayOfCharacterSetsAvailable->Count()-1; i>=0; --i)
|
sl@0
|
53 |
{
|
sl@0
|
54 |
const CCnvCharacterSetConverter::SCharacterSet& charactersSet=(*arrayOfCharacterSetsAvailable)[i];
|
sl@0
|
55 |
characterSetConverter->PrepareToConvertToOrFromL(charactersSet.Identifier(), *arrayOfCharacterSetsAvailable, fileServerSession);
|
sl@0
|
56 |
TPtrC charactersSetName(charactersSet.Name());
|
sl@0
|
57 |
if (charactersSet.NameIsFileName())
|
sl@0
|
58 |
{
|
sl@0
|
59 |
charactersSetName.Set(TParsePtrC(charactersSetName).Name());
|
sl@0
|
60 |
}
|
sl@0
|
61 |
INFO_PRINTF2(_L(" %S\n"), &charactersSetName);
|
sl@0
|
62 |
}
|
sl@0
|
63 |
TInt state=CCnvCharacterSetConverter::KStateDefault;
|
sl@0
|
64 |
INFO_PRINTF1(_L("Testing fix for defect number EDNSHAY-45VJAU"));
|
sl@0
|
65 |
characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierBig5, *arrayOfCharacterSetsAvailable, fileServerSession);
|
sl@0
|
66 |
TBuf16<28> generatedUnicode;
|
sl@0
|
67 |
test(characterSetConverter->ConvertToUnicode(generatedUnicode, _L8("++ ZAC"), state)==0);
|
sl@0
|
68 |
test(state==CCnvCharacterSetConverter::KStateDefault);
|
sl@0
|
69 |
CleanupStack::PopAndDestroy(3); // arrayOfCharacterSetsAvailable and characterSetConverter and fileServerSession
|
sl@0
|
70 |
}
|
sl@0
|
71 |
|
sl@0
|
72 |
CT_BIG5::CT_BIG5()
|
sl@0
|
73 |
{
|
sl@0
|
74 |
SetTestStepName(KTestStep_T_BIG5);
|
sl@0
|
75 |
}
|
sl@0
|
76 |
|
sl@0
|
77 |
TVerdict CT_BIG5::doTestStepL()
|
sl@0
|
78 |
{
|
sl@0
|
79 |
SetTestStepResult(EFail);
|
sl@0
|
80 |
|
sl@0
|
81 |
__UHEAP_MARK;
|
sl@0
|
82 |
TRAPD(error1, DoE32MainL());
|
sl@0
|
83 |
__UHEAP_MARKEND;
|
sl@0
|
84 |
|
sl@0
|
85 |
if(error1 == KErrNone)
|
sl@0
|
86 |
{
|
sl@0
|
87 |
SetTestStepResult(EPass);
|
sl@0
|
88 |
}
|
sl@0
|
89 |
|
sl@0
|
90 |
return TestStepResult();
|
sl@0
|
91 |
}
|
sl@0
|
92 |
|