sl@0
|
1 |
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef __CTEXTUTILSTEST_H__
|
sl@0
|
17 |
#define __CTEXTUTILSTEST_H__
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <e32base.h>
|
sl@0
|
20 |
|
sl@0
|
21 |
#include "IpuTestUtils.h"
|
sl@0
|
22 |
#include "ctestbase.h"
|
sl@0
|
23 |
|
sl@0
|
24 |
class CTextUtilsTest : public CTestBase
|
sl@0
|
25 |
{
|
sl@0
|
26 |
public:
|
sl@0
|
27 |
|
sl@0
|
28 |
// Static factory c'tor.
|
sl@0
|
29 |
//
|
sl@0
|
30 |
// Rtn: pointer to newly created object - ownership transfered to caller.
|
sl@0
|
31 |
//
|
sl@0
|
32 |
static CTextUtilsTest* NewLC(CIpuTestHarness* aTestHarness);
|
sl@0
|
33 |
|
sl@0
|
34 |
// Static factory c'tor.
|
sl@0
|
35 |
//
|
sl@0
|
36 |
// Rtn: pointer to newly created object - ownership transfered to caller.
|
sl@0
|
37 |
//
|
sl@0
|
38 |
static CTextUtilsTest* NewL(CIpuTestHarness* aTestHarness);
|
sl@0
|
39 |
|
sl@0
|
40 |
// D'tor
|
sl@0
|
41 |
//
|
sl@0
|
42 |
~CTextUtilsTest();
|
sl@0
|
43 |
|
sl@0
|
44 |
// Does the tests
|
sl@0
|
45 |
//
|
sl@0
|
46 |
void DoTestsL();
|
sl@0
|
47 |
|
sl@0
|
48 |
private:
|
sl@0
|
49 |
|
sl@0
|
50 |
// C'tor
|
sl@0
|
51 |
//
|
sl@0
|
52 |
CTextUtilsTest(CIpuTestHarness* aTestHarness);
|
sl@0
|
53 |
|
sl@0
|
54 |
// 2nd phase construction
|
sl@0
|
55 |
//
|
sl@0
|
56 |
void ConstructL();
|
sl@0
|
57 |
|
sl@0
|
58 |
// Tests RemoveWhitespace
|
sl@0
|
59 |
//
|
sl@0
|
60 |
// In:
|
sl@0
|
61 |
// aData - the data
|
sl@0
|
62 |
// aExpectedLeft - expected result of removing left-most whitespace
|
sl@0
|
63 |
// aConsumedLeft - the number of cosumed whitespaces from the left
|
sl@0
|
64 |
// aExpectedRight - expected result of removing right-most whitespace
|
sl@0
|
65 |
// aConsumedRight - the number of cosumed whitespaces from the right
|
sl@0
|
66 |
// aExpectedBoth - expected result of removing left- and right-most whitespace
|
sl@0
|
67 |
// aConsumedBoth - the number of cosumed whitespaces from the left and right
|
sl@0
|
68 |
//
|
sl@0
|
69 |
void TestTextUtilsRemoveL(const TDesC& aBase, const TDesC& aRemoveLeft, TInt aConsumedLeft,
|
sl@0
|
70 |
const TDesC& aRemoveRight, TInt aConsumedRight,
|
sl@0
|
71 |
const TDesC& aRemoveBoth, TInt aConsumedBoth);
|
sl@0
|
72 |
|
sl@0
|
73 |
// Tests ConvertDescriptorToInt
|
sl@0
|
74 |
//
|
sl@0
|
75 |
// In:
|
sl@0
|
76 |
// aDes - the descriptor
|
sl@0
|
77 |
// aInt - expected int value (any number if aValid is EFalse)
|
sl@0
|
78 |
// aValid - indicates whether aDes is a valid int representation.
|
sl@0
|
79 |
//
|
sl@0
|
80 |
void TestTextUtilsDesToIntConversionL(const TDesC& aDes, TInt aInt, TBool aValid);
|
sl@0
|
81 |
|
sl@0
|
82 |
// Tests ConvertIntToDescriptor
|
sl@0
|
83 |
//
|
sl@0
|
84 |
// In:
|
sl@0
|
85 |
// aInt - the int value
|
sl@0
|
86 |
// aDes - the expecteddescriptor
|
sl@0
|
87 |
//
|
sl@0
|
88 |
void TestTextUtilsIntToDesConversionL(TInt aInt, const TDesC& aDes);
|
sl@0
|
89 |
|
sl@0
|
90 |
void TestTextUtilsDesToHexConversionL(const TDesC& aDes, TInt aHex, TBool aValid);
|
sl@0
|
91 |
void TestTextUtilsDesToHexConversion8L(const TDesC& aDes, TInt aHex, TBool aValid);
|
sl@0
|
92 |
|
sl@0
|
93 |
|
sl@0
|
94 |
void TestTextUtilsHexToDesConversionL(TInt aHex, const TDesC& aDes);
|
sl@0
|
95 |
|
sl@0
|
96 |
void TestTextUtilsExtractQuotedStringL(
|
sl@0
|
97 |
const TDesC& aBuffer,
|
sl@0
|
98 |
const TDesC& aString,
|
sl@0
|
99 |
const TDesC& aRemainder,
|
sl@0
|
100 |
TInt aExpectedError
|
sl@0
|
101 |
);
|
sl@0
|
102 |
|
sl@0
|
103 |
void TestTextUtilsExtractTokenFromListL(
|
sl@0
|
104 |
const TDesC& aBuffer,
|
sl@0
|
105 |
const TDesC& aToken0,
|
sl@0
|
106 |
const TDesC& aToken1,
|
sl@0
|
107 |
const TDesC& aToken2,
|
sl@0
|
108 |
const TDesC& aRemainder,
|
sl@0
|
109 |
const TDesC& aSeparator
|
sl@0
|
110 |
);
|
sl@0
|
111 |
|
sl@0
|
112 |
void TestTextUtilsExtractTokenFromListL(
|
sl@0
|
113 |
const TDesC& aBuffer,
|
sl@0
|
114 |
const TDesC& aToken0,
|
sl@0
|
115 |
const TDesC& aToken1,
|
sl@0
|
116 |
const TDesC& aToken2,
|
sl@0
|
117 |
const TDesC& aRemainder,
|
sl@0
|
118 |
TChar aSeparator
|
sl@0
|
119 |
);
|
sl@0
|
120 |
|
sl@0
|
121 |
private: // Attributes
|
sl@0
|
122 |
|
sl@0
|
123 |
// Test harness
|
sl@0
|
124 |
//
|
sl@0
|
125 |
CIpuTestHarness* iTestHarness;
|
sl@0
|
126 |
|
sl@0
|
127 |
};
|
sl@0
|
128 |
|
sl@0
|
129 |
#endif // __CTEXTUTILSTEST_H__
|
sl@0
|
130 |
|