|
1 // Copyright (c) 2001-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 #ifndef __CESCAPEUTILSTEST_H__ |
|
17 #define __CESCAPEUTILSTEST_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <escapeutils.h> |
|
21 |
|
22 #include "ctestbase.h" |
|
23 |
|
24 class CEscapeUtilsTest : public CTestBase |
|
25 { |
|
26 public: |
|
27 |
|
28 // Static factory c'tor. |
|
29 // |
|
30 // Rtn: pointer to newly created object - ownership transfered to caller. |
|
31 // |
|
32 static CEscapeUtilsTest* NewLC(CIpuTestHarness* aTestHarness); |
|
33 |
|
34 // Static factory c'tor. |
|
35 // |
|
36 // Rtn: pointer to newly created object - ownership transfered to caller. |
|
37 // |
|
38 static CEscapeUtilsTest* NewL(CIpuTestHarness* aTestHarness); |
|
39 |
|
40 // D'tor |
|
41 // |
|
42 ~CEscapeUtilsTest(); |
|
43 |
|
44 // Does the tests |
|
45 // |
|
46 void DoTestsL(); |
|
47 |
|
48 private: |
|
49 |
|
50 // C'tor |
|
51 // |
|
52 CEscapeUtilsTest(CIpuTestHarness* aTestHarness); |
|
53 |
|
54 // 2nd phase construction |
|
55 // |
|
56 void ConstructL(); |
|
57 |
|
58 // Tests EscapeEncodeL functions |
|
59 // |
|
60 // In: |
|
61 // aData - the data to escape |
|
62 // aExpected - the expected escaped result |
|
63 // |
|
64 void TestEscapeUtilsEscapeEncodeL(const TDesC& aData, const TDesC& aExpected, EscapeUtils::TEscapeMode aEscapeMode); |
|
65 |
|
66 // Tests EscapeDecodeL functions |
|
67 // |
|
68 // In: |
|
69 // aData - the data to escape |
|
70 // aExpected - the expected escaped result |
|
71 // |
|
72 void TestEscapeUtilsEscapeDecodeL(const TDesC& aData, const TDesC& aExpected); |
|
73 |
|
74 // Tests unicode/utf8 conversions - NOTE the utf8 version is escaped encoded. |
|
75 // |
|
76 // In: |
|
77 // aUnicode - the unicode data |
|
78 // aUtf8 - the utf8 data (escape encoded) |
|
79 // |
|
80 void TestEscapeUtilsUnicodeUtf8ConversionsL(const TDesC& aUnicode, const TDesC& aUtf8); |
|
81 |
|
82 // Tests IsExcludedChar |
|
83 // |
|
84 // In: |
|
85 // aChar - the test char |
|
86 // aIsExcluded - the expected result |
|
87 // |
|
88 void TestEscapeUtilsIsExcludedCharL(TChar aChar, TBool aIsExcluded); |
|
89 |
|
90 // Tests IsEscapeTriple |
|
91 // |
|
92 // In: |
|
93 // aData - the data to check |
|
94 // aIsTriple - the expected result |
|
95 // aValue - the value of the triple (set to anything if aIsTriple is EFalse) |
|
96 // |
|
97 void TestEscapeUtilsIsEscapeTripleL(const TDesC& aData, TBool aIsTriple, TInt aValue); |
|
98 |
|
99 // Tests Base64 Encoding and Decoding |
|
100 // |
|
101 // In: |
|
102 // aData - the data to check |
|
103 // |
|
104 void TestEscapeUtilsBase64ConversionL(const TDesC& aData); |
|
105 |
|
106 private: // Attributes |
|
107 |
|
108 // Test harness |
|
109 // |
|
110 CIpuTestHarness* iTestHarness; |
|
111 |
|
112 }; |
|
113 |
|
114 #endif // __CESCAPEUTILSTEST_H__ |
|
115 |