|
1 // Copyright (c) 2008-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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @test |
|
19 @internalComponent |
|
20 */ |
|
21 |
|
22 #ifndef COMPARISON_H |
|
23 #define COMPARISON_H |
|
24 |
|
25 |
|
26 |
|
27 #include "stresslet.h" |
|
28 #include "test_step_comparison.h" |
|
29 #include "test_step_conf.h" |
|
30 |
|
31 #include "utils.h" |
|
32 |
|
33 class CCompWin; |
|
34 class CCrpClient; |
|
35 |
|
36 |
|
37 class CComparison : public CStresslet |
|
38 { |
|
39 private: |
|
40 class COperationTimer : public CTimer |
|
41 { |
|
42 public: |
|
43 COperationTimer(CComparison* aComp); |
|
44 void ConstructL(); |
|
45 //pure virtual functions from CActive |
|
46 void DoCancel(); |
|
47 void RunL(); |
|
48 private: |
|
49 CComparison* iComp; |
|
50 }; |
|
51 |
|
52 //delayed bitmap comparison |
|
53 class COneShotCompare : public CAsyncOneShot |
|
54 { |
|
55 public: |
|
56 COneShotCompare(TInt aPriority, CComparison& aComparison); |
|
57 static COneShotCompare* NewL(TInt aPriority, CComparison& aComparison); |
|
58 virtual void RunL(); |
|
59 private: |
|
60 CComparison& iComparison; |
|
61 }; |
|
62 |
|
63 friend class COneShotCompare; |
|
64 |
|
65 enum TMode |
|
66 { |
|
67 EAct, |
|
68 EMove, |
|
69 EResize |
|
70 }; |
|
71 enum TAct |
|
72 { |
|
73 EACreate, |
|
74 EADestroy, |
|
75 EAFront, |
|
76 EABack, |
|
77 EAMove, |
|
78 EAResize, |
|
79 EATick, |
|
80 EAToggleVisible, |
|
81 EACount |
|
82 }; |
|
83 struct TBehaviour |
|
84 { |
|
85 CCompWin* iWin; |
|
86 TPoint iPos; |
|
87 TInt iCount; |
|
88 }; |
|
89 public: |
|
90 static CComparison * NewLC(MTestStepReporter& aReporter); |
|
91 virtual ~CComparison(); |
|
92 |
|
93 void Verify(CFbsBitmap * aServerBmp); |
|
94 void SetRunDataL(const TRunData& aRunData, MTestStepConfigurationContextFactory* aConfFactory); |
|
95 TBool WindowsReadyForVerification() const; |
|
96 void SetVerifyTick(TUint32 aTick); |
|
97 |
|
98 private: |
|
99 void HandleRedraw(TWsRedrawEvent &aEvent); |
|
100 void HandleEvent(TWsEvent &aEvent); |
|
101 |
|
102 virtual void StartL(); |
|
103 TInt Tick(); |
|
104 |
|
105 void TickL(); |
|
106 void ActL(); |
|
107 void MoveL(); |
|
108 void ResizeL(); |
|
109 |
|
110 void DoStuffL(); |
|
111 void CreateWindowL(); |
|
112 void DestroyWindow(); |
|
113 void MoveWindow(); |
|
114 void ResizeWindow(); |
|
115 void BringWindowToFrontL(); |
|
116 void SendWindowToBackL(); |
|
117 void TickWindowL(); |
|
118 void ToggleVisible(); |
|
119 |
|
120 TInt FindTopWindow(CCompWin* aWin); |
|
121 void DrawBitmap(); |
|
122 CCompWin* RandomWindow(); |
|
123 TBool BitmapsMatch(const CFbsBitmap * aBitmap1, const CFbsBitmap * aBitmap2); |
|
124 void Touch(); |
|
125 |
|
126 CComparison (MTestStepReporter& aReporter); |
|
127 |
|
128 void ConstructL(); |
|
129 void WriteLog(); |
|
130 private: |
|
131 TInt64 iFirstSeed; |
|
132 TMode iMode; |
|
133 TAct iAct; |
|
134 TBool iWasOk; |
|
135 TBehaviour iBehaviour; |
|
136 CPeriodic* iPeriodic; |
|
137 RWindowGroup* iWinGroup; |
|
138 RBlankWindow* iBackground; |
|
139 RPointerArray<CCompWin> iWindows; |
|
140 CFbsBitmap * iBitmap[2]; |
|
141 CFbsBitmapDevice * iDevice[2]; |
|
142 CFbsBitGc * iBmpGc; |
|
143 CFbsBitmap * iDifferenceBitmap; |
|
144 CFbsBitmapDevice * iDifferenceDevice; |
|
145 CWsScreenDevice* iScreen; |
|
146 CFbsBitmap *iScreenBitmap; |
|
147 RFs iFs; |
|
148 TTime iStartTime; |
|
149 TInt iCurrentBmp; |
|
150 TInt iLastBmp; |
|
151 TInt iTestNum; |
|
152 TInt iErrorNum; |
|
153 TUint32 iPixel1; |
|
154 TUint32 iPixel2; |
|
155 TPoint iPixelPos; |
|
156 |
|
157 TBool iMustConclude; |
|
158 TInt iNumWindowsLeft; //number of windows to be created before test is over |
|
159 CTestExecWatchCat* iWatchCat; |
|
160 TRunData iData; |
|
161 |
|
162 TBool iStuffDone; |
|
163 COperationTimer* iTimer; |
|
164 COneShotCompare *iOneShotCompare; |
|
165 }; |
|
166 |
|
167 #endif // COMPARISON_H |