sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2004-2010 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 <charconv.h>
|
sl@0
|
20 |
#include <gdi.h>
|
sl@0
|
21 |
#include <conpics.h>
|
sl@0
|
22 |
#include <txtrich.h>
|
sl@0
|
23 |
#include <apadef.h>
|
sl@0
|
24 |
|
sl@0
|
25 |
#include "TXTPLAIN.H"
|
sl@0
|
26 |
#include "TxtWriter.h"
|
sl@0
|
27 |
#include "TETextDefect.h"
|
sl@0
|
28 |
|
sl@0
|
29 |
LOCAL_D CTestStep *pTestStep = NULL;
|
sl@0
|
30 |
#define test(cond) \
|
sl@0
|
31 |
{ \
|
sl@0
|
32 |
TBool __bb = (cond); \
|
sl@0
|
33 |
pTestStep->TEST(__bb); \
|
sl@0
|
34 |
if (!__bb) \
|
sl@0
|
35 |
{ \
|
sl@0
|
36 |
ERR_PRINTF1(_L("ERROR: Test Failed")); \
|
sl@0
|
37 |
User::Leave(1); \
|
sl@0
|
38 |
} \
|
sl@0
|
39 |
}
|
sl@0
|
40 |
#define test2(cond, line) \
|
sl@0
|
41 |
{ \
|
sl@0
|
42 |
TBool __bb = (cond); \
|
sl@0
|
43 |
pTestStep->TEST(__bb); \
|
sl@0
|
44 |
if (!__bb) \
|
sl@0
|
45 |
{ \
|
sl@0
|
46 |
ERR_PRINTF2(_L("Line %d, ERROR: Test Failed"), line); \
|
sl@0
|
47 |
User::Leave(1); \
|
sl@0
|
48 |
} \
|
sl@0
|
49 |
}
|
sl@0
|
50 |
#undef INFO_PRINTF1
|
sl@0
|
51 |
#undef INFO_PRINTF2
|
sl@0
|
52 |
#undef ERR_PRINTF1
|
sl@0
|
53 |
#undef ERR_PRINTF2
|
sl@0
|
54 |
#undef ERR_PRINTF3
|
sl@0
|
55 |
// copy from tefexportconst.h
|
sl@0
|
56 |
#define INFO_PRINTF1(p1) pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1))
|
sl@0
|
57 |
#define INFO_PRINTF2(p1, p2) pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2))
|
sl@0
|
58 |
#define ERR_PRINTF1(p1) pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1))
|
sl@0
|
59 |
#define ERR_PRINTF2(p1, p2) pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2))
|
sl@0
|
60 |
#define ERR_PRINTF3(p1, p2, p3) pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2), (p3)) ;
|
sl@0
|
61 |
|
sl@0
|
62 |
|
sl@0
|
63 |
//Used for supressing warning in OOM tests
|
sl@0
|
64 |
#define __UNUSED_VAR(var) var = var
|
sl@0
|
65 |
|
sl@0
|
66 |
// this fixes a MSVC link warning
|
sl@0
|
67 |
#ifdef __VC32__
|
sl@0
|
68 |
#pragma comment (linker, "/opt:noref")
|
sl@0
|
69 |
#endif
|
sl@0
|
70 |
|
sl@0
|
71 |
_LIT(KTestName, "Start of Tests...");
|
sl@0
|
72 |
|
sl@0
|
73 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
74 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
75 |
//Test macroses and functions
|
sl@0
|
76 |
LOCAL_C void Check(TInt aValue, TInt aLine)
|
sl@0
|
77 |
{
|
sl@0
|
78 |
if(!aValue)
|
sl@0
|
79 |
{
|
sl@0
|
80 |
test2(EFalse, aLine);
|
sl@0
|
81 |
}
|
sl@0
|
82 |
}
|
sl@0
|
83 |
LOCAL_C void Check(TInt aValue, TInt aExpected, TInt aLine)
|
sl@0
|
84 |
{
|
sl@0
|
85 |
if(aValue != aExpected)
|
sl@0
|
86 |
{
|
sl@0
|
87 |
ERR_PRINTF3(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
|
sl@0
|
88 |
test2(EFalse, aLine);
|
sl@0
|
89 |
}
|
sl@0
|
90 |
}
|
sl@0
|
91 |
#define CHECK1(arg) ::Check((arg), __LINE__)
|
sl@0
|
92 |
#define CHECK2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
|
sl@0
|
93 |
|
sl@0
|
94 |
|
sl@0
|
95 |
LOCAL_C void Inc049456L()
|
sl@0
|
96 |
{
|
sl@0
|
97 |
INFO_PRINTF1(_L("Inc049456L"));
|
sl@0
|
98 |
|
sl@0
|
99 |
CPlainTextConverter* converter = CPlainTextConverter::NewLC();
|
sl@0
|
100 |
CleanupStack::PopAndDestroy(converter);
|
sl@0
|
101 |
}
|
sl@0
|
102 |
|
sl@0
|
103 |
LOCAL_C void OOM049456L()
|
sl@0
|
104 |
{
|
sl@0
|
105 |
INFO_PRINTF1(_L("OOM049456L"));
|
sl@0
|
106 |
|
sl@0
|
107 |
TInt tryCount=0;
|
sl@0
|
108 |
TInt error = KErrNone;
|
sl@0
|
109 |
__UNUSED_VAR(tryCount);
|
sl@0
|
110 |
|
sl@0
|
111 |
do
|
sl@0
|
112 |
{
|
sl@0
|
113 |
__UHEAP_MARK;
|
sl@0
|
114 |
|
sl@0
|
115 |
// find out the number of open handles
|
sl@0
|
116 |
TInt startProcessHandleCount;
|
sl@0
|
117 |
TInt startThreadHandleCount;
|
sl@0
|
118 |
RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
|
sl@0
|
119 |
|
sl@0
|
120 |
__UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount);
|
sl@0
|
121 |
|
sl@0
|
122 |
TRAP(error,Inc049456L());
|
sl@0
|
123 |
|
sl@0
|
124 |
__UHEAP_SETFAIL(RHeap::ENone,0);
|
sl@0
|
125 |
|
sl@0
|
126 |
// check that no handles have leaked
|
sl@0
|
127 |
TInt endProcessHandleCount;
|
sl@0
|
128 |
TInt endThreadHandleCount;
|
sl@0
|
129 |
RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
|
sl@0
|
130 |
|
sl@0
|
131 |
CHECK1(startProcessHandleCount == endProcessHandleCount);
|
sl@0
|
132 |
CHECK1(startThreadHandleCount == endThreadHandleCount);
|
sl@0
|
133 |
|
sl@0
|
134 |
__UHEAP_MARKEND;
|
sl@0
|
135 |
|
sl@0
|
136 |
}while(error==KErrNoMemory);
|
sl@0
|
137 |
|
sl@0
|
138 |
CHECK2(error, KErrNone);
|
sl@0
|
139 |
INFO_PRINTF2(_L("- server succeeded at heap failure rate of %i\n"),tryCount);
|
sl@0
|
140 |
}
|
sl@0
|
141 |
|
sl@0
|
142 |
|
sl@0
|
143 |
|
sl@0
|
144 |
|
sl@0
|
145 |
LOCAL_C void Inc051360L()
|
sl@0
|
146 |
{
|
sl@0
|
147 |
INFO_PRINTF1(_L("Inc051360L"));
|
sl@0
|
148 |
|
sl@0
|
149 |
// Test data to force a remainder of 2 from the charconv unicode conversion.
|
sl@0
|
150 |
// The etext buffer is 1024 bytes that truncates the last utf-8 character.
|
sl@0
|
151 |
// It needs three bytes but only has two, hence remainder 2.
|
sl@0
|
152 |
const TUint8 KUtf8TextJapanese [] =
|
sl@0
|
153 |
{
|
sl@0
|
154 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
155 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
156 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
157 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
158 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
159 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
160 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
161 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
162 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
163 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
164 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
165 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
166 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
167 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
168 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
169 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
170 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
171 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
172 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
173 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
174 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
175 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
176 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
177 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
178 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
179 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
180 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
181 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
182 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
183 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
184 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
185 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
186 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
187 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
188 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
189 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
190 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
191 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
192 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
193 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
194 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
195 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
196 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
197 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
198 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
199 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
200 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
201 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
202 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
sl@0
|
203 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // 1000 bytes
|
sl@0
|
204 |
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // 1020
|
sl@0
|
205 |
0x20, 0x20, 0xE3, 0x81, 0x82, 0xE3, 0x81, 0x8B, // total 1028
|
sl@0
|
206 |
}; // ^ 1025, will not be read on first pass
|
sl@0
|
207 |
|
sl@0
|
208 |
// Need to know the data length for our buffers.
|
sl@0
|
209 |
const TUint KBufferSize = 1028;
|
sl@0
|
210 |
|
sl@0
|
211 |
// Copy the raw data into an 8-bit descriptor
|
sl@0
|
212 |
TBuf8<KBufferSize> textBuffer;
|
sl@0
|
213 |
textBuffer.Copy (KUtf8TextJapanese, KBufferSize);
|
sl@0
|
214 |
|
sl@0
|
215 |
// The unicode conversion of the result expected
|
sl@0
|
216 |
const TUint16 KUnicodeTextJapaneseResult [] = {0x3042, 0x304B,};
|
sl@0
|
217 |
|
sl@0
|
218 |
TBuf16 <2> unicodeConversion;
|
sl@0
|
219 |
unicodeConversion.Copy (KUnicodeTextJapaneseResult, 2);
|
sl@0
|
220 |
|
sl@0
|
221 |
// The converter
|
sl@0
|
222 |
CPlainTextConverter* plainText = CPlainTextConverter::NewLC();
|
sl@0
|
223 |
|
sl@0
|
224 |
// The input buffer
|
sl@0
|
225 |
CBufFlat* inbuffer = CBufFlat::NewL(KBufferSize);
|
sl@0
|
226 |
CleanupStack::PushL (inbuffer);
|
sl@0
|
227 |
|
sl@0
|
228 |
inbuffer->InsertL (0, textBuffer);
|
sl@0
|
229 |
|
sl@0
|
230 |
// The input stream
|
sl@0
|
231 |
RBufReadStream inputStr (*inbuffer, 0);
|
sl@0
|
232 |
CleanupClosePushL (inputStr);
|
sl@0
|
233 |
|
sl@0
|
234 |
// The output buffer
|
sl@0
|
235 |
CBufFlat* outbuffer = CBufFlat::NewL(KBufferSize);
|
sl@0
|
236 |
CleanupStack::PushL (outbuffer);
|
sl@0
|
237 |
|
sl@0
|
238 |
// The output stream
|
sl@0
|
239 |
RBufWriteStream outputStr (*outbuffer, 0);
|
sl@0
|
240 |
CleanupClosePushL (outputStr);
|
sl@0
|
241 |
|
sl@0
|
242 |
// Input specifications
|
sl@0
|
243 |
CPlainText::TImportExportParam param;
|
sl@0
|
244 |
param.iOutputInternal = TRUE; // force output to internal format
|
sl@0
|
245 |
param.iForeignEncoding = KCharacterSetIdentifierUtf8;
|
sl@0
|
246 |
|
sl@0
|
247 |
// The result of the operation
|
sl@0
|
248 |
CPlainText::TImportExportResult result;
|
sl@0
|
249 |
|
sl@0
|
250 |
// Translate the data
|
sl@0
|
251 |
TPlainTextReader::TranslateL(param, result, outputStr, inputStr);
|
sl@0
|
252 |
|
sl@0
|
253 |
// Get the 8-bit data into a 16-bit buffer.
|
sl@0
|
254 |
// Can't use Copy as this will store each byte on a word boundary!
|
sl@0
|
255 |
TPtr8 ptr8 (outbuffer->Ptr(outbuffer->Size()-4));
|
sl@0
|
256 |
const TUint16* ptr = (TUint16*) (ptr8.Ptr());
|
sl@0
|
257 |
TPtrC16 des16 (ptr, 2);
|
sl@0
|
258 |
|
sl@0
|
259 |
CHECK1(unicodeConversion == des16);
|
sl@0
|
260 |
|
sl@0
|
261 |
CleanupStack::PopAndDestroy (&outputStr);
|
sl@0
|
262 |
CleanupStack::PopAndDestroy (outbuffer);
|
sl@0
|
263 |
CleanupStack::PopAndDestroy (&inputStr);
|
sl@0
|
264 |
CleanupStack::PopAndDestroy (inbuffer);
|
sl@0
|
265 |
CleanupStack::PopAndDestroy (plainText);
|
sl@0
|
266 |
}
|
sl@0
|
267 |
|
sl@0
|
268 |
LOCAL_C void OOM051360L()
|
sl@0
|
269 |
{
|
sl@0
|
270 |
INFO_PRINTF1(_L("OOM051360L"));
|
sl@0
|
271 |
|
sl@0
|
272 |
TInt tryCount=0;
|
sl@0
|
273 |
TInt error = KErrNone;
|
sl@0
|
274 |
__UNUSED_VAR(tryCount);
|
sl@0
|
275 |
|
sl@0
|
276 |
do
|
sl@0
|
277 |
{
|
sl@0
|
278 |
__UHEAP_MARK;
|
sl@0
|
279 |
|
sl@0
|
280 |
// find out the number of open handles
|
sl@0
|
281 |
TInt startProcessHandleCount;
|
sl@0
|
282 |
TInt startThreadHandleCount;
|
sl@0
|
283 |
RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
|
sl@0
|
284 |
|
sl@0
|
285 |
__UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount);
|
sl@0
|
286 |
|
sl@0
|
287 |
TRAP(error,Inc051360L());
|
sl@0
|
288 |
|
sl@0
|
289 |
__UHEAP_SETFAIL(RHeap::ENone,0);
|
sl@0
|
290 |
|
sl@0
|
291 |
// check that no handles have leaked
|
sl@0
|
292 |
TInt endProcessHandleCount;
|
sl@0
|
293 |
TInt endThreadHandleCount;
|
sl@0
|
294 |
RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
|
sl@0
|
295 |
|
sl@0
|
296 |
CHECK1(startProcessHandleCount == endProcessHandleCount);
|
sl@0
|
297 |
CHECK1(startThreadHandleCount == endThreadHandleCount);
|
sl@0
|
298 |
|
sl@0
|
299 |
__UHEAP_MARKEND;
|
sl@0
|
300 |
|
sl@0
|
301 |
}while(error==KErrNoMemory);
|
sl@0
|
302 |
|
sl@0
|
303 |
CHECK2(error, KErrNone);
|
sl@0
|
304 |
INFO_PRINTF2(_L("- server succeeded at heap failure rate of %i\n"),tryCount);
|
sl@0
|
305 |
}
|
sl@0
|
306 |
|
sl@0
|
307 |
LOCAL_C void OOM056552L()
|
sl@0
|
308 |
{
|
sl@0
|
309 |
INFO_PRINTF1(_L("OOM056552L"));
|
sl@0
|
310 |
|
sl@0
|
311 |
TInt tryCount=0;
|
sl@0
|
312 |
TInt error = KErrNone;
|
sl@0
|
313 |
__UNUSED_VAR(tryCount);
|
sl@0
|
314 |
|
sl@0
|
315 |
do
|
sl@0
|
316 |
{
|
sl@0
|
317 |
__UHEAP_MARK;
|
sl@0
|
318 |
|
sl@0
|
319 |
CParaFormatLayer* paraLayer=CParaFormatLayer::NewL();
|
sl@0
|
320 |
CCharFormatLayer* charLayer=CCharFormatLayer::NewL();
|
sl@0
|
321 |
CRichText* richText = CRichText::NewL(paraLayer,charLayer);
|
sl@0
|
322 |
CXzePicture* pic=CXzePicture::NewL('x');
|
sl@0
|
323 |
TPictureHeader header;
|
sl@0
|
324 |
header.iPictureType = KUidPictureTypeDoor;
|
sl@0
|
325 |
header.iPicture=pic;
|
sl@0
|
326 |
|
sl@0
|
327 |
__UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount);
|
sl@0
|
328 |
|
sl@0
|
329 |
TRAP(error, richText->InsertL(richText->DocumentLength(), header));
|
sl@0
|
330 |
|
sl@0
|
331 |
__UHEAP_SETFAIL(RHeap::ENone,0);
|
sl@0
|
332 |
|
sl@0
|
333 |
delete paraLayer; paraLayer = NULL;
|
sl@0
|
334 |
delete charLayer; charLayer = NULL;
|
sl@0
|
335 |
delete richText; richText = NULL;
|
sl@0
|
336 |
|
sl@0
|
337 |
__UHEAP_MARKEND;
|
sl@0
|
338 |
|
sl@0
|
339 |
}while(error==KErrNoMemory);
|
sl@0
|
340 |
|
sl@0
|
341 |
test(error==KErrNone);
|
sl@0
|
342 |
INFO_PRINTF2(_L(" richText->InsertL - succeeded at heap failure rate of %i\n"),tryCount);
|
sl@0
|
343 |
}
|
sl@0
|
344 |
/////////////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
345 |
// Testing the fix for
|
sl@0
|
346 |
// "INC055971 NTT - Received MMS with line break "CR" set does not cause line feed."
|
sl@0
|
347 |
// In order to make the testing easier, MOutputChar, MTextWriter, TSLBTransaltor,
|
sl@0
|
348 |
// TParagraphTextWriter, TLineTextWriter production classes are used outside their environment.
|
sl@0
|
349 |
// TOutputChar test class implements MOutputChar interface. It is used to collect the character
|
sl@0
|
350 |
// output from the processing of the imput character sequences. Then, the output is tested against
|
sl@0
|
351 |
// the expected set of output characters.
|
sl@0
|
352 |
//
|
sl@0
|
353 |
// The follwing translation rules are tested:
|
sl@0
|
354 |
// 1) Organising by paragraph
|
sl@0
|
355 |
// - 0x0D - line break;
|
sl@0
|
356 |
// - 0x0A - line break;
|
sl@0
|
357 |
// - 0x0D 0x0A - line break;
|
sl@0
|
358 |
// 2) Organising by line
|
sl@0
|
359 |
// - single line break - space;
|
sl@0
|
360 |
// - double line break - paragraph delimiter;
|
sl@0
|
361 |
|
sl@0
|
362 |
TBuf<32> TheOutputTestBuf;//Here the output is collected and then asserted
|
sl@0
|
363 |
|
sl@0
|
364 |
class TOutputChar : public MOutputChar
|
sl@0
|
365 |
{
|
sl@0
|
366 |
public:
|
sl@0
|
367 |
virtual void OutputCharL(TText aChar)
|
sl@0
|
368 |
{
|
sl@0
|
369 |
TheOutputTestBuf.Append(aChar);
|
sl@0
|
370 |
}
|
sl@0
|
371 |
};
|
sl@0
|
372 |
|
sl@0
|
373 |
static void TranslateToEofTestL(TSLBTransaltor& aSLBTranslator, const TDesC& aTestBuf)
|
sl@0
|
374 |
{
|
sl@0
|
375 |
for(TInt i=0;i<aTestBuf.Length();++i)
|
sl@0
|
376 |
{
|
sl@0
|
377 |
TText c = aTestBuf[i];
|
sl@0
|
378 |
aSLBTranslator.ProcessL(c);
|
sl@0
|
379 |
}
|
sl@0
|
380 |
aSLBTranslator.FlushL();
|
sl@0
|
381 |
}
|
sl@0
|
382 |
|
sl@0
|
383 |
static void INC055971L()
|
sl@0
|
384 |
{
|
sl@0
|
385 |
TBuf<32> testBuf;
|
sl@0
|
386 |
TOutputChar outputChar;
|
sl@0
|
387 |
|
sl@0
|
388 |
INFO_PRINTF1(_L("INC055971L - OrganiseByParagraph test"));
|
sl@0
|
389 |
|
sl@0
|
390 |
{
|
sl@0
|
391 |
TParagraphTextWriter paragraphTextWriter(outputChar);
|
sl@0
|
392 |
TSLBTransaltor slbTranslator(paragraphTextWriter);
|
sl@0
|
393 |
|
sl@0
|
394 |
testBuf = _L("\xD");
|
sl@0
|
395 |
TheOutputTestBuf.Zero();
|
sl@0
|
396 |
::TranslateToEofTestL(slbTranslator, testBuf);
|
sl@0
|
397 |
CHECK1(TheOutputTestBuf.Length() == 1);
|
sl@0
|
398 |
CHECK1(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
|
sl@0
|
399 |
|
sl@0
|
400 |
testBuf = _L("\xA");
|
sl@0
|
401 |
TheOutputTestBuf.Zero();
|
sl@0
|
402 |
::TranslateToEofTestL(slbTranslator, testBuf);
|
sl@0
|
403 |
CHECK1(TheOutputTestBuf.Length() == 1);
|
sl@0
|
404 |
CHECK1(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
|
sl@0
|
405 |
|
sl@0
|
406 |
testBuf = _L("\xD\xA");
|
sl@0
|
407 |
TheOutputTestBuf.Zero();
|
sl@0
|
408 |
::TranslateToEofTestL(slbTranslator, testBuf);
|
sl@0
|
409 |
CHECK1(TheOutputTestBuf.Length() == 1);
|
sl@0
|
410 |
CHECK1(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
|
sl@0
|
411 |
|
sl@0
|
412 |
testBuf = _L("zz\xD\xA\xD\xA\xAz\xD");
|
sl@0
|
413 |
TheOutputTestBuf.Zero();
|
sl@0
|
414 |
::TranslateToEofTestL(slbTranslator, testBuf);
|
sl@0
|
415 |
CHECK1(TheOutputTestBuf.Length() == 7);
|
sl@0
|
416 |
CHECK1(TheOutputTestBuf[0] == 'z');
|
sl@0
|
417 |
CHECK1(TheOutputTestBuf[1] == 'z');
|
sl@0
|
418 |
CHECK1(TheOutputTestBuf[2] == CEditableText::EParagraphDelimiter);
|
sl@0
|
419 |
CHECK1(TheOutputTestBuf[3] == CEditableText::EParagraphDelimiter);
|
sl@0
|
420 |
CHECK1(TheOutputTestBuf[4] == CEditableText::EParagraphDelimiter);
|
sl@0
|
421 |
CHECK1(TheOutputTestBuf[5] == 'z');
|
sl@0
|
422 |
CHECK1(TheOutputTestBuf[6] == CEditableText::EParagraphDelimiter);
|
sl@0
|
423 |
|
sl@0
|
424 |
testBuf = _L("This\xDIs\xATest\xD\xAMessage");
|
sl@0
|
425 |
TheOutputTestBuf.Zero();
|
sl@0
|
426 |
::TranslateToEofTestL(slbTranslator, testBuf);
|
sl@0
|
427 |
CHECK1(TheOutputTestBuf.Length() == 20);
|
sl@0
|
428 |
CHECK1(TheOutputTestBuf[4] == CEditableText::EParagraphDelimiter);
|
sl@0
|
429 |
CHECK1(TheOutputTestBuf[7] == CEditableText::EParagraphDelimiter);
|
sl@0
|
430 |
CHECK1(TheOutputTestBuf[12] == CEditableText::EParagraphDelimiter);
|
sl@0
|
431 |
}
|
sl@0
|
432 |
|
sl@0
|
433 |
INFO_PRINTF1(_L("INC055971L - OrganiseByLine test"));
|
sl@0
|
434 |
|
sl@0
|
435 |
{
|
sl@0
|
436 |
TLineTextWriter lineTextWriter(outputChar);
|
sl@0
|
437 |
TSLBTransaltor slbTranslator(lineTextWriter);
|
sl@0
|
438 |
|
sl@0
|
439 |
testBuf = _L("\xD");
|
sl@0
|
440 |
TheOutputTestBuf.Zero();
|
sl@0
|
441 |
::TranslateToEofTestL(slbTranslator, testBuf);
|
sl@0
|
442 |
CHECK1(TheOutputTestBuf.Length() == 1);
|
sl@0
|
443 |
CHECK1(TheOutputTestBuf[0] == ' ');
|
sl@0
|
444 |
|
sl@0
|
445 |
testBuf = _L("\xA");
|
sl@0
|
446 |
TheOutputTestBuf.Zero();
|
sl@0
|
447 |
::TranslateToEofTestL(slbTranslator, testBuf);
|
sl@0
|
448 |
CHECK1(TheOutputTestBuf.Length() == 1);
|
sl@0
|
449 |
CHECK1(TheOutputTestBuf[0] == ' ');
|
sl@0
|
450 |
|
sl@0
|
451 |
testBuf = _L("\xD\xA");
|
sl@0
|
452 |
TheOutputTestBuf.Zero();
|
sl@0
|
453 |
::TranslateToEofTestL(slbTranslator, testBuf);
|
sl@0
|
454 |
CHECK1(TheOutputTestBuf.Length() == 1);
|
sl@0
|
455 |
CHECK1(TheOutputTestBuf[0] == ' ');
|
sl@0
|
456 |
|
sl@0
|
457 |
testBuf = _L("\xD\xA\xD\xA");
|
sl@0
|
458 |
TheOutputTestBuf.Zero();
|
sl@0
|
459 |
::TranslateToEofTestL(slbTranslator, testBuf);
|
sl@0
|
460 |
CHECK1(TheOutputTestBuf.Length() == 1);
|
sl@0
|
461 |
CHECK1(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
|
sl@0
|
462 |
|
sl@0
|
463 |
testBuf = _L("\xD\xD");
|
sl@0
|
464 |
TheOutputTestBuf.Zero();
|
sl@0
|
465 |
::TranslateToEofTestL(slbTranslator, testBuf);
|
sl@0
|
466 |
CHECK1(TheOutputTestBuf.Length() == 1);
|
sl@0
|
467 |
CHECK1(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
|
sl@0
|
468 |
|
sl@0
|
469 |
testBuf = _L("\xA\xA");
|
sl@0
|
470 |
TheOutputTestBuf.Zero();
|
sl@0
|
471 |
::TranslateToEofTestL(slbTranslator, testBuf);
|
sl@0
|
472 |
CHECK1(TheOutputTestBuf.Length() == 1);
|
sl@0
|
473 |
CHECK1(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
|
sl@0
|
474 |
|
sl@0
|
475 |
testBuf = _L("\xA\xD");
|
sl@0
|
476 |
TheOutputTestBuf.Zero();
|
sl@0
|
477 |
::TranslateToEofTestL(slbTranslator, testBuf);
|
sl@0
|
478 |
CHECK1(TheOutputTestBuf.Length() == 1);
|
sl@0
|
479 |
CHECK1(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
|
sl@0
|
480 |
|
sl@0
|
481 |
testBuf = _L("\xD\xA\xA");
|
sl@0
|
482 |
TheOutputTestBuf.Zero();
|
sl@0
|
483 |
::TranslateToEofTestL(slbTranslator, testBuf);
|
sl@0
|
484 |
CHECK1(TheOutputTestBuf.Length() == 1);
|
sl@0
|
485 |
CHECK1(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
|
sl@0
|
486 |
|
sl@0
|
487 |
testBuf = _L("\xD\xAz\xAzz\xA\xD");
|
sl@0
|
488 |
TheOutputTestBuf.Zero();
|
sl@0
|
489 |
::TranslateToEofTestL(slbTranslator, testBuf);
|
sl@0
|
490 |
CHECK1(TheOutputTestBuf.Length() == 6);
|
sl@0
|
491 |
CHECK1(TheOutputTestBuf[0] == ' ');
|
sl@0
|
492 |
CHECK1(TheOutputTestBuf[1] == 'z');
|
sl@0
|
493 |
CHECK1(TheOutputTestBuf[2] == ' ');
|
sl@0
|
494 |
CHECK1(TheOutputTestBuf[3] == 'z');
|
sl@0
|
495 |
CHECK1(TheOutputTestBuf[4] == 'z');
|
sl@0
|
496 |
CHECK1(TheOutputTestBuf[5] == CEditableText::EParagraphDelimiter);
|
sl@0
|
497 |
}
|
sl@0
|
498 |
}
|
sl@0
|
499 |
|
sl@0
|
500 |
/**
|
sl@0
|
501 |
@SYMTestCaseID SYSLIB-ETEXT-CT-3346
|
sl@0
|
502 |
@SYMTestCaseDesc Tests the fix for the problem where EOD character was not getting
|
sl@0
|
503 |
formatted when ApplyCharFormatL() function called, caused text to appear clipped on
|
sl@0
|
504 |
MOAP devices.
|
sl@0
|
505 |
@SYMTestPriority High
|
sl@0
|
506 |
@SYMTestActions Create CRichText object and insert some text. Apply font and size
|
sl@0
|
507 |
formatting to entire text. Check that EOD character formatting is consistant with rest
|
sl@0
|
508 |
of the text formatting.
|
sl@0
|
509 |
@SYMTestExpectedResults Formatting for EOD character should be the same as the rest of
|
sl@0
|
510 |
the text formatting.
|
sl@0
|
511 |
@SYMDEF INC097216: When font size is set as small, bottom of a text is clipped on wk38 (MOAP)
|
sl@0
|
512 |
*/
|
sl@0
|
513 |
LOCAL_C void INC097216L()
|
sl@0
|
514 |
{
|
sl@0
|
515 |
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-ETEXT-CT-3346 INC097216L - Test EOD character is formatted with rest of text "));
|
sl@0
|
516 |
|
sl@0
|
517 |
__UHEAP_MARK;
|
sl@0
|
518 |
|
sl@0
|
519 |
CParaFormatLayer* paraLayer=CParaFormatLayer::NewL();
|
sl@0
|
520 |
CCharFormatLayer* charLayer=CCharFormatLayer::NewL();
|
sl@0
|
521 |
CRichText* richText = CRichText::NewL(paraLayer,charLayer);
|
sl@0
|
522 |
|
sl@0
|
523 |
_LIT(KTestText, "The quick brown fox jumped over the lazy dog");
|
sl@0
|
524 |
|
sl@0
|
525 |
richText->InsertL(0, KTestText);
|
sl@0
|
526 |
TCharFormat charFormat(_L("Times"), 100);
|
sl@0
|
527 |
TCharFormatMask formatMask;
|
sl@0
|
528 |
|
sl@0
|
529 |
formatMask.SetAttrib(EAttFontHeight);
|
sl@0
|
530 |
|
sl@0
|
531 |
TInt textLength = richText->DocumentLength();
|
sl@0
|
532 |
richText->ApplyCharFormatL(charFormat, formatMask, 0, textLength);
|
sl@0
|
533 |
|
sl@0
|
534 |
richText->GetCharFormat(charFormat, formatMask, textLength-1, 1); // get format info for last text character
|
sl@0
|
535 |
TInt characterFontHeight = charFormat.iFontSpec.iHeight;
|
sl@0
|
536 |
|
sl@0
|
537 |
richText->GetCharFormat(charFormat, formatMask, textLength, 1); // get format info for EOD character
|
sl@0
|
538 |
TInt EodFontHeight = charFormat.iFontSpec.iHeight;
|
sl@0
|
539 |
|
sl@0
|
540 |
CHECK1(characterFontHeight == EodFontHeight);
|
sl@0
|
541 |
|
sl@0
|
542 |
delete paraLayer; paraLayer = NULL;
|
sl@0
|
543 |
delete charLayer; charLayer = NULL;
|
sl@0
|
544 |
delete richText; richText = NULL;
|
sl@0
|
545 |
|
sl@0
|
546 |
__UHEAP_MARKEND;
|
sl@0
|
547 |
}
|
sl@0
|
548 |
|
sl@0
|
549 |
/**
|
sl@0
|
550 |
@SYMTestCaseID SYSLIB-ETEXT-CT-3386
|
sl@0
|
551 |
@SYMTestCaseDesc Tests the fix INC101996:CEikRichTextEditor control don’t support anti-aliasing font
|
sl@0
|
552 |
@SYMTestPriority High
|
sl@0
|
553 |
@SYMTestActions Create CRichText object and insert some text. Apply formatting to entire string
|
sl@0
|
554 |
then apply antialiasing formatting to part of the string.
|
sl@0
|
555 |
Ensure that the anti-aliasing formatting information is applied as expected.
|
sl@0
|
556 |
@SYMTestExpectedResults Antialiasing formatting should be applied to the correct part of the string
|
sl@0
|
557 |
and the rest of the string should remain unchanged
|
sl@0
|
558 |
@SYMDEF INC101996
|
sl@0
|
559 |
*/
|
sl@0
|
560 |
LOCAL_C void INC101996L()
|
sl@0
|
561 |
{
|
sl@0
|
562 |
INFO_PRINTF1(_L("@SYMTestCaseID:SYSLIB-ETEXT-CT-3386 INC101996 CEikRichTextEditor control don't support anti-aliasing font"));
|
sl@0
|
563 |
|
sl@0
|
564 |
__UHEAP_MARK;
|
sl@0
|
565 |
|
sl@0
|
566 |
CParaFormatLayer* paraLayer=CParaFormatLayer::NewL();
|
sl@0
|
567 |
CCharFormatLayer* charLayer=CCharFormatLayer::NewL();
|
sl@0
|
568 |
CRichText* richText = CRichText::NewL(paraLayer,charLayer);
|
sl@0
|
569 |
|
sl@0
|
570 |
_LIT(KTestText, "The quick brown fox jumped over the lazy dog");
|
sl@0
|
571 |
_LIT(KDefaulFormattedText, "The quick brown fox ju");
|
sl@0
|
572 |
_LIT(KAntiAliasedText, "mped over the lazy dog\x2029");
|
sl@0
|
573 |
|
sl@0
|
574 |
//insert the test text into the string
|
sl@0
|
575 |
richText->InsertL(0, KTestText);
|
sl@0
|
576 |
|
sl@0
|
577 |
TCharFormat defaultCharFormat(_L("Times"), 100);
|
sl@0
|
578 |
TCharFormat antiAliasedCharFormat(_L("Times"), 100);
|
sl@0
|
579 |
|
sl@0
|
580 |
//Set up antiAliasedCharFormat to allow anti-aliasing
|
sl@0
|
581 |
antiAliasedCharFormat.iFontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
|
sl@0
|
582 |
|
sl@0
|
583 |
TCharFormatMask formatMask;
|
sl@0
|
584 |
formatMask.SetAttrib(EAttFontTypeface);
|
sl@0
|
585 |
|
sl@0
|
586 |
//Format the entire string using default formatting
|
sl@0
|
587 |
TInt textLength = richText->DocumentLength();
|
sl@0
|
588 |
richText->ApplyCharFormatL(defaultCharFormat, formatMask, 0, textLength);
|
sl@0
|
589 |
|
sl@0
|
590 |
//Change the formatting of the second half of the string to anti-aliased
|
sl@0
|
591 |
TInt halfLength = textLength/2;
|
sl@0
|
592 |
richText->ApplyCharFormatL(antiAliasedCharFormat, formatMask, halfLength, halfLength);
|
sl@0
|
593 |
|
sl@0
|
594 |
//Get the string portion with default formatting
|
sl@0
|
595 |
TPtrC defaultString;
|
sl@0
|
596 |
richText->GetChars(defaultString, defaultCharFormat,0);
|
sl@0
|
597 |
|
sl@0
|
598 |
TGlyphBitmapType startBitmapType = defaultCharFormat.iFontSpec.iFontStyle.BitmapType();
|
sl@0
|
599 |
|
sl@0
|
600 |
//Verify the formatting and the contents of the string
|
sl@0
|
601 |
CHECK2(startBitmapType, EDefaultGlyphBitmap);
|
sl@0
|
602 |
CHECK1(defaultString == KDefaulFormattedText);
|
sl@0
|
603 |
|
sl@0
|
604 |
//Get the string portion with antialiased formatting
|
sl@0
|
605 |
TPtrC antialiasedString;
|
sl@0
|
606 |
richText->GetChars(antialiasedString, antiAliasedCharFormat,halfLength);
|
sl@0
|
607 |
|
sl@0
|
608 |
TGlyphBitmapType endBitmapType = antiAliasedCharFormat.iFontSpec.iFontStyle.BitmapType();
|
sl@0
|
609 |
|
sl@0
|
610 |
//Verify the formatting and the contents of the string
|
sl@0
|
611 |
CHECK2(endBitmapType,EAntiAliasedGlyphBitmap);
|
sl@0
|
612 |
CHECK1(antialiasedString == KAntiAliasedText);
|
sl@0
|
613 |
|
sl@0
|
614 |
delete paraLayer; paraLayer = NULL;
|
sl@0
|
615 |
delete charLayer; charLayer = NULL;
|
sl@0
|
616 |
delete richText; richText = NULL;
|
sl@0
|
617 |
|
sl@0
|
618 |
__UHEAP_MARKEND;
|
sl@0
|
619 |
}
|
sl@0
|
620 |
|
sl@0
|
621 |
|
sl@0
|
622 |
/***
|
sl@0
|
623 |
Invoke the tests
|
sl@0
|
624 |
*/
|
sl@0
|
625 |
LOCAL_C void DoTestsL()
|
sl@0
|
626 |
{
|
sl@0
|
627 |
__UHEAP_MARK;
|
sl@0
|
628 |
|
sl@0
|
629 |
OOM049456L();
|
sl@0
|
630 |
Inc051360L();
|
sl@0
|
631 |
OOM051360L();
|
sl@0
|
632 |
OOM056552L();
|
sl@0
|
633 |
INC055971L();
|
sl@0
|
634 |
INC097216L();
|
sl@0
|
635 |
INC101996L();
|
sl@0
|
636 |
|
sl@0
|
637 |
__UHEAP_MARKEND;
|
sl@0
|
638 |
}
|
sl@0
|
639 |
|
sl@0
|
640 |
CTEtextDefect::CTEtextDefect()
|
sl@0
|
641 |
{
|
sl@0
|
642 |
SetTestStepName(KTestStep_TEtextDefect);
|
sl@0
|
643 |
pTestStep = this;
|
sl@0
|
644 |
}
|
sl@0
|
645 |
|
sl@0
|
646 |
TVerdict CTEtextDefect::doTestStepL()
|
sl@0
|
647 |
{
|
sl@0
|
648 |
SetTestStepResult(EFail);
|
sl@0
|
649 |
|
sl@0
|
650 |
CTrapCleanup* trapCleanup=CTrapCleanup::New();
|
sl@0
|
651 |
|
sl@0
|
652 |
INFO_PRINTF1(KTestName);
|
sl@0
|
653 |
TRAPD(error, DoTestsL());
|
sl@0
|
654 |
|
sl@0
|
655 |
delete trapCleanup;
|
sl@0
|
656 |
|
sl@0
|
657 |
if (error == KErrNone)
|
sl@0
|
658 |
{
|
sl@0
|
659 |
SetTestStepResult(EPass);
|
sl@0
|
660 |
}
|
sl@0
|
661 |
|
sl@0
|
662 |
return TestStepResult();
|
sl@0
|
663 |
}
|