|
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 __CTEXTUTILSTEST_H__ |
|
17 #define __CTEXTUTILSTEST_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 |
|
21 #include "IpuTestUtils.h" |
|
22 #include "ctestbase.h" |
|
23 |
|
24 class CTextUtilsTest : 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 CTextUtilsTest* NewLC(CIpuTestHarness* aTestHarness); |
|
33 |
|
34 // Static factory c'tor. |
|
35 // |
|
36 // Rtn: pointer to newly created object - ownership transfered to caller. |
|
37 // |
|
38 static CTextUtilsTest* NewL(CIpuTestHarness* aTestHarness); |
|
39 |
|
40 // D'tor |
|
41 // |
|
42 ~CTextUtilsTest(); |
|
43 |
|
44 // Does the tests |
|
45 // |
|
46 void DoTestsL(); |
|
47 |
|
48 private: |
|
49 |
|
50 // C'tor |
|
51 // |
|
52 CTextUtilsTest(CIpuTestHarness* aTestHarness); |
|
53 |
|
54 // 2nd phase construction |
|
55 // |
|
56 void ConstructL(); |
|
57 |
|
58 // Tests RemoveWhitespace |
|
59 // |
|
60 // In: |
|
61 // aData - the data |
|
62 // aExpectedLeft - expected result of removing left-most whitespace |
|
63 // aConsumedLeft - the number of cosumed whitespaces from the left |
|
64 // aExpectedRight - expected result of removing right-most whitespace |
|
65 // aConsumedRight - the number of cosumed whitespaces from the right |
|
66 // aExpectedBoth - expected result of removing left- and right-most whitespace |
|
67 // aConsumedBoth - the number of cosumed whitespaces from the left and right |
|
68 // |
|
69 void TestTextUtilsRemoveL(const TDesC& aBase, const TDesC& aRemoveLeft, TInt aConsumedLeft, |
|
70 const TDesC& aRemoveRight, TInt aConsumedRight, |
|
71 const TDesC& aRemoveBoth, TInt aConsumedBoth); |
|
72 |
|
73 // Tests ConvertDescriptorToInt |
|
74 // |
|
75 // In: |
|
76 // aDes - the descriptor |
|
77 // aInt - expected int value (any number if aValid is EFalse) |
|
78 // aValid - indicates whether aDes is a valid int representation. |
|
79 // |
|
80 void TestTextUtilsDesToIntConversionL(const TDesC& aDes, TInt aInt, TBool aValid); |
|
81 |
|
82 // Tests ConvertIntToDescriptor |
|
83 // |
|
84 // In: |
|
85 // aInt - the int value |
|
86 // aDes - the expecteddescriptor |
|
87 // |
|
88 void TestTextUtilsIntToDesConversionL(TInt aInt, const TDesC& aDes); |
|
89 |
|
90 void TestTextUtilsDesToHexConversionL(const TDesC& aDes, TInt aHex, TBool aValid); |
|
91 void TestTextUtilsDesToHexConversion8L(const TDesC& aDes, TInt aHex, TBool aValid); |
|
92 |
|
93 |
|
94 void TestTextUtilsHexToDesConversionL(TInt aHex, const TDesC& aDes); |
|
95 |
|
96 void TestTextUtilsExtractQuotedStringL( |
|
97 const TDesC& aBuffer, |
|
98 const TDesC& aString, |
|
99 const TDesC& aRemainder, |
|
100 TInt aExpectedError |
|
101 ); |
|
102 |
|
103 void TestTextUtilsExtractTokenFromListL( |
|
104 const TDesC& aBuffer, |
|
105 const TDesC& aToken0, |
|
106 const TDesC& aToken1, |
|
107 const TDesC& aToken2, |
|
108 const TDesC& aRemainder, |
|
109 const TDesC& aSeparator |
|
110 ); |
|
111 |
|
112 void TestTextUtilsExtractTokenFromListL( |
|
113 const TDesC& aBuffer, |
|
114 const TDesC& aToken0, |
|
115 const TDesC& aToken1, |
|
116 const TDesC& aToken2, |
|
117 const TDesC& aRemainder, |
|
118 TChar aSeparator |
|
119 ); |
|
120 |
|
121 private: // Attributes |
|
122 |
|
123 // Test harness |
|
124 // |
|
125 CIpuTestHarness* iTestHarness; |
|
126 |
|
127 }; |
|
128 |
|
129 #endif // __CTEXTUTILSTEST_H__ |
|
130 |