103
|
1 |
// Copyright (c) 1996-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 |
/**
|
|
17 |
@file
|
|
18 |
@test
|
|
19 |
@internalComponent - Internal Symbian test code
|
|
20 |
*/
|
|
21 |
|
|
22 |
#ifndef __TGDI_H__
|
|
23 |
#define __TGDI_H__
|
|
24 |
|
|
25 |
#include <e32std.h>
|
|
26 |
#include <w32std.h>
|
|
27 |
#include "../tlib/testbase.h"
|
|
28 |
#include <bitstd.h>
|
|
29 |
#include "AUTO.H"
|
|
30 |
#include "TGraphicsHarness.h"
|
|
31 |
|
|
32 |
class CGdiTestLowLevel;
|
|
33 |
|
|
34 |
CGdiTestLowLevel *SetOriginTest();
|
|
35 |
CGdiTestLowLevel *PolyLineTest();
|
|
36 |
CGdiTestLowLevel *PolygonTest();
|
|
37 |
CGdiTestLowLevel *BlitMaskedTest();
|
|
38 |
CGdiTestLowLevel *DrawArcTest();
|
|
39 |
CGdiTestLowLevel *DrawPieTest();
|
|
40 |
CGdiTestLowLevel *DrawRoundRectTest();
|
|
41 |
CGdiTestLowLevel *BoxTextTest();
|
|
42 |
CGdiTestLowLevel *VertTextTest();
|
|
43 |
CGdiTestLowLevel *JustifiedTextTest();
|
|
44 |
CGdiTestLowLevel *VertBoxTextTest();
|
|
45 |
CGdiTestLowLevel *WideLineTest();
|
|
46 |
CGdiTestLowLevel *DrawTextTest();
|
|
47 |
CGdiTestLowLevel *DrawRectTest();
|
|
48 |
|
|
49 |
class CTGdi;
|
|
50 |
class CGdiTestLowLevel : public CBase
|
|
51 |
//
|
|
52 |
// BaseTest uses code that is assumed to be good to draw to one window
|
|
53 |
// TheTest uses the code beng tested to draw a matching pattern
|
|
54 |
//
|
|
55 |
{
|
|
56 |
public:
|
|
57 |
void AssignGdi(CWindowGc *aGc);
|
|
58 |
void SetGdiTest(CTGdi *aGdiTest);
|
|
59 |
virtual void PreTestSetupL(const TRect &aRect, TInt aCount);
|
|
60 |
virtual void BaseTest(const TRect &aRect, TInt aCount)=0;
|
|
61 |
virtual void TheTest(const TRect &aRect, TInt aCount)=0;
|
|
62 |
virtual void ConstructL(TInt aNumOfRects);
|
|
63 |
virtual TInt Count(TBool aMainTests)=0;
|
|
64 |
protected:
|
|
65 |
CWindowGc *iGdi;
|
|
66 |
CTGdi *iGdiTest;
|
|
67 |
};
|
|
68 |
|
|
69 |
class CGdiRect : public CGdiTestLowLevel
|
|
70 |
{
|
|
71 |
public:
|
|
72 |
void PreTestSetupL(const TRect &aRect, TInt aCount);
|
|
73 |
void ConstructL(TInt aNumOfRects);
|
|
74 |
TInt Count(TBool aMainTests);
|
|
75 |
protected:
|
|
76 |
TRgb iBrushCol;
|
|
77 |
TRgb iPenCol;
|
|
78 |
};
|
|
79 |
|
|
80 |
|
|
81 |
class CGdiDrawRect : public CGdiRect
|
|
82 |
{
|
|
83 |
public:
|
|
84 |
TInt Count(TBool aMainTests);
|
|
85 |
void BaseTest(const TRect &aRect, TInt aCount);
|
|
86 |
void TheTest(const TRect &aRect, TInt aCount);
|
|
87 |
};
|
|
88 |
|
|
89 |
class CGdiDrawRoundRect : public CGdiRect
|
|
90 |
{
|
|
91 |
public:
|
|
92 |
TInt Count(TBool aMainTests);
|
|
93 |
void BaseTest(const TRect &aRect, TInt aCount);
|
|
94 |
void TheTest(const TRect &aRect, TInt aCount);
|
|
95 |
};
|
|
96 |
|
|
97 |
class CGdiDrawACP : public CGdiTestLowLevel
|
|
98 |
{
|
|
99 |
public:
|
|
100 |
void PreTestSetupL(const TRect &aRect, TInt aCount);
|
|
101 |
void ConstructL(TInt aNumOfRects);
|
|
102 |
TInt Count(TBool aMainTests);
|
|
103 |
protected:
|
|
104 |
TRgb iBrushCol;
|
|
105 |
TRgb iPenCol;
|
|
106 |
};
|
|
107 |
|
|
108 |
class CGdiDrawArc : public CGdiDrawACP
|
|
109 |
{
|
|
110 |
public:
|
|
111 |
void BaseTest(const TRect &aRect, TInt aCount);
|
|
112 |
void TheTest(const TRect &aRect, TInt aCount);
|
|
113 |
};
|
|
114 |
|
|
115 |
class CGdiDrawPie : public CGdiDrawACP
|
|
116 |
{
|
|
117 |
public:
|
|
118 |
void BaseTest(const TRect &aRect, TInt aCount);
|
|
119 |
void TheTest(const TRect &aRect, TInt aCount);
|
|
120 |
};
|
|
121 |
|
|
122 |
class CGdiPolyLine : public CGdiTestLowLevel
|
|
123 |
{
|
|
124 |
public:
|
|
125 |
CGdiPolyLine();
|
|
126 |
void PreTestSetupL(const TRect &aRect, TInt aCount);
|
|
127 |
void ConstructL(TInt aNumOfRects);
|
|
128 |
TInt Count(TBool aMainTests);
|
|
129 |
void BaseTest(const TRect &aRect, TInt aCount);
|
|
130 |
void TheTest(const TRect &aRect, TInt aCount);
|
|
131 |
private:
|
|
132 |
CArrayFixSeg<TPoint> iPnts;
|
|
133 |
};
|
|
134 |
|
|
135 |
class CGdiPolygon : public CGdiTestLowLevel
|
|
136 |
{
|
|
137 |
private:
|
|
138 |
enum {KMaxPolygonPoints=100};
|
|
139 |
enum {KPolygonStep=4};
|
|
140 |
public:
|
|
141 |
CGdiPolygon();
|
|
142 |
void PreTestSetupL(const TRect &aRect, TInt aCount);
|
|
143 |
void ConstructL(TInt aNumOfRects);
|
|
144 |
TInt Count(TBool aMainTests);
|
|
145 |
void BaseTest(const TRect &aRect, TInt aCount);
|
|
146 |
void TheTest(const TRect &aRect, TInt aCount);
|
|
147 |
private:
|
|
148 |
CArrayFixSeg<TPoint> iPnts;
|
|
149 |
};
|
|
150 |
|
|
151 |
class CGdiWideLine : public CGdiTestLowLevel
|
|
152 |
{
|
|
153 |
private:
|
|
154 |
enum TMaxWidths {
|
|
155 |
EMainNumWidths=16,
|
|
156 |
EMinorNumWidths=4};
|
|
157 |
public:
|
|
158 |
void PreTestSetupL(const TRect &aRect, TInt aCount);
|
|
159 |
void BaseTest(const TRect &aRect, TInt aCount);
|
|
160 |
void TheTest(const TRect &aRect, TInt aCount);
|
|
161 |
void ConstructL(TInt aNumOfRects);
|
|
162 |
TInt Count(TBool aMainTests);
|
|
163 |
private:
|
|
164 |
TInt iWidth;
|
|
165 |
};
|
|
166 |
|
|
167 |
class CGdiSetOrigin : public CGdiTestLowLevel
|
|
168 |
{
|
|
169 |
public:
|
|
170 |
~CGdiSetOrigin();
|
|
171 |
void PreTestSetupL(const TRect &aRect, TInt aCount);
|
|
172 |
void DrawIt(const TPoint &aOffset);
|
|
173 |
void BaseTest(const TRect &aRect, TInt aCount);
|
|
174 |
void TheTest(const TRect &aRect, TInt aCount);
|
|
175 |
void ConstructL(TInt aNumOfRects);
|
|
176 |
TInt Count(TBool aMainTests);
|
|
177 |
private:
|
|
178 |
CFbsFont *iFont;
|
|
179 |
CArrayFixFlat<TPoint> *iPolylineArray;
|
|
180 |
CArrayFixFlat<TPoint> *iPolygonArray;
|
|
181 |
};
|
|
182 |
|
|
183 |
class CGdiDrawText : public CGdiTestLowLevel
|
|
184 |
{
|
|
185 |
public:
|
|
186 |
~CGdiDrawText();
|
|
187 |
void PreTestSetupL(const TRect &aRect, TInt aCount);
|
|
188 |
void BaseTest(const TRect &aRect, TInt aCount);
|
|
189 |
void TheTest(const TRect &aRect, TInt aCount);
|
|
190 |
void ConstructL(TInt aNumOfRects);
|
|
191 |
TInt Count(TBool aMainTests);
|
|
192 |
private:
|
|
193 |
TInt iWidth;
|
|
194 |
CFbsFont *iFont;
|
|
195 |
TBuf<0x400> iBigBuffer;
|
|
196 |
};
|
|
197 |
|
|
198 |
class CGdiDrawVertText : public CGdiTestLowLevel
|
|
199 |
{
|
|
200 |
public:
|
|
201 |
~CGdiDrawVertText();
|
|
202 |
void PreTestSetupL(const TRect &aRect, TInt aCount);
|
|
203 |
void BaseTest(const TRect &aRect, TInt aCount);
|
|
204 |
void TheTest(const TRect &aRect, TInt aCount);
|
|
205 |
void ConstructL(TInt aNumOfRects);
|
|
206 |
TInt Count(TBool aMainTests);
|
|
207 |
private:
|
|
208 |
TInt iWidth;
|
|
209 |
CFbsFont *iFont;
|
|
210 |
TBuf<0x400> iBigBuffer;
|
|
211 |
};
|
|
212 |
|
|
213 |
//class CGdiDrawJustifiedText : public CGdiTestLowLevel
|
|
214 |
//DEF107985 The test for JustifiedText has been removed as it was a bad/useless test
|
|
215 |
|
|
216 |
class CGdiBoxText : public CGdiTestLowLevel
|
|
217 |
{
|
|
218 |
public:
|
|
219 |
~CGdiBoxText();
|
|
220 |
void PreTestSetupL(const TRect &aRect, TInt aCount);
|
|
221 |
void BaseTest(const TRect &aRect, TInt aCount);
|
|
222 |
void TheTest(const TRect &aRect, TInt aCount);
|
|
223 |
void ConstructL(TInt aNumOfRects);
|
|
224 |
TInt Count(TBool aMainTests);
|
|
225 |
private:
|
|
226 |
TInt iWidth;
|
|
227 |
TInt iBbLen;
|
|
228 |
CFbsFont *iFont;
|
|
229 |
TBuf<0x400> iBigBuffer;
|
|
230 |
};
|
|
231 |
|
|
232 |
class CGdiVertBoxText : public CGdiTestLowLevel
|
|
233 |
{
|
|
234 |
public:
|
|
235 |
~CGdiVertBoxText();
|
|
236 |
void PreTestSetupL(const TRect &aRect, TInt aCount);
|
|
237 |
void BaseTest(const TRect &aRect, TInt aCount);
|
|
238 |
void TheTest(const TRect &aRect, TInt aCount);
|
|
239 |
void ConstructL(TInt aNumOfRects);
|
|
240 |
TInt Count(TBool aMainTests);
|
|
241 |
private:
|
|
242 |
TInt iWidth;
|
|
243 |
TInt iBbLen;
|
|
244 |
CFbsFont *iFont;
|
|
245 |
TBuf<0x400> iBigBuffer;
|
|
246 |
};
|
|
247 |
/*
|
|
248 |
class CGdiDottedLine : public CGdiTestLowLevel
|
|
249 |
{
|
|
250 |
enum TMaxPatterns {
|
|
251 |
EMainMaxPatterns=5,
|
|
252 |
EMinorMaxPatterns=3};
|
|
253 |
public:
|
|
254 |
void SetGridRegion(TRegion &grid,const TRect &aRect);
|
|
255 |
void PreTestSetupL(const TRect &aRect, TInt aCount);
|
|
256 |
void BaseTest(const TRect &aRect, TInt aCount);
|
|
257 |
void TheTest(const TRect &aRect, TInt aCount);
|
|
258 |
void ConstructL(TInt aNumOfRects);
|
|
259 |
TInt Count(TBool aMainTests);
|
|
260 |
private:
|
|
261 |
TUint iPattern;
|
|
262 |
TInt iPattLen;
|
|
263 |
static TUint iPatterns[EMainMaxPatterns];
|
|
264 |
static TInt iPattLens[EMainMaxPatterns];
|
|
265 |
};
|
|
266 |
TUint CGdiDottedLine::iPatterns[]={
|
|
267 |
0x55FF0033,
|
|
268 |
0xFF00,
|
|
269 |
0x1,
|
|
270 |
0xFFFF,
|
|
271 |
0xF0F0F0};
|
|
272 |
TInt CGdiDottedLine::iPattLens[]={
|
|
273 |
32,
|
|
274 |
16,
|
|
275 |
2,
|
|
276 |
32,
|
|
277 |
24};
|
|
278 |
*/
|
|
279 |
class CTestWindow : public CBlankWindow
|
|
280 |
{
|
|
281 |
public:
|
|
282 |
CTestWindow(TRgb aCol);
|
|
283 |
~CTestWindow();
|
|
284 |
void ConstructL(TPoint aPos,TSize aSize,CTWinBase* aParent, CWindowGc& aGc );
|
|
285 |
};
|
|
286 |
|
|
287 |
class CGdiBlitMasked: public CGdiTestLowLevel
|
|
288 |
{
|
|
289 |
enum TNumMasks {ENumMasks=2};
|
|
290 |
public:
|
|
291 |
~CGdiBlitMasked();
|
|
292 |
void PreTestSetupL(const TRect &aRect, TInt aCount);
|
|
293 |
void BaseTest(const TRect &aRect, TInt aCount);
|
|
294 |
void TheTest(const TRect &aRect, TInt aCount);
|
|
295 |
void ConstructL(TInt aNumOfRects);
|
|
296 |
TInt Count(TBool aMainTests);
|
|
297 |
private:
|
|
298 |
void doCreateTestBitmapL(CFbsBitmap *aBitmap, CFbsBitGc *&aGc, CFbsBitmapDevice *&aDevice, const TSize &aSize);
|
|
299 |
void createTestBitmapL(CFbsBitmap *&aBitmap, const TSize &aSize);
|
|
300 |
private:
|
|
301 |
CFbsBitmap *iMask[ENumMasks];
|
|
302 |
CFbsBitmap *iBitmap;
|
|
303 |
//
|
|
304 |
CFbsBitmap *iScratch;
|
|
305 |
CFbsBitmapDevice *iScratchDevice;
|
|
306 |
CFbsBitGc *iScratchGc;
|
|
307 |
//
|
|
308 |
CFbsBitmap *iScratchMask;
|
|
309 |
CFbsBitmapDevice *iScratchMaskDevice;
|
|
310 |
CFbsBitGc *iScratchMaskGc;
|
|
311 |
//
|
|
312 |
TBool iInvertMask;
|
|
313 |
CFbsBitmap *iCurrMask;
|
|
314 |
CGraphicsContext::TDrawMode iDrawMode;
|
|
315 |
};
|
|
316 |
|
|
317 |
class CTGdi : public CTWsGraphicsBase
|
|
318 |
{
|
|
319 |
public:
|
|
320 |
CTGdi(CTestStep* aStep);
|
|
321 |
void ConstructL();
|
|
322 |
TSize WinSize();
|
|
323 |
void GdiTestL(CGdiTestLowLevel *aTest);
|
|
324 |
void TestDefetct_DEF045746L();
|
|
325 |
void DrawTextOnWindow(const TDesC& aText,CTWin* aWin);
|
|
326 |
protected:
|
|
327 |
//from CTGraphicsStep
|
|
328 |
virtual void RunTestCaseL(TInt aCurTestCase);
|
|
329 |
private:
|
|
330 |
void DoGdiTestL(const TRect &aRect, TInt aNum);
|
|
331 |
void NonDrawing();
|
|
332 |
private:
|
|
333 |
TSize iWinSize;
|
|
334 |
TInt iSubState;
|
|
335 |
CGdiTestLowLevel *iGdiTest;
|
|
336 |
CTestWindow* iWin;
|
|
337 |
CFont* iFont;
|
|
338 |
TInt iTextOffsetX;
|
|
339 |
TInt iTextOffsetY;
|
|
340 |
TBool iTestPassing;
|
|
341 |
};
|
|
342 |
|
|
343 |
class CTGdiStep : public CTGraphicsStep
|
|
344 |
{
|
|
345 |
public:
|
|
346 |
CTGdiStep();
|
|
347 |
protected:
|
|
348 |
//from CTGraphicsStep
|
|
349 |
virtual CTGraphicsBase* CreateTestL();
|
|
350 |
};
|
|
351 |
|
|
352 |
_LIT(KTGdiStep,"TGdi");
|
|
353 |
|
|
354 |
|
|
355 |
#endif
|