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 <utf.h>
|
sl@0
|
21 |
#include "t_newlin7.h"
|
sl@0
|
22 |
|
sl@0
|
23 |
///////////////////////////////////////////////////////////////////////////////////////
|
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 |
/**
|
sl@0
|
38 |
@SYMTestCaseID SYSLIB-CHARCONV-CT-0570
|
sl@0
|
39 |
@SYMTestCaseDesc Testing base64 sequences combined with line-breaks
|
sl@0
|
40 |
@SYMTestPriority Medium
|
sl@0
|
41 |
@SYMTestActions Tests for conversion from UTF-7 to Unicode with line-breaks
|
sl@0
|
42 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
43 |
@SYMREQ REQ0000
|
sl@0
|
44 |
*/
|
sl@0
|
45 |
void CT_NEWLIN7::TestNEWLIN7()
|
sl@0
|
46 |
{
|
sl@0
|
47 |
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0570 Testing base64 sequences combined with line-breaks "));
|
sl@0
|
48 |
TBuf16<256> unicode;
|
sl@0
|
49 |
TBuf8<256> utf7;
|
sl@0
|
50 |
TInt state=CnvUtfConverter::KStateDefault;
|
sl@0
|
51 |
utf7=_L8("+U0E\nU0E");
|
sl@0
|
52 |
test(CnvUtfConverter::ConvertToUnicodeFromUtf7(unicode, utf7, state)==0);
|
sl@0
|
53 |
test(state==CnvUtfConverter::KStateDefault);
|
sl@0
|
54 |
test(unicode.Length()==5);
|
sl@0
|
55 |
test(unicode[0]==0x5341);
|
sl@0
|
56 |
test(unicode[1]==0x000a);
|
sl@0
|
57 |
test(unicode[2]==0x0055);
|
sl@0
|
58 |
test(unicode[3]==0x0030);
|
sl@0
|
59 |
test(unicode[4]==0x0045);
|
sl@0
|
60 |
unicode=_L16(")\n)\n*\n*\n+\n+\n)\n)\n*\n*\n+\n+");
|
sl@0
|
61 |
test(CnvUtfConverter::ConvertFromUnicodeToUtf7(utf7, unicode, ETrue)==0);
|
sl@0
|
62 |
test(utf7==_L8(")\n)\n+ACo-\n+ACo-\n+-\n+-\n)\n)\n+ACo-\n+ACo-\n+-\n+-"));
|
sl@0
|
63 |
test(CnvUtfConverter::ConvertFromUnicodeToUtf7(utf7, unicode, EFalse)==0);
|
sl@0
|
64 |
test(utf7==_L8(")\n)\n*\n*\n+-\n+-\n)\n)\n*\n*\n+-\n+-"));
|
sl@0
|
65 |
}
|
sl@0
|
66 |
|
sl@0
|
67 |
CT_NEWLIN7::CT_NEWLIN7()
|
sl@0
|
68 |
{
|
sl@0
|
69 |
SetTestStepName(KTestStep_T_NEWLIN7);
|
sl@0
|
70 |
}
|
sl@0
|
71 |
|
sl@0
|
72 |
TVerdict CT_NEWLIN7::doTestStepL()
|
sl@0
|
73 |
{
|
sl@0
|
74 |
SetTestStepResult(EFail);
|
sl@0
|
75 |
|
sl@0
|
76 |
__UHEAP_MARK;
|
sl@0
|
77 |
|
sl@0
|
78 |
TRAPD(error1, TestNEWLIN7());
|
sl@0
|
79 |
|
sl@0
|
80 |
__UHEAP_MARKEND;
|
sl@0
|
81 |
|
sl@0
|
82 |
if(error1 == KErrNone )
|
sl@0
|
83 |
{
|
sl@0
|
84 |
SetTestStepResult(EPass);
|
sl@0
|
85 |
}
|
sl@0
|
86 |
|
sl@0
|
87 |
return TestStepResult();
|
sl@0
|
88 |
}
|