First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 @internalComponent - Internal Symbian test code
27 #include "../tlib/testbase.h"
30 #include "TGraphicsHarness.h"
32 class CGdiTestLowLevel;
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();
50 class CGdiTestLowLevel : public CBase
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
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;
69 class CGdiRect : public CGdiTestLowLevel
72 void PreTestSetupL(const TRect &aRect, TInt aCount);
73 void ConstructL(TInt aNumOfRects);
74 TInt Count(TBool aMainTests);
81 class CGdiDrawRect : public CGdiRect
84 TInt Count(TBool aMainTests);
85 void BaseTest(const TRect &aRect, TInt aCount);
86 void TheTest(const TRect &aRect, TInt aCount);
89 class CGdiDrawRoundRect : public CGdiRect
92 TInt Count(TBool aMainTests);
93 void BaseTest(const TRect &aRect, TInt aCount);
94 void TheTest(const TRect &aRect, TInt aCount);
97 class CGdiDrawACP : public CGdiTestLowLevel
100 void PreTestSetupL(const TRect &aRect, TInt aCount);
101 void ConstructL(TInt aNumOfRects);
102 TInt Count(TBool aMainTests);
108 class CGdiDrawArc : public CGdiDrawACP
111 void BaseTest(const TRect &aRect, TInt aCount);
112 void TheTest(const TRect &aRect, TInt aCount);
115 class CGdiDrawPie : public CGdiDrawACP
118 void BaseTest(const TRect &aRect, TInt aCount);
119 void TheTest(const TRect &aRect, TInt aCount);
122 class CGdiPolyLine : public CGdiTestLowLevel
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);
132 CArrayFixSeg<TPoint> iPnts;
135 class CGdiPolygon : public CGdiTestLowLevel
138 enum {KMaxPolygonPoints=100};
139 enum {KPolygonStep=4};
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);
148 CArrayFixSeg<TPoint> iPnts;
151 class CGdiWideLine : public CGdiTestLowLevel
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);
167 class CGdiSetOrigin : public CGdiTestLowLevel
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);
179 CArrayFixFlat<TPoint> *iPolylineArray;
180 CArrayFixFlat<TPoint> *iPolygonArray;
183 class CGdiDrawText : public CGdiTestLowLevel
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);
195 TBuf<0x400> iBigBuffer;
198 class CGdiDrawVertText : public CGdiTestLowLevel
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);
210 TBuf<0x400> iBigBuffer;
213 //class CGdiDrawJustifiedText : public CGdiTestLowLevel
214 //DEF107985 The test for JustifiedText has been removed as it was a bad/useless test
216 class CGdiBoxText : public CGdiTestLowLevel
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);
229 TBuf<0x400> iBigBuffer;
232 class CGdiVertBoxText : public CGdiTestLowLevel
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);
245 TBuf<0x400> iBigBuffer;
248 class CGdiDottedLine : public CGdiTestLowLevel
252 EMinorMaxPatterns=3};
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);
263 static TUint iPatterns[EMainMaxPatterns];
264 static TInt iPattLens[EMainMaxPatterns];
266 TUint CGdiDottedLine::iPatterns[]={
272 TInt CGdiDottedLine::iPattLens[]={
279 class CTestWindow : public CBlankWindow
282 CTestWindow(TRgb aCol);
284 void ConstructL(TPoint aPos,TSize aSize,CTWinBase* aParent, CWindowGc& aGc );
287 class CGdiBlitMasked: public CGdiTestLowLevel
289 enum TNumMasks {ENumMasks=2};
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);
298 void doCreateTestBitmapL(CFbsBitmap *aBitmap, CFbsBitGc *&aGc, CFbsBitmapDevice *&aDevice, const TSize &aSize);
299 void createTestBitmapL(CFbsBitmap *&aBitmap, const TSize &aSize);
301 CFbsBitmap *iMask[ENumMasks];
304 CFbsBitmap *iScratch;
305 CFbsBitmapDevice *iScratchDevice;
306 CFbsBitGc *iScratchGc;
308 CFbsBitmap *iScratchMask;
309 CFbsBitmapDevice *iScratchMaskDevice;
310 CFbsBitGc *iScratchMaskGc;
313 CFbsBitmap *iCurrMask;
314 CGraphicsContext::TDrawMode iDrawMode;
317 class CTGdi : public CTWsGraphicsBase
320 CTGdi(CTestStep* aStep);
323 void GdiTestL(CGdiTestLowLevel *aTest);
324 void TestDefetct_DEF045746L();
325 void DrawTextOnWindow(const TDesC& aText,CTWin* aWin);
327 //from CTGraphicsStep
328 virtual void RunTestCaseL(TInt aCurTestCase);
330 void DoGdiTestL(const TRect &aRect, TInt aNum);
335 CGdiTestLowLevel *iGdiTest;
343 class CTGdiStep : public CTGraphicsStep
348 //from CTGraphicsStep
349 virtual CTGraphicsBase* CreateTestL();
352 _LIT(KTGdiStep,"TGdi");