sl@0: // Copyright (c) 2008-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: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent sl@0: */ sl@0: sl@0: #ifndef COMPARISON_H sl@0: #define COMPARISON_H sl@0: sl@0: sl@0: sl@0: #include "stresslet.h" sl@0: #include "test_step_comparison.h" sl@0: #include "test_step_conf.h" sl@0: sl@0: #include "utils.h" sl@0: sl@0: class CCompWin; sl@0: class CCrpClient; sl@0: sl@0: sl@0: class CComparison : public CStresslet sl@0: { sl@0: private: sl@0: class COperationTimer : public CTimer sl@0: { sl@0: public: sl@0: COperationTimer(CComparison* aComp); sl@0: void ConstructL(); sl@0: //pure virtual functions from CActive sl@0: void DoCancel(); sl@0: void RunL(); sl@0: private: sl@0: CComparison* iComp; sl@0: }; sl@0: sl@0: //delayed bitmap comparison sl@0: class COneShotCompare : public CAsyncOneShot sl@0: { sl@0: public: sl@0: COneShotCompare(TInt aPriority, CComparison& aComparison); sl@0: static COneShotCompare* NewL(TInt aPriority, CComparison& aComparison); sl@0: virtual void RunL(); sl@0: private: sl@0: CComparison& iComparison; sl@0: }; sl@0: sl@0: friend class COneShotCompare; sl@0: sl@0: enum TMode sl@0: { sl@0: EAct, sl@0: EMove, sl@0: EResize sl@0: }; sl@0: enum TAct sl@0: { sl@0: EACreate, sl@0: EADestroy, sl@0: EAFront, sl@0: EABack, sl@0: EAMove, sl@0: EAResize, sl@0: EATick, sl@0: EAToggleVisible, sl@0: EACount sl@0: }; sl@0: struct TBehaviour sl@0: { sl@0: CCompWin* iWin; sl@0: TPoint iPos; sl@0: TInt iCount; sl@0: }; sl@0: public: sl@0: static CComparison * NewLC(MTestStepReporter& aReporter); sl@0: virtual ~CComparison(); sl@0: sl@0: void Verify(CFbsBitmap * aServerBmp); sl@0: void SetRunDataL(const TRunData& aRunData, MTestStepConfigurationContextFactory* aConfFactory); sl@0: TBool WindowsReadyForVerification() const; sl@0: void SetVerifyTick(TUint32 aTick); sl@0: sl@0: private: sl@0: void HandleRedraw(TWsRedrawEvent &aEvent); sl@0: void HandleEvent(TWsEvent &aEvent); sl@0: sl@0: virtual void StartL(); sl@0: TInt Tick(); sl@0: sl@0: void TickL(); sl@0: void ActL(); sl@0: void MoveL(); sl@0: void ResizeL(); sl@0: sl@0: void DoStuffL(); sl@0: void CreateWindowL(); sl@0: void DestroyWindow(); sl@0: void MoveWindow(); sl@0: void ResizeWindow(); sl@0: void BringWindowToFrontL(); sl@0: void SendWindowToBackL(); sl@0: void TickWindowL(); sl@0: void ToggleVisible(); sl@0: sl@0: TInt FindTopWindow(CCompWin* aWin); sl@0: void DrawBitmap(); sl@0: CCompWin* RandomWindow(); sl@0: TBool BitmapsMatch(const CFbsBitmap * aBitmap1, const CFbsBitmap * aBitmap2); sl@0: void Touch(); sl@0: sl@0: CComparison (MTestStepReporter& aReporter); sl@0: sl@0: void ConstructL(); sl@0: void WriteLog(); sl@0: private: sl@0: TInt64 iFirstSeed; sl@0: TMode iMode; sl@0: TAct iAct; sl@0: TBool iWasOk; sl@0: TBehaviour iBehaviour; sl@0: CPeriodic* iPeriodic; sl@0: RWindowGroup* iWinGroup; sl@0: RBlankWindow* iBackground; sl@0: RPointerArray iWindows; sl@0: CFbsBitmap * iBitmap[2]; sl@0: CFbsBitmapDevice * iDevice[2]; sl@0: CFbsBitGc * iBmpGc; sl@0: CFbsBitmap * iDifferenceBitmap; sl@0: CFbsBitmapDevice * iDifferenceDevice; sl@0: CWsScreenDevice* iScreen; sl@0: CFbsBitmap *iScreenBitmap; sl@0: RFs iFs; sl@0: TTime iStartTime; sl@0: TInt iCurrentBmp; sl@0: TInt iLastBmp; sl@0: TInt iTestNum; sl@0: TInt iErrorNum; sl@0: TUint32 iPixel1; sl@0: TUint32 iPixel2; sl@0: TPoint iPixelPos; sl@0: sl@0: TBool iMustConclude; sl@0: TInt iNumWindowsLeft; //number of windows to be created before test is over sl@0: CTestExecWatchCat* iWatchCat; sl@0: TRunData iData; sl@0: sl@0: TBool iStuffDone; sl@0: COperationTimer* iTimer; sl@0: COneShotCompare *iOneShotCompare; sl@0: }; sl@0: sl@0: #endif // COMPARISON_H