sl@0
|
1 |
// Copyright (c) 1995-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 |
// Header for window server auto test code
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#ifndef __AUTO_H__
|
sl@0
|
20 |
#define __AUTO_H__
|
sl@0
|
21 |
|
sl@0
|
22 |
#include <e32std.h>
|
sl@0
|
23 |
#include <e32math.h>
|
sl@0
|
24 |
#include "../../SERVER/w32cmd.h"
|
sl@0
|
25 |
#include <w32std.h>
|
sl@0
|
26 |
#include "../tlib/testbase.h"
|
sl@0
|
27 |
#include <wsautotest.mbg>
|
sl@0
|
28 |
#include "TGraphicsHarness.h"
|
sl@0
|
29 |
#include "../../SERVER/openwfc/panics.h"
|
sl@0
|
30 |
|
sl@0
|
31 |
#define DISABLE_FAIL_DIALOG
|
sl@0
|
32 |
|
sl@0
|
33 |
#define TEST_BITMAP_NAME _L("Z:\\WSTEST\\WSAUTOTEST.MBM")
|
sl@0
|
34 |
|
sl@0
|
35 |
#define SCREEN_MODE_TESTING
|
sl@0
|
36 |
|
sl@0
|
37 |
#define LOG_MESSAGE(p) LogMessage(((TText8*)__FILE__), __LINE__,(p))
|
sl@0
|
38 |
#define LOG_MESSAGE2(p1,p2) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2))
|
sl@0
|
39 |
#define LOG_MESSAGE3(p1,p2,p3) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2),(p3))
|
sl@0
|
40 |
#define LOG_MESSAGE4(p1,p2,p3,p4) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2),(p3),(p4))
|
sl@0
|
41 |
#define LOG_MESSAGE5(p1,p2,p3,p4,p5) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2),(p3),(p4),(p5))
|
sl@0
|
42 |
#define LOG_MESSAGE6(p1,p2,p3,p4,p5,p6) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2),(p3),(p4),(p5),(p6))
|
sl@0
|
43 |
#define LOG_MESSAGE7(p1,p2,p3,p4,p5,p6,p7) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2),(p3),(p4),(p5),(p6),(p7))
|
sl@0
|
44 |
|
sl@0
|
45 |
// MB 23\11\04 The heap size was only 4k which was causing DSA step 7 to fail on HW.
|
sl@0
|
46 |
// Increased heap size to 8k
|
sl@0
|
47 |
// 23/02/2009 Again failing with no memory due to COLOR16MAP used.
|
sl@0
|
48 |
// Increased heap size to 16k
|
sl@0
|
49 |
LOCAL_D const TUint KOtherProcHeapSize=0x4000;
|
sl@0
|
50 |
LOCAL_D const TInt KAutoTestPriority=-20;
|
sl@0
|
51 |
|
sl@0
|
52 |
TBool DoCheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect);
|
sl@0
|
53 |
TBool DoCheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, TUint aFlags);
|
sl@0
|
54 |
TBool DoCheckRectRWin(RWindowBase &aWin1,RWindowBase &aWin2,const TRect &aRect);
|
sl@0
|
55 |
TBool DoCheckRectRWin(RWindowBase &aWin1,RWindowBase &aWin2,const TRect &aRect, TUint aFlags);
|
sl@0
|
56 |
TBool DoCheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2);
|
sl@0
|
57 |
TBool DoCheckRect(TPoint aPos1,TPoint aPos2,TSize aSize);
|
sl@0
|
58 |
|
sl@0
|
59 |
_LIT(KWSERV,"WSERV");
|
sl@0
|
60 |
_LIT(KW32,"W32");
|
sl@0
|
61 |
_LIT(KPlatsecBegin,"*PlatSec* ERROR - BEGIN NEGATIVE PLATSEC TESTING");
|
sl@0
|
62 |
_LIT(KPlatsecEnd,"*PlatSec* ERROR - END NEGATIVE PLATSEC TESTING");
|
sl@0
|
63 |
_LIT(KTestFontTypefaceName,"DejaVu Sans Condensed");
|
sl@0
|
64 |
|
sl@0
|
65 |
class TestClient;
|
sl@0
|
66 |
class CMinWin;
|
sl@0
|
67 |
class CTWsGraphicsBase;
|
sl@0
|
68 |
|
sl@0
|
69 |
enum TestState
|
sl@0
|
70 |
{
|
sl@0
|
71 |
EInvalid,
|
sl@0
|
72 |
ENext,
|
sl@0
|
73 |
EWait,
|
sl@0
|
74 |
EFinished
|
sl@0
|
75 |
};
|
sl@0
|
76 |
|
sl@0
|
77 |
enum TAutoPanics
|
sl@0
|
78 |
{
|
sl@0
|
79 |
EAutoPanicTestFailed,
|
sl@0
|
80 |
EAutoPanicPanicFailed,
|
sl@0
|
81 |
EAutoPanicTestRectsIndex,
|
sl@0
|
82 |
EAutoPanicTestRectsSection,
|
sl@0
|
83 |
EAutoPanicUnexpectedLeave,
|
sl@0
|
84 |
EAutoPanicTestBrushesIndex,
|
sl@0
|
85 |
EAutoPanicWindowType,
|
sl@0
|
86 |
EAutoPanicTooManyDownKeys,
|
sl@0
|
87 |
EAutoPanicInvalidEvent,
|
sl@0
|
88 |
EAutoFadeWindow,
|
sl@0
|
89 |
EAutoPanicWrongTest,
|
sl@0
|
90 |
EAutoPanicAnimError,
|
sl@0
|
91 |
ETManPanicPcFailed, //Panic use in a test copied from TMan
|
sl@0
|
92 |
EAutoPanicTestError, //Test returned bad return type
|
sl@0
|
93 |
EAutoPanicDirect, //Direct Screen Access logic state error
|
sl@0
|
94 |
EAutoPanicScanCapital, //Scan codes must not be lower case letters
|
sl@0
|
95 |
EAutoPanicRedrawStoring, //Inconsistent Redraw Storing Behaviour
|
sl@0
|
96 |
EAutoPanicRecalledCreateTestBaseL, //Called CreateTestBaseL twice
|
sl@0
|
97 |
EAutoPanicHeartBeatCursorRect, //Invalid size of rectangle in ChangeTransAndCheckHeartBeat
|
sl@0
|
98 |
EAutoPanicGroupWinHasChild, //Main test group window has child at start of test
|
sl@0
|
99 |
EAutoPanicPanicSetTrans, //Error setting transparency during panic tests
|
sl@0
|
100 |
EAutoPanicNoDigitiser, //Pointer event when the configuration has no digitiser
|
sl@0
|
101 |
};
|
sl@0
|
102 |
|
sl@0
|
103 |
enum TPanicExitReasons
|
sl@0
|
104 |
{
|
sl@0
|
105 |
EWsExitReasonBad,
|
sl@0
|
106 |
EWsExitReasonFinished,
|
sl@0
|
107 |
};
|
sl@0
|
108 |
|
sl@0
|
109 |
enum TAutoLeaves
|
sl@0
|
110 |
{
|
sl@0
|
111 |
ETestPassed=0,
|
sl@0
|
112 |
ETestFailed=1,
|
sl@0
|
113 |
};
|
sl@0
|
114 |
|
sl@0
|
115 |
typedef TInt (*TPanicFunction)(TInt aInt, TAny *aPtr);
|
sl@0
|
116 |
|
sl@0
|
117 |
struct SPanicParams
|
sl@0
|
118 |
{
|
sl@0
|
119 |
TInt num;
|
sl@0
|
120 |
TPanicFunction func;
|
sl@0
|
121 |
TAny *ptr;
|
sl@0
|
122 |
};
|
sl@0
|
123 |
|
sl@0
|
124 |
class LogWindow : public CTWin
|
sl@0
|
125 |
{
|
sl@0
|
126 |
enum
|
sl@0
|
127 |
{
|
sl@0
|
128 |
EDummyValue=-9999
|
sl@0
|
129 |
};
|
sl@0
|
130 |
public:
|
sl@0
|
131 |
LogWindow();
|
sl@0
|
132 |
void ConstructL(CTWinBase& aParent);
|
sl@0
|
133 |
void Draw();
|
sl@0
|
134 |
void DrawSubTitle();
|
sl@0
|
135 |
void DrawMessage();
|
sl@0
|
136 |
void LogTest(const TDesC &aTitle,TInt aNum);
|
sl@0
|
137 |
const TDesC& LogSubTest(const TDesC &aTitle,TInt aNum);
|
sl@0
|
138 |
const TDesC& LogMessage(TBool aLog,const TDesC& aText,TInt aNum=EDummyValue);
|
sl@0
|
139 |
private:
|
sl@0
|
140 |
TBuf<0x40> iTestTitle;
|
sl@0
|
141 |
TBuf<0x40> iSubTitle;
|
sl@0
|
142 |
TBuf<0x40> iMessage;
|
sl@0
|
143 |
TInt iTitleHeight;
|
sl@0
|
144 |
};
|
sl@0
|
145 |
|
sl@0
|
146 |
class CTestBase;
|
sl@0
|
147 |
|
sl@0
|
148 |
/**
|
sl@0
|
149 |
This class is a window that is used to fake a border around the TestWindow defined below.
|
sl@0
|
150 |
It simply draws an opaque black window on top of which the TestWindow will be drawn giving the illusion
|
sl@0
|
151 |
there is a border.
|
sl@0
|
152 |
|
sl@0
|
153 |
@see TestWindow
|
sl@0
|
154 |
@internalComponent
|
sl@0
|
155 |
@released
|
sl@0
|
156 |
*/
|
sl@0
|
157 |
class CBorderWindow : public CTWin
|
sl@0
|
158 |
{
|
sl@0
|
159 |
public:
|
sl@0
|
160 |
CBorderWindow();
|
sl@0
|
161 |
void ConstructL(CTWinBase& aParent);
|
sl@0
|
162 |
void Draw();
|
sl@0
|
163 |
};
|
sl@0
|
164 |
|
sl@0
|
165 |
class TestWindow : public CTWin
|
sl@0
|
166 |
{
|
sl@0
|
167 |
public:
|
sl@0
|
168 |
TestWindow();
|
sl@0
|
169 |
~TestWindow();
|
sl@0
|
170 |
void Draw();
|
sl@0
|
171 |
void SetUpL(TPoint aPos, TSize aSize, CTWinBase* aParent, CWindowGc& aGc);
|
sl@0
|
172 |
void ClearWin();
|
sl@0
|
173 |
void SetBorderExt(TPoint aPos, TSize aSize);
|
sl@0
|
174 |
CBorderWindow* GetBorderWin();
|
sl@0
|
175 |
private:
|
sl@0
|
176 |
CBorderWindow* iBorderWin;
|
sl@0
|
177 |
};
|
sl@0
|
178 |
|
sl@0
|
179 |
/**
|
sl@0
|
180 |
This class used to run each individual test before the migration to TEF.
|
sl@0
|
181 |
Now it doesn't do much and should probably be refactored.
|
sl@0
|
182 |
|
sl@0
|
183 |
@internalComponent
|
sl@0
|
184 |
@released
|
sl@0
|
185 |
*/
|
sl@0
|
186 |
class CTestDriver : public CBase
|
sl@0
|
187 |
{
|
sl@0
|
188 |
public:
|
sl@0
|
189 |
/** Factory function that returns a class derived from CTestDriver */
|
sl@0
|
190 |
static CTestDriver* CreateL(TInt aScreenNumber);
|
sl@0
|
191 |
virtual ~CTestDriver();
|
sl@0
|
192 |
|
sl@0
|
193 |
protected:
|
sl@0
|
194 |
CTestDriver(TInt aScreenNumber);
|
sl@0
|
195 |
|
sl@0
|
196 |
public:
|
sl@0
|
197 |
virtual void DoDisplayDialog(TDesC& timeBuf,TDesC& testReport) = 0;
|
sl@0
|
198 |
|
sl@0
|
199 |
void TestComplete2();
|
sl@0
|
200 |
void DestroyTest();
|
sl@0
|
201 |
|
sl@0
|
202 |
inline TInt ScreenNumber() {return iScreenNumber;}
|
sl@0
|
203 |
inline TInt NumberOfScreens() {return iNumberOfScreens;}
|
sl@0
|
204 |
|
sl@0
|
205 |
public:
|
sl@0
|
206 |
CTestBase *iTest;
|
sl@0
|
207 |
TInt iSubTestNum;
|
sl@0
|
208 |
static TInt iTestNum;
|
sl@0
|
209 |
protected:
|
sl@0
|
210 |
TTime iStartTime;
|
sl@0
|
211 |
TInt iScreenNumber;
|
sl@0
|
212 |
TInt iTestSize;
|
sl@0
|
213 |
TInt iNumberOfScreens;
|
sl@0
|
214 |
};
|
sl@0
|
215 |
|
sl@0
|
216 |
/** Variant of CTestDriver used when the tests are run on the primary screen.
|
sl@0
|
217 |
|
sl@0
|
218 |
@internalComponent
|
sl@0
|
219 |
@released
|
sl@0
|
220 |
*/
|
sl@0
|
221 |
class CTestDriverPrimary: public CTestDriver
|
sl@0
|
222 |
{
|
sl@0
|
223 |
public:
|
sl@0
|
224 |
CTestDriverPrimary(TInt aScreenNumber);
|
sl@0
|
225 |
void DoDisplayDialog(TDesC& timeBuf,TDesC& testReport);
|
sl@0
|
226 |
};
|
sl@0
|
227 |
|
sl@0
|
228 |
/** Variant of CTestDriver used when the tests are run on a secondary screen.
|
sl@0
|
229 |
|
sl@0
|
230 |
@internalComponent
|
sl@0
|
231 |
@released
|
sl@0
|
232 |
*/
|
sl@0
|
233 |
class CTestDriverSecondary : public CTestDriver
|
sl@0
|
234 |
{
|
sl@0
|
235 |
public:
|
sl@0
|
236 |
CTestDriverSecondary(TInt aScreenNumber);
|
sl@0
|
237 |
void DoDisplayDialog(TDesC& timeBuf,TDesC& testReport);
|
sl@0
|
238 |
};
|
sl@0
|
239 |
|
sl@0
|
240 |
/** List of rectangles use by TGDI.CPP and TRECTLIST.CPP.
|
sl@0
|
241 |
|
sl@0
|
242 |
Since only 2 tests make use of this shouldn't it be moved outside of the framework?
|
sl@0
|
243 |
|
sl@0
|
244 |
@internalComponent
|
sl@0
|
245 |
@released
|
sl@0
|
246 |
*/
|
sl@0
|
247 |
class TTestRects
|
sl@0
|
248 |
{
|
sl@0
|
249 |
private:
|
sl@0
|
250 |
enum TRectListLimits
|
sl@0
|
251 |
{
|
sl@0
|
252 |
EMaxRectFromList=64,
|
sl@0
|
253 |
EMaxRectZeroSize=73,
|
sl@0
|
254 |
EMaxRectWide=83,
|
sl@0
|
255 |
EMaxRectHigh=93
|
sl@0
|
256 |
};
|
sl@0
|
257 |
|
sl@0
|
258 |
public:
|
sl@0
|
259 |
void Construct(const RWindow &aWindow);
|
sl@0
|
260 |
TInt Count1() const;
|
sl@0
|
261 |
TInt Count2() const;
|
sl@0
|
262 |
TInt Count3() const;
|
sl@0
|
263 |
TRect operator[](TInt aIndex);
|
sl@0
|
264 |
static void ResetSeed();
|
sl@0
|
265 |
private:
|
sl@0
|
266 |
TInt Rnd(TInt aSize);
|
sl@0
|
267 |
TInt RndMax(TInt aSize);
|
sl@0
|
268 |
TInt RectCoord(TInt aSection,TInt aSize);
|
sl@0
|
269 |
void RectCoordPair(TInt &aTl, TInt &aBr, TInt aSection, TInt aSize);
|
sl@0
|
270 |
|
sl@0
|
271 |
private:
|
sl@0
|
272 |
TSize iSize;
|
sl@0
|
273 |
static TRect iList[64];
|
sl@0
|
274 |
static TInt64 iSeed;
|
sl@0
|
275 |
};
|
sl@0
|
276 |
|
sl@0
|
277 |
/**
|
sl@0
|
278 |
@internalComponent
|
sl@0
|
279 |
@released
|
sl@0
|
280 |
*/
|
sl@0
|
281 |
class CBitmap : public CBase
|
sl@0
|
282 |
{
|
sl@0
|
283 |
public:
|
sl@0
|
284 |
static CBitmap* NewLC(const TSize& aSizeInPixels,TDisplayMode aDispMode);
|
sl@0
|
285 |
static CBitmap* NewL(const TSize& aSizeInPixels,TDisplayMode aDispMode);
|
sl@0
|
286 |
static CBitmap* NewL(TInt aHandle);
|
sl@0
|
287 |
static CBitmap* NewL(TDesC& aFileName);
|
sl@0
|
288 |
~CBitmap();
|
sl@0
|
289 |
inline CFbsBitmap& Bitmap() const {return *iBitmap;}
|
sl@0
|
290 |
inline CFbsBitmapDevice& Device() const {return *iDevice;}
|
sl@0
|
291 |
inline CFbsBitGc& Gc() const {return *iGc;}
|
sl@0
|
292 |
private:
|
sl@0
|
293 |
static CBitmap* NewLC(TInt aHandle,const TSize& aSizeInPixels,TDisplayMode aDispMode);
|
sl@0
|
294 |
void ConstructL(TInt aHandle,const TSize& aSizeInPixels,TDisplayMode aDispMode);
|
sl@0
|
295 |
private:
|
sl@0
|
296 |
CFbsBitmap* iBitmap;
|
sl@0
|
297 |
CFbsBitmapDevice* iDevice;
|
sl@0
|
298 |
CFbsBitGc* iGc;
|
sl@0
|
299 |
};
|
sl@0
|
300 |
|
sl@0
|
301 |
/*TPartialRedrawType*/
|
sl@0
|
302 |
enum TPartialRedrawType
|
sl@0
|
303 |
{
|
sl@0
|
304 |
//redraw store type is not yet determined.
|
sl@0
|
305 |
EPartialRedraw_Unknown,
|
sl@0
|
306 |
//redraw store is discarded on invalidation and begin-redraw on a smaller rect.
|
sl@0
|
307 |
EPartialRedraw_None,
|
sl@0
|
308 |
// redraw store is preserved on invalidation and begin-redraw on a smaller rect.
|
sl@0
|
309 |
EPartialRedraw_PreserveStoredCmds,
|
sl@0
|
310 |
// redraw store is appended with partial redraw commands, and old redraw store is suitably modified.
|
sl@0
|
311 |
EPartialRedraw_FullRedrawSupport
|
sl@0
|
312 |
};
|
sl@0
|
313 |
|
sl@0
|
314 |
class CTestBase : public CBase
|
sl@0
|
315 |
{
|
sl@0
|
316 |
public:
|
sl@0
|
317 |
enum TPriorites
|
sl@0
|
318 |
{
|
sl@0
|
319 |
EAutoTestPriority=KAutoTestPriority
|
sl@0
|
320 |
};
|
sl@0
|
321 |
enum TTestLevel
|
sl@0
|
322 |
{
|
sl@0
|
323 |
ELevelQuick, // Quick check on main cases for each function
|
sl@0
|
324 |
ELevelNormal, // Suitable test level for internal release
|
sl@0
|
325 |
ELevelRelease, // Thorough test suitable for official releases
|
sl@0
|
326 |
ELevelMega, // Really OTT, takes forever to run, leave it going over the weekend sort of tests
|
sl@0
|
327 |
};
|
sl@0
|
328 |
public:
|
sl@0
|
329 |
CTestBase(const TDesC &aTitle,CTWsGraphicsBase* aTestBase);
|
sl@0
|
330 |
~CTestBase();
|
sl@0
|
331 |
void StartTestL(TInt aNum, CTestDriver* aDriver, TTestLevel aLevel);
|
sl@0
|
332 |
void LogSubTest(const TDesC &aTitle);
|
sl@0
|
333 |
void LogMessage(TInt aValue);
|
sl@0
|
334 |
void LogSubState(TInt aSubState);
|
sl@0
|
335 |
TInt LaunchPanicThread(RThread &aThread, SPanicParams *aPtr);
|
sl@0
|
336 |
TInt TestPanicL(SPanicParams *aPtr, TInt aExitReason, const TDesC &aCategory, TBool* aTestFinished=NULL);
|
sl@0
|
337 |
TInt TestPanicL(TPanicFunction aFunction, TInt aExitReason, TInt aInt, TAny *aPtr, const TDesC &aCategory, TBool* aTestFinished=NULL);
|
sl@0
|
338 |
TInt TestWsPanicL(TPanicFunction aFunction, TClientPanic aExitReason, TInt aInt, TAny *aPtr=NULL, TBool* aTestFinished=NULL);
|
sl@0
|
339 |
TInt TestW32PanicL(TPanicFunction aFunction, TW32Panic aExitReason, TInt aInt, TAny *aPtr, TBool* aTestFinished=NULL);
|
sl@0
|
340 |
TInt TestWservPanicL(TPanicFunction aFunction, TWservPanic aExitReason, TInt aInt, TAny *aPtr);
|
sl@0
|
341 |
void TriggerFail();
|
sl@0
|
342 |
static void DrawTestBackground(TBool aInvertColours, const TSize &aSize, TInt aGrays=16);
|
sl@0
|
343 |
inline CTestDriver* Driver();
|
sl@0
|
344 |
void SimulatePointer(TRawEvent::TType aType, TInt aX, TInt aY);
|
sl@0
|
345 |
TBool ConfigurationSupportsPointerEventTesting() const;
|
sl@0
|
346 |
void SimulateEvent(TRawEvent::TType aType);
|
sl@0
|
347 |
void LogColors(const CBitmapDevice& aDevice,TPoint aBasePoint, TPoint aStartPoint, TPoint aEndPoint);
|
sl@0
|
348 |
void LogColors4(const CBitmapDevice& aDevice,TPoint aStartPoint,TInt aLen);
|
sl@0
|
349 |
inline TInt ScreenNumber() {return iScreenNumber;}
|
sl@0
|
350 |
TPartialRedrawType RedrawStoreTypeL();
|
sl@0
|
351 |
TBool IsFullRomL();
|
sl@0
|
352 |
void SimulateKeyDownUpWithModifiers(TInt aScanCode,TUint aModifiers);
|
sl@0
|
353 |
void SimulatePointerDownUp(TInt aX, TInt aY);
|
sl@0
|
354 |
void SimulateKeyDownUp(TInt aScanCode);
|
sl@0
|
355 |
void SimulateKey(TRawEvent::TType aType, TInt aScanCode);
|
sl@0
|
356 |
void DelayIfFullRomL();
|
sl@0
|
357 |
void SetUpMember(TSpriteMember &aMember);
|
sl@0
|
358 |
void AbortL();
|
sl@0
|
359 |
void LogLeave(TInt aErr);
|
sl@0
|
360 |
void CloseAllPanicWindows();
|
sl@0
|
361 |
const TSize& StdTestWindowSize();
|
sl@0
|
362 |
TInt MaxGrays() const;
|
sl@0
|
363 |
TInt MaxColors() const;
|
sl@0
|
364 |
TInt SaveScreen(const TDesC& aFileName);
|
sl@0
|
365 |
TInt SaveScreen(const TDesC& aFileName,const TSize& aScreenSize,TDisplayMode aColorDepth);
|
sl@0
|
366 |
protected:
|
sl@0
|
367 |
void UpdateTestResults(TInt aNoOfTest, TInt aNoOfTestPass);
|
sl@0
|
368 |
void SaveScreenL(const TDesC& aFileName,const TSize& aScreenSize,TDisplayMode aColorDepth);
|
sl@0
|
369 |
public:
|
sl@0
|
370 |
static TInt iNumberTestsPass;
|
sl@0
|
371 |
static TInt iNumberTests;
|
sl@0
|
372 |
TInt iState;
|
sl@0
|
373 |
TInt iScreenNumber;
|
sl@0
|
374 |
static TInt iScreenNo;
|
sl@0
|
375 |
TTestRects iTestRects;
|
sl@0
|
376 |
static TRect iNormalPointerCursorArea;
|
sl@0
|
377 |
TBuf<0x40> iSubTitle;
|
sl@0
|
378 |
TTestLevel iTestLevel;
|
sl@0
|
379 |
static TInt iNumberOfGrpWndsOnPrimaryScreenWithZeroPriority; // Will be used in TGWHANDLE test.
|
sl@0
|
380 |
protected:
|
sl@0
|
381 |
CTestDriver* iDriver;
|
sl@0
|
382 |
private:
|
sl@0
|
383 |
TBuf<0x40> iTitle;
|
sl@0
|
384 |
CTWsGraphicsBase* iTestBase;
|
sl@0
|
385 |
/**
|
sl@0
|
386 |
Several tests use 3 windows : one is a log window, one is a reference window
|
sl@0
|
387 |
and one is the actual output of the test. All these windows have the same width which is roughly
|
sl@0
|
388 |
1/3 of the screen. They also have the same height which is roughly equal to the screen height.
|
sl@0
|
389 |
*/
|
sl@0
|
390 |
TSize iStdTestWindowSize;
|
sl@0
|
391 |
CMinWin* iMinWin;
|
sl@0
|
392 |
TInt iTestNum;
|
sl@0
|
393 |
TBool iFail; // Used to trigger failures to test test code.
|
sl@0
|
394 |
TInt iThreadNumber;
|
sl@0
|
395 |
/**
|
sl@0
|
396 |
The type of redraw store in use. Static members so that RedrawStoreTypeL computes
|
sl@0
|
397 |
this value only once and then returns the cached result as this remains the same for
|
sl@0
|
398 |
the entire test run.
|
sl@0
|
399 |
*/
|
sl@0
|
400 |
static TPartialRedrawType iRedrawType;
|
sl@0
|
401 |
/** The number of greys available in the richest grey mode. */
|
sl@0
|
402 |
static TInt iMaxGrays;
|
sl@0
|
403 |
/** The number of colours available in the richest supported colour mode. */
|
sl@0
|
404 |
static TInt iMaxColors;
|
sl@0
|
405 |
};
|
sl@0
|
406 |
|
sl@0
|
407 |
class CTWsGraphicsBase : public CTGraphicsBase
|
sl@0
|
408 |
{
|
sl@0
|
409 |
public:
|
sl@0
|
410 |
CTWsGraphicsBase(CTestStep* aStep);
|
sl@0
|
411 |
~CTWsGraphicsBase();
|
sl@0
|
412 |
void CreateTestBaseL(CTTMSGraphicsStep* aTmsStep);
|
sl@0
|
413 |
inline CTestBase *TestBase() const {return(iTest);};
|
sl@0
|
414 |
void TestComplete();
|
sl@0
|
415 |
void LogMessage(const TText8* aFile,TInt aLine,TRefByValue<const TDesC> aFmt,...);
|
sl@0
|
416 |
TInt GetScreenFromIni() const;
|
sl@0
|
417 |
protected:
|
sl@0
|
418 |
void CheckRect(TPoint aPos1,TPoint aPos2,TSize aSize, const TDesC *aErrorMsg=NULL);
|
sl@0
|
419 |
void CheckRect(TPoint aPos1,TPoint aPos2,TSize aSize, const TDesC &aErrorMsg);
|
sl@0
|
420 |
void CheckRectNoMatch(TPoint aPos1,TPoint aPos2,TSize aSize, const TDesC *aErrorMsg=NULL);
|
sl@0
|
421 |
void CheckRectNoMatch(TPoint aPos1,TPoint aPos2,TSize aSize, const TDesC &aErrorMsg);
|
sl@0
|
422 |
void CheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2, const TDesC *aErrorMsg=NULL);
|
sl@0
|
423 |
void CheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2, const TDesC &aErrorMsg);
|
sl@0
|
424 |
void CheckRectNoMatch(CTBaseWin *aWin1,CTBaseWin *aWin2, const TDesC *aErrorMsg=NULL);
|
sl@0
|
425 |
void CheckRectNoMatch(CTBaseWin *aWin1,CTBaseWin *aWin2, const TDesC &aErrorMsg);
|
sl@0
|
426 |
TBool CheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, const TDesC *aErrorMsg=NULL);
|
sl@0
|
427 |
TBool CheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, const TDesC &aErrorMsg);
|
sl@0
|
428 |
void CheckRectNoMatch(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, const TDesC *aErrorMsg=NULL);
|
sl@0
|
429 |
void CheckRectNoMatch(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, const TDesC &aErrorMsg);
|
sl@0
|
430 |
TBool CompareWindows(const TDesC *aErrorMsg=NULL);
|
sl@0
|
431 |
TBool CompareWindows(const TDesC &aErrorMsg);
|
sl@0
|
432 |
void CompareWindows(const TRect &aRect, const TDesC *aErrorMsg=NULL);
|
sl@0
|
433 |
void CompareWindows(const TRect &aRect, const TDesC &aErrorMsg);
|
sl@0
|
434 |
void CompareWindowsSoftFailWinscw(const TText8* aFile, TInt aLine);
|
sl@0
|
435 |
const TSize& StdTestWindowSize();
|
sl@0
|
436 |
TInt MaxGrays() const;
|
sl@0
|
437 |
TInt MaxColors() const;
|
sl@0
|
438 |
private:
|
sl@0
|
439 |
TBool CheckRetValue(TBool aPass,const TDesC* aErrorMsg,const TDesC& aErrorFunction);
|
sl@0
|
440 |
protected:
|
sl@0
|
441 |
CTestBase* iTest;
|
sl@0
|
442 |
CTTMSGraphicsStep* iTmsStep;
|
sl@0
|
443 |
};
|
sl@0
|
444 |
|
sl@0
|
445 |
class TestWindowGroup : public CTWindowGroup
|
sl@0
|
446 |
{
|
sl@0
|
447 |
public:
|
sl@0
|
448 |
TestWindowGroup(CTClient *aClient);
|
sl@0
|
449 |
void BecomeOwning();
|
sl@0
|
450 |
void KeyL(const TKeyEvent &aKey,const TTime &aTime);
|
sl@0
|
451 |
void KeyDownL(const TKeyEvent &aKey,const TTime &aTime);
|
sl@0
|
452 |
void KeyUpL(const TKeyEvent &aKey,const TTime &aTime);
|
sl@0
|
453 |
};
|
sl@0
|
454 |
|
sl@0
|
455 |
class TestClient : public CTClient
|
sl@0
|
456 |
{
|
sl@0
|
457 |
public:
|
sl@0
|
458 |
TestClient();
|
sl@0
|
459 |
~TestClient();
|
sl@0
|
460 |
void ConstructL(); // virtual from CTClient
|
sl@0
|
461 |
void KeyL(const TKeyEvent &aKey,const TTime &aTime);
|
sl@0
|
462 |
void Shutdown();
|
sl@0
|
463 |
inline CTestDriver* Driver();
|
sl@0
|
464 |
TBool WaitForEvent();
|
sl@0
|
465 |
TBool IsEventWaiting();
|
sl@0
|
466 |
void LogAvailableScreenModeL();
|
sl@0
|
467 |
void TestWsSetBufferSizeL();
|
sl@0
|
468 |
void TestWsSetMaxBufferSizeL();
|
sl@0
|
469 |
inline LogWindow& StdLogWindow() {return *iStdLogWindow;}
|
sl@0
|
470 |
void SetTestClientScreenMode(TInt aMode);
|
sl@0
|
471 |
void UpdateTestClientScreenMode();
|
sl@0
|
472 |
public:
|
sl@0
|
473 |
RArray<TInt> iScreenModes;
|
sl@0
|
474 |
|
sl@0
|
475 |
private:
|
sl@0
|
476 |
/**
|
sl@0
|
477 |
Several tests use 3 windows : one is a log window, one is a reference window
|
sl@0
|
478 |
and one is the actual output of the test. This member is the log window.
|
sl@0
|
479 |
*/
|
sl@0
|
480 |
LogWindow* iStdLogWindow;
|
sl@0
|
481 |
CTestDriver* iDriver;
|
sl@0
|
482 |
};
|
sl@0
|
483 |
|
sl@0
|
484 |
class TThreadStartUp
|
sl@0
|
485 |
{
|
sl@0
|
486 |
public:
|
sl@0
|
487 |
TThreadStartUp() :iInitFunction(0), iParam(0) {}
|
sl@0
|
488 |
TThreadStartUp(TThreadFunction aInitFunction,TAny* aParam) :iInitFunction(aInitFunction), iParam(aParam) {}
|
sl@0
|
489 |
public:
|
sl@0
|
490 |
TThreadFunction iInitFunction; //The call to this fn will prepare a cleanup stack, but this function should not leave.
|
sl@0
|
491 |
TAny* iParam;
|
sl@0
|
492 |
};
|
sl@0
|
493 |
|
sl@0
|
494 |
#if defined(__WINS__)
|
sl@0
|
495 |
const TOwnerType KOwnerType=EOwnerThread;
|
sl@0
|
496 |
#else
|
sl@0
|
497 |
const TOwnerType KOwnerType=EOwnerProcess;
|
sl@0
|
498 |
#endif
|
sl@0
|
499 |
|
sl@0
|
500 |
typedef TBuf<32> TBufArg;
|
sl@0
|
501 |
|
sl@0
|
502 |
class CProcess : public CBase
|
sl@0
|
503 |
{
|
sl@0
|
504 |
public:
|
sl@0
|
505 |
enum
|
sl@0
|
506 |
{
|
sl@0
|
507 |
eProcessPriortyTest,
|
sl@0
|
508 |
eProcessKeyTest,
|
sl@0
|
509 |
eProcessDirectTest,
|
sl@0
|
510 |
eProcessMultiDisplayTest,
|
sl@0
|
511 |
eNumProcessCalls //Must be last one
|
sl@0
|
512 |
};
|
sl@0
|
513 |
struct TInitialFunction
|
sl@0
|
514 |
{
|
sl@0
|
515 |
inline TInitialFunction(const TDesC& aParam,TThreadFunction aFunction) :iParam(aParam), iFunction(aFunction) {}
|
sl@0
|
516 |
TBuf<16> iParam;
|
sl@0
|
517 |
TThreadFunction iFunction;
|
sl@0
|
518 |
};
|
sl@0
|
519 |
public:
|
sl@0
|
520 |
static TInt Start(const TWinCommand& aParam);
|
sl@0
|
521 |
static CProcess* NewL(TInt aFunctionNo,TInt aScreenNumber=KDefaultScreen);
|
sl@0
|
522 |
static CProcess* NewTL(TInt aFunctionNo,TInt aScreenNumber=KDefaultScreen,TRequestStatus* aClientRequestStatus = NULL);
|
sl@0
|
523 |
static CProcess* NewThreadL(const TDesC& aName,TThreadFunction aFunction,TThreadStartUp* aPtr
|
sl@0
|
524 |
,TRequestStatus* aStatus);
|
sl@0
|
525 |
static CProcess* NewThreadL(const TDesC& aName,TThreadStartUp* aPtr);
|
sl@0
|
526 |
static CProcess* NewThreadRendezvousL(const TDesC& aName,TThreadFunction aFunction,TThreadStartUp* aPtr,TRequestStatus* aLogonStatus,TRequestStatus& aRendezvousStatus);
|
sl@0
|
527 |
static CProcess* NewThreadRendezvousL(const TDesC& aName,TThreadStartUp* aPtr,TRequestStatus& aRendezvousStatus);
|
sl@0
|
528 |
|
sl@0
|
529 |
static CProcess* NewSimpleThreadL(const TDesC& aName,TThreadStartUp* aPtr,TRequestStatus* aStatus=NULL);
|
sl@0
|
530 |
void ConstructL(TInt aFunctionNo,TInt aScreenNumber=KDefaultScreen);
|
sl@0
|
531 |
void ConstructTL(TInt aFunctionNo,TInt aScreenNumber=KDefaultScreen,TRequestStatus* aStatus=NULL);
|
sl@0
|
532 |
void ConstructL(const TDesC& aName,TThreadFunction aFunction,TThreadStartUp* aPtr,TRequestStatus* aStatus);
|
sl@0
|
533 |
void ConstructRendezvousL(const TDesC& aName,TThreadFunction aFunction,TThreadStartUp* aPtr,TRequestStatus* aLogonStatus,TRequestStatus& aRendezvousStatus);
|
sl@0
|
534 |
|
sl@0
|
535 |
~CProcess();
|
sl@0
|
536 |
void Logon(TRequestStatus& aStatus) const;
|
sl@0
|
537 |
void Terminate(TInt aReason);
|
sl@0
|
538 |
TBool StillAlive();
|
sl@0
|
539 |
void LeaveIfDied();
|
sl@0
|
540 |
static TBool ProcessDied(TInt aScreenNo=KDefaultScreen);
|
sl@0
|
541 |
private:
|
sl@0
|
542 |
enum
|
sl@0
|
543 |
{
|
sl@0
|
544 |
eOtherCreated=0x0001,
|
sl@0
|
545 |
eThreadCreated=0x0002,
|
sl@0
|
546 |
};
|
sl@0
|
547 |
private:
|
sl@0
|
548 |
static TInt ThreadInit(TAny *aPtr);
|
sl@0
|
549 |
static void InitialiseL(TThreadStartUp* aPtr);
|
sl@0
|
550 |
static TInt SimpleThreadInit(TAny *aPtr);
|
sl@0
|
551 |
void Close();
|
sl@0
|
552 |
static void GetProcArg(const TWinCommand& aParam,TBufArg& aProcArg);
|
sl@0
|
553 |
static void GetScreenArg(const TWinCommand& aParam, TInt& aScreenArg);
|
sl@0
|
554 |
|
sl@0
|
555 |
private:
|
sl@0
|
556 |
TUint iCreated;
|
sl@0
|
557 |
RProcess iOther;
|
sl@0
|
558 |
RThread iThread;
|
sl@0
|
559 |
static TInitialFunction iFunctions[eNumProcessCalls];
|
sl@0
|
560 |
};
|
sl@0
|
561 |
|
sl@0
|
562 |
GLREF_D TestWindow* BaseWin;
|
sl@0
|
563 |
GLREF_D TestWindow* TestWin;
|
sl@0
|
564 |
GLREF_D TestClient* TheClient;
|
sl@0
|
565 |
GLREF_D CWindowGc* TheGc;
|
sl@0
|
566 |
|
sl@0
|
567 |
GLREF_C void AutoPanic(TInt aPanic);
|
sl@0
|
568 |
GLREF_C void CleanUpWindow(TAny *aWindow);
|
sl@0
|
569 |
GLREF_C void PushWindowL(RWindowTreeNode *aWindow);
|
sl@0
|
570 |
GLREF_C TBool OpacityAndAlphaSupportedL();
|
sl@0
|
571 |
GLREF_C TInt TransparencySupportedL();
|
sl@0
|
572 |
GLREF_C TInt CheckScalingSupportedOrNot();
|
sl@0
|
573 |
GLREF_C TBool CheckNonZeroOriginsSupportedOrNot();
|
sl@0
|
574 |
GLREF_C TPoint PhysicalToLogical(TPoint aPhysicalPtMinusOrigin,TSize aScale);
|
sl@0
|
575 |
GLREF_C TPtrC DisplayModeAsString(TDisplayMode aMode);
|
sl@0
|
576 |
GLREF_C TBool LossyCheckBlankBitmap(const CFbsBitmap& aBitmap, const TRect aArea, const TRgb aCheckColor, TBool aLossyCompare=ETrue);
|
sl@0
|
577 |
GLREF_C TBool LossyCompareBitmap(const CFbsBitmap& aBitmap1, const CFbsBitmap& aBitmap2, const TRect aCompareRect, TBool aLossyCompare=ETrue);
|
sl@0
|
578 |
GLDEF_C TBool LossyCompareBitmapRecord(CFbsBitmap& aBitmap1, CFbsBitmap& aBitmap2, const TRect aCompareRect, TBool aLossyCompare, TInt& aPixelsDifferent, CTestExecuteLogger& aLogger);
|
sl@0
|
579 |
GLREF_C TBool LossyCheckBlankWindow(const CWsScreenDevice& aScreen, CFbsBitmap& aBitmap, const TRect aArea, const TRgb aCheckColor);
|
sl@0
|
580 |
GLREF_C TBool LossyCompareWindow(const CWsScreenDevice& aScreen, CFbsBitmap& aBitmap1, CFbsBitmap& aBitmap2, const TRect aCompareRect);
|
sl@0
|
581 |
|
sl@0
|
582 |
#define LogText(S) {_LIT(String__LINE__,S); Logger.Log(String__LINE__);}
|
sl@0
|
583 |
#define LogFormat(S) {Logger.Log(S);}
|
sl@0
|
584 |
|
sl@0
|
585 |
inline CTestDriver* CTestBase::Driver()
|
sl@0
|
586 |
{
|
sl@0
|
587 |
return iDriver;
|
sl@0
|
588 |
}
|
sl@0
|
589 |
|
sl@0
|
590 |
class CTransWindow : public CBlankWindow
|
sl@0
|
591 |
{
|
sl@0
|
592 |
public:
|
sl@0
|
593 |
static CTransWindow* NewL(RPointerArray<CTransWindow>& aWindows,TRgb aColor,TRect aPos);
|
sl@0
|
594 |
static CTransWindow* NewL(CTWinBase* aParent,TRgb aColor,TRect aPos,TDisplayMode* aDisplayMode);
|
sl@0
|
595 |
static CTransWindow* NewL(CTWinBase* aParent,TRgb aColor,TDisplayMode* aDisplayMode);
|
sl@0
|
596 |
void ToggleVisibility();
|
sl@0
|
597 |
static void SetOrdinal(RPointerArray<CTransWindow>& aWindows,TInt aOldPos,TInt aNewPos);
|
sl@0
|
598 |
inline TRgb Color() {return iCol;}
|
sl@0
|
599 |
inline TBool IsVisible() {return iVisible;}
|
sl@0
|
600 |
void SetShadowDisabled(TBool aState);
|
sl@0
|
601 |
inline TBool IsShadowing() {return iShadowing;}
|
sl@0
|
602 |
inline TBool ShadowHeight() {return iShadowHight;}
|
sl@0
|
603 |
inline void SetPosOffset(TPoint aOffset) {iPosOffset=aOffset;}
|
sl@0
|
604 |
virtual void Draw();
|
sl@0
|
605 |
void SetDrawOpaque(TBool aDrawOpaque) { iDrawOpaque = aDrawOpaque; }
|
sl@0
|
606 |
TBool DrawOpaque() const { return iDrawOpaque; }
|
sl@0
|
607 |
//Virtual functions from CTWinBase overridden in CTBaseWin
|
sl@0
|
608 |
void AdjustShadow(TInt aAdjust);
|
sl@0
|
609 |
TPoint Position() const;
|
sl@0
|
610 |
inline TInt TransparentError() {return iError;}
|
sl@0
|
611 |
private:
|
sl@0
|
612 |
CTransWindow(TRgb aColor) :CBlankWindow(aColor), iVisible(ETrue) {}
|
sl@0
|
613 |
//Virtual function from CTBaseWin
|
sl@0
|
614 |
void InitWin();
|
sl@0
|
615 |
private:
|
sl@0
|
616 |
TBool iVisible;
|
sl@0
|
617 |
TBool iShadowing;
|
sl@0
|
618 |
TBool iDrawOpaque;
|
sl@0
|
619 |
TInt iShadowHight;
|
sl@0
|
620 |
TPoint iPosOffset;
|
sl@0
|
621 |
TInt iError;
|
sl@0
|
622 |
};
|
sl@0
|
623 |
|
sl@0
|
624 |
class CMinWin : public CBase
|
sl@0
|
625 |
{
|
sl@0
|
626 |
public:
|
sl@0
|
627 |
CMinWin(TInt aScreenNo);
|
sl@0
|
628 |
~CMinWin();
|
sl@0
|
629 |
void ConstructL();
|
sl@0
|
630 |
void Draw(const TRect& aRect);
|
sl@0
|
631 |
private:
|
sl@0
|
632 |
RWsSession iWs;
|
sl@0
|
633 |
RWindow iWin;
|
sl@0
|
634 |
RWindowGroup iGroup;
|
sl@0
|
635 |
CWsScreenDevice* iScr;
|
sl@0
|
636 |
TInt iScreenNo;
|
sl@0
|
637 |
TRect iRect;
|
sl@0
|
638 |
CWindowGc* iGc;
|
sl@0
|
639 |
};
|
sl@0
|
640 |
|
sl@0
|
641 |
class CTimeOut : public CTimer
|
sl@0
|
642 |
{
|
sl@0
|
643 |
public:
|
sl@0
|
644 |
inline CTimeOut(): CTimer((EPriorityLow+EPriorityIdle)/2) {}
|
sl@0
|
645 |
void ConstructL();
|
sl@0
|
646 |
void Start(TTimeIntervalMicroSeconds32 aInterval,TCallBack aCallBack);
|
sl@0
|
647 |
//Pure virtual from CActive
|
sl@0
|
648 |
void RunL();
|
sl@0
|
649 |
private:
|
sl@0
|
650 |
TCallBack iCallBack;
|
sl@0
|
651 |
};
|
sl@0
|
652 |
|
sl@0
|
653 |
#define COMPARE_WINDOWS_SOFTFAIL_WINSCW CompareWindowsSoftFailWinscw((TText8*)__FILE__, __LINE__)
|
sl@0
|
654 |
|
sl@0
|
655 |
#define __WS_CONSTRUCT_STEP__(a) \
|
sl@0
|
656 |
CT##a##Step::CT##a##Step() \
|
sl@0
|
657 |
{ \
|
sl@0
|
658 |
SetTestStepName(KT##a##Step); \
|
sl@0
|
659 |
SetLogHeapInfo(ETrue); \
|
sl@0
|
660 |
} \
|
sl@0
|
661 |
\
|
sl@0
|
662 |
CTGraphicsBase* CT##a##Step::CreateTestL() \
|
sl@0
|
663 |
{ \
|
sl@0
|
664 |
CTWsGraphicsBase* test=new (ELeave) CT##a (this); \
|
sl@0
|
665 |
test->CreateTestBaseL(this);\
|
sl@0
|
666 |
return test;\
|
sl@0
|
667 |
}
|
sl@0
|
668 |
|
sl@0
|
669 |
#endif
|