45
|
1 |
// Copyright (c) 1998-2010 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 <f32file.h>
|
|
17 |
#include <s32file.h>
|
|
18 |
#include "TTYPES.H"
|
|
19 |
|
|
20 |
|
|
21 |
RFs fs;
|
|
22 |
CDirectFileStore* writestore=NULL;
|
|
23 |
CDirectFileStore* readstore=NULL;
|
|
24 |
RStoreWriteStream writestrm;
|
|
25 |
RStoreReadStream readstrm;
|
|
26 |
|
|
27 |
TestTypeface::TestTypeface(
|
|
28 |
const TBuf<KMaxTypefaceNameLength>& aName,
|
|
29 |
TUint32 aFlags,
|
|
30 |
CTTypes* aTest) :
|
|
31 |
iName(aName),
|
|
32 |
iFlags(aFlags),
|
|
33 |
iTest(aTest)
|
|
34 |
{}
|
|
35 |
|
|
36 |
/**
|
|
37 |
TestTypeface::Test
|
|
38 |
Tests functionality contained within TTypeface, settings various attributes
|
|
39 |
on the typeface & retrieving them to confirm the result
|
|
40 |
The test also streams the typeface to file, via CDirectFileStore calls & retrieves again
|
|
41 |
from the store to confirm result
|
|
42 |
*/
|
|
43 |
void TestTypeface::Test()
|
|
44 |
{
|
|
45 |
TTypeface typeface1;
|
|
46 |
typeface1.iName = iName;
|
|
47 |
const TBool prop = iFlags & TTypeface::EProportional;
|
|
48 |
const TBool seri = iFlags & TTypeface::ESerif;
|
|
49 |
const TBool symb = iFlags & TTypeface::ESymbol;
|
|
50 |
|
|
51 |
typeface1.SetIsProportional(prop);
|
|
52 |
iTest->TEST(typeface1.IsProportional() == prop);
|
|
53 |
|
|
54 |
typeface1.SetIsSerif(seri);
|
|
55 |
iTest->TEST(typeface1.IsSerif() == seri);
|
|
56 |
iTest->TEST(typeface1.IsProportional() == prop);
|
|
57 |
|
|
58 |
typeface1.SetIsSymbol(symb);
|
|
59 |
iTest->TEST(typeface1.IsSymbol() == symb);
|
|
60 |
iTest->TEST(typeface1.IsProportional() == prop);
|
|
61 |
iTest->TEST(typeface1.IsSerif() == seri);
|
|
62 |
|
|
63 |
TTypeface typeface2;
|
|
64 |
typeface2.iName = iName;
|
|
65 |
typeface2.SetIsProportional(prop);
|
|
66 |
typeface2.SetIsSerif(seri);
|
|
67 |
typeface2.SetIsSymbol(symb);
|
|
68 |
iTest->TEST(typeface1 == typeface2);
|
|
69 |
|
|
70 |
TestStream();
|
|
71 |
|
|
72 |
for (TInt i = 0; i < 8; i++)
|
|
73 |
{
|
|
74 |
typeface1.SetAttributes(i);
|
|
75 |
iTest->TEST(typeface1.Attributes() == i);
|
|
76 |
}
|
|
77 |
|
|
78 |
for (TInt i = 0; i < 16; i++)
|
|
79 |
{
|
|
80 |
typeface1.SetScriptTypeForMetrics(i);
|
|
81 |
iTest->TEST(typeface1.ScriptTypeForMetrics() == i);
|
|
82 |
}
|
|
83 |
|
|
84 |
// test for PDEF124646. The test shouldn't cause any thread panic when passing in
|
|
85 |
// a big value of an invalid TLanguage index. If the fix is not present this test will crash.
|
|
86 |
|
|
87 |
for (TInt ii = 1; ii < 1000000; ii *= 10)
|
|
88 |
{
|
|
89 |
typeface1.SetScriptTypeForMetrics(static_cast<TLanguage>(ii));
|
|
90 |
}
|
|
91 |
}
|
|
92 |
|
|
93 |
/**
|
|
94 |
TestTypeface::TestStream
|
|
95 |
Called by the TestTypeface::Test method, this function
|
|
96 |
sets attributes on a typeface & streams the object to file, via CDirectFileStore calls.
|
|
97 |
It then retrieves the typeface from the store to confirm result
|
|
98 |
*/
|
|
99 |
void TestTypeface::TestStream()
|
|
100 |
{
|
|
101 |
TTypeface typeface1;
|
|
102 |
typeface1.iName = iName;
|
|
103 |
typeface1.SetIsProportional(TTypeface::EProportional & iFlags);
|
|
104 |
typeface1.SetIsSerif(TTypeface::ESerif & iFlags);
|
|
105 |
typeface1.SetIsSymbol(TTypeface::ESymbol & iFlags);
|
|
106 |
iTest->InitialiseWriteStream();
|
|
107 |
TRAPD(ret, typeface1.ExternalizeL(writestrm));
|
|
108 |
iTest->TEST2(ret, KErrNone);
|
|
109 |
iTest->ResetWriteStream();
|
|
110 |
|
|
111 |
TTypeface typeface2;
|
|
112 |
iTest->InitialiseReadStream();
|
|
113 |
TRAP(ret, typeface2.InternalizeL(readstrm));
|
|
114 |
iTest->TEST2(ret, KErrNone);
|
|
115 |
iTest->ResetReadStream();
|
|
116 |
iTest->TEST(typeface1 == typeface2);
|
|
117 |
}
|
|
118 |
|
|
119 |
TestMargins::TestMargins(TInt aLeft,TInt aRight,TInt aTop,TInt aBottom, CTTypes* aTest):
|
|
120 |
iLeft(aLeft),
|
|
121 |
iRight(aRight),
|
|
122 |
iTop(aTop),
|
|
123 |
iBottom(aBottom),
|
|
124 |
iTest(aTest)
|
|
125 |
{}
|
|
126 |
|
|
127 |
/**
|
|
128 |
TestMargins::Test
|
|
129 |
Tests functionality contained within the TMargins class, settings various attributes
|
|
130 |
on the margins & streaming the object to file, via CDirectFileStore calls.
|
|
131 |
The TMargins object is then retrieved from the store & compared within original to confirm result
|
|
132 |
*/
|
|
133 |
void TestMargins::Test()
|
|
134 |
{
|
|
135 |
TestStream();
|
|
136 |
}
|
|
137 |
|
|
138 |
/**
|
|
139 |
TestMargins::TestStream
|
|
140 |
Tests functionality contained within the TMargins class, settings various attributes
|
|
141 |
on the margins & streaming the object to file, via CDirectFileStore calls.
|
|
142 |
The TMargins object is then retrieved from the store & compared within original to confirm result
|
|
143 |
*/
|
|
144 |
void TestMargins::TestStream()
|
|
145 |
{
|
|
146 |
TMargins tm;
|
|
147 |
tm.iLeft=iLeft;
|
|
148 |
tm.iRight=iRight;
|
|
149 |
tm.iTop=iTop;
|
|
150 |
tm.iBottom=iBottom;
|
|
151 |
iTest->InitialiseWriteStream();
|
|
152 |
TRAPD(ret,tm.ExternalizeL(writestrm));
|
|
153 |
iTest->TEST2(ret, KErrNone);
|
|
154 |
iTest->ResetWriteStream();
|
|
155 |
TMargins tm2;
|
|
156 |
tm2.iLeft=0;
|
|
157 |
tm2.iRight=0;
|
|
158 |
tm2.iTop=0;
|
|
159 |
tm2.iBottom=0;
|
|
160 |
iTest->InitialiseReadStream();
|
|
161 |
TRAP(ret,tm2.InternalizeL(readstrm));
|
|
162 |
iTest->TEST2(ret, KErrNone);
|
|
163 |
iTest->ResetReadStream();
|
|
164 |
iTest->TEST(tm.iLeft==tm2.iLeft);
|
|
165 |
iTest->TEST(tm.iRight==tm2.iRight);
|
|
166 |
iTest->TEST(tm.iTop==tm2.iTop);
|
|
167 |
iTest->TEST(tm.iBottom==tm2.iBottom);
|
|
168 |
}
|
|
169 |
|
|
170 |
//---------
|
|
171 |
/**
|
|
172 |
@SYMTestCaseID GRAPHICS-GDI-0001
|
|
173 |
|
|
174 |
@SYMPREQ PREQ1301
|
|
175 |
|
|
176 |
@SYMREQ REQ5381
|
|
177 |
|
|
178 |
@SYMTestCaseDesc Getting/setting font effects with FontEffect
|
|
179 |
|
|
180 |
@SYMTestPriority Critical
|
|
181 |
|
|
182 |
@SYMTestStatus Implemented
|
|
183 |
|
|
184 |
@SYMTestActions (1) Call SetEffect with attributes EAlgorithmicBold and EFalse
|
|
185 |
(2) Call IsEffectOn with attribute EAlgorithmicBold to check (1)
|
|
186 |
(3) Call SetEffect with attributes EAlgorithmicBold and ETrue
|
|
187 |
(4) Call IsEffectOn with attribute EAlgorithmicBold to check (3)
|
|
188 |
(5) Repeat (1) - (4) with all supported font effects attributes
|
|
189 |
|
|
190 |
@SYMTestExpectedResults Getters should return the expected results set by setters
|
|
191 |
(2) IsEffectOn should return a value EFalse
|
|
192 |
(4) IsEffectOn should return a value ETrue
|
|
193 |
*/
|
|
194 |
void TestFontEffect::Test()
|
|
195 |
{
|
|
196 |
TUint32 fontEffect = FontEffect::ENone;
|
|
197 |
|
|
198 |
FontEffect::SetEffect(FontEffect::EAlgorithmicBold, EFalse, fontEffect);
|
|
199 |
iTest->TEST(!FontEffect::IsEffectOn(FontEffect::EAlgorithmicBold, fontEffect));
|
|
200 |
FontEffect::SetEffect(FontEffect::EAlgorithmicBold, ETrue, fontEffect);
|
|
201 |
iTest->TEST( FontEffect::IsEffectOn(FontEffect::EAlgorithmicBold, fontEffect));
|
|
202 |
|
|
203 |
FontEffect::SetEffect(FontEffect::EDropShadow, EFalse, fontEffect);
|
|
204 |
iTest->TEST(!FontEffect::IsEffectOn(FontEffect::EDropShadow, fontEffect));
|
|
205 |
FontEffect::SetEffect(FontEffect::EDropShadow, ETrue, fontEffect);
|
|
206 |
iTest->TEST( FontEffect::IsEffectOn(FontEffect::EDropShadow, fontEffect));
|
|
207 |
|
|
208 |
FontEffect::SetEffect(FontEffect::EOutline, EFalse, fontEffect);
|
|
209 |
iTest->TEST(!FontEffect::IsEffectOn(FontEffect::EOutline, fontEffect));
|
|
210 |
FontEffect::SetEffect(FontEffect::EOutline, ETrue, fontEffect);
|
|
211 |
iTest->TEST( FontEffect::IsEffectOn(FontEffect::EOutline, fontEffect));
|
|
212 |
|
|
213 |
FontEffect::SetEffect(FontEffect::EEmbossed, EFalse, fontEffect);
|
|
214 |
iTest->TEST(!FontEffect::IsEffectOn(FontEffect::EEmbossed, fontEffect));
|
|
215 |
FontEffect::SetEffect(FontEffect::EEmbossed, ETrue, fontEffect);
|
|
216 |
iTest->TEST( FontEffect::IsEffectOn(FontEffect::EEmbossed, fontEffect));
|
|
217 |
|
|
218 |
FontEffect::SetEffect(FontEffect::EEngraved, EFalse, fontEffect);
|
|
219 |
iTest->TEST(!FontEffect::IsEffectOn(FontEffect::EEngraved, fontEffect));
|
|
220 |
FontEffect::SetEffect(FontEffect::EEngraved, ETrue, fontEffect);
|
|
221 |
iTest->TEST( FontEffect::IsEffectOn(FontEffect::EEngraved, fontEffect));
|
|
222 |
|
|
223 |
FontEffect::SetEffect(FontEffect::ESoftEdge, EFalse, fontEffect);
|
|
224 |
iTest->TEST(!FontEffect::IsEffectOn(FontEffect::ESoftEdge, fontEffect));
|
|
225 |
FontEffect::SetEffect(FontEffect::ESoftEdge, ETrue, fontEffect);
|
|
226 |
iTest->TEST( FontEffect::IsEffectOn(FontEffect::ESoftEdge, fontEffect));
|
|
227 |
}
|
|
228 |
|
|
229 |
void TestTFontStyle::Test()
|
|
230 |
{
|
|
231 |
TFontStyle fontStyle00;
|
|
232 |
TFontStyle fontStyle01(EPostureUpright, EStrokeWeightNormal, EPrintPosNormal);
|
|
233 |
TFontStyle fontStyle02(EPostureItalic, EStrokeWeightNormal, EPrintPosNormal);
|
|
234 |
TFontStyle fontStyle03(EPostureUpright, EStrokeWeightBold, EPrintPosNormal);
|
|
235 |
TFontStyle fontStyle04(EPostureItalic, EStrokeWeightBold, EPrintPosNormal);
|
|
236 |
TFontStyle fontStyle05(EPostureUpright, EStrokeWeightNormal, EPrintPosSuperscript);
|
|
237 |
TFontStyle fontStyle06(EPostureItalic, EStrokeWeightNormal, EPrintPosSuperscript);
|
|
238 |
TFontStyle fontStyle07(EPostureUpright, EStrokeWeightBold, EPrintPosSuperscript);
|
|
239 |
TFontStyle fontStyle08(EPostureItalic, EStrokeWeightBold, EPrintPosSuperscript);
|
|
240 |
TFontStyle fontStyle09(EPostureUpright, EStrokeWeightNormal, EPrintPosSubscript);
|
|
241 |
TFontStyle fontStyle10(EPostureItalic, EStrokeWeightNormal, EPrintPosSubscript);
|
|
242 |
TFontStyle fontStyle11(EPostureUpright, EStrokeWeightBold, EPrintPosSubscript);
|
|
243 |
TFontStyle fontStyle12(EPostureItalic, EStrokeWeightBold, EPrintPosSubscript);
|
|
244 |
|
|
245 |
Test(fontStyle00);
|
|
246 |
Test(fontStyle01);
|
|
247 |
Test(fontStyle02);
|
|
248 |
Test(fontStyle03);
|
|
249 |
Test(fontStyle04);
|
|
250 |
Test(fontStyle05);
|
|
251 |
Test(fontStyle06);
|
|
252 |
Test(fontStyle07);
|
|
253 |
Test(fontStyle08);
|
|
254 |
Test(fontStyle09);
|
|
255 |
Test(fontStyle10);
|
|
256 |
Test(fontStyle11);
|
|
257 |
Test(fontStyle12);
|
|
258 |
}
|
|
259 |
|
|
260 |
/**
|
|
261 |
TestFontStyle::Test
|
|
262 |
Tests functionality contained within the TFontStyle class.
|
|
263 |
a TFontStyle object is streamed to & from a file store (via CDirectFileStore) & the results are compared.
|
|
264 |
Attributes such as Posture, Stroke, Position, BitmapType etc are set & the result verified
|
|
265 |
*/
|
|
266 |
void TestTFontStyle::Test(TFontStyle& aFontStyle)
|
|
267 |
{
|
|
268 |
TestStream(aFontStyle);
|
|
269 |
TestStyle(aFontStyle);
|
|
270 |
TestBitmapType(aFontStyle);
|
|
271 |
TestFontEffect(aFontStyle);
|
|
272 |
}
|
|
273 |
|
|
274 |
/**
|
|
275 |
TestFontStyle::TestStream
|
|
276 |
Streams a TFontStyle object is to & from a file store (via CDirectFileStore) & the results are compared.
|
|
277 |
*/
|
|
278 |
void TestTFontStyle::TestStream(const TFontStyle& aFontStyle)
|
|
279 |
{
|
|
280 |
iTest -> InitialiseWriteStream();
|
|
281 |
TRAPD(ret, aFontStyle.ExternalizeL(writestrm));
|
|
282 |
iTest -> TEST2(ret, KErrNone);
|
|
283 |
iTest -> ResetWriteStream();
|
|
284 |
TFontStyle fontStyle;
|
|
285 |
iTest -> InitialiseReadStream();
|
|
286 |
TRAP(ret, fontStyle.InternalizeL(readstrm));
|
|
287 |
iTest -> TEST2(ret, KErrNone);
|
|
288 |
iTest -> ResetReadStream();
|
|
289 |
iTest -> TEST(aFontStyle == fontStyle);
|
|
290 |
}
|
|
291 |
|
|
292 |
/**
|
|
293 |
TestFontStyle::TestStyle
|
|
294 |
Tests key attributes of a TFontStyle object by settings Posture, Stroke, Print position & verifiying the result
|
|
295 |
*/
|
|
296 |
void TestTFontStyle::TestStyle(TFontStyle& aFontStyle)
|
|
297 |
{
|
|
298 |
iTest -> TEST(TestPosture(aFontStyle));
|
|
299 |
iTest -> TEST(TestStrokeWeight(aFontStyle));
|
|
300 |
iTest -> TEST(TestPrintPosition(aFontStyle));
|
|
301 |
}
|
|
302 |
|
|
303 |
/**
|
|
304 |
TestFontStyle::TestPosture
|
|
305 |
Tests Posture attribute of a TFontStyle object by setting a particular value that opposes the original posture & verifiying the new setting
|
|
306 |
*/
|
|
307 |
TBool TestTFontStyle::TestPosture(TFontStyle& aFontStyle)
|
|
308 |
{
|
|
309 |
if (EPostureUpright == aFontStyle.Posture())
|
|
310 |
{
|
|
311 |
aFontStyle.SetPosture(EPostureItalic);
|
|
312 |
return VerifyStyle(aFontStyle, EPostureItalic, aFontStyle.StrokeWeight(), aFontStyle.PrintPosition());
|
|
313 |
}
|
|
314 |
else if (EPostureItalic == aFontStyle.Posture())
|
|
315 |
{
|
|
316 |
aFontStyle.SetPosture(EPostureUpright);
|
|
317 |
return VerifyStyle(aFontStyle, EPostureUpright, aFontStyle.StrokeWeight(), aFontStyle.PrintPosition());
|
|
318 |
}
|
|
319 |
return EFalse;
|
|
320 |
}
|
|
321 |
|
|
322 |
/**
|
|
323 |
TestFontStyle::TestStrokeWeight
|
|
324 |
Tests Stroke attribute of a TFontStyle object by setting a particular value that opposes the original stroke & verifiying the new setting
|
|
325 |
*/
|
|
326 |
TBool TestTFontStyle::TestStrokeWeight(TFontStyle& aFontStyle)
|
|
327 |
{
|
|
328 |
if (EStrokeWeightNormal == aFontStyle.StrokeWeight())
|
|
329 |
{
|
|
330 |
aFontStyle.SetStrokeWeight(EStrokeWeightBold);
|
|
331 |
return VerifyStyle(aFontStyle, aFontStyle.Posture(), EStrokeWeightBold, aFontStyle.PrintPosition());
|
|
332 |
}
|
|
333 |
else if (EStrokeWeightBold == aFontStyle.StrokeWeight())
|
|
334 |
{
|
|
335 |
aFontStyle.SetStrokeWeight(EStrokeWeightNormal);
|
|
336 |
return VerifyStyle(aFontStyle, aFontStyle.Posture(), EStrokeWeightNormal, aFontStyle.PrintPosition());
|
|
337 |
}
|
|
338 |
return EFalse;
|
|
339 |
}
|
|
340 |
|
|
341 |
/**
|
|
342 |
TestFontStyle::TestPrintPosition
|
|
343 |
Tests Print Position attribute of a TFontStyle object by setting a particular value that opposes the original position & verifiying the new setting
|
|
344 |
*/
|
|
345 |
TBool TestTFontStyle::TestPrintPosition(TFontStyle& aFontStyle)
|
|
346 |
{
|
|
347 |
if (EPrintPosNormal == aFontStyle.PrintPosition())
|
|
348 |
{
|
|
349 |
aFontStyle.SetPrintPosition(EPrintPosSuperscript);
|
|
350 |
return VerifyStyle(aFontStyle, aFontStyle.Posture(), aFontStyle.StrokeWeight(), EPrintPosSuperscript);
|
|
351 |
}
|
|
352 |
else if (EPrintPosSuperscript == aFontStyle.PrintPosition())
|
|
353 |
{
|
|
354 |
aFontStyle.SetPrintPosition(EPrintPosSubscript);
|
|
355 |
return VerifyStyle(aFontStyle, aFontStyle.Posture(), aFontStyle.StrokeWeight(), EPrintPosSubscript);
|
|
356 |
}
|
|
357 |
else if (EPrintPosSubscript == aFontStyle.PrintPosition())
|
|
358 |
{
|
|
359 |
aFontStyle.SetPrintPosition(EPrintPosNormal);
|
|
360 |
return VerifyStyle(aFontStyle, aFontStyle.Posture(), aFontStyle.StrokeWeight(), EPrintPosNormal);
|
|
361 |
}
|
|
362 |
return EFalse;
|
|
363 |
}
|
|
364 |
|
|
365 |
/**
|
|
366 |
TestFontStyle::VerifyStyle
|
|
367 |
Verifies the various attributes in a TFontStyle object
|
|
368 |
*/
|
|
369 |
TBool TestTFontStyle::VerifyStyle(
|
|
370 |
const TFontStyle& aFontStyle,
|
|
371 |
TFontPosture aFontPosture,
|
|
372 |
TFontStrokeWeight aFontStrokeWeight,
|
|
373 |
TFontPrintPosition aFontPrintPosition)
|
|
374 |
{
|
|
375 |
return
|
|
376 |
aFontPosture == aFontStyle.Posture() &&
|
|
377 |
aFontStrokeWeight == aFontStyle.StrokeWeight() &&
|
|
378 |
aFontPrintPosition == aFontStyle.PrintPosition();
|
|
379 |
}
|
|
380 |
|
|
381 |
/**
|
|
382 |
TestFontStyle::TestBitmapType
|
|
383 |
Sets the BitmapType attribute for a TFontStyle object to different values & verifies the result is recorded
|
|
384 |
*/
|
|
385 |
void TestTFontStyle::TestBitmapType(TFontStyle& aFontStyle)
|
|
386 |
{
|
|
387 |
aFontStyle.SetBitmapType(EDefaultGlyphBitmap);
|
|
388 |
iTest -> TEST(EDefaultGlyphBitmap == aFontStyle.BitmapType());
|
|
389 |
aFontStyle.SetBitmapType(EMonochromeGlyphBitmap);
|
|
390 |
iTest -> TEST(EMonochromeGlyphBitmap == aFontStyle.BitmapType());
|
|
391 |
aFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
|
|
392 |
iTest -> TEST(EAntiAliasedGlyphBitmap == aFontStyle.BitmapType());
|
|
393 |
}
|
|
394 |
|
|
395 |
/**
|
|
396 |
@SYMTestCaseID GRAPHICS-GDI-0002
|
|
397 |
|
|
398 |
@SYMPREQ PREQ1301
|
|
399 |
|
|
400 |
@SYMREQ REQ5381
|
|
401 |
|
|
402 |
@SYMTestCaseDesc Getting/setting font effects on TFontStyle
|
|
403 |
|
|
404 |
@SYMTestPriority Critical
|
|
405 |
|
|
406 |
@SYMTestStatus Implemented
|
|
407 |
|
|
408 |
@SYMTestActions (1) Call SetEffects with attributes EAlgorithmicBold and EFalse
|
|
409 |
(2) Call IsEffectOn with attribute EAlgorithmicBold to check (1)
|
|
410 |
(3) Call SetEffects with attributes EAlgorithmicBold and ETrue
|
|
411 |
(4) Call IsEffectOn with attribute EAlgorithmicBold to check (3)
|
|
412 |
(5) Call SetEffects/Effects to verify the attribute set in (3)
|
|
413 |
(6) Repeat (1) - (5) with all supported font effects attributes
|
|
414 |
|
|
415 |
@SYMTestExpectedResults Getters should return the expected results set by setters
|
|
416 |
(2) IsEffectOn should return a value EFalse
|
|
417 |
(4) IsEffectOn should return a value ETrue
|
|
418 |
(5) Effects should return the value set by SetEffects
|
|
419 |
*/
|
|
420 |
void TestTFontStyle::TestFontEffect(TFontStyle& aFontStyle)
|
|
421 |
{
|
|
422 |
aFontStyle.SetEffects(FontEffect::EAlgorithmicBold, EFalse);
|
|
423 |
iTest -> TEST(!aFontStyle.IsEffectOn(FontEffect::EAlgorithmicBold));
|
|
424 |
aFontStyle.SetEffects(FontEffect::EAlgorithmicBold, ETrue);
|
|
425 |
iTest -> TEST( aFontStyle.IsEffectOn(FontEffect::EAlgorithmicBold));
|
|
426 |
VerifyFontEffect(aFontStyle);
|
|
427 |
|
|
428 |
aFontStyle.SetEffects(FontEffect::EDropShadow, EFalse);
|
|
429 |
iTest -> TEST(!aFontStyle.IsEffectOn(FontEffect::EDropShadow));
|
|
430 |
aFontStyle.SetEffects(FontEffect::EDropShadow, ETrue);
|
|
431 |
iTest -> TEST( aFontStyle.IsEffectOn(FontEffect::EDropShadow));
|
|
432 |
VerifyFontEffect(aFontStyle);
|
|
433 |
|
|
434 |
aFontStyle.SetEffects(FontEffect::EOutline, EFalse);
|
|
435 |
iTest -> TEST(!aFontStyle.IsEffectOn(FontEffect::EOutline));
|
|
436 |
aFontStyle.SetEffects(FontEffect::EOutline, ETrue);
|
|
437 |
iTest -> TEST( aFontStyle.IsEffectOn(FontEffect::EOutline));
|
|
438 |
VerifyFontEffect(aFontStyle);
|
|
439 |
|
|
440 |
aFontStyle.SetEffects(FontEffect::EEmbossed, EFalse);
|
|
441 |
iTest -> TEST(!aFontStyle.IsEffectOn(FontEffect::EEmbossed));
|
|
442 |
aFontStyle.SetEffects(FontEffect::EEmbossed, ETrue);
|
|
443 |
iTest -> TEST( aFontStyle.IsEffectOn(FontEffect::EEmbossed));
|
|
444 |
VerifyFontEffect(aFontStyle);
|
|
445 |
|
|
446 |
aFontStyle.SetEffects(FontEffect::EEngraved, EFalse);
|
|
447 |
iTest -> TEST(!aFontStyle.IsEffectOn(FontEffect::EEngraved));
|
|
448 |
aFontStyle.SetEffects(FontEffect::EEngraved, ETrue);
|
|
449 |
iTest -> TEST( aFontStyle.IsEffectOn(FontEffect::EEngraved));
|
|
450 |
VerifyFontEffect(aFontStyle);
|
|
451 |
|
|
452 |
aFontStyle.SetEffects(FontEffect::ESoftEdge, EFalse);
|
|
453 |
iTest -> TEST(!aFontStyle.IsEffectOn(FontEffect::ESoftEdge));
|
|
454 |
aFontStyle.SetEffects(FontEffect::ESoftEdge, ETrue);
|
|
455 |
iTest -> TEST( aFontStyle.IsEffectOn(FontEffect::ESoftEdge));
|
|
456 |
VerifyFontEffect(aFontStyle);
|
|
457 |
}
|
|
458 |
|
|
459 |
void TestTFontStyle::VerifyFontEffect(TFontStyle& aFontStyle)
|
|
460 |
{
|
|
461 |
const TUint32 effects = aFontStyle.Effects();
|
|
462 |
aFontStyle.SetEffects(effects);
|
|
463 |
iTest -> TEST(effects == aFontStyle.Effects());
|
|
464 |
}
|
|
465 |
|
|
466 |
//-----------
|
|
467 |
TestPageSpec::TestPageSpec(TPageSpec::TPageOrientation aOrientation,const TSize& aSize, CTTypes* aTest):
|
|
468 |
iPortraitPageSize(aSize),
|
|
469 |
iOrientation(aOrientation),
|
|
470 |
iTest(aTest)
|
|
471 |
{}
|
|
472 |
|
|
473 |
/**
|
|
474 |
TestPageSpec::Test
|
|
475 |
Tests functionality contained within the TPageSpec class.
|
|
476 |
a TPageSpec object is streamed to & from a file store (via CDirectFileStore) & the results are compared.
|
|
477 |
Attributes such as Orientaton, Page Size are also tested
|
|
478 |
*/
|
|
479 |
void TestPageSpec::Test()
|
|
480 |
{
|
|
481 |
TPageSpec tps(iOrientation,iPortraitPageSize);
|
|
482 |
iTest->TEST(tps.iOrientation==iOrientation);
|
|
483 |
iTest->TEST(tps.iPortraitPageSize==iPortraitPageSize);
|
|
484 |
if(iOrientation==TPageSpec::EPortrait)
|
|
485 |
iTest->TEST(tps.OrientedPageSize()==iPortraitPageSize);
|
|
486 |
else
|
|
487 |
iTest->TEST(tps.OrientedPageSize()==TSize(iPortraitPageSize.iHeight,iPortraitPageSize.iWidth));
|
|
488 |
TestStream();
|
|
489 |
}
|
|
490 |
|
|
491 |
void TestPageSpec::TestStream()
|
|
492 |
{
|
|
493 |
TPageSpec tps(iOrientation,iPortraitPageSize);
|
|
494 |
iTest->InitialiseWriteStream();
|
|
495 |
TRAPD(ret,tps.ExternalizeL(writestrm));
|
|
496 |
iTest->TEST2(ret, KErrNone);
|
|
497 |
iTest->ResetWriteStream();
|
|
498 |
TPageSpec tps2;
|
|
499 |
iTest->InitialiseReadStream();
|
|
500 |
TRAP(ret,tps2.InternalizeL(readstrm));
|
|
501 |
iTest->TEST2(ret, KErrNone);
|
|
502 |
iTest->ResetReadStream();
|
|
503 |
TPageSpec::TPageOrientation tpo=tps.iOrientation;
|
|
504 |
TPageSpec::TPageOrientation tpo2=tps2.iOrientation;
|
|
505 |
iTest->TEST(tpo==tpo2);
|
|
506 |
TSize tpss=tps.iPortraitPageSize;
|
|
507 |
TSize tpss2=tps2.iPortraitPageSize;
|
|
508 |
iTest->TEST(tpss==tpss2);
|
|
509 |
}
|
|
510 |
|
|
511 |
/**
|
|
512 |
TestFontSSpec::Test
|
|
513 |
Tests functionality contained within the TFontSpec class.
|
|
514 |
a TFontSpec object is streamed to & from a file store (via CDirectFileStore) & the results are compared.
|
|
515 |
Attributes such as typeface, font height, style are set & the result verified
|
|
516 |
*/
|
|
517 |
TestFontSpec::TestFontSpec(const TTypeface& aTypeface,TInt aHeight,TFontStyle aStyle, CTTypes* aTest):
|
|
518 |
iTypeface(aTypeface),
|
|
519 |
iHeight(aHeight),
|
|
520 |
iStyle(aStyle),
|
|
521 |
iTest(aTest)
|
|
522 |
{}
|
|
523 |
|
|
524 |
void TestFontSpec::Test()
|
|
525 |
{
|
|
526 |
TFontSpec fontspec;
|
|
527 |
fontspec.iTypeface=iTypeface;
|
|
528 |
fontspec.iHeight=iHeight;
|
|
529 |
fontspec.iFontStyle=iStyle;
|
|
530 |
TFontSpec fontspec2(iTypeface.iName,iHeight);
|
|
531 |
fontspec2.iTypeface=iTypeface;
|
|
532 |
fontspec2.iFontStyle=iStyle;
|
|
533 |
iTest->TEST(fontspec==fontspec2);
|
|
534 |
TestStream();
|
|
535 |
}
|
|
536 |
|
|
537 |
void TestFontSpec::TestStream()
|
|
538 |
{
|
|
539 |
TFontSpec fs(iTypeface.iName,iHeight);
|
|
540 |
fs.iTypeface=iTypeface;
|
|
541 |
fs.iFontStyle=iStyle;
|
|
542 |
iTest->InitialiseWriteStream();
|
|
543 |
TRAPD(ret,fs.ExternalizeL(writestrm));
|
|
544 |
iTest->TEST2(ret, KErrNone);
|
|
545 |
iTest->ResetWriteStream();
|
|
546 |
TFontSpec fs2;
|
|
547 |
iTest->InitialiseReadStream();
|
|
548 |
TRAP(ret,fs2.InternalizeL(readstrm));
|
|
549 |
iTest->TEST2(ret, KErrNone);
|
|
550 |
iTest->ResetReadStream();
|
|
551 |
iTest->TEST(fs==fs2);
|
|
552 |
}
|
|
553 |
|
|
554 |
|
|
555 |
TestRgb::TestRgb(TUint8 r1,TUint8 g1,TUint8 b1, CTTypes* aTest):
|
|
556 |
iR(r1),
|
|
557 |
iG(g1),
|
|
558 |
iB(b1),
|
|
559 |
iTest(aTest)
|
|
560 |
{}
|
|
561 |
|
|
562 |
/**
|
|
563 |
TestRgb::Test
|
|
564 |
Tests functionality contained within the TRgb class.
|
|
565 |
Attributes such as base colours are set/retrieved & the result verified
|
|
566 |
*/
|
|
567 |
void TestRgb::Test()
|
|
568 |
{
|
|
569 |
TestSet();
|
|
570 |
TestGet();
|
|
571 |
TestComp();
|
|
572 |
TestStream();
|
|
573 |
}
|
|
574 |
|
|
575 |
void TestRgb::TestSet()
|
|
576 |
{
|
|
577 |
TRgb c1;
|
|
578 |
TRgb c2(128,128,128);
|
|
579 |
TRgb c3(500,500,500);
|
|
580 |
TRgb c4(iR,iG,iB);
|
|
581 |
TRgb c5(500,600,700);
|
|
582 |
iTest->TEST(c2.Red()==128);
|
|
583 |
iTest->TEST(c2.Green()==128);
|
|
584 |
iTest->TEST(c2.Blue()==128);
|
|
585 |
iTest->TEST(c3.Red()<256);
|
|
586 |
iTest->TEST(c3.Green()<256);
|
|
587 |
iTest->TEST(c3.Blue()<256);
|
|
588 |
iTest->TEST(c4.Red()==iR && c4.Green()==iG && c4.Blue()==iB);
|
|
589 |
iTest->TEST(c5.Red()<256);
|
|
590 |
iTest->TEST(c5.Green()<256);
|
|
591 |
iTest->TEST(c5.Blue()<256);
|
|
592 |
c1=c4;
|
|
593 |
iTest->TEST(c1.Red()==iR && c1.Green()==iG && c1.Blue()==iB);
|
|
594 |
c1=TRgb(64,128,192);
|
|
595 |
iTest->TEST(c1.Red()==64);
|
|
596 |
iTest->TEST(c1.Green()==128);
|
|
597 |
iTest->TEST(c1.Blue()==192);
|
|
598 |
c1=c5;
|
|
599 |
iTest->TEST(c1.Red()<256);
|
|
600 |
iTest->TEST(c1.Green()<256);
|
|
601 |
iTest->TEST(c1.Blue()<256);
|
|
602 |
c1=TRgb::Gray4(3);
|
|
603 |
iTest->TEST(c1.Red()==255 && c1.Green()==255 && c1.Blue()==255);
|
|
604 |
c1=TRgb::Gray16(15);
|
|
605 |
iTest->TEST(c1.Red()==255 && c1.Green()==255 && c1.Blue()==255);
|
|
606 |
c1=TRgb::Gray256(255);
|
|
607 |
iTest->TEST(c1.Red()==255 && c1.Green()==255 && c1.Blue()==255);
|
|
608 |
c1=TRgb::Gray4(4);
|
|
609 |
iTest->TEST(c1.Red()<256 && c1.Green()<256 && c1.Blue()<256);
|
|
610 |
c1=TRgb::Gray16(16);
|
|
611 |
iTest->TEST(c1.Red()<256 && c1.Green()<256 && c1.Blue()<256);
|
|
612 |
c1=TRgb::Gray256(256);
|
|
613 |
iTest->TEST(c1.Red()<256 && c1.Green()<256 && c1.Blue()<256);
|
|
614 |
iTest->TEST(c4.Red()==iR && c4.Green()==iG && c4.Blue()==iB);
|
|
615 |
}
|
|
616 |
|
|
617 |
/**
|
|
618 |
TRgb::TestGet
|
|
619 |
Tests mapping of the TRgb value to various gray-scale displaymodes
|
|
620 |
*/
|
|
621 |
void TestRgb::TestGet()
|
|
622 |
{
|
|
623 |
TRgb c1(iR,iG,iB);
|
|
624 |
iTest->TEST(c1.Gray4()==(2*iR+5*iG+iB)/512);
|
|
625 |
iTest->TEST(c1.Gray16()==(2*iR+5*iG+iB)/128);
|
|
626 |
iTest->TEST(c1.Gray256()==(2*iR+5*iG+iB)/8);
|
|
627 |
iTest->TEST(c1.Internal()==*((TUint32*)&c1));
|
|
628 |
TRgb c2;
|
|
629 |
c2=TRgb(*((TUint32*)&c1), 0xff);
|
|
630 |
iTest->TEST(c2==TRgb(iR,iG,iB));
|
|
631 |
}
|
|
632 |
|
|
633 |
/**
|
|
634 |
TestRgb::TestComp
|
|
635 |
Test operator overrides for TRgb class
|
|
636 |
*/
|
|
637 |
void TestRgb::TestComp()
|
|
638 |
{
|
|
639 |
TRgb c1(iR,iG,iB);
|
|
640 |
TRgb c2(iR,iG,iB);
|
|
641 |
TRgb c3(255-iR,iG,iB);
|
|
642 |
iTest->TEST(c1==c2);
|
|
643 |
iTest->TEST(c1!=c3);
|
|
644 |
iTest->TEST(c2!=c3);
|
|
645 |
iTest->TEST(c1==c2);
|
|
646 |
c1&=c3;
|
|
647 |
iTest->TEST(c1==TRgb(0,iG,iB));
|
|
648 |
c2|=c3;
|
|
649 |
iTest->TEST(c2==TRgb(255,iG,iB));
|
|
650 |
c1^=c2;
|
|
651 |
iTest->TEST(c1==TRgb(255,0,0));
|
|
652 |
}
|
|
653 |
|
|
654 |
/**
|
|
655 |
TestRgb::TestStream
|
|
656 |
Streams a TRgb object to & from a file store (via CDirectFileStore calls) & copmares results
|
|
657 |
*/
|
|
658 |
void TestRgb::TestStream()
|
|
659 |
{
|
|
660 |
TRgb rgb(iR,iG,iB);
|
|
661 |
iTest->InitialiseWriteStream();
|
|
662 |
TRAPD(ret,rgb.ExternalizeL(writestrm));
|
|
663 |
iTest->TEST2(ret, KErrNone);
|
|
664 |
iTest->ResetWriteStream();
|
|
665 |
TRgb rgb2;
|
|
666 |
iTest->InitialiseReadStream();
|
|
667 |
TRAP(ret,rgb2.InternalizeL(readstrm));
|
|
668 |
iTest->TEST2(ret, KErrNone);
|
|
669 |
iTest->ResetReadStream();
|
|
670 |
iTest->TEST(rgb==rgb2);
|
|
671 |
}
|
|
672 |
|
|
673 |
TestZoomFactor::TestZoomFactor(CTTypes* aTest, TInt aZoomFactor):
|
|
674 |
iZoomFactor(aZoomFactor),
|
|
675 |
iTest(aTest)
|
|
676 |
{}
|
|
677 |
|
|
678 |
/**
|
|
679 |
TestZoomFactor::Test
|
|
680 |
Tests attributes associated with TZoomFactor for mapping twips to pixels/device-specifc units
|
|
681 |
*/
|
|
682 |
void TestZoomFactor::Test()
|
|
683 |
{
|
|
684 |
TZoomFactor zf((MGraphicsDeviceMap*)NULL);
|
|
685 |
zf.SetZoomFactor(iZoomFactor);
|
|
686 |
iTest->TEST(zf.ZoomFactor()==iZoomFactor);
|
|
687 |
zf.SetZoomFactor(iZoomFactor*10);
|
|
688 |
iTest->TEST(zf.ZoomFactor()==iZoomFactor*10);
|
|
689 |
zf.SetZoomFactor(iZoomFactor/10);
|
|
690 |
iTest->TEST(zf.ZoomFactor()==iZoomFactor/10);
|
|
691 |
zf.SetGraphicsDeviceMap(NULL);
|
|
692 |
}
|
|
693 |
|
|
694 |
/**
|
|
695 |
TestDisplayModeUtils::Test
|
|
696 |
Test attributes associated with TDisplayModeUtils
|
|
697 |
*/
|
|
698 |
void TestDisplayModeUtils::Test()
|
|
699 |
{
|
|
700 |
const TInt KNumTestModes = 12;
|
|
701 |
TDisplayMode mode[] = { ENone, EGray2, EGray4, EGray16, EGray256,
|
|
702 |
EColor16, EColor256, EColor4K, EColor64K, EColor16M, ERgb, EColor16MU, EColor16MA, EColor16MAP};
|
|
703 |
TInt numColors[] = { 0, 2, 4, 16, 256, 16, 256, 4096, 65536, 16777216, 0 ,16777216, 16777216, 16777216};
|
|
704 |
TBool isColor[] = { EFalse, EFalse, EFalse, EFalse, EFalse,
|
|
705 |
ETrue, ETrue, ETrue, ETrue, ETrue, ETrue, ETrue, ETrue, ETrue};
|
|
706 |
|
|
707 |
for (TInt count = 0; count < KNumTestModes; count++)
|
|
708 |
{
|
|
709 |
iTest->TEST(TDisplayModeUtils::NumDisplayModeColors(mode[count]) == numColors[count]);
|
|
710 |
iTest->TEST((TDisplayModeUtils::IsDisplayModeColor(mode[count]) && isColor[count]) ||
|
|
711 |
(!TDisplayModeUtils::IsDisplayModeColor(mode[count]) && !isColor[count]));
|
|
712 |
}
|
|
713 |
}
|
|
714 |
|
|
715 |
CTTypes::CTTypes(CTestStep* aStep):
|
|
716 |
CTGraphicsBase(aStep)
|
|
717 |
{
|
|
718 |
INFO_PRINTF1(_L("Testing T classes in GDI.H:"));
|
|
719 |
}
|
|
720 |
|
|
721 |
CTTypes::~CTTypes()
|
|
722 |
{
|
|
723 |
fs.Delete(_L("c:\\ttypes.str"));
|
|
724 |
}
|
|
725 |
|
|
726 |
void CTTypes::ConstructL()
|
|
727 |
{
|
|
728 |
User::LeaveIfError(fs.Connect());
|
|
729 |
}
|
|
730 |
|
|
731 |
void CTTypes::RunTestCaseL(TInt aCurTestCase)
|
|
732 |
{
|
|
733 |
switch(aCurTestCase)
|
|
734 |
{
|
|
735 |
case 1:
|
|
736 |
{
|
|
737 |
__UHEAP_MARK;
|
|
738 |
TestRgb tr1(0,0,0, this);
|
|
739 |
TestRgb tr2(100,100,100, this);
|
|
740 |
TestRgb tr3(10,20,30, this);
|
|
741 |
TestRgb tr4(110,160,210, this);
|
|
742 |
TestRgb tr5(255,255,255, this);
|
|
743 |
INFO_PRINTF1(_L("TRgb"));
|
|
744 |
tr1.Test();
|
|
745 |
tr2.Test();
|
|
746 |
tr3.Test();
|
|
747 |
tr4.Test();
|
|
748 |
tr5.Test();
|
|
749 |
((CTTypesStep*)iStep)->CloseTMSGraphicsStep();
|
|
750 |
__UHEAP_MARKEND;
|
|
751 |
}
|
|
752 |
break;
|
|
753 |
case 2:
|
|
754 |
{
|
|
755 |
INFO_PRINTF1(_L("TTypeface"));
|
|
756 |
TestTypeface ttf1(_L(""), 0, this);
|
|
757 |
TestTypeface ttf2(_L("Font name"), 1, this);
|
|
758 |
TestTypeface ttf3(_L("Font name"), 2, this);
|
|
759 |
TestTypeface ttf4(_L("Font name"), 3, this);
|
|
760 |
TestTypeface ttf5(_L("Font name"), 4, this);
|
|
761 |
TestTypeface ttf6(_L("Font name"), 5, this);
|
|
762 |
TestTypeface ttf7(_L("Font name"), 6, this);
|
|
763 |
TestTypeface ttf8(_L("Another font name"), 7, this);
|
|
764 |
ttf1.Test();
|
|
765 |
ttf2.Test();
|
|
766 |
ttf3.Test();
|
|
767 |
ttf4.Test();
|
|
768 |
ttf5.Test();
|
|
769 |
ttf6.Test();
|
|
770 |
ttf7.Test();
|
|
771 |
ttf8.Test();
|
|
772 |
}
|
|
773 |
break;
|
|
774 |
case 3:
|
|
775 |
{
|
|
776 |
TestMargins tm1(0,0,0,0, this);
|
|
777 |
TestMargins tm2(10,20,30,40, this);
|
|
778 |
TestMargins tm3(-10,-20,-30,-40, this);
|
|
779 |
INFO_PRINTF1(_L("TMargins"));
|
|
780 |
tm1.Test();
|
|
781 |
tm2.Test();
|
|
782 |
tm3.Test();
|
|
783 |
}
|
|
784 |
break;
|
|
785 |
case 4:
|
|
786 |
{
|
|
787 |
TestPageSpec tps1(TPageSpec::EPortrait,TSize(0,0), this);
|
|
788 |
TestPageSpec tps2(TPageSpec::ELandscape,TSize(0,0), this);
|
|
789 |
TestPageSpec tps3(TPageSpec::EPortrait,TSize(10,-5), this);
|
|
790 |
TestPageSpec tps4(TPageSpec::ELandscape,TSize(15,-20), this);
|
|
791 |
TestPageSpec tps5(TPageSpec::EPortrait,TSize(1000,1500), this);
|
|
792 |
TestPageSpec tps6(TPageSpec::ELandscape,TSize(2000,500), this);
|
|
793 |
INFO_PRINTF1(_L("TPageSpec"));
|
|
794 |
tps1.Test();
|
|
795 |
tps2.Test();
|
|
796 |
tps3.Test();
|
|
797 |
tps4.Test();
|
|
798 |
tps5.Test();
|
|
799 |
tps6.Test();
|
|
800 |
}
|
|
801 |
break;
|
|
802 |
case 5:
|
|
803 |
{
|
|
804 |
INFO_PRINTF1(_L("FontEffect"));
|
|
805 |
((CTTypesStep*)iStep)->SetTestStepID(_L("GRAPHICS-GDI-0002"));
|
|
806 |
TestFontEffect te(this);
|
|
807 |
((CTTypesStep*)iStep)->RecordTestResultL();
|
|
808 |
te.Test();
|
|
809 |
}
|
|
810 |
break;
|
|
811 |
case 6:
|
|
812 |
{
|
|
813 |
INFO_PRINTF1(_L("TFontSyle"));
|
|
814 |
TestTFontStyle ts(this);
|
|
815 |
ts.Test();
|
|
816 |
}
|
|
817 |
break;
|
|
818 |
case 7:
|
|
819 |
{
|
|
820 |
TTypeface typeface;
|
|
821 |
typeface.iName=_L("Font name");
|
|
822 |
TFontStyle fontstyle;
|
|
823 |
TestFontSpec tfspec(typeface,200,fontstyle, this);
|
|
824 |
INFO_PRINTF1(_L("TFontSpec"));
|
|
825 |
tfspec.Test();
|
|
826 |
}
|
|
827 |
break;
|
|
828 |
case 8:
|
|
829 |
{
|
|
830 |
/*
|
|
831 |
TestLine tl1(TPoint(10,10),TPoint(90,90), this);
|
|
832 |
TestLine tl2(TPoint(100,150),TPoint(50,-50), this);
|
|
833 |
TestLine tl3(TPoint(-50,50),TPoint(60,-40), this);
|
|
834 |
TestLine tl4(TPoint(-100,0),TPoint(0,200), this);
|
|
835 |
TestLine tl5(TPoint(150,-50),TPoint(50,75), this);
|
|
836 |
TestLine tl6(TPoint(0,-100),TPoint(-50,-150), this);
|
|
837 |
TestLine tl7(TPoint(-1000,-1000),TPoint(1000,1000), this);
|
|
838 |
TestLine tl8(TPoint(1000,-1000),TPoint(-1000,1000), this);
|
|
839 |
TestLine tl9(TPoint(500,-1000),TPoint(-500,1000), this);
|
|
840 |
TestLine tl10(TPoint(-500,-1000),TPoint(500,1000), this);
|
|
841 |
TestLine tl11(TPoint(1000,-500),TPoint(-1000,500), this);
|
|
842 |
TestLine tl12(TPoint(1000,500),TPoint(-1000,-500), this);
|
|
843 |
INFO_PRINTF1(_L("TLinearDDA"));
|
|
844 |
tl1.Test();
|
|
845 |
tl2.Test();
|
|
846 |
tl3.Test();
|
|
847 |
tl4.Test();
|
|
848 |
tl5.Test();
|
|
849 |
tl6.Test();
|
|
850 |
tl7.Test();
|
|
851 |
tl8.Test();
|
|
852 |
tl9.Test();
|
|
853 |
tl10.Test();
|
|
854 |
tl11.Test();
|
|
855 |
tl12.Test();
|
|
856 |
*/
|
|
857 |
INFO_PRINTF1(_L("TLinearDDA is only for Graphics team. Removed."));
|
|
858 |
}
|
|
859 |
break;
|
|
860 |
case 9:
|
|
861 |
{
|
|
862 |
INFO_PRINTF1(_L("CTypefaceStore"));
|
|
863 |
TestTFStore ttfs(this);
|
|
864 |
ttfs.Test();
|
|
865 |
}
|
|
866 |
break;
|
|
867 |
case 10:
|
|
868 |
{
|
|
869 |
INFO_PRINTF1(_L("CFontCache"));
|
|
870 |
TestFontCache tfc(this);
|
|
871 |
tfc.Test();
|
|
872 |
}
|
|
873 |
break;
|
|
874 |
case 11:
|
|
875 |
{
|
|
876 |
/*
|
|
877 |
INFO_PRINTF1(_L("CScaleCropPicture"));
|
|
878 |
TestPicture tp(this);
|
|
879 |
tp.Test();
|
|
880 |
*/
|
|
881 |
INFO_PRINTF1(_L("CScaleCropPicture is only for Graphics team. Removed."));
|
|
882 |
}
|
|
883 |
break;
|
|
884 |
case 12:
|
|
885 |
{
|
|
886 |
/*
|
|
887 |
INFO_PRINTF1(_L("CPalette"));
|
|
888 |
TestPalette tpal(this);
|
|
889 |
tpal.Test();
|
|
890 |
*/
|
|
891 |
INFO_PRINTF1(_L("CPalette is only for Graphics team. Removed."));
|
|
892 |
}
|
|
893 |
break;
|
|
894 |
case 13:
|
|
895 |
{
|
|
896 |
INFO_PRINTF1(_L("TDisplayModeUtils"));
|
|
897 |
TestDisplayModeUtils tdmu(this);
|
|
898 |
tdmu.Test();
|
|
899 |
}
|
|
900 |
break;
|
|
901 |
case 14:
|
|
902 |
((CTTypesStep*)iStep)->SetOverallTestStepID(_L("GRAPHICS-GDI-0001"));
|
|
903 |
((CTTypesStep*)iStep)->RecordTestResultL();
|
|
904 |
((CTTypesStep*)iStep)->CloseTMSGraphicsStep();
|
|
905 |
TestComplete();
|
|
906 |
break;
|
|
907 |
}
|
|
908 |
}
|
|
909 |
|
|
910 |
void CTTypes::InitialiseWriteStream()
|
|
911 |
{
|
|
912 |
TRAPD(ret,writestore=CDirectFileStore::ReplaceL(fs,_L("c:\\ttypes.str"),EFileStream|EFileWrite));
|
|
913 |
TEST2(ret, KErrNone);
|
|
914 |
TRAP(ret,writestore->SetTypeL(KDirectFileStoreLayoutUid));
|
|
915 |
TEST2(ret, KErrNone);
|
|
916 |
TStreamId headerid(0); //To stop a warning
|
|
917 |
TRAP(ret,headerid=writestrm.CreateL(*writestore));
|
|
918 |
TEST2(ret, KErrNone);
|
|
919 |
TRAP(ret,writestore->SetRootL(headerid));
|
|
920 |
TEST2(ret, KErrNone);
|
|
921 |
}
|
|
922 |
|
|
923 |
void CTTypes::ResetWriteStream()
|
|
924 |
{
|
|
925 |
writestrm.Close();
|
|
926 |
delete writestore;
|
|
927 |
}
|
|
928 |
|
|
929 |
void CTTypes::InitialiseReadStream()
|
|
930 |
{
|
|
931 |
TRAPD(ret,readstore=CDirectFileStore::OpenL(fs,_L("c:\\ttypes.str"),EFileStream|EFileRead)); //* --Geert
|
|
932 |
TEST2(ret, KErrNone);
|
|
933 |
TStreamId headerid=readstore->Root();
|
|
934 |
TRAP(ret,readstrm.OpenL(*readstore,headerid));
|
|
935 |
TEST2(ret, KErrNone);
|
|
936 |
}
|
|
937 |
|
|
938 |
void CTTypes::ResetReadStream()
|
|
939 |
{
|
|
940 |
readstrm.Close();
|
|
941 |
delete readstore;
|
|
942 |
}
|
|
943 |
|
|
944 |
//--------------
|
|
945 |
__CONSTRUCT_STEP__(Types)
|
|
946 |
|