sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Header for window server auto test code sl@0: // sl@0: // sl@0: sl@0: sl@0: #ifndef __AUTO_H__ sl@0: #define __AUTO_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include "../../SERVER/w32cmd.h" sl@0: #include sl@0: #include "../tlib/testbase.h" sl@0: #include sl@0: #include "TGraphicsHarness.h" sl@0: #include "../../SERVER/openwfc/panics.h" sl@0: sl@0: #define DISABLE_FAIL_DIALOG sl@0: sl@0: #define TEST_BITMAP_NAME _L("Z:\\WSTEST\\WSAUTOTEST.MBM") sl@0: sl@0: #define SCREEN_MODE_TESTING sl@0: sl@0: #define LOG_MESSAGE(p) LogMessage(((TText8*)__FILE__), __LINE__,(p)) sl@0: #define LOG_MESSAGE2(p1,p2) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2)) sl@0: #define LOG_MESSAGE3(p1,p2,p3) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2),(p3)) sl@0: #define LOG_MESSAGE4(p1,p2,p3,p4) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2),(p3),(p4)) sl@0: #define LOG_MESSAGE5(p1,p2,p3,p4,p5) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2),(p3),(p4),(p5)) sl@0: #define LOG_MESSAGE6(p1,p2,p3,p4,p5,p6) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2),(p3),(p4),(p5),(p6)) sl@0: #define LOG_MESSAGE7(p1,p2,p3,p4,p5,p6,p7) LogMessage(((TText8*)__FILE__), __LINE__,(p1),(p2),(p3),(p4),(p5),(p6),(p7)) sl@0: sl@0: // MB 23\11\04 The heap size was only 4k which was causing DSA step 7 to fail on HW. sl@0: // Increased heap size to 8k sl@0: // 23/02/2009 Again failing with no memory due to COLOR16MAP used. sl@0: // Increased heap size to 16k sl@0: LOCAL_D const TUint KOtherProcHeapSize=0x4000; sl@0: LOCAL_D const TInt KAutoTestPriority=-20; sl@0: sl@0: TBool DoCheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect); sl@0: TBool DoCheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, TUint aFlags); sl@0: TBool DoCheckRectRWin(RWindowBase &aWin1,RWindowBase &aWin2,const TRect &aRect); sl@0: TBool DoCheckRectRWin(RWindowBase &aWin1,RWindowBase &aWin2,const TRect &aRect, TUint aFlags); sl@0: TBool DoCheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2); sl@0: TBool DoCheckRect(TPoint aPos1,TPoint aPos2,TSize aSize); sl@0: sl@0: _LIT(KWSERV,"WSERV"); sl@0: _LIT(KW32,"W32"); sl@0: _LIT(KPlatsecBegin,"*PlatSec* ERROR - BEGIN NEGATIVE PLATSEC TESTING"); sl@0: _LIT(KPlatsecEnd,"*PlatSec* ERROR - END NEGATIVE PLATSEC TESTING"); sl@0: _LIT(KTestFontTypefaceName,"DejaVu Sans Condensed"); sl@0: sl@0: class TestClient; sl@0: class CMinWin; sl@0: class CTWsGraphicsBase; sl@0: sl@0: enum TestState sl@0: { sl@0: EInvalid, sl@0: ENext, sl@0: EWait, sl@0: EFinished sl@0: }; sl@0: sl@0: enum TAutoPanics sl@0: { sl@0: EAutoPanicTestFailed, sl@0: EAutoPanicPanicFailed, sl@0: EAutoPanicTestRectsIndex, sl@0: EAutoPanicTestRectsSection, sl@0: EAutoPanicUnexpectedLeave, sl@0: EAutoPanicTestBrushesIndex, sl@0: EAutoPanicWindowType, sl@0: EAutoPanicTooManyDownKeys, sl@0: EAutoPanicInvalidEvent, sl@0: EAutoFadeWindow, sl@0: EAutoPanicWrongTest, sl@0: EAutoPanicAnimError, sl@0: ETManPanicPcFailed, //Panic use in a test copied from TMan sl@0: EAutoPanicTestError, //Test returned bad return type sl@0: EAutoPanicDirect, //Direct Screen Access logic state error sl@0: EAutoPanicScanCapital, //Scan codes must not be lower case letters sl@0: EAutoPanicRedrawStoring, //Inconsistent Redraw Storing Behaviour sl@0: EAutoPanicRecalledCreateTestBaseL, //Called CreateTestBaseL twice sl@0: EAutoPanicHeartBeatCursorRect, //Invalid size of rectangle in ChangeTransAndCheckHeartBeat sl@0: EAutoPanicGroupWinHasChild, //Main test group window has child at start of test sl@0: EAutoPanicPanicSetTrans, //Error setting transparency during panic tests sl@0: EAutoPanicNoDigitiser, //Pointer event when the configuration has no digitiser sl@0: }; sl@0: sl@0: enum TPanicExitReasons sl@0: { sl@0: EWsExitReasonBad, sl@0: EWsExitReasonFinished, sl@0: }; sl@0: sl@0: enum TAutoLeaves sl@0: { sl@0: ETestPassed=0, sl@0: ETestFailed=1, sl@0: }; sl@0: sl@0: typedef TInt (*TPanicFunction)(TInt aInt, TAny *aPtr); sl@0: sl@0: struct SPanicParams sl@0: { sl@0: TInt num; sl@0: TPanicFunction func; sl@0: TAny *ptr; sl@0: }; sl@0: sl@0: class LogWindow : public CTWin sl@0: { sl@0: enum sl@0: { sl@0: EDummyValue=-9999 sl@0: }; sl@0: public: sl@0: LogWindow(); sl@0: void ConstructL(CTWinBase& aParent); sl@0: void Draw(); sl@0: void DrawSubTitle(); sl@0: void DrawMessage(); sl@0: void LogTest(const TDesC &aTitle,TInt aNum); sl@0: const TDesC& LogSubTest(const TDesC &aTitle,TInt aNum); sl@0: const TDesC& LogMessage(TBool aLog,const TDesC& aText,TInt aNum=EDummyValue); sl@0: private: sl@0: TBuf<0x40> iTestTitle; sl@0: TBuf<0x40> iSubTitle; sl@0: TBuf<0x40> iMessage; sl@0: TInt iTitleHeight; sl@0: }; sl@0: sl@0: class CTestBase; sl@0: sl@0: /** sl@0: This class is a window that is used to fake a border around the TestWindow defined below. sl@0: It simply draws an opaque black window on top of which the TestWindow will be drawn giving the illusion sl@0: there is a border. sl@0: sl@0: @see TestWindow sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: class CBorderWindow : public CTWin sl@0: { sl@0: public: sl@0: CBorderWindow(); sl@0: void ConstructL(CTWinBase& aParent); sl@0: void Draw(); sl@0: }; sl@0: sl@0: class TestWindow : public CTWin sl@0: { sl@0: public: sl@0: TestWindow(); sl@0: ~TestWindow(); sl@0: void Draw(); sl@0: void SetUpL(TPoint aPos, TSize aSize, CTWinBase* aParent, CWindowGc& aGc); sl@0: void ClearWin(); sl@0: void SetBorderExt(TPoint aPos, TSize aSize); sl@0: CBorderWindow* GetBorderWin(); sl@0: private: sl@0: CBorderWindow* iBorderWin; sl@0: }; sl@0: sl@0: /** sl@0: This class used to run each individual test before the migration to TEF. sl@0: Now it doesn't do much and should probably be refactored. sl@0: sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: class CTestDriver : public CBase sl@0: { sl@0: public: sl@0: /** Factory function that returns a class derived from CTestDriver */ sl@0: static CTestDriver* CreateL(TInt aScreenNumber); sl@0: virtual ~CTestDriver(); sl@0: sl@0: protected: sl@0: CTestDriver(TInt aScreenNumber); sl@0: sl@0: public: sl@0: virtual void DoDisplayDialog(TDesC& timeBuf,TDesC& testReport) = 0; sl@0: sl@0: void TestComplete2(); sl@0: void DestroyTest(); sl@0: sl@0: inline TInt ScreenNumber() {return iScreenNumber;} sl@0: inline TInt NumberOfScreens() {return iNumberOfScreens;} sl@0: sl@0: public: sl@0: CTestBase *iTest; sl@0: TInt iSubTestNum; sl@0: static TInt iTestNum; sl@0: protected: sl@0: TTime iStartTime; sl@0: TInt iScreenNumber; sl@0: TInt iTestSize; sl@0: TInt iNumberOfScreens; sl@0: }; sl@0: sl@0: /** Variant of CTestDriver used when the tests are run on the primary screen. sl@0: sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: class CTestDriverPrimary: public CTestDriver sl@0: { sl@0: public: sl@0: CTestDriverPrimary(TInt aScreenNumber); sl@0: void DoDisplayDialog(TDesC& timeBuf,TDesC& testReport); sl@0: }; sl@0: sl@0: /** Variant of CTestDriver used when the tests are run on a secondary screen. sl@0: sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: class CTestDriverSecondary : public CTestDriver sl@0: { sl@0: public: sl@0: CTestDriverSecondary(TInt aScreenNumber); sl@0: void DoDisplayDialog(TDesC& timeBuf,TDesC& testReport); sl@0: }; sl@0: sl@0: /** List of rectangles use by TGDI.CPP and TRECTLIST.CPP. sl@0: sl@0: Since only 2 tests make use of this shouldn't it be moved outside of the framework? sl@0: sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: class TTestRects sl@0: { sl@0: private: sl@0: enum TRectListLimits sl@0: { sl@0: EMaxRectFromList=64, sl@0: EMaxRectZeroSize=73, sl@0: EMaxRectWide=83, sl@0: EMaxRectHigh=93 sl@0: }; sl@0: sl@0: public: sl@0: void Construct(const RWindow &aWindow); sl@0: TInt Count1() const; sl@0: TInt Count2() const; sl@0: TInt Count3() const; sl@0: TRect operator[](TInt aIndex); sl@0: static void ResetSeed(); sl@0: private: sl@0: TInt Rnd(TInt aSize); sl@0: TInt RndMax(TInt aSize); sl@0: TInt RectCoord(TInt aSection,TInt aSize); sl@0: void RectCoordPair(TInt &aTl, TInt &aBr, TInt aSection, TInt aSize); sl@0: sl@0: private: sl@0: TSize iSize; sl@0: static TRect iList[64]; sl@0: static TInt64 iSeed; sl@0: }; sl@0: sl@0: /** sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: class CBitmap : public CBase sl@0: { sl@0: public: sl@0: static CBitmap* NewLC(const TSize& aSizeInPixels,TDisplayMode aDispMode); sl@0: static CBitmap* NewL(const TSize& aSizeInPixels,TDisplayMode aDispMode); sl@0: static CBitmap* NewL(TInt aHandle); sl@0: static CBitmap* NewL(TDesC& aFileName); sl@0: ~CBitmap(); sl@0: inline CFbsBitmap& Bitmap() const {return *iBitmap;} sl@0: inline CFbsBitmapDevice& Device() const {return *iDevice;} sl@0: inline CFbsBitGc& Gc() const {return *iGc;} sl@0: private: sl@0: static CBitmap* NewLC(TInt aHandle,const TSize& aSizeInPixels,TDisplayMode aDispMode); sl@0: void ConstructL(TInt aHandle,const TSize& aSizeInPixels,TDisplayMode aDispMode); sl@0: private: sl@0: CFbsBitmap* iBitmap; sl@0: CFbsBitmapDevice* iDevice; sl@0: CFbsBitGc* iGc; sl@0: }; sl@0: sl@0: /*TPartialRedrawType*/ sl@0: enum TPartialRedrawType sl@0: { sl@0: //redraw store type is not yet determined. sl@0: EPartialRedraw_Unknown, sl@0: //redraw store is discarded on invalidation and begin-redraw on a smaller rect. sl@0: EPartialRedraw_None, sl@0: // redraw store is preserved on invalidation and begin-redraw on a smaller rect. sl@0: EPartialRedraw_PreserveStoredCmds, sl@0: // redraw store is appended with partial redraw commands, and old redraw store is suitably modified. sl@0: EPartialRedraw_FullRedrawSupport sl@0: }; sl@0: sl@0: class CTestBase : public CBase sl@0: { sl@0: public: sl@0: enum TPriorites sl@0: { sl@0: EAutoTestPriority=KAutoTestPriority sl@0: }; sl@0: enum TTestLevel sl@0: { sl@0: ELevelQuick, // Quick check on main cases for each function sl@0: ELevelNormal, // Suitable test level for internal release sl@0: ELevelRelease, // Thorough test suitable for official releases sl@0: ELevelMega, // Really OTT, takes forever to run, leave it going over the weekend sort of tests sl@0: }; sl@0: public: sl@0: CTestBase(const TDesC &aTitle,CTWsGraphicsBase* aTestBase); sl@0: ~CTestBase(); sl@0: void StartTestL(TInt aNum, CTestDriver* aDriver, TTestLevel aLevel); sl@0: void LogSubTest(const TDesC &aTitle); sl@0: void LogMessage(TInt aValue); sl@0: void LogSubState(TInt aSubState); sl@0: TInt LaunchPanicThread(RThread &aThread, SPanicParams *aPtr); sl@0: TInt TestPanicL(SPanicParams *aPtr, TInt aExitReason, const TDesC &aCategory, TBool* aTestFinished=NULL); sl@0: TInt TestPanicL(TPanicFunction aFunction, TInt aExitReason, TInt aInt, TAny *aPtr, const TDesC &aCategory, TBool* aTestFinished=NULL); sl@0: TInt TestWsPanicL(TPanicFunction aFunction, TClientPanic aExitReason, TInt aInt, TAny *aPtr=NULL, TBool* aTestFinished=NULL); sl@0: TInt TestW32PanicL(TPanicFunction aFunction, TW32Panic aExitReason, TInt aInt, TAny *aPtr, TBool* aTestFinished=NULL); sl@0: TInt TestWservPanicL(TPanicFunction aFunction, TWservPanic aExitReason, TInt aInt, TAny *aPtr); sl@0: void TriggerFail(); sl@0: static void DrawTestBackground(TBool aInvertColours, const TSize &aSize, TInt aGrays=16); sl@0: inline CTestDriver* Driver(); sl@0: void SimulatePointer(TRawEvent::TType aType, TInt aX, TInt aY); sl@0: TBool ConfigurationSupportsPointerEventTesting() const; sl@0: void SimulateEvent(TRawEvent::TType aType); sl@0: void LogColors(const CBitmapDevice& aDevice,TPoint aBasePoint, TPoint aStartPoint, TPoint aEndPoint); sl@0: void LogColors4(const CBitmapDevice& aDevice,TPoint aStartPoint,TInt aLen); sl@0: inline TInt ScreenNumber() {return iScreenNumber;} sl@0: TPartialRedrawType RedrawStoreTypeL(); sl@0: TBool IsFullRomL(); sl@0: void SimulateKeyDownUpWithModifiers(TInt aScanCode,TUint aModifiers); sl@0: void SimulatePointerDownUp(TInt aX, TInt aY); sl@0: void SimulateKeyDownUp(TInt aScanCode); sl@0: void SimulateKey(TRawEvent::TType aType, TInt aScanCode); sl@0: void DelayIfFullRomL(); sl@0: void SetUpMember(TSpriteMember &aMember); sl@0: void AbortL(); sl@0: void LogLeave(TInt aErr); sl@0: void CloseAllPanicWindows(); sl@0: const TSize& StdTestWindowSize(); sl@0: TInt MaxGrays() const; sl@0: TInt MaxColors() const; sl@0: TInt SaveScreen(const TDesC& aFileName); sl@0: TInt SaveScreen(const TDesC& aFileName,const TSize& aScreenSize,TDisplayMode aColorDepth); sl@0: protected: sl@0: void UpdateTestResults(TInt aNoOfTest, TInt aNoOfTestPass); sl@0: void SaveScreenL(const TDesC& aFileName,const TSize& aScreenSize,TDisplayMode aColorDepth); sl@0: public: sl@0: static TInt iNumberTestsPass; sl@0: static TInt iNumberTests; sl@0: TInt iState; sl@0: TInt iScreenNumber; sl@0: static TInt iScreenNo; sl@0: TTestRects iTestRects; sl@0: static TRect iNormalPointerCursorArea; sl@0: TBuf<0x40> iSubTitle; sl@0: TTestLevel iTestLevel; sl@0: static TInt iNumberOfGrpWndsOnPrimaryScreenWithZeroPriority; // Will be used in TGWHANDLE test. sl@0: protected: sl@0: CTestDriver* iDriver; sl@0: private: sl@0: TBuf<0x40> iTitle; sl@0: CTWsGraphicsBase* iTestBase; sl@0: /** sl@0: Several tests use 3 windows : one is a log window, one is a reference window sl@0: and one is the actual output of the test. All these windows have the same width which is roughly sl@0: 1/3 of the screen. They also have the same height which is roughly equal to the screen height. sl@0: */ sl@0: TSize iStdTestWindowSize; sl@0: CMinWin* iMinWin; sl@0: TInt iTestNum; sl@0: TBool iFail; // Used to trigger failures to test test code. sl@0: TInt iThreadNumber; sl@0: /** sl@0: The type of redraw store in use. Static members so that RedrawStoreTypeL computes sl@0: this value only once and then returns the cached result as this remains the same for sl@0: the entire test run. sl@0: */ sl@0: static TPartialRedrawType iRedrawType; sl@0: /** The number of greys available in the richest grey mode. */ sl@0: static TInt iMaxGrays; sl@0: /** The number of colours available in the richest supported colour mode. */ sl@0: static TInt iMaxColors; sl@0: }; sl@0: sl@0: class CTWsGraphicsBase : public CTGraphicsBase sl@0: { sl@0: public: sl@0: CTWsGraphicsBase(CTestStep* aStep); sl@0: ~CTWsGraphicsBase(); sl@0: void CreateTestBaseL(CTTMSGraphicsStep* aTmsStep); sl@0: inline CTestBase *TestBase() const {return(iTest);}; sl@0: void TestComplete(); sl@0: void LogMessage(const TText8* aFile,TInt aLine,TRefByValue aFmt,...); sl@0: TInt GetScreenFromIni() const; sl@0: protected: sl@0: void CheckRect(TPoint aPos1,TPoint aPos2,TSize aSize, const TDesC *aErrorMsg=NULL); sl@0: void CheckRect(TPoint aPos1,TPoint aPos2,TSize aSize, const TDesC &aErrorMsg); sl@0: void CheckRectNoMatch(TPoint aPos1,TPoint aPos2,TSize aSize, const TDesC *aErrorMsg=NULL); sl@0: void CheckRectNoMatch(TPoint aPos1,TPoint aPos2,TSize aSize, const TDesC &aErrorMsg); sl@0: void CheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2, const TDesC *aErrorMsg=NULL); sl@0: void CheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2, const TDesC &aErrorMsg); sl@0: void CheckRectNoMatch(CTBaseWin *aWin1,CTBaseWin *aWin2, const TDesC *aErrorMsg=NULL); sl@0: void CheckRectNoMatch(CTBaseWin *aWin1,CTBaseWin *aWin2, const TDesC &aErrorMsg); sl@0: TBool CheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, const TDesC *aErrorMsg=NULL); sl@0: TBool CheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, const TDesC &aErrorMsg); sl@0: void CheckRectNoMatch(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, const TDesC *aErrorMsg=NULL); sl@0: void CheckRectNoMatch(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, const TDesC &aErrorMsg); sl@0: TBool CompareWindows(const TDesC *aErrorMsg=NULL); sl@0: TBool CompareWindows(const TDesC &aErrorMsg); sl@0: void CompareWindows(const TRect &aRect, const TDesC *aErrorMsg=NULL); sl@0: void CompareWindows(const TRect &aRect, const TDesC &aErrorMsg); sl@0: void CompareWindowsSoftFailWinscw(const TText8* aFile, TInt aLine); sl@0: const TSize& StdTestWindowSize(); sl@0: TInt MaxGrays() const; sl@0: TInt MaxColors() const; sl@0: private: sl@0: TBool CheckRetValue(TBool aPass,const TDesC* aErrorMsg,const TDesC& aErrorFunction); sl@0: protected: sl@0: CTestBase* iTest; sl@0: CTTMSGraphicsStep* iTmsStep; sl@0: }; sl@0: sl@0: class TestWindowGroup : public CTWindowGroup sl@0: { sl@0: public: sl@0: TestWindowGroup(CTClient *aClient); sl@0: void BecomeOwning(); sl@0: void KeyL(const TKeyEvent &aKey,const TTime &aTime); sl@0: void KeyDownL(const TKeyEvent &aKey,const TTime &aTime); sl@0: void KeyUpL(const TKeyEvent &aKey,const TTime &aTime); sl@0: }; sl@0: sl@0: class TestClient : public CTClient sl@0: { sl@0: public: sl@0: TestClient(); sl@0: ~TestClient(); sl@0: void ConstructL(); // virtual from CTClient sl@0: void KeyL(const TKeyEvent &aKey,const TTime &aTime); sl@0: void Shutdown(); sl@0: inline CTestDriver* Driver(); sl@0: TBool WaitForEvent(); sl@0: TBool IsEventWaiting(); sl@0: void LogAvailableScreenModeL(); sl@0: void TestWsSetBufferSizeL(); sl@0: void TestWsSetMaxBufferSizeL(); sl@0: inline LogWindow& StdLogWindow() {return *iStdLogWindow;} sl@0: void SetTestClientScreenMode(TInt aMode); sl@0: void UpdateTestClientScreenMode(); sl@0: public: sl@0: RArray iScreenModes; sl@0: sl@0: private: sl@0: /** sl@0: Several tests use 3 windows : one is a log window, one is a reference window sl@0: and one is the actual output of the test. This member is the log window. sl@0: */ sl@0: LogWindow* iStdLogWindow; sl@0: CTestDriver* iDriver; sl@0: }; sl@0: sl@0: class TThreadStartUp sl@0: { sl@0: public: sl@0: TThreadStartUp() :iInitFunction(0), iParam(0) {} sl@0: TThreadStartUp(TThreadFunction aInitFunction,TAny* aParam) :iInitFunction(aInitFunction), iParam(aParam) {} sl@0: public: sl@0: TThreadFunction iInitFunction; //The call to this fn will prepare a cleanup stack, but this function should not leave. sl@0: TAny* iParam; sl@0: }; sl@0: sl@0: #if defined(__WINS__) sl@0: const TOwnerType KOwnerType=EOwnerThread; sl@0: #else sl@0: const TOwnerType KOwnerType=EOwnerProcess; sl@0: #endif sl@0: sl@0: typedef TBuf<32> TBufArg; sl@0: sl@0: class CProcess : public CBase sl@0: { sl@0: public: sl@0: enum sl@0: { sl@0: eProcessPriortyTest, sl@0: eProcessKeyTest, sl@0: eProcessDirectTest, sl@0: eProcessMultiDisplayTest, sl@0: eNumProcessCalls //Must be last one sl@0: }; sl@0: struct TInitialFunction sl@0: { sl@0: inline TInitialFunction(const TDesC& aParam,TThreadFunction aFunction) :iParam(aParam), iFunction(aFunction) {} sl@0: TBuf<16> iParam; sl@0: TThreadFunction iFunction; sl@0: }; sl@0: public: sl@0: static TInt Start(const TWinCommand& aParam); sl@0: static CProcess* NewL(TInt aFunctionNo,TInt aScreenNumber=KDefaultScreen); sl@0: static CProcess* NewTL(TInt aFunctionNo,TInt aScreenNumber=KDefaultScreen,TRequestStatus* aClientRequestStatus = NULL); sl@0: static CProcess* NewThreadL(const TDesC& aName,TThreadFunction aFunction,TThreadStartUp* aPtr sl@0: ,TRequestStatus* aStatus); sl@0: static CProcess* NewThreadL(const TDesC& aName,TThreadStartUp* aPtr); sl@0: static CProcess* NewThreadRendezvousL(const TDesC& aName,TThreadFunction aFunction,TThreadStartUp* aPtr,TRequestStatus* aLogonStatus,TRequestStatus& aRendezvousStatus); sl@0: static CProcess* NewThreadRendezvousL(const TDesC& aName,TThreadStartUp* aPtr,TRequestStatus& aRendezvousStatus); sl@0: sl@0: static CProcess* NewSimpleThreadL(const TDesC& aName,TThreadStartUp* aPtr,TRequestStatus* aStatus=NULL); sl@0: void ConstructL(TInt aFunctionNo,TInt aScreenNumber=KDefaultScreen); sl@0: void ConstructTL(TInt aFunctionNo,TInt aScreenNumber=KDefaultScreen,TRequestStatus* aStatus=NULL); sl@0: void ConstructL(const TDesC& aName,TThreadFunction aFunction,TThreadStartUp* aPtr,TRequestStatus* aStatus); sl@0: void ConstructRendezvousL(const TDesC& aName,TThreadFunction aFunction,TThreadStartUp* aPtr,TRequestStatus* aLogonStatus,TRequestStatus& aRendezvousStatus); sl@0: sl@0: ~CProcess(); sl@0: void Logon(TRequestStatus& aStatus) const; sl@0: void Terminate(TInt aReason); sl@0: TBool StillAlive(); sl@0: void LeaveIfDied(); sl@0: static TBool ProcessDied(TInt aScreenNo=KDefaultScreen); sl@0: private: sl@0: enum sl@0: { sl@0: eOtherCreated=0x0001, sl@0: eThreadCreated=0x0002, sl@0: }; sl@0: private: sl@0: static TInt ThreadInit(TAny *aPtr); sl@0: static void InitialiseL(TThreadStartUp* aPtr); sl@0: static TInt SimpleThreadInit(TAny *aPtr); sl@0: void Close(); sl@0: static void GetProcArg(const TWinCommand& aParam,TBufArg& aProcArg); sl@0: static void GetScreenArg(const TWinCommand& aParam, TInt& aScreenArg); sl@0: sl@0: private: sl@0: TUint iCreated; sl@0: RProcess iOther; sl@0: RThread iThread; sl@0: static TInitialFunction iFunctions[eNumProcessCalls]; sl@0: }; sl@0: sl@0: GLREF_D TestWindow* BaseWin; sl@0: GLREF_D TestWindow* TestWin; sl@0: GLREF_D TestClient* TheClient; sl@0: GLREF_D CWindowGc* TheGc; sl@0: sl@0: GLREF_C void AutoPanic(TInt aPanic); sl@0: GLREF_C void CleanUpWindow(TAny *aWindow); sl@0: GLREF_C void PushWindowL(RWindowTreeNode *aWindow); sl@0: GLREF_C TBool OpacityAndAlphaSupportedL(); sl@0: GLREF_C TInt TransparencySupportedL(); sl@0: GLREF_C TInt CheckScalingSupportedOrNot(); sl@0: GLREF_C TBool CheckNonZeroOriginsSupportedOrNot(); sl@0: GLREF_C TPoint PhysicalToLogical(TPoint aPhysicalPtMinusOrigin,TSize aScale); sl@0: GLREF_C TPtrC DisplayModeAsString(TDisplayMode aMode); sl@0: GLREF_C TBool LossyCheckBlankBitmap(const CFbsBitmap& aBitmap, const TRect aArea, const TRgb aCheckColor, TBool aLossyCompare=ETrue); sl@0: GLREF_C TBool LossyCompareBitmap(const CFbsBitmap& aBitmap1, const CFbsBitmap& aBitmap2, const TRect aCompareRect, TBool aLossyCompare=ETrue); sl@0: GLDEF_C TBool LossyCompareBitmapRecord(CFbsBitmap& aBitmap1, CFbsBitmap& aBitmap2, const TRect aCompareRect, TBool aLossyCompare, TInt& aPixelsDifferent, CTestExecuteLogger& aLogger); sl@0: GLREF_C TBool LossyCheckBlankWindow(const CWsScreenDevice& aScreen, CFbsBitmap& aBitmap, const TRect aArea, const TRgb aCheckColor); sl@0: GLREF_C TBool LossyCompareWindow(const CWsScreenDevice& aScreen, CFbsBitmap& aBitmap1, CFbsBitmap& aBitmap2, const TRect aCompareRect); sl@0: sl@0: #define LogText(S) {_LIT(String__LINE__,S); Logger.Log(String__LINE__);} sl@0: #define LogFormat(S) {Logger.Log(S);} sl@0: sl@0: inline CTestDriver* CTestBase::Driver() sl@0: { sl@0: return iDriver; sl@0: } sl@0: sl@0: class CTransWindow : public CBlankWindow sl@0: { sl@0: public: sl@0: static CTransWindow* NewL(RPointerArray& aWindows,TRgb aColor,TRect aPos); sl@0: static CTransWindow* NewL(CTWinBase* aParent,TRgb aColor,TRect aPos,TDisplayMode* aDisplayMode); sl@0: static CTransWindow* NewL(CTWinBase* aParent,TRgb aColor,TDisplayMode* aDisplayMode); sl@0: void ToggleVisibility(); sl@0: static void SetOrdinal(RPointerArray& aWindows,TInt aOldPos,TInt aNewPos); sl@0: inline TRgb Color() {return iCol;} sl@0: inline TBool IsVisible() {return iVisible;} sl@0: void SetShadowDisabled(TBool aState); sl@0: inline TBool IsShadowing() {return iShadowing;} sl@0: inline TBool ShadowHeight() {return iShadowHight;} sl@0: inline void SetPosOffset(TPoint aOffset) {iPosOffset=aOffset;} sl@0: virtual void Draw(); sl@0: void SetDrawOpaque(TBool aDrawOpaque) { iDrawOpaque = aDrawOpaque; } sl@0: TBool DrawOpaque() const { return iDrawOpaque; } sl@0: //Virtual functions from CTWinBase overridden in CTBaseWin sl@0: void AdjustShadow(TInt aAdjust); sl@0: TPoint Position() const; sl@0: inline TInt TransparentError() {return iError;} sl@0: private: sl@0: CTransWindow(TRgb aColor) :CBlankWindow(aColor), iVisible(ETrue) {} sl@0: //Virtual function from CTBaseWin sl@0: void InitWin(); sl@0: private: sl@0: TBool iVisible; sl@0: TBool iShadowing; sl@0: TBool iDrawOpaque; sl@0: TInt iShadowHight; sl@0: TPoint iPosOffset; sl@0: TInt iError; sl@0: }; sl@0: sl@0: class CMinWin : public CBase sl@0: { sl@0: public: sl@0: CMinWin(TInt aScreenNo); sl@0: ~CMinWin(); sl@0: void ConstructL(); sl@0: void Draw(const TRect& aRect); sl@0: private: sl@0: RWsSession iWs; sl@0: RWindow iWin; sl@0: RWindowGroup iGroup; sl@0: CWsScreenDevice* iScr; sl@0: TInt iScreenNo; sl@0: TRect iRect; sl@0: CWindowGc* iGc; sl@0: }; sl@0: sl@0: class CTimeOut : public CTimer sl@0: { sl@0: public: sl@0: inline CTimeOut(): CTimer((EPriorityLow+EPriorityIdle)/2) {} sl@0: void ConstructL(); sl@0: void Start(TTimeIntervalMicroSeconds32 aInterval,TCallBack aCallBack); sl@0: //Pure virtual from CActive sl@0: void RunL(); sl@0: private: sl@0: TCallBack iCallBack; sl@0: }; sl@0: sl@0: #define COMPARE_WINDOWS_SOFTFAIL_WINSCW CompareWindowsSoftFailWinscw((TText8*)__FILE__, __LINE__) sl@0: sl@0: #define __WS_CONSTRUCT_STEP__(a) \ sl@0: CT##a##Step::CT##a##Step() \ sl@0: { \ sl@0: SetTestStepName(KT##a##Step); \ sl@0: SetLogHeapInfo(ETrue); \ sl@0: } \ sl@0: \ sl@0: CTGraphicsBase* CT##a##Step::CreateTestL() \ sl@0: { \ sl@0: CTWsGraphicsBase* test=new (ELeave) CT##a (this); \ sl@0: test->CreateTestBaseL(this);\ sl@0: return test;\ sl@0: } sl@0: sl@0: #endif