os/graphics/windowing/windowserver/test/tauto/openwfc/AUTO.H
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/openwfc/AUTO.H	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,669 @@
     1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Header for window server auto test code
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +
    1.22 +#ifndef __AUTO_H__
    1.23 +#define __AUTO_H__
    1.24 +
    1.25 +#include <e32std.h>
    1.26 +#include <e32math.h>
    1.27 +#include "../../SERVER/w32cmd.h"
    1.28 +#include <w32std.h>
    1.29 +#include "../tlib/testbase.h"
    1.30 +#include <wsautotest.mbg>
    1.31 +#include "TGraphicsHarness.h"
    1.32 +#include "../../SERVER/openwfc/panics.h"
    1.33 +
    1.34 +#define DISABLE_FAIL_DIALOG
    1.35 +
    1.36 +#define TEST_BITMAP_NAME _L("Z:\\WSTEST\\WSAUTOTEST.MBM")
    1.37 +
    1.38 +#define SCREEN_MODE_TESTING
    1.39 +
    1.40 +#define LOG_MESSAGE(p) LogMessage(((TText8*)__FILE__), __LINE__,(p))
    1.41 +#define LOG_MESSAGE2(p1,p2) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2))
    1.42 +#define LOG_MESSAGE3(p1,p2,p3) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2),(p3))
    1.43 +#define LOG_MESSAGE4(p1,p2,p3,p4) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2),(p3),(p4))
    1.44 +#define LOG_MESSAGE5(p1,p2,p3,p4,p5) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2),(p3),(p4),(p5))
    1.45 +#define LOG_MESSAGE6(p1,p2,p3,p4,p5,p6) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2),(p3),(p4),(p5),(p6))
    1.46 +#define LOG_MESSAGE7(p1,p2,p3,p4,p5,p6,p7) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2),(p3),(p4),(p5),(p6),(p7))
    1.47 +
    1.48 +// MB 23\11\04 The heap size was only 4k which was causing DSA step 7 to fail on HW.
    1.49 +// Increased heap size to 8k
    1.50 +// 23/02/2009 Again failing with no memory due to COLOR16MAP used. 
    1.51 +// Increased heap size to 16k
    1.52 +LOCAL_D const TUint KOtherProcHeapSize=0x4000;
    1.53 +LOCAL_D const TInt KAutoTestPriority=-20;
    1.54 +
    1.55 +TBool DoCheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect);
    1.56 +TBool DoCheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, TUint aFlags);
    1.57 +TBool DoCheckRectRWin(RWindowBase &aWin1,RWindowBase &aWin2,const TRect &aRect);
    1.58 +TBool DoCheckRectRWin(RWindowBase &aWin1,RWindowBase &aWin2,const TRect &aRect, TUint aFlags);
    1.59 +TBool DoCheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2);
    1.60 +TBool DoCheckRect(TPoint aPos1,TPoint aPos2,TSize aSize);
    1.61 +
    1.62 +_LIT(KWSERV,"WSERV");
    1.63 +_LIT(KW32,"W32");
    1.64 +_LIT(KPlatsecBegin,"*PlatSec* ERROR - BEGIN NEGATIVE PLATSEC TESTING");
    1.65 +_LIT(KPlatsecEnd,"*PlatSec* ERROR - END NEGATIVE PLATSEC TESTING");
    1.66 +_LIT(KTestFontTypefaceName,"DejaVu Sans Condensed");
    1.67 +
    1.68 +class TestClient;
    1.69 +class CMinWin;
    1.70 +class CTWsGraphicsBase;
    1.71 +
    1.72 +enum TestState
    1.73 +	{
    1.74 +	EInvalid,
    1.75 +	ENext,
    1.76 +	EWait,
    1.77 +	EFinished
    1.78 +	};
    1.79 +
    1.80 +enum TAutoPanics
    1.81 +	{
    1.82 +	EAutoPanicTestFailed,
    1.83 +	EAutoPanicPanicFailed,
    1.84 +	EAutoPanicTestRectsIndex,
    1.85 +	EAutoPanicTestRectsSection,
    1.86 +	EAutoPanicUnexpectedLeave,
    1.87 +	EAutoPanicTestBrushesIndex,
    1.88 +	EAutoPanicWindowType,
    1.89 +	EAutoPanicTooManyDownKeys,
    1.90 +	EAutoPanicInvalidEvent,
    1.91 +	EAutoFadeWindow,
    1.92 +	EAutoPanicWrongTest,
    1.93 +	EAutoPanicAnimError,
    1.94 +	ETManPanicPcFailed,		              //Panic use in a test copied from TMan
    1.95 +	EAutoPanicTestError,	              //Test returned bad return type
    1.96 +	EAutoPanicDirect,		              //Direct Screen Access logic state error
    1.97 +	EAutoPanicScanCapital,	              //Scan codes must not be lower case letters
    1.98 +	EAutoPanicRedrawStoring,              //Inconsistent Redraw Storing Behaviour
    1.99 + 	EAutoPanicRecalledCreateTestBaseL,    //Called CreateTestBaseL twice
   1.100 + 	EAutoPanicHeartBeatCursorRect,        //Invalid size of rectangle in ChangeTransAndCheckHeartBeat
   1.101 +	EAutoPanicGroupWinHasChild,           //Main test group window has child at start of test
   1.102 +  	EAutoPanicPanicSetTrans,              //Error setting transparency during panic tests
   1.103 +  	EAutoPanicNoDigitiser,                //Pointer event when the configuration has no digitiser
   1.104 +	};
   1.105 +
   1.106 +enum TPanicExitReasons
   1.107 +	{
   1.108 +	EWsExitReasonBad,
   1.109 +	EWsExitReasonFinished,
   1.110 +	};
   1.111 +
   1.112 +enum TAutoLeaves
   1.113 +	{
   1.114 +	ETestPassed=0,
   1.115 +	ETestFailed=1,
   1.116 +	};
   1.117 +
   1.118 +typedef TInt (*TPanicFunction)(TInt aInt, TAny *aPtr);
   1.119 +
   1.120 +struct SPanicParams
   1.121 +	{
   1.122 +	TInt num;
   1.123 +	TPanicFunction func;
   1.124 +	TAny *ptr;
   1.125 +	};
   1.126 +
   1.127 +class LogWindow : public CTWin
   1.128 +	{
   1.129 +	enum
   1.130 +		{
   1.131 +		EDummyValue=-9999
   1.132 +		};
   1.133 +public:
   1.134 +	LogWindow();
   1.135 +	void ConstructL(CTWinBase& aParent);
   1.136 +	void Draw();
   1.137 +	void DrawSubTitle();
   1.138 +	void DrawMessage();
   1.139 +	void LogTest(const TDesC &aTitle,TInt aNum);
   1.140 +	const TDesC& LogSubTest(const TDesC &aTitle,TInt aNum);
   1.141 +	const TDesC& LogMessage(TBool aLog,const TDesC& aText,TInt aNum=EDummyValue);
   1.142 +private:
   1.143 +	TBuf<0x40> iTestTitle;
   1.144 +	TBuf<0x40> iSubTitle;
   1.145 +	TBuf<0x40> iMessage;
   1.146 +	TInt iTitleHeight;
   1.147 +	};
   1.148 +
   1.149 +class CTestBase;
   1.150 +
   1.151 +/** 
   1.152 +This class is a window that is used to fake a border around the TestWindow defined below.
   1.153 +It simply draws an opaque black window on top of which the TestWindow will be drawn giving the illusion
   1.154 +there is a border.
   1.155 +
   1.156 +@see TestWindow
   1.157 +@internalComponent
   1.158 +@released
   1.159 +*/
   1.160 +class CBorderWindow : public CTWin
   1.161 +	{
   1.162 +public:
   1.163 +	CBorderWindow();
   1.164 +	void ConstructL(CTWinBase& aParent);
   1.165 +	void Draw();
   1.166 +	};
   1.167 +
   1.168 +class TestWindow : public CTWin
   1.169 +	{
   1.170 +public:
   1.171 +	TestWindow();
   1.172 +	~TestWindow();
   1.173 +	void Draw();
   1.174 +	void SetUpL(TPoint aPos, TSize aSize, CTWinBase* aParent, CWindowGc& aGc);
   1.175 +	void ClearWin();
   1.176 +	void SetBorderExt(TPoint aPos, TSize aSize);
   1.177 +	CBorderWindow* GetBorderWin();
   1.178 +private:
   1.179 +	CBorderWindow* iBorderWin;
   1.180 +	};
   1.181 +
   1.182 +/**
   1.183 +This class used to run each individual test before the migration to TEF.
   1.184 +Now it doesn't do much and should probably be refactored.
   1.185 +
   1.186 +@internalComponent
   1.187 +@released
   1.188 +*/
   1.189 +class CTestDriver : public CBase
   1.190 +	{
   1.191 +public:
   1.192 +	/** Factory function that returns a class derived from CTestDriver */
   1.193 +	static CTestDriver* CreateL(TInt aScreenNumber);
   1.194 +	virtual ~CTestDriver();
   1.195 +	
   1.196 +protected:
   1.197 +	CTestDriver(TInt aScreenNumber);
   1.198 +	
   1.199 +public:
   1.200 +	virtual void DoDisplayDialog(TDesC& timeBuf,TDesC& testReport) = 0;
   1.201 +
   1.202 +	void TestComplete2();
   1.203 +	void DestroyTest();
   1.204 +
   1.205 +	inline TInt ScreenNumber() {return iScreenNumber;}
   1.206 +	inline TInt NumberOfScreens() {return iNumberOfScreens;}
   1.207 +
   1.208 +public:
   1.209 +	CTestBase *iTest;
   1.210 +	TInt iSubTestNum;
   1.211 +	static TInt iTestNum;
   1.212 +protected:
   1.213 +	TTime iStartTime;
   1.214 +	TInt iScreenNumber;
   1.215 +	TInt iTestSize;
   1.216 +	TInt iNumberOfScreens;
   1.217 +	};
   1.218 +
   1.219 +/** Variant of CTestDriver used when the tests are run on the primary screen.
   1.220 +
   1.221 +@internalComponent
   1.222 +@released
   1.223 +*/
   1.224 +class CTestDriverPrimary: public CTestDriver
   1.225 +	{
   1.226 +public:
   1.227 +	CTestDriverPrimary(TInt aScreenNumber);
   1.228 +	void DoDisplayDialog(TDesC& timeBuf,TDesC& testReport);
   1.229 +	};
   1.230 +
   1.231 +/** Variant of CTestDriver used when the tests are run on a secondary screen.
   1.232 +
   1.233 +@internalComponent
   1.234 +@released
   1.235 +*/
   1.236 +class CTestDriverSecondary : public CTestDriver
   1.237 +	{
   1.238 +public:
   1.239 +	CTestDriverSecondary(TInt aScreenNumber);
   1.240 +	void DoDisplayDialog(TDesC& timeBuf,TDesC& testReport);
   1.241 +	};
   1.242 +
   1.243 +/** List of rectangles use by TGDI.CPP and TRECTLIST.CPP.
   1.244 +
   1.245 +Since only 2 tests make use of this shouldn't it be moved outside of the framework?
   1.246 +
   1.247 +@internalComponent
   1.248 +@released
   1.249 +*/
   1.250 +class TTestRects
   1.251 +	{
   1.252 +private:
   1.253 +	enum TRectListLimits
   1.254 +		{
   1.255 +		EMaxRectFromList=64,
   1.256 +		EMaxRectZeroSize=73,
   1.257 +		EMaxRectWide=83,
   1.258 +		EMaxRectHigh=93
   1.259 +		};
   1.260 +		
   1.261 +public:
   1.262 +	void Construct(const RWindow &aWindow);
   1.263 +	TInt Count1() const;
   1.264 +	TInt Count2() const;
   1.265 +	TInt Count3() const;
   1.266 +	TRect operator[](TInt aIndex);
   1.267 +	static void ResetSeed();
   1.268 +private:
   1.269 +	TInt Rnd(TInt aSize);
   1.270 +	TInt RndMax(TInt aSize);
   1.271 +	TInt RectCoord(TInt aSection,TInt aSize);
   1.272 +	void RectCoordPair(TInt &aTl, TInt &aBr, TInt aSection, TInt aSize);
   1.273 +	
   1.274 +private:
   1.275 +	TSize iSize;
   1.276 +	static TRect iList[64];
   1.277 +	static TInt64 iSeed;
   1.278 +	};
   1.279 +
   1.280 +/**
   1.281 +@internalComponent
   1.282 +@released
   1.283 +*/
   1.284 +class CBitmap : public CBase
   1.285 +	{
   1.286 +public:
   1.287 +	static CBitmap* NewLC(const TSize& aSizeInPixels,TDisplayMode aDispMode);
   1.288 +	static CBitmap* NewL(const TSize& aSizeInPixels,TDisplayMode aDispMode);
   1.289 +	static CBitmap* NewL(TInt aHandle);
   1.290 +	static CBitmap* NewL(TDesC& aFileName);
   1.291 +	~CBitmap();
   1.292 +	inline CFbsBitmap& Bitmap() const {return *iBitmap;}
   1.293 +	inline CFbsBitmapDevice& Device() const {return *iDevice;}
   1.294 +	inline CFbsBitGc& Gc() const {return *iGc;}
   1.295 +private:
   1.296 +	static CBitmap* NewLC(TInt aHandle,const TSize& aSizeInPixels,TDisplayMode aDispMode);
   1.297 +	void ConstructL(TInt aHandle,const TSize& aSizeInPixels,TDisplayMode aDispMode);
   1.298 +private:
   1.299 +	CFbsBitmap* iBitmap;
   1.300 +	CFbsBitmapDevice* iDevice;
   1.301 +	CFbsBitGc* iGc;
   1.302 +	};
   1.303 +
   1.304 +/*TPartialRedrawType*/
   1.305 +enum TPartialRedrawType
   1.306 +	{
   1.307 +	//redraw store type is not yet determined.
   1.308 +	EPartialRedraw_Unknown,
   1.309 +	//redraw store is discarded on invalidation and begin-redraw on a smaller rect.
   1.310 +	EPartialRedraw_None,
   1.311 +	// redraw store is preserved on invalidation and begin-redraw on a smaller rect.
   1.312 +	EPartialRedraw_PreserveStoredCmds,
   1.313 +	// redraw store is appended with partial redraw commands, and old redraw store is suitably modified.
   1.314 +	EPartialRedraw_FullRedrawSupport
   1.315 +	};
   1.316 +
   1.317 +class CTestBase : public CBase
   1.318 +	{
   1.319 +public:
   1.320 +	enum TPriorites
   1.321 +		{
   1.322 +		EAutoTestPriority=KAutoTestPriority
   1.323 +		};
   1.324 +	enum TTestLevel
   1.325 +		{
   1.326 +		ELevelQuick,		// Quick check on main cases for each function
   1.327 +		ELevelNormal,		// Suitable test level for internal release
   1.328 +		ELevelRelease,		// Thorough test suitable for official releases
   1.329 +		ELevelMega,			// Really OTT, takes forever to run, leave it going over the weekend sort of tests
   1.330 +		};
   1.331 +public:
   1.332 +	CTestBase(const TDesC &aTitle,CTWsGraphicsBase* aTestBase);
   1.333 +	~CTestBase();
   1.334 +	void StartTestL(TInt aNum, CTestDriver* aDriver, TTestLevel aLevel);
   1.335 +	void LogSubTest(const TDesC &aTitle);
   1.336 +	void LogMessage(TInt aValue);
   1.337 +	void LogSubState(TInt aSubState);
   1.338 +	TInt LaunchPanicThread(RThread &aThread, SPanicParams *aPtr);
   1.339 +	TInt TestPanicL(SPanicParams *aPtr, TInt aExitReason, const TDesC &aCategory, TBool* aTestFinished=NULL);
   1.340 +	TInt TestPanicL(TPanicFunction aFunction, TInt aExitReason, TInt aInt, TAny *aPtr, const TDesC &aCategory, TBool* aTestFinished=NULL);
   1.341 +	TInt TestWsPanicL(TPanicFunction aFunction, TClientPanic aExitReason, TInt aInt, TAny *aPtr=NULL, TBool* aTestFinished=NULL);
   1.342 +	TInt TestW32PanicL(TPanicFunction aFunction, TW32Panic aExitReason, TInt aInt, TAny *aPtr, TBool* aTestFinished=NULL);
   1.343 +	TInt TestWservPanicL(TPanicFunction aFunction, TWservPanic aExitReason, TInt aInt, TAny *aPtr);
   1.344 +	void TriggerFail();
   1.345 +	static void DrawTestBackground(TBool aInvertColours, const TSize &aSize, TInt aGrays=16);
   1.346 +	inline CTestDriver* Driver();
   1.347 +	void SimulatePointer(TRawEvent::TType aType, TInt aX, TInt aY);
   1.348 +	TBool ConfigurationSupportsPointerEventTesting() const;
   1.349 +	void SimulateEvent(TRawEvent::TType aType);
   1.350 +	void LogColors(const CBitmapDevice& aDevice,TPoint aBasePoint, TPoint aStartPoint, TPoint aEndPoint);
   1.351 +	void LogColors4(const CBitmapDevice& aDevice,TPoint aStartPoint,TInt aLen);
   1.352 +	inline TInt ScreenNumber() {return iScreenNumber;}
   1.353 +	TPartialRedrawType RedrawStoreTypeL();
   1.354 +	TBool IsFullRomL();
   1.355 +	void SimulateKeyDownUpWithModifiers(TInt aScanCode,TUint aModifiers);
   1.356 +	void SimulatePointerDownUp(TInt aX, TInt aY);
   1.357 +	void SimulateKeyDownUp(TInt aScanCode);
   1.358 +	void SimulateKey(TRawEvent::TType aType, TInt aScanCode);
   1.359 +	void DelayIfFullRomL();
   1.360 +	void SetUpMember(TSpriteMember &aMember);
   1.361 +	void AbortL();
   1.362 +	void LogLeave(TInt aErr);
   1.363 +	void CloseAllPanicWindows();
   1.364 +	const TSize& StdTestWindowSize();
   1.365 +	TInt MaxGrays() const;
   1.366 +	TInt MaxColors() const;
   1.367 +	TInt SaveScreen(const TDesC& aFileName);
   1.368 +	TInt SaveScreen(const TDesC& aFileName,const TSize& aScreenSize,TDisplayMode aColorDepth);
   1.369 +protected:
   1.370 +	void UpdateTestResults(TInt aNoOfTest, TInt aNoOfTestPass);
   1.371 +	void SaveScreenL(const TDesC& aFileName,const TSize& aScreenSize,TDisplayMode aColorDepth);
   1.372 +public:
   1.373 +	static TInt iNumberTestsPass;
   1.374 +	static TInt iNumberTests;
   1.375 +	TInt iState;
   1.376 +	TInt iScreenNumber;
   1.377 +	static TInt iScreenNo;
   1.378 +	TTestRects iTestRects;
   1.379 +	static TRect iNormalPointerCursorArea;
   1.380 +	TBuf<0x40> iSubTitle;
   1.381 +	TTestLevel iTestLevel;
   1.382 +	static TInt iNumberOfGrpWndsOnPrimaryScreenWithZeroPriority; // Will be used in TGWHANDLE test.
   1.383 +protected:
   1.384 +	CTestDriver* iDriver;
   1.385 +private:
   1.386 +	TBuf<0x40> iTitle;
   1.387 +	CTWsGraphicsBase* iTestBase;
   1.388 +	/** 
   1.389 +	Several tests use 3 windows : one is a log window, one is a reference window 
   1.390 +	and one is the actual output of the test. All these windows have the same width which is roughly
   1.391 +	1/3 of the screen. They also have the same height which is roughly equal to the screen height.
   1.392 +	*/
   1.393 +	TSize iStdTestWindowSize;
   1.394 +	CMinWin* iMinWin;
   1.395 +	TInt iTestNum;
   1.396 +	TBool iFail;	// Used to trigger failures to test test code.
   1.397 +	TInt iThreadNumber;
   1.398 +	/** 
   1.399 +	The type of redraw store in use. Static members so that	RedrawStoreTypeL computes
   1.400 +	this value only once and then returns the cached result as this remains the same for
   1.401 +	the entire test run.
   1.402 +	*/
   1.403 +	static TPartialRedrawType iRedrawType;
   1.404 +	/** The number of greys available in the richest grey mode. */
   1.405 +	static TInt iMaxGrays;
   1.406 +	/** The number of colours available in the richest supported colour mode. */
   1.407 +	static TInt iMaxColors;
   1.408 +	};
   1.409 +
   1.410 +class CTWsGraphicsBase : public CTGraphicsBase
   1.411 +	{
   1.412 +public:
   1.413 +	CTWsGraphicsBase(CTestStep* aStep);
   1.414 +	~CTWsGraphicsBase();
   1.415 +	void CreateTestBaseL(CTTMSGraphicsStep* aTmsStep);
   1.416 +	inline CTestBase *TestBase() const {return(iTest);};
   1.417 +	void TestComplete();
   1.418 +	void LogMessage(const TText8* aFile,TInt aLine,TRefByValue<const TDesC> aFmt,...);
   1.419 +	TInt GetScreenFromIni() const;
   1.420 +protected:
   1.421 +	void CheckRect(TPoint aPos1,TPoint aPos2,TSize aSize, const TDesC *aErrorMsg=NULL);
   1.422 +	void CheckRect(TPoint aPos1,TPoint aPos2,TSize aSize, const TDesC &aErrorMsg);
   1.423 +	void CheckRectNoMatch(TPoint aPos1,TPoint aPos2,TSize aSize, const TDesC *aErrorMsg=NULL);
   1.424 +	void CheckRectNoMatch(TPoint aPos1,TPoint aPos2,TSize aSize, const TDesC &aErrorMsg);
   1.425 +	void CheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2, const TDesC *aErrorMsg=NULL);
   1.426 +	void CheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2, const TDesC &aErrorMsg);
   1.427 +	void CheckRectNoMatch(CTBaseWin *aWin1,CTBaseWin *aWin2, const TDesC *aErrorMsg=NULL);
   1.428 +	void CheckRectNoMatch(CTBaseWin *aWin1,CTBaseWin *aWin2, const TDesC &aErrorMsg);
   1.429 +	TBool CheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, const TDesC *aErrorMsg=NULL);
   1.430 +	TBool CheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, const TDesC &aErrorMsg);
   1.431 +	void CheckRectNoMatch(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, const TDesC *aErrorMsg=NULL);
   1.432 +	void CheckRectNoMatch(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, const TDesC &aErrorMsg);
   1.433 +	TBool CompareWindows(const TDesC *aErrorMsg=NULL);
   1.434 +	TBool CompareWindows(const TDesC &aErrorMsg);
   1.435 +	void CompareWindows(const TRect &aRect, const TDesC *aErrorMsg=NULL);
   1.436 +	void CompareWindows(const TRect &aRect, const TDesC &aErrorMsg);
   1.437 +	void CompareWindowsSoftFailWinscw(const TText8* aFile, TInt aLine);
   1.438 +	const TSize& StdTestWindowSize();
   1.439 +	TInt MaxGrays() const;
   1.440 +	TInt MaxColors() const;
   1.441 +private:
   1.442 +	TBool CheckRetValue(TBool aPass,const TDesC* aErrorMsg,const TDesC& aErrorFunction);
   1.443 +protected:
   1.444 +	CTestBase* iTest;
   1.445 +	CTTMSGraphicsStep* iTmsStep;
   1.446 +	};
   1.447 +
   1.448 +class TestWindowGroup : public CTWindowGroup
   1.449 +	{
   1.450 +public:
   1.451 +	TestWindowGroup(CTClient *aClient);
   1.452 +	void BecomeOwning();
   1.453 +	void KeyL(const TKeyEvent &aKey,const TTime &aTime);
   1.454 +	void KeyDownL(const TKeyEvent &aKey,const TTime &aTime);
   1.455 +	void KeyUpL(const TKeyEvent &aKey,const TTime &aTime);
   1.456 +	};
   1.457 +
   1.458 +class TestClient : public CTClient
   1.459 +	{
   1.460 +public:
   1.461 +	TestClient();
   1.462 +	~TestClient();
   1.463 +	void ConstructL();	// virtual from CTClient
   1.464 +	void KeyL(const TKeyEvent &aKey,const TTime &aTime);
   1.465 +	void Shutdown();
   1.466 +	inline CTestDriver* Driver();
   1.467 +	TBool WaitForEvent();
   1.468 +	TBool IsEventWaiting();
   1.469 +	void LogAvailableScreenModeL();
   1.470 +	void TestWsSetBufferSizeL();
   1.471 +	void TestWsSetMaxBufferSizeL();
   1.472 +	inline LogWindow& StdLogWindow() {return *iStdLogWindow;}
   1.473 +	void SetTestClientScreenMode(TInt aMode);
   1.474 +	void UpdateTestClientScreenMode();
   1.475 +public:
   1.476 +	RArray<TInt> iScreenModes;
   1.477 +	
   1.478 +private:
   1.479 +	/**
   1.480 +	Several tests use 3 windows : one is a log window, one is a reference window 
   1.481 +	and one is the actual output of the test. This member is the log window.
   1.482 +	*/
   1.483 +	LogWindow* iStdLogWindow;
   1.484 +	CTestDriver* iDriver;
   1.485 +	};
   1.486 +
   1.487 +class TThreadStartUp
   1.488 +	{
   1.489 +public:
   1.490 +	TThreadStartUp() :iInitFunction(0), iParam(0) {}
   1.491 +	TThreadStartUp(TThreadFunction aInitFunction,TAny* aParam) :iInitFunction(aInitFunction), iParam(aParam) {}
   1.492 +public:
   1.493 +	TThreadFunction iInitFunction;	   //The call to this fn will prepare a cleanup stack, but this function should not leave.
   1.494 +	TAny* iParam;
   1.495 +	};
   1.496 +
   1.497 +#if defined(__WINS__)
   1.498 +	const TOwnerType KOwnerType=EOwnerThread;
   1.499 +#else
   1.500 +	const TOwnerType KOwnerType=EOwnerProcess;
   1.501 +#endif
   1.502 +
   1.503 +typedef TBuf<32> TBufArg;
   1.504 +
   1.505 +class CProcess : public CBase
   1.506 +	{
   1.507 +public:
   1.508 +	enum
   1.509 +		{
   1.510 +		eProcessPriortyTest,
   1.511 +		eProcessKeyTest,
   1.512 +		eProcessDirectTest,
   1.513 +		eProcessMultiDisplayTest,
   1.514 +		eNumProcessCalls		//Must be last one
   1.515 +		};
   1.516 +	struct TInitialFunction
   1.517 +		{
   1.518 +		inline TInitialFunction(const TDesC& aParam,TThreadFunction aFunction) :iParam(aParam), iFunction(aFunction) {}
   1.519 +		TBuf<16> iParam;
   1.520 +		TThreadFunction iFunction;
   1.521 +		};
   1.522 +public:
   1.523 +	static TInt Start(const TWinCommand& aParam);
   1.524 +	static CProcess* NewL(TInt aFunctionNo,TInt aScreenNumber=KDefaultScreen);
   1.525 +	static CProcess* NewTL(TInt aFunctionNo,TInt aScreenNumber=KDefaultScreen,TRequestStatus* aClientRequestStatus = NULL);
   1.526 +	static CProcess* NewThreadL(const TDesC& aName,TThreadFunction aFunction,TThreadStartUp* aPtr
   1.527 +																							,TRequestStatus* aStatus);
   1.528 +	static CProcess* NewThreadL(const TDesC& aName,TThreadStartUp* aPtr);
   1.529 +	static CProcess* NewThreadRendezvousL(const TDesC& aName,TThreadFunction aFunction,TThreadStartUp* aPtr,TRequestStatus* aLogonStatus,TRequestStatus& aRendezvousStatus);
   1.530 +	static CProcess* NewThreadRendezvousL(const TDesC& aName,TThreadStartUp* aPtr,TRequestStatus& aRendezvousStatus);
   1.531 +
   1.532 +	static CProcess* NewSimpleThreadL(const TDesC& aName,TThreadStartUp* aPtr,TRequestStatus* aStatus=NULL);
   1.533 +	void ConstructL(TInt aFunctionNo,TInt aScreenNumber=KDefaultScreen);
   1.534 +	void ConstructTL(TInt aFunctionNo,TInt aScreenNumber=KDefaultScreen,TRequestStatus* aStatus=NULL);
   1.535 +	void ConstructL(const TDesC& aName,TThreadFunction aFunction,TThreadStartUp* aPtr,TRequestStatus* aStatus);
   1.536 +	void ConstructRendezvousL(const TDesC& aName,TThreadFunction aFunction,TThreadStartUp* aPtr,TRequestStatus* aLogonStatus,TRequestStatus& aRendezvousStatus);
   1.537 +
   1.538 +	~CProcess();
   1.539 +	void Logon(TRequestStatus& aStatus) const;
   1.540 +	void Terminate(TInt aReason);
   1.541 +	TBool StillAlive();
   1.542 +	void LeaveIfDied();
   1.543 +	static TBool ProcessDied(TInt aScreenNo=KDefaultScreen);
   1.544 +private:
   1.545 +	enum
   1.546 +		{
   1.547 +		eOtherCreated=0x0001,
   1.548 +		eThreadCreated=0x0002,
   1.549 +		};
   1.550 +private:
   1.551 +	static TInt ThreadInit(TAny *aPtr);
   1.552 +	static void InitialiseL(TThreadStartUp* aPtr);
   1.553 +	static TInt SimpleThreadInit(TAny *aPtr);
   1.554 +	void Close();
   1.555 +	static void GetProcArg(const TWinCommand& aParam,TBufArg& aProcArg);
   1.556 +	static void GetScreenArg(const TWinCommand& aParam, TInt& aScreenArg);
   1.557 +
   1.558 +private:
   1.559 +	TUint iCreated;
   1.560 +	RProcess iOther;
   1.561 +	RThread iThread;
   1.562 +	static TInitialFunction iFunctions[eNumProcessCalls];
   1.563 +	};
   1.564 +
   1.565 +GLREF_D TestWindow* BaseWin;
   1.566 +GLREF_D TestWindow* TestWin;
   1.567 +GLREF_D TestClient* TheClient;
   1.568 +GLREF_D CWindowGc* TheGc;
   1.569 +
   1.570 +GLREF_C void AutoPanic(TInt aPanic);
   1.571 +GLREF_C void CleanUpWindow(TAny *aWindow);
   1.572 +GLREF_C void PushWindowL(RWindowTreeNode *aWindow);
   1.573 +GLREF_C TBool OpacityAndAlphaSupportedL();
   1.574 +GLREF_C TInt TransparencySupportedL();
   1.575 +GLREF_C TInt CheckScalingSupportedOrNot();
   1.576 +GLREF_C TBool CheckNonZeroOriginsSupportedOrNot();
   1.577 +GLREF_C TPoint PhysicalToLogical(TPoint aPhysicalPtMinusOrigin,TSize aScale);
   1.578 +GLREF_C TPtrC DisplayModeAsString(TDisplayMode aMode);
   1.579 +GLREF_C TBool LossyCheckBlankBitmap(const CFbsBitmap& aBitmap, const TRect aArea, const TRgb aCheckColor, TBool aLossyCompare=ETrue);
   1.580 +GLREF_C TBool LossyCompareBitmap(const CFbsBitmap& aBitmap1, const CFbsBitmap& aBitmap2, const TRect aCompareRect, TBool aLossyCompare=ETrue);
   1.581 +GLDEF_C TBool LossyCompareBitmapRecord(CFbsBitmap& aBitmap1, CFbsBitmap& aBitmap2, const TRect aCompareRect, TBool aLossyCompare, TInt& aPixelsDifferent, CTestExecuteLogger& aLogger);
   1.582 +GLREF_C TBool LossyCheckBlankWindow(const CWsScreenDevice& aScreen, CFbsBitmap& aBitmap, const TRect aArea, const TRgb aCheckColor);
   1.583 +GLREF_C TBool LossyCompareWindow(const CWsScreenDevice& aScreen, CFbsBitmap& aBitmap1, CFbsBitmap& aBitmap2, const TRect aCompareRect);
   1.584 +
   1.585 +#define LogText(S) {_LIT(String__LINE__,S); Logger.Log(String__LINE__);}
   1.586 +#define LogFormat(S) {Logger.Log(S);}
   1.587 +
   1.588 +inline CTestDriver* CTestBase::Driver()
   1.589 +	{
   1.590 +	return iDriver;
   1.591 +	}
   1.592 +
   1.593 +class CTransWindow : public CBlankWindow
   1.594 +	{
   1.595 +public:
   1.596 +	static CTransWindow* NewL(RPointerArray<CTransWindow>& aWindows,TRgb aColor,TRect aPos);
   1.597 +	static CTransWindow* NewL(CTWinBase* aParent,TRgb aColor,TRect aPos,TDisplayMode* aDisplayMode);
   1.598 +	static CTransWindow* NewL(CTWinBase* aParent,TRgb aColor,TDisplayMode* aDisplayMode);
   1.599 +	void ToggleVisibility();
   1.600 +	static void SetOrdinal(RPointerArray<CTransWindow>& aWindows,TInt aOldPos,TInt aNewPos);
   1.601 +	inline TRgb Color() {return iCol;}
   1.602 +	inline TBool IsVisible() {return iVisible;}
   1.603 +	void SetShadowDisabled(TBool aState);
   1.604 +	inline TBool IsShadowing() {return iShadowing;}
   1.605 +	inline TBool ShadowHeight() {return iShadowHight;}
   1.606 +	inline void SetPosOffset(TPoint aOffset) {iPosOffset=aOffset;}
   1.607 +	virtual void Draw();
   1.608 +	void SetDrawOpaque(TBool aDrawOpaque) { iDrawOpaque = aDrawOpaque; }
   1.609 +	TBool DrawOpaque() const { return iDrawOpaque; }
   1.610 +	//Virtual functions from CTWinBase overridden in CTBaseWin
   1.611 +	void AdjustShadow(TInt aAdjust);
   1.612 +	TPoint Position() const;
   1.613 +	inline TInt TransparentError() {return iError;}
   1.614 +private:
   1.615 +	CTransWindow(TRgb aColor) :CBlankWindow(aColor), iVisible(ETrue) {}
   1.616 +	//Virtual function from CTBaseWin
   1.617 +	void InitWin();
   1.618 +private:
   1.619 +	TBool iVisible;
   1.620 +	TBool iShadowing;
   1.621 +	TBool iDrawOpaque;
   1.622 +	TInt iShadowHight;
   1.623 +	TPoint iPosOffset;
   1.624 +	TInt iError;
   1.625 +	};
   1.626 +
   1.627 +class CMinWin : public CBase
   1.628 +	{
   1.629 +public:
   1.630 +	CMinWin(TInt aScreenNo);
   1.631 +	~CMinWin();
   1.632 +	void ConstructL();
   1.633 +	void Draw(const TRect& aRect);
   1.634 +private:
   1.635 +	RWsSession iWs;
   1.636 +	RWindow iWin;
   1.637 +	RWindowGroup iGroup;
   1.638 +	CWsScreenDevice* iScr;
   1.639 +	TInt iScreenNo;
   1.640 +	TRect iRect;
   1.641 +	CWindowGc* iGc;
   1.642 +	};
   1.643 +
   1.644 +class CTimeOut : public CTimer
   1.645 +	{
   1.646 +public:
   1.647 +	inline CTimeOut(): CTimer((EPriorityLow+EPriorityIdle)/2) {}
   1.648 +	void ConstructL();
   1.649 +	void Start(TTimeIntervalMicroSeconds32 aInterval,TCallBack aCallBack);
   1.650 +	//Pure virtual from CActive
   1.651 +	void RunL();
   1.652 +private:
   1.653 +	TCallBack iCallBack;
   1.654 +	};
   1.655 +
   1.656 +#define COMPARE_WINDOWS_SOFTFAIL_WINSCW	CompareWindowsSoftFailWinscw((TText8*)__FILE__, __LINE__)
   1.657 +
   1.658 +#define __WS_CONSTRUCT_STEP__(a) \
   1.659 +	CT##a##Step::CT##a##Step() \
   1.660 +	{ \
   1.661 +	SetTestStepName(KT##a##Step); \
   1.662 +	SetLogHeapInfo(ETrue); \
   1.663 +	} \
   1.664 +	 \
   1.665 +CTGraphicsBase* CT##a##Step::CreateTestL() \
   1.666 +	{ \
   1.667 +	CTWsGraphicsBase* test=new (ELeave) CT##a (this); \
   1.668 + 	test->CreateTestBaseL(this);\
   1.669 +	return test;\
   1.670 +	} 
   1.671 +
   1.672 +#endif