|
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <e32test.h> |
|
17 #include <charconv.h> |
|
18 |
|
19 #include <xml/parserfeature.h> |
|
20 #include <xml/xmlframeworkerrors.h> |
|
21 |
|
22 #include "stabilitytestclass.h" |
|
23 #include "testdocuments.h" |
|
24 |
|
25 using namespace Xml; |
|
26 |
|
27 static RTest test(_L("t_wbxmlparserucs4testspartone")); |
|
28 |
|
29 |
|
30 /** |
|
31 @SYMTestCaseID SYSLIB-XML-CT-3725 |
|
32 @SYMTestCaseDesc Parsing unicode characters. |
|
33 @SYMTestPriority Medium |
|
34 @SYMTestActions Parsing unicode characters and comparing the expected output. |
|
35 @SYMTestExpectedResults Expected out matches actual output. |
|
36 @SYMREQ REQ0000 |
|
37 */ |
|
38 static void ParserTestsL() |
|
39 { |
|
40 test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3725 ParserTestsL tests... ")); |
|
41 |
|
42 __UHEAP_MARK; |
|
43 |
|
44 |
|
45 TBuf16<256> ucs4_0041; |
|
46 |
|
47 // <wml>A</wml> |
|
48 // 0x01, 0x04, 0x6A, 0x00, 0x7F, 0x02, 0x80, 0x41, 0x01 |
|
49 |
|
50 ucs4_0041.Append(0x01); |
|
51 ucs4_0041.Append(0x04); |
|
52 ucs4_0041.Append(0x6A); |
|
53 ucs4_0041.Append(0x00); |
|
54 ucs4_0041.Append(0x7F); |
|
55 ucs4_0041.Append(0x02); |
|
56 ucs4_0041.Append(0x80); |
|
57 ucs4_0041.Append(0x41); |
|
58 ucs4_0041.Append(0x01); |
|
59 |
|
60 _LIT (KDataComparison, "<wml xmlns='-//WAPFORUM//DTD WML 1.1//EN'>A</wml>"); |
|
61 |
|
62 TPassOrFailureSettings aPassOrFailureSettings; |
|
63 |
|
64 aPassOrFailureSettings.iStringDictionaryUri = &KBlankStringDictionaryUri; |
|
65 aPassOrFailureSettings.iDoParseDocument = ETrue; |
|
66 aPassOrFailureSettings.iFilenameProvided = EFalse; |
|
67 aPassOrFailureSettings.iParseMode = EErrorOnUnrecognisedTags| |
|
68 ERawContent; |
|
69 aPassOrFailureSettings.iExpectedCode = KErrNone; |
|
70 |
|
71 |
|
72 CStabilityTestClass* behaviourTest = CStabilityTestClass::NewL(test); |
|
73 CleanupStack::PushL(behaviourTest); |
|
74 |
|
75 |
|
76 behaviourTest->TestBehaviour(ucs4_0041, aPassOrFailureSettings); |
|
77 |
|
78 test(KDataComparison() == *behaviourTest->iOutput); |
|
79 behaviourTest->iOutput->Zero(); |
|
80 |
|
81 |
|
82 CleanupStack::PopAndDestroy(behaviourTest); |
|
83 |
|
84 __UHEAP_MARKEND; |
|
85 } |
|
86 |
|
87 static void MainL() |
|
88 { |
|
89 ParserTestsL(); |
|
90 } |
|
91 |
|
92 TInt E32Main() |
|
93 { |
|
94 |
|
95 __UHEAP_MARK; |
|
96 test.Title(); |
|
97 test.Start(_L("initialising")); |
|
98 |
|
99 CTrapCleanup* c=CTrapCleanup::New(); |
|
100 |
|
101 // start the loader |
|
102 RFs fs; |
|
103 test (fs.Connect()==KErrNone); |
|
104 fs.Close(); |
|
105 |
|
106 test (c!=0); |
|
107 TRAPD(r,MainL()); |
|
108 test (r==KErrNone); |
|
109 delete c; |
|
110 test.End(); |
|
111 test.Close(); |
|
112 __UHEAP_MARKEND; |
|
113 |
|
114 return KErrNone; |
|
115 } |
|
116 |