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 |
// Automatically test the window server
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <e32std.h>
|
sl@0
|
20 |
#include <w32std.h>
|
sl@0
|
21 |
#include <e32svr.h>
|
sl@0
|
22 |
#include <hal.h>
|
sl@0
|
23 |
#include "../tlib/testbase.h"
|
sl@0
|
24 |
#include <stdlib.h>
|
sl@0
|
25 |
#include "AUTO.H"
|
sl@0
|
26 |
|
sl@0
|
27 |
LOCAL_D const TUint KPanicThreadHeapSize=0x8000;
|
sl@0
|
28 |
|
sl@0
|
29 |
GLREF_C TInt ProcPriTestOtherProcess(TAny *aScreenNumber);
|
sl@0
|
30 |
GLREF_C TInt ProcToKill(TAny *aScreenNumber);
|
sl@0
|
31 |
GLREF_C TInt ProcDirect(TAny *aScreenNumber);
|
sl@0
|
32 |
GLREF_C TInt ProcMultiDisplay(TAny *aScreenNumber);
|
sl@0
|
33 |
|
sl@0
|
34 |
_LIT(Priority,"ProcPriTest");
|
sl@0
|
35 |
_LIT(ToKill,"ProcToKill");
|
sl@0
|
36 |
_LIT(Direct,"ProcDirect");
|
sl@0
|
37 |
_LIT(MultiDisplay,"ProcMultiDisplay");
|
sl@0
|
38 |
|
sl@0
|
39 |
CProcess::TInitialFunction CProcess::iFunctions[]=
|
sl@0
|
40 |
{
|
sl@0
|
41 |
TInitialFunction(Priority,ProcPriTestOtherProcess),
|
sl@0
|
42 |
TInitialFunction(ToKill,ProcToKill),
|
sl@0
|
43 |
TInitialFunction(Direct,ProcDirect),
|
sl@0
|
44 |
TInitialFunction(MultiDisplay,ProcMultiDisplay)
|
sl@0
|
45 |
};
|
sl@0
|
46 |
|
sl@0
|
47 |
GLDEF_D TestWindow *BaseWin;
|
sl@0
|
48 |
GLDEF_D TestWindow *TestWin;
|
sl@0
|
49 |
GLDEF_D TestClient *TheClient=NULL;
|
sl@0
|
50 |
GLDEF_D CWindowGc *TheGc;
|
sl@0
|
51 |
TInt CTestBase::iMaxGrays=0;
|
sl@0
|
52 |
TInt CTestBase::iScreenNo=0;
|
sl@0
|
53 |
TInt CTestBase::iMaxColors=0;
|
sl@0
|
54 |
TInt CTestBase::iNumberTestsPass=0;
|
sl@0
|
55 |
TInt CTestBase::iNumberTests=0;
|
sl@0
|
56 |
TRect CTestBase::iNormalPointerCursorArea;
|
sl@0
|
57 |
TPartialRedrawType CTestBase::iRedrawType=EPartialRedraw_Unknown;
|
sl@0
|
58 |
TInt CTestBase::iNumberOfGrpWndsOnPrimaryScreenWithZeroPriority = 0;
|
sl@0
|
59 |
TInt CTestDriver::iTestNum=0;
|
sl@0
|
60 |
|
sl@0
|
61 |
GLDEF_D TInt TheTestResult=ETestPassed; // start with passed to anticipate empty test table
|
sl@0
|
62 |
|
sl@0
|
63 |
const TInt KBorderWinWidth = 5;
|
sl@0
|
64 |
|
sl@0
|
65 |
_LIT(Auto,"AUTO ");
|
sl@0
|
66 |
|
sl@0
|
67 |
TInt64 TTestRects::iSeed=0;
|
sl@0
|
68 |
TRect TTestRects::iList[]={
|
sl@0
|
69 |
// 0-5
|
sl@0
|
70 |
TRect(2,2,2,2),
|
sl@0
|
71 |
TRect(2,2,2,2),
|
sl@0
|
72 |
TRect(2,2,2,2),
|
sl@0
|
73 |
TRect(2,2,2,2),
|
sl@0
|
74 |
TRect(2,2,2,2),
|
sl@0
|
75 |
// 5-13
|
sl@0
|
76 |
TRect(0,0,0,0),
|
sl@0
|
77 |
TRect(2,0,2,0),
|
sl@0
|
78 |
TRect(4,0,4,0),
|
sl@0
|
79 |
TRect(0,2,0,2),
|
sl@0
|
80 |
TRect(2,2,2,2),
|
sl@0
|
81 |
TRect(4,2,4,2),
|
sl@0
|
82 |
TRect(0,4,0,4),
|
sl@0
|
83 |
TRect(2,4,2,4),
|
sl@0
|
84 |
TRect(4,4,4,4),
|
sl@0
|
85 |
// 13-22
|
sl@0
|
86 |
TRect(0,0,1,1),
|
sl@0
|
87 |
TRect(1,0,3,1),
|
sl@0
|
88 |
TRect(3,0,4,1),
|
sl@0
|
89 |
TRect(0,1,1,3),
|
sl@0
|
90 |
TRect(1,1,3,3),
|
sl@0
|
91 |
TRect(3,1,4,3),
|
sl@0
|
92 |
TRect(0,3,1,4),
|
sl@0
|
93 |
TRect(1,3,3,4),
|
sl@0
|
94 |
TRect(3,3,4,4),
|
sl@0
|
95 |
// 23-31
|
sl@0
|
96 |
TRect(0,0,2,0),
|
sl@0
|
97 |
TRect(2,0,4,0),
|
sl@0
|
98 |
TRect(0,0,4,0),
|
sl@0
|
99 |
TRect(0,2,2,2),
|
sl@0
|
100 |
TRect(2,2,4,2),
|
sl@0
|
101 |
TRect(0,2,4,2),
|
sl@0
|
102 |
TRect(0,4,2,4),
|
sl@0
|
103 |
TRect(2,4,4,4),
|
sl@0
|
104 |
TRect(0,4,4,4),
|
sl@0
|
105 |
// 32-40
|
sl@0
|
106 |
TRect(0,0,0,2),
|
sl@0
|
107 |
TRect(0,2,0,4),
|
sl@0
|
108 |
TRect(0,0,0,4),
|
sl@0
|
109 |
TRect(2,0,2,2),
|
sl@0
|
110 |
TRect(2,2,2,4),
|
sl@0
|
111 |
TRect(2,0,2,4),
|
sl@0
|
112 |
TRect(4,0,4,2),
|
sl@0
|
113 |
TRect(4,2,4,4),
|
sl@0
|
114 |
TRect(4,0,4,4),
|
sl@0
|
115 |
// 41-44
|
sl@0
|
116 |
TRect(0,0,2,2),
|
sl@0
|
117 |
TRect(2,0,4,2),
|
sl@0
|
118 |
TRect(0,2,2,4),
|
sl@0
|
119 |
TRect(2,2,4,4),
|
sl@0
|
120 |
// 45-48
|
sl@0
|
121 |
TRect(0,0,3,3),
|
sl@0
|
122 |
TRect(1,0,4,3),
|
sl@0
|
123 |
TRect(0,1,3,4),
|
sl@0
|
124 |
TRect(1,1,4,4),
|
sl@0
|
125 |
// 49
|
sl@0
|
126 |
TRect(0,0,4,4),
|
sl@0
|
127 |
// 40-53
|
sl@0
|
128 |
TRect(1,2,2,2),
|
sl@0
|
129 |
TRect(2,2,3,2),
|
sl@0
|
130 |
TRect(2,1,2,2),
|
sl@0
|
131 |
TRect(2,2,3,2),
|
sl@0
|
132 |
// 54-59
|
sl@0
|
133 |
TRect(1,2,3,2),
|
sl@0
|
134 |
TRect(2,1,2,3),
|
sl@0
|
135 |
TRect(1,1,2,2),
|
sl@0
|
136 |
TRect(1,2,2,3),
|
sl@0
|
137 |
TRect(2,2,3,3),
|
sl@0
|
138 |
TRect(2,1,3,2),
|
sl@0
|
139 |
// 60-63
|
sl@0
|
140 |
TRect(1,1,3,2),
|
sl@0
|
141 |
TRect(1,1,2,3),
|
sl@0
|
142 |
TRect(1,2,3,3),
|
sl@0
|
143 |
TRect(2,1,3,3)};
|
sl@0
|
144 |
|
sl@0
|
145 |
#if defined(__WINS__)
|
sl@0
|
146 |
void FindNonMatchingPixelL(TPoint aPt1,TPoint aPt2,TSize aSize)
|
sl@0
|
147 |
// This function is purely for use when debugging to find the first non-matching pixel
|
sl@0
|
148 |
// when a check of two on screen rects has failed.
|
sl@0
|
149 |
{
|
sl@0
|
150 |
HBufC8* buf1=HBufC8::NewMaxLC(2*aSize.iWidth);
|
sl@0
|
151 |
HBufC8* buf2=HBufC8::NewMaxLC(2*aSize.iWidth);
|
sl@0
|
152 |
TPtr8 ptr1=buf1->Des();
|
sl@0
|
153 |
TPtr8 ptr2=buf2->Des();
|
sl@0
|
154 |
TInt row=0;
|
sl@0
|
155 |
TBool ret = true;
|
sl@0
|
156 |
for (;row<aSize.iHeight;++row)
|
sl@0
|
157 |
{
|
sl@0
|
158 |
TheClient->iScreen->GetScanLine(ptr1,aPt1,aSize.iWidth,EColor64K);
|
sl@0
|
159 |
TheClient->iScreen->GetScanLine(ptr2,aPt2,aSize.iWidth,EColor64K);
|
sl@0
|
160 |
if (ptr1!=ptr2)
|
sl@0
|
161 |
break;
|
sl@0
|
162 |
++aPt1.iY;
|
sl@0
|
163 |
++aPt2.iY;
|
sl@0
|
164 |
}
|
sl@0
|
165 |
TRgb color1,color2;
|
sl@0
|
166 |
if (row<aSize.iHeight)
|
sl@0
|
167 |
{
|
sl@0
|
168 |
for (TInt col=0;col<aSize.iWidth;++col)
|
sl@0
|
169 |
{
|
sl@0
|
170 |
TheClient->iScreen->GetPixel(color1,aPt1);
|
sl@0
|
171 |
TheClient->iScreen->GetPixel(color2,aPt2);
|
sl@0
|
172 |
if (color1!=color2)
|
sl@0
|
173 |
{ // Break here to find first pixel that didn't match.
|
sl@0
|
174 |
TBuf<256> buf;
|
sl@0
|
175 |
_LIT(KFindNonMatchingPixelFmt,"First non matching pixel (%d,%d)");
|
sl@0
|
176 |
buf.Format(KFindNonMatchingPixelFmt,col,row);
|
sl@0
|
177 |
TheClient->iWs.LogMessage(buf);
|
sl@0
|
178 |
break;
|
sl@0
|
179 |
|
sl@0
|
180 |
}
|
sl@0
|
181 |
++aPt1.iX;
|
sl@0
|
182 |
++aPt2.iX;
|
sl@0
|
183 |
}
|
sl@0
|
184 |
}
|
sl@0
|
185 |
CleanupStack::PopAndDestroy(2);
|
sl@0
|
186 |
}
|
sl@0
|
187 |
|
sl@0
|
188 |
void FindNonMatchingPixel(TPoint aPt1,TPoint aPt2,TSize aSize)
|
sl@0
|
189 |
{
|
sl@0
|
190 |
TRAPD(ignore,FindNonMatchingPixelL(aPt1,aPt2,aSize));
|
sl@0
|
191 |
}
|
sl@0
|
192 |
#endif
|
sl@0
|
193 |
|
sl@0
|
194 |
void AutoPanic(TInt aPanic)
|
sl@0
|
195 |
{
|
sl@0
|
196 |
User::Panic(_L("Auto"),aPanic);
|
sl@0
|
197 |
}
|
sl@0
|
198 |
|
sl@0
|
199 |
void CleanUpWindow(TAny *aWindow)
|
sl@0
|
200 |
{
|
sl@0
|
201 |
((RWindowTreeNode *)aWindow)->Close();
|
sl@0
|
202 |
}
|
sl@0
|
203 |
|
sl@0
|
204 |
void PushWindowL(RWindowTreeNode *aWindow)
|
sl@0
|
205 |
{
|
sl@0
|
206 |
CleanupStack::PushL(TCleanupItem(CleanUpWindow,aWindow));
|
sl@0
|
207 |
}
|
sl@0
|
208 |
|
sl@0
|
209 |
|
sl@0
|
210 |
TBool OpacityAndAlphaSupportedL()
|
sl@0
|
211 |
{
|
sl@0
|
212 |
// If opacity is not implemented, EFalse will be returned
|
sl@0
|
213 |
if(TransparencySupportedL()!=KErrNone)
|
sl@0
|
214 |
return EFalse;
|
sl@0
|
215 |
|
sl@0
|
216 |
const TRgb KTransparencyColor(0,0,0);
|
sl@0
|
217 |
RWindow winb(TheClient->iWs);
|
sl@0
|
218 |
CleanupClosePushL(winb);
|
sl@0
|
219 |
RWindow wint(TheClient->iWs);
|
sl@0
|
220 |
CleanupClosePushL(wint);
|
sl@0
|
221 |
User::LeaveIfError(winb.Construct(*TheClient->iGroup->GroupWin(), ENullWsHandle));
|
sl@0
|
222 |
User::LeaveIfError(wint.Construct(*TheClient->iGroup->GroupWin(), ENullWsHandle));
|
sl@0
|
223 |
winb.SetExtent(TPoint(0,0), TSize(50,50));
|
sl@0
|
224 |
wint.SetExtent(TPoint(0,0), TSize(50,50));
|
sl@0
|
225 |
winb.SetRequiredDisplayMode(EColor256);
|
sl@0
|
226 |
wint.SetRequiredDisplayMode(EColor256);
|
sl@0
|
227 |
wint.SetTransparencyFactor(KTransparencyColor);
|
sl@0
|
228 |
winb.SetBackgroundColor(TRgb(0,0,255));
|
sl@0
|
229 |
wint.SetBackgroundColor(TRgb(255,0,0));
|
sl@0
|
230 |
winb.Activate();
|
sl@0
|
231 |
wint.Activate();
|
sl@0
|
232 |
|
sl@0
|
233 |
wint.BeginRedraw();
|
sl@0
|
234 |
TheClient->iGc->Activate(wint);
|
sl@0
|
235 |
TheClient->iGc->SetOpaque(ETrue);
|
sl@0
|
236 |
TheClient->iGc->SetPenStyle(CGraphicsContext::ENullPen);
|
sl@0
|
237 |
TheClient->iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
238 |
TheClient->iGc->SetBrushColor(TRgb(0,255,0));
|
sl@0
|
239 |
TheClient->iGc->DrawRect(TRect(TPoint(0,0), TSize(50,50)));
|
sl@0
|
240 |
TheClient->iGc->SetOpaque(EFalse);
|
sl@0
|
241 |
TheClient->iGc->Deactivate();
|
sl@0
|
242 |
wint.EndRedraw();
|
sl@0
|
243 |
TheClient->Flush();
|
sl@0
|
244 |
|
sl@0
|
245 |
// The window should be all green, if opacity is working, or all blue if it isn't.
|
sl@0
|
246 |
// If the window has any other colour, then something has broken.
|
sl@0
|
247 |
TRgb color;
|
sl@0
|
248 |
TheClient->iScreen->GetPixel(color,TPoint(25,25));
|
sl@0
|
249 |
if (color.Red()>0 || ((color.Green()==0) == (color.Blue()==0)))
|
sl@0
|
250 |
User::Leave(KErrGeneral);
|
sl@0
|
251 |
TBool ret=(color.Green()>0);
|
sl@0
|
252 |
|
sl@0
|
253 |
CleanupStack::PopAndDestroy(2,&winb); // wint
|
sl@0
|
254 |
return ret;
|
sl@0
|
255 |
}
|
sl@0
|
256 |
|
sl@0
|
257 |
TInt TransparencySupportedL()
|
sl@0
|
258 |
{
|
sl@0
|
259 |
// Creates a window and enables alpha transparency, if this feature
|
sl@0
|
260 |
// is not enabled, KErrNotSupported will be returned
|
sl@0
|
261 |
RWindow win(TheClient->iWs);
|
sl@0
|
262 |
User::LeaveIfError(win.Construct(*TheClient->iGroup->GroupWin(), ENullWsHandle));
|
sl@0
|
263 |
win.SetExtent(TPoint(0,0), TSize(50,50));
|
sl@0
|
264 |
TInt ret=win.SetTransparencyAlphaChannel();
|
sl@0
|
265 |
win.Close();
|
sl@0
|
266 |
return ret;
|
sl@0
|
267 |
}
|
sl@0
|
268 |
|
sl@0
|
269 |
TInt CheckScalingSupportedOrNot()
|
sl@0
|
270 |
{
|
sl@0
|
271 |
TBool scalingSupported=EFalse;
|
sl@0
|
272 |
TSizeMode originalModeData=TheClient->iScreen->GetCurrentScreenModeAttributes();
|
sl@0
|
273 |
TSizeMode tempData=originalModeData;
|
sl@0
|
274 |
tempData.iScreenScale=TSize(2,2);
|
sl@0
|
275 |
TheClient->iScreen->SetCurrentScreenModeAttributes(tempData);
|
sl@0
|
276 |
TSize scale=TheClient->iScreen->GetCurrentScreenModeScale();
|
sl@0
|
277 |
if (scale.iWidth==2 && scale.iHeight==2)
|
sl@0
|
278 |
{
|
sl@0
|
279 |
scalingSupported=ETrue;
|
sl@0
|
280 |
}
|
sl@0
|
281 |
TheClient->iScreen->SetCurrentScreenModeAttributes(originalModeData);
|
sl@0
|
282 |
TheClient->Flush();
|
sl@0
|
283 |
return scalingSupported;
|
sl@0
|
284 |
}
|
sl@0
|
285 |
|
sl@0
|
286 |
TBool CheckNonZeroOriginsSupportedOrNot()
|
sl@0
|
287 |
{
|
sl@0
|
288 |
TBool nonZeroOriginsSupported=EFalse;
|
sl@0
|
289 |
TSizeMode sizeMode1=TheClient->iScreen->GetCurrentScreenModeAttributes();
|
sl@0
|
290 |
TSizeMode sizeMode2=sizeMode1;
|
sl@0
|
291 |
sizeMode2.iOrigin=TPoint(30,30);
|
sl@0
|
292 |
TheClient->iScreen->SetCurrentScreenModeAttributes(sizeMode2);
|
sl@0
|
293 |
TPoint origin=TheClient->iScreen->GetCurrentScreenModeScaledOrigin();
|
sl@0
|
294 |
if (origin.iX==30 && origin.iY==30)
|
sl@0
|
295 |
{
|
sl@0
|
296 |
nonZeroOriginsSupported=ETrue;
|
sl@0
|
297 |
}
|
sl@0
|
298 |
TheClient->iScreen->SetCurrentScreenModeAttributes(sizeMode1);
|
sl@0
|
299 |
TheClient->Flush();
|
sl@0
|
300 |
return nonZeroOriginsSupported;
|
sl@0
|
301 |
}
|
sl@0
|
302 |
|
sl@0
|
303 |
TPoint PhysicalToLogical(TPoint aPhysicalPtMinusOrigin,TSize aScale)
|
sl@0
|
304 |
{
|
sl@0
|
305 |
TPoint logicalPt(aPhysicalPtMinusOrigin);
|
sl@0
|
306 |
if (aScale.iWidth!=1)
|
sl@0
|
307 |
{
|
sl@0
|
308 |
logicalPt.iX=(logicalPt.iX>= 0 ? logicalPt.iX/aScale.iWidth : (logicalPt.iX-(aScale.iWidth-1))/aScale.iWidth);
|
sl@0
|
309 |
}
|
sl@0
|
310 |
if (aScale.iHeight!=1)
|
sl@0
|
311 |
{
|
sl@0
|
312 |
logicalPt.iY=(logicalPt.iY>= 0 ? logicalPt.iY/aScale.iHeight : (logicalPt.iY-(aScale.iHeight-1))/aScale.iHeight);
|
sl@0
|
313 |
}
|
sl@0
|
314 |
return logicalPt;
|
sl@0
|
315 |
}
|
sl@0
|
316 |
|
sl@0
|
317 |
//
|
sl@0
|
318 |
// Log window, logs testing //
|
sl@0
|
319 |
//
|
sl@0
|
320 |
|
sl@0
|
321 |
LogWindow::LogWindow() : CTWin(), iTestTitle(KNullDesC), iSubTitle(KNullDesC), iMessage(KNullDesC)
|
sl@0
|
322 |
{}
|
sl@0
|
323 |
|
sl@0
|
324 |
void LogWindow::ConstructL(CTWinBase &parent)
|
sl@0
|
325 |
{
|
sl@0
|
326 |
CTWin::ConstructL(parent);
|
sl@0
|
327 |
iTitleHeight=iFont->HeightInPixels()+4;
|
sl@0
|
328 |
}
|
sl@0
|
329 |
|
sl@0
|
330 |
void LogWindow::DrawSubTitle()
|
sl@0
|
331 |
{
|
sl@0
|
332 |
iGc->DrawText(iSubTitle, TRect(2,iTitleHeight*2,iSize.iWidth-2,iTitleHeight*3),iFont->AscentInPixels(), CGraphicsContext::ECenter);
|
sl@0
|
333 |
}
|
sl@0
|
334 |
|
sl@0
|
335 |
void LogWindow::DrawMessage()
|
sl@0
|
336 |
{
|
sl@0
|
337 |
iGc->DrawText(iMessage, TRect(1,iTitleHeight*4,iSize.iWidth-2,iTitleHeight*5),iFont->AscentInPixels(), CGraphicsContext::ECenter);
|
sl@0
|
338 |
}
|
sl@0
|
339 |
|
sl@0
|
340 |
void LogWindow::Draw()
|
sl@0
|
341 |
{
|
sl@0
|
342 |
iGc->SetPenColor(TRgb::Gray16(8));
|
sl@0
|
343 |
iGc->SetPenColor(TRgb::Gray16(0));
|
sl@0
|
344 |
DrawBorder();
|
sl@0
|
345 |
iGc->DrawLine(TPoint(0,iTitleHeight),TPoint(iSize.iWidth,iTitleHeight));
|
sl@0
|
346 |
iGc->DrawText(iTestTitle, TPoint((iSize.iWidth-iFont->TextWidthInPixels(iTestTitle))/2,iFont->AscentInPixels()+2));
|
sl@0
|
347 |
DrawSubTitle();
|
sl@0
|
348 |
DrawMessage();
|
sl@0
|
349 |
}
|
sl@0
|
350 |
|
sl@0
|
351 |
/**
|
sl@0
|
352 |
This function is not used at the moment but I leave it in in case I need it when I improve the logging in
|
sl@0
|
353 |
the log window.
|
sl@0
|
354 |
*/
|
sl@0
|
355 |
void LogWindow::LogTest(const TDesC &aTitle,TInt aNum)
|
sl@0
|
356 |
{
|
sl@0
|
357 |
_LIT(Test,"Test %d,%S");
|
sl@0
|
358 |
iTestTitle.Format(Test,aNum,&aTitle);
|
sl@0
|
359 |
TLogMessageText buf;
|
sl@0
|
360 |
_LIT(AutoNewTest,"AUTO New Test: ");
|
sl@0
|
361 |
buf.Append(AutoNewTest);
|
sl@0
|
362 |
buf.Append(iTestTitle);
|
sl@0
|
363 |
TheClient->LogMessage(buf);
|
sl@0
|
364 |
iMessage.Zero();
|
sl@0
|
365 |
iWin.Invalidate();
|
sl@0
|
366 |
}
|
sl@0
|
367 |
|
sl@0
|
368 |
/**
|
sl@0
|
369 |
This function is not used at the moment but I leave it in in case I need it when I improve the logging in
|
sl@0
|
370 |
the log window.
|
sl@0
|
371 |
*/
|
sl@0
|
372 |
const TDesC& LogWindow::LogSubTest(const TDesC &aTitle,TInt aNum)
|
sl@0
|
373 |
{
|
sl@0
|
374 |
_LIT(SubTest,"Sub-Test[%d], %S");
|
sl@0
|
375 |
iSubTitle.Format(SubTest,aNum,&aTitle);
|
sl@0
|
376 |
TLogMessageText buf;
|
sl@0
|
377 |
buf.Append(Auto);
|
sl@0
|
378 |
buf.Append(iSubTitle);
|
sl@0
|
379 |
TheClient->LogMessage(buf);
|
sl@0
|
380 |
iMessage.Zero();
|
sl@0
|
381 |
iGc->Activate(iWin);
|
sl@0
|
382 |
iGc->UseFont((CFont *)iFont);
|
sl@0
|
383 |
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
384 |
DrawSubTitle();
|
sl@0
|
385 |
DrawMessage();
|
sl@0
|
386 |
iGc->Deactivate();
|
sl@0
|
387 |
TheClient->iWs.Flush();
|
sl@0
|
388 |
return iSubTitle;
|
sl@0
|
389 |
}
|
sl@0
|
390 |
|
sl@0
|
391 |
const TDesC& LogWindow::LogMessage(TBool aLog,const TDesC& aText,TInt aNum)
|
sl@0
|
392 |
{
|
sl@0
|
393 |
if (aNum!=EDummyValue)
|
sl@0
|
394 |
{
|
sl@0
|
395 |
_LIT(StringInt,"%S %d");
|
sl@0
|
396 |
iMessage.Format(StringInt,&aText,aNum);
|
sl@0
|
397 |
}
|
sl@0
|
398 |
else
|
sl@0
|
399 |
{
|
sl@0
|
400 |
_LIT(String,"%S");
|
sl@0
|
401 |
iMessage.Format(String,&aText);
|
sl@0
|
402 |
}
|
sl@0
|
403 |
iGc->Activate(iWin);
|
sl@0
|
404 |
iGc->UseFont((CFont *)iFont);
|
sl@0
|
405 |
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
406 |
DrawMessage();
|
sl@0
|
407 |
iGc->Deactivate();
|
sl@0
|
408 |
if (aLog)
|
sl@0
|
409 |
{
|
sl@0
|
410 |
TLogMessageText buf;
|
sl@0
|
411 |
buf.Append(Auto);
|
sl@0
|
412 |
buf.Append(iMessage);
|
sl@0
|
413 |
TheClient->LogMessage(buf);
|
sl@0
|
414 |
}
|
sl@0
|
415 |
TheClient->iWs.Flush();
|
sl@0
|
416 |
return iMessage;
|
sl@0
|
417 |
}
|
sl@0
|
418 |
|
sl@0
|
419 |
|
sl@0
|
420 |
//
|
sl@0
|
421 |
// Test window, simple window used to do test graphics in //
|
sl@0
|
422 |
//
|
sl@0
|
423 |
TestWindow::TestWindow() : CTWin()
|
sl@0
|
424 |
{
|
sl@0
|
425 |
}
|
sl@0
|
426 |
|
sl@0
|
427 |
TestWindow::~TestWindow()
|
sl@0
|
428 |
{
|
sl@0
|
429 |
delete iBorderWin;
|
sl@0
|
430 |
}
|
sl@0
|
431 |
|
sl@0
|
432 |
void TestWindow::SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc)
|
sl@0
|
433 |
{
|
sl@0
|
434 |
iBorderWin=new(ELeave) CBorderWindow();
|
sl@0
|
435 |
iBorderWin->SetUpL(pos,size,parent,aGc);
|
sl@0
|
436 |
TRAPD(err, CTWin::ConstructL(*iBorderWin));
|
sl@0
|
437 |
if (err==KErrNone)
|
sl@0
|
438 |
{
|
sl@0
|
439 |
SetExt(TPoint(2,2),TSize(size.iWidth-4,size.iHeight-4));
|
sl@0
|
440 |
if (err==KErrNone)
|
sl@0
|
441 |
{
|
sl@0
|
442 |
Activate();
|
sl@0
|
443 |
AssignGC(aGc);
|
sl@0
|
444 |
return;
|
sl@0
|
445 |
}
|
sl@0
|
446 |
}
|
sl@0
|
447 |
delete this;
|
sl@0
|
448 |
User::Leave(err);
|
sl@0
|
449 |
}
|
sl@0
|
450 |
|
sl@0
|
451 |
void TestWindow::Draw()
|
sl@0
|
452 |
{
|
sl@0
|
453 |
iGc->Clear();
|
sl@0
|
454 |
}
|
sl@0
|
455 |
|
sl@0
|
456 |
void TestWindow::ClearWin()
|
sl@0
|
457 |
{
|
sl@0
|
458 |
TheGc->Activate(*Win());
|
sl@0
|
459 |
TheGc->Clear();
|
sl@0
|
460 |
TheGc->Deactivate();
|
sl@0
|
461 |
}
|
sl@0
|
462 |
|
sl@0
|
463 |
void TestWindow::SetBorderExt(TPoint aPos, TSize aSize)
|
sl@0
|
464 |
{
|
sl@0
|
465 |
iBorderWin->SetExt(aPos, aSize);
|
sl@0
|
466 |
}
|
sl@0
|
467 |
|
sl@0
|
468 |
CBorderWindow* TestWindow::GetBorderWin()
|
sl@0
|
469 |
{
|
sl@0
|
470 |
return iBorderWin;
|
sl@0
|
471 |
}
|
sl@0
|
472 |
//
|
sl@0
|
473 |
CBorderWindow::CBorderWindow() : CTWin()
|
sl@0
|
474 |
{
|
sl@0
|
475 |
}
|
sl@0
|
476 |
|
sl@0
|
477 |
void CBorderWindow::ConstructL(CTWinBase &parent)
|
sl@0
|
478 |
{
|
sl@0
|
479 |
CTWin::ConstructL(parent);
|
sl@0
|
480 |
}
|
sl@0
|
481 |
|
sl@0
|
482 |
void CBorderWindow::Draw()
|
sl@0
|
483 |
{
|
sl@0
|
484 |
iGc->SetBrushColor(TRgb::Gray16(0));
|
sl@0
|
485 |
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
486 |
iGc->SetPenStyle(CGraphicsContext::ENullPen);
|
sl@0
|
487 |
iGc->DrawRect(TRect(Size()));
|
sl@0
|
488 |
}
|
sl@0
|
489 |
|
sl@0
|
490 |
//
|
sl@0
|
491 |
|
sl@0
|
492 |
TestWindowGroup::TestWindowGroup(CTClient *aClient) : CTWindowGroup(aClient)
|
sl@0
|
493 |
{
|
sl@0
|
494 |
}
|
sl@0
|
495 |
|
sl@0
|
496 |
void TestWindowGroup::BecomeOwning()
|
sl@0
|
497 |
{
|
sl@0
|
498 |
iGroupWin.DefaultOwningWindow();
|
sl@0
|
499 |
}
|
sl@0
|
500 |
|
sl@0
|
501 |
void TestWindowGroup::KeyL(const TKeyEvent &aKey,const TTime &aTime)
|
sl@0
|
502 |
{
|
sl@0
|
503 |
if (aKey.iModifiers&EModifierFunc)
|
sl@0
|
504 |
{
|
sl@0
|
505 |
switch(aKey.iCode)
|
sl@0
|
506 |
{
|
sl@0
|
507 |
case 'f':
|
sl@0
|
508 |
TheClient->Driver()->iTest->TriggerFail();
|
sl@0
|
509 |
break;
|
sl@0
|
510 |
}
|
sl@0
|
511 |
}
|
sl@0
|
512 |
else if (iCurWin)
|
sl@0
|
513 |
iCurWin->WinKeyL(aKey,aTime);
|
sl@0
|
514 |
}
|
sl@0
|
515 |
|
sl@0
|
516 |
void TestWindowGroup::KeyDownL(const TKeyEvent &aKey,const TTime &aTime)
|
sl@0
|
517 |
{
|
sl@0
|
518 |
if (iCurWin)
|
sl@0
|
519 |
iCurWin->KeyDownL(aKey,aTime);
|
sl@0
|
520 |
}
|
sl@0
|
521 |
|
sl@0
|
522 |
void TestWindowGroup::KeyUpL(const TKeyEvent &aKey,const TTime &aTime)
|
sl@0
|
523 |
{
|
sl@0
|
524 |
if (iCurWin)
|
sl@0
|
525 |
iCurWin->KeyUpL(aKey,aTime);
|
sl@0
|
526 |
}
|
sl@0
|
527 |
|
sl@0
|
528 |
//
|
sl@0
|
529 |
|
sl@0
|
530 |
TestClient::TestClient()
|
sl@0
|
531 |
{}
|
sl@0
|
532 |
|
sl@0
|
533 |
void TestClient::ConstructL()
|
sl@0
|
534 |
{
|
sl@0
|
535 |
CTClient::ConstructL();
|
sl@0
|
536 |
|
sl@0
|
537 |
iGroup=new(ELeave) TestWindowGroup(this);
|
sl@0
|
538 |
iGroup->ConstructL();
|
sl@0
|
539 |
|
sl@0
|
540 |
iScreen->GetScreenSizeModeList(&iScreenModes);
|
sl@0
|
541 |
iScreen->SetScreenMode(iScreenModes[0]);
|
sl@0
|
542 |
TSize screenSize=iScreen->SizeInPixels();
|
sl@0
|
543 |
|
sl@0
|
544 |
TInt winWidth=(screenSize.iWidth/3)-10;
|
sl@0
|
545 |
TInt winHeight=screenSize.iHeight-10;
|
sl@0
|
546 |
iStdLogWindow=new(ELeave) LogWindow();
|
sl@0
|
547 |
iStdLogWindow->SetUpL(TPoint(5,5),TSize(winWidth,winHeight),iGroup,*iGc);
|
sl@0
|
548 |
BaseWin=new(ELeave) TestWindow();
|
sl@0
|
549 |
BaseWin->SetUpL(TPoint(screenSize.iWidth/3+5,5),TSize(winWidth,winHeight),iGroup,*iGc);
|
sl@0
|
550 |
TestWin=new(ELeave) TestWindow();
|
sl@0
|
551 |
TestWin->SetUpL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight),iGroup,*iGc);
|
sl@0
|
552 |
|
sl@0
|
553 |
iDriver = CTestDriver::CreateL(iScreenNumber); // virtual constructor
|
sl@0
|
554 |
|
sl@0
|
555 |
TheGc=new(ELeave) CWindowGc(iScreen);
|
sl@0
|
556 |
User::LeaveIfError(TheGc->Construct());
|
sl@0
|
557 |
|
sl@0
|
558 |
_LIT(KTestLog,"WSERV Auto Test Log");
|
sl@0
|
559 |
LogMessage(KTestLog());
|
sl@0
|
560 |
LogAvailableScreenModeL();
|
sl@0
|
561 |
|
sl@0
|
562 |
//This class was designed to be created once and reused by all the tests, now it is created for each test,
|
sl@0
|
563 |
//this needs to be changed back so tests like the following are only done once.
|
sl@0
|
564 |
TestWsSetBufferSizeL();
|
sl@0
|
565 |
TestWsSetMaxBufferSizeL();
|
sl@0
|
566 |
}
|
sl@0
|
567 |
|
sl@0
|
568 |
inline CTestDriver* TestClient::Driver()
|
sl@0
|
569 |
{
|
sl@0
|
570 |
return iDriver;
|
sl@0
|
571 |
}
|
sl@0
|
572 |
|
sl@0
|
573 |
TBool TestClient::WaitForEvent()
|
sl@0
|
574 |
{
|
sl@0
|
575 |
if (iEventHandler->iStatus!=KRequestPending)
|
sl@0
|
576 |
return ETrue;
|
sl@0
|
577 |
else if (iRedrawEventHandler->iStatus!=KRequestPending)
|
sl@0
|
578 |
return EFalse;
|
sl@0
|
579 |
User::WaitForRequest(iEventHandler->iStatus,iRedrawEventHandler->iStatus);
|
sl@0
|
580 |
TRequestStatus* status=&iEventHandler->iStatus;
|
sl@0
|
581 |
TBool ret=ETrue;
|
sl@0
|
582 |
if (iEventHandler->iStatus==KRequestPending)
|
sl@0
|
583 |
{
|
sl@0
|
584 |
status=&iRedrawEventHandler->iStatus;
|
sl@0
|
585 |
ret=EFalse;
|
sl@0
|
586 |
}
|
sl@0
|
587 |
TInt reason=status->Int();
|
sl@0
|
588 |
*status=KRequestPending;
|
sl@0
|
589 |
User::RequestComplete(status,reason);
|
sl@0
|
590 |
return ret;
|
sl@0
|
591 |
}
|
sl@0
|
592 |
|
sl@0
|
593 |
TBool TestClient::IsEventWaiting()
|
sl@0
|
594 |
{
|
sl@0
|
595 |
return (iEventHandler->iStatus!=KRequestPending || iRedrawEventHandler->iStatus!=KRequestPending);
|
sl@0
|
596 |
}
|
sl@0
|
597 |
|
sl@0
|
598 |
TestClient::~TestClient()
|
sl@0
|
599 |
{
|
sl@0
|
600 |
iScreenModes.Close();
|
sl@0
|
601 |
delete iDriver;
|
sl@0
|
602 |
delete TheGc;
|
sl@0
|
603 |
delete iStdLogWindow;
|
sl@0
|
604 |
delete BaseWin;
|
sl@0
|
605 |
delete TestWin;
|
sl@0
|
606 |
}
|
sl@0
|
607 |
|
sl@0
|
608 |
void TestClient::LogAvailableScreenModeL()
|
sl@0
|
609 |
{
|
sl@0
|
610 |
_LIT(KColorModes,"Color Modes: ");
|
sl@0
|
611 |
_LIT(KComma,", ");
|
sl@0
|
612 |
_LIT(KColor,"Color");
|
sl@0
|
613 |
_LIT(KGrey,"Grey");
|
sl@0
|
614 |
CArrayFixFlat<TInt>* modeList=new(ELeave) CArrayFixFlat<TInt>(15);
|
sl@0
|
615 |
iWs.GetColorModeList(modeList);
|
sl@0
|
616 |
TLogMessageText buf,buf2;
|
sl@0
|
617 |
buf.Append(KColorModes);
|
sl@0
|
618 |
TDisplayMode mode;
|
sl@0
|
619 |
TInt ii=0;
|
sl@0
|
620 |
FOREVER
|
sl@0
|
621 |
{
|
sl@0
|
622 |
mode=STATIC_CAST(TDisplayMode,(*modeList)[ii]);
|
sl@0
|
623 |
buf.AppendNum((*modeList)[ii]);
|
sl@0
|
624 |
buf2.Append(TDisplayModeUtils::IsDisplayModeColor(mode)?KColor():KGrey());
|
sl@0
|
625 |
buf2.AppendNum(TDisplayModeUtils::NumDisplayModeColors(mode));
|
sl@0
|
626 |
if (mode==EColor16MU)
|
sl@0
|
627 |
buf2.Append('U');
|
sl@0
|
628 |
if (++ii==modeList->Count())
|
sl@0
|
629 |
break;
|
sl@0
|
630 |
buf.Append(KComma);
|
sl@0
|
631 |
buf2.Append(KComma);
|
sl@0
|
632 |
}
|
sl@0
|
633 |
LogMessage(buf);
|
sl@0
|
634 |
LogMessage(buf2);
|
sl@0
|
635 |
delete modeList;
|
sl@0
|
636 |
}
|
sl@0
|
637 |
|
sl@0
|
638 |
void TestClient::TestWsSetBufferSizeL()
|
sl@0
|
639 |
{
|
sl@0
|
640 |
RWsSession ws;
|
sl@0
|
641 |
User::LeaveIfError(ws.Connect());
|
sl@0
|
642 |
ws.SetBufferSizeL(256); // default buffer size 640
|
sl@0
|
643 |
ws.SetBufferSizeL(0x8000); // 16K is max buffer size
|
sl@0
|
644 |
ws.SetBufferSizeL(0x4000);
|
sl@0
|
645 |
ws.Close();
|
sl@0
|
646 |
}
|
sl@0
|
647 |
|
sl@0
|
648 |
void TestClient::TestWsSetMaxBufferSizeL()
|
sl@0
|
649 |
{
|
sl@0
|
650 |
RWsSession ws;
|
sl@0
|
651 |
User::LeaveIfError(ws.Connect());
|
sl@0
|
652 |
// allow buffer to grow bigger than the default 640 bytes
|
sl@0
|
653 |
const TInt KBigMessageSize = 800;
|
sl@0
|
654 |
ws.SetMaxBufferSizeL(KBigMessageSize + 8); // big message + command header length
|
sl@0
|
655 |
|
sl@0
|
656 |
// send the big message to the wserv
|
sl@0
|
657 |
TBuf8<KBigMessageSize> bigMessage;
|
sl@0
|
658 |
|
sl@0
|
659 |
// LogMessage needs a pointer to a TInt with the message size at the start of the buffer
|
sl@0
|
660 |
const TInt szLength = sizeof(TInt);
|
sl@0
|
661 |
TInt length = KBigMessageSize - szLength; // length in Unicode characters
|
sl@0
|
662 |
bigMessage.Append((TUint8*) &length, szLength);
|
sl@0
|
663 |
|
sl@0
|
664 |
_LIT(KLetterA, "a");
|
sl@0
|
665 |
do
|
sl@0
|
666 |
{
|
sl@0
|
667 |
bigMessage.Append((TUint8*) KLetterA().Ptr(), 2);
|
sl@0
|
668 |
}
|
sl@0
|
669 |
while (bigMessage.Length() < KBigMessageSize);
|
sl@0
|
670 |
|
sl@0
|
671 |
// send to Wserv, note that the message is too long to be logged
|
sl@0
|
672 |
ws.TestWrite(ws.WsHandle(), EWsClOpLogMessage, bigMessage.Ptr(), KBigMessageSize);
|
sl@0
|
673 |
ws.Flush();
|
sl@0
|
674 |
|
sl@0
|
675 |
ws.Close();
|
sl@0
|
676 |
}
|
sl@0
|
677 |
|
sl@0
|
678 |
void TestClient::SetTestClientScreenMode(TInt aMode)
|
sl@0
|
679 |
{
|
sl@0
|
680 |
iScreen->SetAppScreenMode(aMode);
|
sl@0
|
681 |
iScreen->SetScreenMode(aMode);
|
sl@0
|
682 |
UpdateTestClientScreenMode();
|
sl@0
|
683 |
}
|
sl@0
|
684 |
|
sl@0
|
685 |
void TestClient::UpdateTestClientScreenMode()
|
sl@0
|
686 |
{
|
sl@0
|
687 |
TSize screenSize=iScreen->SizeInPixels();
|
sl@0
|
688 |
|
sl@0
|
689 |
// Sets new positions and dimensions for the three window and their controlling border windows
|
sl@0
|
690 |
|
sl@0
|
691 |
if (screenSize.iHeight > screenSize.iWidth) // Portrait mode
|
sl@0
|
692 |
{
|
sl@0
|
693 |
TInt winWidth=screenSize.iWidth - (KBorderWinWidth * 2);
|
sl@0
|
694 |
TInt winHeight=(screenSize.iHeight/3) - (KBorderWinWidth * 2);
|
sl@0
|
695 |
|
sl@0
|
696 |
iStdLogWindow->SetExt(TPoint(KBorderWinWidth,KBorderWinWidth),TSize(winWidth,winHeight));
|
sl@0
|
697 |
BaseWin->SetBorderExt(TPoint(KBorderWinWidth,screenSize.iHeight/3+KBorderWinWidth),TSize(winWidth,winHeight));
|
sl@0
|
698 |
BaseWin->SetExt(TPoint(2,2),TSize(winWidth - (KBorderWinWidth - 1),winHeight - (KBorderWinWidth - 1)));
|
sl@0
|
699 |
TestWin->SetBorderExt(TPoint(KBorderWinWidth,screenSize.iHeight/3*2+KBorderWinWidth),TSize(winWidth,winHeight));
|
sl@0
|
700 |
TestWin->SetExt(TPoint(2,2),TSize(winWidth - (KBorderWinWidth - 1),winHeight - (KBorderWinWidth - 1)));
|
sl@0
|
701 |
}
|
sl@0
|
702 |
else // Landscape modes
|
sl@0
|
703 |
{
|
sl@0
|
704 |
TInt winWidth=(screenSize.iWidth/3) - (KBorderWinWidth * 2);
|
sl@0
|
705 |
TInt winHeight=screenSize.iHeight - (KBorderWinWidth * 2);
|
sl@0
|
706 |
|
sl@0
|
707 |
iStdLogWindow->SetExt(TPoint(KBorderWinWidth,KBorderWinWidth),TSize(winWidth,winHeight));
|
sl@0
|
708 |
BaseWin->SetBorderExt(TPoint(screenSize.iWidth/3 + KBorderWinWidth,KBorderWinWidth),TSize(winWidth,winHeight));
|
sl@0
|
709 |
BaseWin->SetExt(TPoint(2,2),TSize(winWidth - (KBorderWinWidth - 1),winHeight - (KBorderWinWidth - 1)));
|
sl@0
|
710 |
TestWin->SetBorderExt(TPoint(screenSize.iWidth/3*2+KBorderWinWidth,KBorderWinWidth),TSize(winWidth,winHeight));
|
sl@0
|
711 |
TestWin->SetExt(TPoint(2,2),TSize(winWidth - (KBorderWinWidth - 1),winHeight - (KBorderWinWidth - 1)));
|
sl@0
|
712 |
}
|
sl@0
|
713 |
|
sl@0
|
714 |
// Remove shading artefacts from window resizing operations
|
sl@0
|
715 |
TestWin->Win()->Invalidate();
|
sl@0
|
716 |
TestWin->Win()->BeginRedraw();
|
sl@0
|
717 |
TestWin->ClearWin();
|
sl@0
|
718 |
TestWin->Win()->EndRedraw();
|
sl@0
|
719 |
|
sl@0
|
720 |
BaseWin->Win()->Invalidate();
|
sl@0
|
721 |
BaseWin->Win()->BeginRedraw();
|
sl@0
|
722 |
BaseWin->ClearWin();
|
sl@0
|
723 |
BaseWin->Win()->EndRedraw();
|
sl@0
|
724 |
|
sl@0
|
725 |
TheClient->iWs.Flush();
|
sl@0
|
726 |
}
|
sl@0
|
727 |
|
sl@0
|
728 |
|
sl@0
|
729 |
//
|
sl@0
|
730 |
// TestDriver, drives the test code //
|
sl@0
|
731 |
//
|
sl@0
|
732 |
CTestDriver* CTestDriver::CreateL(TInt aScreenNumber)
|
sl@0
|
733 |
{
|
sl@0
|
734 |
CTestDriver* self = NULL;
|
sl@0
|
735 |
if (aScreenNumber==KDefaultScreen)
|
sl@0
|
736 |
self = new (ELeave) CTestDriverPrimary(aScreenNumber);
|
sl@0
|
737 |
else
|
sl@0
|
738 |
self = new (ELeave) CTestDriverSecondary(aScreenNumber);
|
sl@0
|
739 |
|
sl@0
|
740 |
return self;
|
sl@0
|
741 |
}
|
sl@0
|
742 |
|
sl@0
|
743 |
CTestDriver::CTestDriver(TInt aScreenNumber)
|
sl@0
|
744 |
: iScreenNumber(aScreenNumber)
|
sl@0
|
745 |
{
|
sl@0
|
746 |
iStartTime.HomeTime();
|
sl@0
|
747 |
HAL::Get(HALData::EDisplayNumberOfScreens, iNumberOfScreens);
|
sl@0
|
748 |
}
|
sl@0
|
749 |
|
sl@0
|
750 |
CTestDriver::~CTestDriver()
|
sl@0
|
751 |
{
|
sl@0
|
752 |
}
|
sl@0
|
753 |
|
sl@0
|
754 |
void CTestDriver::DestroyTest()
|
sl@0
|
755 |
{
|
sl@0
|
756 |
delete iTest;
|
sl@0
|
757 |
iTest=NULL;
|
sl@0
|
758 |
}
|
sl@0
|
759 |
|
sl@0
|
760 |
void CTestDriver::TestComplete2()
|
sl@0
|
761 |
{
|
sl@0
|
762 |
++iTestNum;
|
sl@0
|
763 |
if (iTestNum==iTestSize)
|
sl@0
|
764 |
{
|
sl@0
|
765 |
TBuf<64> timeBuf;
|
sl@0
|
766 |
TTime endTime;
|
sl@0
|
767 |
endTime.HomeTime();
|
sl@0
|
768 |
TTimeIntervalMicroSeconds elapseTime=endTime.MicroSecondsFrom(iStartTime);
|
sl@0
|
769 |
TInt64 elapseTime2=elapseTime.Int64()/1000;
|
sl@0
|
770 |
TUint diffi = I64LOW(elapseTime2);
|
sl@0
|
771 |
_LIT(TestPass,"PASSED");
|
sl@0
|
772 |
_LIT(TestFail,"FAILED");
|
sl@0
|
773 |
TInt noOfTests=CTestBase::iNumberTests;
|
sl@0
|
774 |
TInt noOfTestsPass=CTestBase::iNumberTestsPass;
|
sl@0
|
775 |
_LIT(TimeBuf,"Elapse Time %d:%02d.%03d %S");
|
sl@0
|
776 |
timeBuf.Format(TimeBuf,diffi/60000,(diffi/1000)%60,diffi%1000000,&(noOfTests==noOfTestsPass?TestPass:TestFail));
|
sl@0
|
777 |
TBuf<60> testReport;
|
sl@0
|
778 |
_LIT(Checks,"Checks");
|
sl@0
|
779 |
_LIT(Fails,"Fails");
|
sl@0
|
780 |
_LIT(TestReport,"Tests:%d %S:%d");
|
sl@0
|
781 |
TInt testNumber=(noOfTests==noOfTestsPass? noOfTestsPass : noOfTests-noOfTestsPass);
|
sl@0
|
782 |
testReport.Format(TestReport,iTestNum,&(noOfTests==noOfTestsPass?Checks():Fails()),testNumber);
|
sl@0
|
783 |
if (noOfTests!=noOfTestsPass)
|
sl@0
|
784 |
{
|
sl@0
|
785 |
_LIT(NumTests,"/%d");
|
sl@0
|
786 |
testReport.AppendFormat(NumTests,noOfTests);
|
sl@0
|
787 |
}
|
sl@0
|
788 |
|
sl@0
|
789 |
TBuf<60> logTestReport;
|
sl@0
|
790 |
_LIT(LogReport," %S:%d/%d");
|
sl@0
|
791 |
logTestReport.Format(LogReport,&Checks,noOfTestsPass,noOfTests);
|
sl@0
|
792 |
TLogMessageText buf;
|
sl@0
|
793 |
_LIT(Finished,"AUTO Testing Complete, ");
|
sl@0
|
794 |
buf.Append(Finished);
|
sl@0
|
795 |
buf.Append(timeBuf);
|
sl@0
|
796 |
buf.Append(logTestReport);
|
sl@0
|
797 |
TheClient->LogMessage(buf);
|
sl@0
|
798 |
|
sl@0
|
799 |
TheTestResult = noOfTests==noOfTestsPass? ETestPassed : ETestFailed;
|
sl@0
|
800 |
DoDisplayDialog(timeBuf,testReport);
|
sl@0
|
801 |
}
|
sl@0
|
802 |
}
|
sl@0
|
803 |
|
sl@0
|
804 |
//
|
sl@0
|
805 |
// Test driver for primary screen (has digitiser/pointer)
|
sl@0
|
806 |
//
|
sl@0
|
807 |
CTestDriverPrimary::CTestDriverPrimary(TInt aScreenNumber) : CTestDriver(aScreenNumber)
|
sl@0
|
808 |
{
|
sl@0
|
809 |
TInt i;
|
sl@0
|
810 |
TInt numOfEntries = 1;
|
sl@0
|
811 |
for (i=0; i<numOfEntries; ++i)
|
sl@0
|
812 |
{
|
sl@0
|
813 |
++iTestSize;
|
sl@0
|
814 |
}
|
sl@0
|
815 |
|
sl@0
|
816 |
// omit multi display test (last entry in test table)
|
sl@0
|
817 |
// for single screen platform
|
sl@0
|
818 |
//
|
sl@0
|
819 |
if (iNumberOfScreens==1)
|
sl@0
|
820 |
--iTestSize;
|
sl@0
|
821 |
|
sl@0
|
822 |
}
|
sl@0
|
823 |
|
sl@0
|
824 |
void CTestDriverPrimary::DoDisplayDialog(TDesC& timeBuf,TDesC& testReport)
|
sl@0
|
825 |
{
|
sl@0
|
826 |
DisplayDialog(_L("Auto tests complete"),timeBuf, testReport);
|
sl@0
|
827 |
}
|
sl@0
|
828 |
|
sl@0
|
829 |
//
|
sl@0
|
830 |
// Test driver for secondary screens
|
sl@0
|
831 |
//
|
sl@0
|
832 |
CTestDriverSecondary::CTestDriverSecondary(TInt aScreenNumber) : CTestDriver(aScreenNumber)
|
sl@0
|
833 |
{
|
sl@0
|
834 |
TInt i;
|
sl@0
|
835 |
TInt numOfEntries = 1;
|
sl@0
|
836 |
for (i=0; i<numOfEntries; ++i)
|
sl@0
|
837 |
{
|
sl@0
|
838 |
++iTestSize;
|
sl@0
|
839 |
}
|
sl@0
|
840 |
}
|
sl@0
|
841 |
|
sl@0
|
842 |
void CTestDriverSecondary::DoDisplayDialog(TDesC& timeBuf,TDesC& testReport)
|
sl@0
|
843 |
{
|
sl@0
|
844 |
if (TheTestResult==ETestFailed)
|
sl@0
|
845 |
DisplayDialog(iScreenNumber,_L("Auto tests complete"),timeBuf, testReport);
|
sl@0
|
846 |
}
|
sl@0
|
847 |
|
sl@0
|
848 |
// TTestRects //
|
sl@0
|
849 |
//
|
sl@0
|
850 |
// This class provides a list of rectangles to test graphics to the test windows
|
sl@0
|
851 |
// The list designed to test all cases total clipping, partial clipping, touching the edges,
|
sl@0
|
852 |
// unclipped etc etc...
|
sl@0
|
853 |
//
|
sl@0
|
854 |
// NOTE:- Quick test version, does not provide a proper list yet
|
sl@0
|
855 |
//
|
sl@0
|
856 |
// For the rectangle list the graphics area is divided into 9 logical areas:-
|
sl@0
|
857 |
// 0:The area above & left of the drawing area
|
sl@0
|
858 |
// 1:The area above but within the left & right limits of the drawing area
|
sl@0
|
859 |
// 2:The area above & right of the drawing area
|
sl@0
|
860 |
// 3:The area left of but within the top & bottom limits of the drawing area
|
sl@0
|
861 |
// 4:The area within the drawing area
|
sl@0
|
862 |
// 5:The area right of but within the top & bottom limits of the drawing area
|
sl@0
|
863 |
// 6:The area below & left of the drawing area
|
sl@0
|
864 |
// 7:The area below but within the left & right limits of the drawing area
|
sl@0
|
865 |
// 8:The area below & right of the drawing area
|
sl@0
|
866 |
//
|
sl@0
|
867 |
// | |
|
sl@0
|
868 |
// 0 | 1 | 2
|
sl@0
|
869 |
// | |
|
sl@0
|
870 |
// -------------------------
|
sl@0
|
871 |
// | |
|
sl@0
|
872 |
// 3 | 4 | 5
|
sl@0
|
873 |
// | |
|
sl@0
|
874 |
// -------------------------
|
sl@0
|
875 |
// | |
|
sl@0
|
876 |
// 6 | 7 | 8
|
sl@0
|
877 |
// | |
|
sl@0
|
878 |
//
|
sl@0
|
879 |
//
|
sl@0
|
880 |
// The full list of rectangles needed to test an official release is as follows:
|
sl@0
|
881 |
//
|
sl@0
|
882 |
// 0-8: A rectangle wholly within each area (0 to 8) without touching the edges (if possible)
|
sl@0
|
883 |
// 9-17: A rectangle wholly within each area and touching all bounding edges
|
sl@0
|
884 |
// 18-26: A rectangle traversing each horizontal pair & triple of areas without touching the boundarys
|
sl@0
|
885 |
// 27-35: A rectangle traversing each vertical pair & triple of areas without touching the boundarys
|
sl@0
|
886 |
// 36-39: A rectangle traversing each 2x2 block of areas without touching the boundarys
|
sl@0
|
887 |
// 40-43: A rectangle traversing each 2x2 block of areas touching each boundary
|
sl@0
|
888 |
// 44: A rectangle that includes all areas
|
sl@0
|
889 |
// 45-48: A rectangle fully enclosed in the central area that touches each edge
|
sl@0
|
890 |
// 49-54: A rectangle fully enclosed in the central area that touches each pair of edges
|
sl@0
|
891 |
// 55-58: A rectangle fully enclosed in the central area that touches each set of three edges
|
sl@0
|
892 |
// 59-67: A Zero size rectangle in each of the 9 areas
|
sl@0
|
893 |
// 68-77: Wide rectangles with heights from 0 to 9 in the central area
|
sl@0
|
894 |
// 78-87: Tall rectangles with widths from 0 to 9 in the central area
|
sl@0
|
895 |
//
|
sl@0
|
896 |
|
sl@0
|
897 |
void TTestRects::Construct(const RWindow &aWindow)
|
sl@0
|
898 |
{
|
sl@0
|
899 |
// 59-67
|
sl@0
|
900 |
// Special case, does not use rectangles from here
|
sl@0
|
901 |
// 68-77
|
sl@0
|
902 |
// Special case, does not use rectangles from here
|
sl@0
|
903 |
// 78-87
|
sl@0
|
904 |
// Special case, does not use rectangles from here
|
sl@0
|
905 |
//
|
sl@0
|
906 |
|
sl@0
|
907 |
iSize=aWindow.Size();
|
sl@0
|
908 |
/*
|
sl@0
|
909 |
TInt wid=size.iWidth;
|
sl@0
|
910 |
TInt hgt=size.iHeight;
|
sl@0
|
911 |
TInt wid2=wid/2;
|
sl@0
|
912 |
TInt hgt2=hgt/2;
|
sl@0
|
913 |
TInt wid3=wid/3;
|
sl@0
|
914 |
TInt hgt3=hgt/3;
|
sl@0
|
915 |
TInt wid4=wid/4;
|
sl@0
|
916 |
TInt hgt4=hgt/4;
|
sl@0
|
917 |
TInt 2wid=wid*2;
|
sl@0
|
918 |
TInt 2hgt=hgt*2;
|
sl@0
|
919 |
TInt 3wid=wid*3;
|
sl@0
|
920 |
TInt 3hgt=hgt*3;
|
sl@0
|
921 |
// 0-8
|
sl@0
|
922 |
iList[0]=TRect(-wid,-hgt,-wid2,-hgt2);
|
sl@0
|
923 |
iList[1]=TRect(wid3,-hgt,wid-wid3,-hgt2);
|
sl@0
|
924 |
iList[2]=TRect(wid+wid2,-2hgt,2wid,-hgt);
|
sl@0
|
925 |
iList[3]=TRect(-3wid,hgt3,-wid3,hgt-hgt3);
|
sl@0
|
926 |
iList[4]=TRect(wid4,hgt3,wid-wid3,hgt-hgt4);
|
sl@0
|
927 |
iList[5]=TRect(3wid,hgt4,wid+3wid,hgt-hgt4);
|
sl@0
|
928 |
iList[6]=TRect(-wid3,hgt+hgt4,-wid2,hgt+hgt);
|
sl@0
|
929 |
iList[7]=TRect(wid2,hgt+hgt4,wid-wid4,hgt+hgt3);
|
sl@0
|
930 |
iList[8]=TRect(2wid,hgt+hgt4,3wid,hgt+hgt2);
|
sl@0
|
931 |
// 9-17
|
sl@0
|
932 |
iList[9]=TRect(-wid,-hgt,0,0);
|
sl@0
|
933 |
iList[10]=TRect(0,-2hgt,wid,0);
|
sl@0
|
934 |
iList[11]=TRect(wid,-hgt2,wid+wid3,0);
|
sl@0
|
935 |
iList[12]=TRect(-wid3,0,0,hgt);
|
sl@0
|
936 |
iList[13]=TRect(0,0,wid,hgt);
|
sl@0
|
937 |
iList[14]=TRect(wid,0,wid+wid4,hgt);
|
sl@0
|
938 |
iList[15]=TRect(-wid,hgt,0,hgt+hgt4);
|
sl@0
|
939 |
iList[16]=TRect(0,hgt,wid,hgt+hgt);
|
sl@0
|
940 |
iList[17]=TRect(wid,hgt,wid+3wid,hgt+3hgt);
|
sl@0
|
941 |
// 18-26
|
sl@0
|
942 |
iList[18]=TRect(-wid,-hgt,wid2,hgt3);
|
sl@0
|
943 |
iList[19]=TRect(wid3,-2hgt,2wid,-hgt3);
|
sl@0
|
944 |
iList[20]=TRect(-wid,-hgt2,wid3,-hgt3);
|
sl@0
|
945 |
iList[21]=TRect(-wid3,hgt4,wid2,hgt2);
|
sl@0
|
946 |
iList[22]=TRect(wid3,hgt3,wid+wid3,hgt-hgt3);
|
sl@0
|
947 |
iList[23]=TRect(-wid,hgt2,wid+wid4,hgt-hgt3);
|
sl@0
|
948 |
iList[24]=TRect(-wid,2hgt,wid3,3hgt);
|
sl@0
|
949 |
iList[25]=TRect(wid-wid4,hgt+hgt3,wid+wid4,2hgt);
|
sl@0
|
950 |
iList[26]=TRect(-wid4,hgt+hgt4,wid+wid4,3);
|
sl@0
|
951 |
*/
|
sl@0
|
952 |
/*
|
sl@0
|
953 |
iList[0]=TRect(0,0,size.iWidth,size.iHeight);
|
sl@0
|
954 |
iList[1]=TRect(-10,-10,size.iWidth/2,size.iHeight/2);
|
sl@0
|
955 |
iList[2]=TRect(size.iWidth/2,size.iHeight/2,size.iWidth+10,size.iHeight+10);
|
sl@0
|
956 |
iList[3]=TRect(size.iWidth/4,size.iHeight/4,size.iWidth/2,size.iHeight/2);
|
sl@0
|
957 |
iList[4]=TRect(-10,size.iHeight/4,size.iWidth+10,size.iHeight/2);
|
sl@0
|
958 |
*/
|
sl@0
|
959 |
}
|
sl@0
|
960 |
|
sl@0
|
961 |
TInt TTestRects::Count1() const
|
sl@0
|
962 |
//
|
sl@0
|
963 |
// Count1() provides the simple base set of rectangles
|
sl@0
|
964 |
//
|
sl@0
|
965 |
{
|
sl@0
|
966 |
return(2);
|
sl@0
|
967 |
}
|
sl@0
|
968 |
|
sl@0
|
969 |
TInt TTestRects::Count2() const
|
sl@0
|
970 |
//
|
sl@0
|
971 |
// Count2() provides an increased set of rectangles for each graphics func to test itself more thoroughly
|
sl@0
|
972 |
//
|
sl@0
|
973 |
{
|
sl@0
|
974 |
return(5);
|
sl@0
|
975 |
}
|
sl@0
|
976 |
|
sl@0
|
977 |
TInt TTestRects::Count3() const
|
sl@0
|
978 |
//
|
sl@0
|
979 |
// Count3() provides the full set of rects for each graphics func to a quick test on
|
sl@0
|
980 |
//
|
sl@0
|
981 |
{
|
sl@0
|
982 |
return(88);
|
sl@0
|
983 |
}
|
sl@0
|
984 |
|
sl@0
|
985 |
/** Reset the seed value to 0. */
|
sl@0
|
986 |
void TTestRects::ResetSeed()
|
sl@0
|
987 |
{
|
sl@0
|
988 |
iSeed = 0;
|
sl@0
|
989 |
}
|
sl@0
|
990 |
|
sl@0
|
991 |
TInt TTestRects::Rnd(TInt aSize)
|
sl@0
|
992 |
//
|
sl@0
|
993 |
// Return a random based around aSize, maybe bigger maybe smaller, who knows?
|
sl@0
|
994 |
//
|
sl@0
|
995 |
{
|
sl@0
|
996 |
TInt rnd=Math::Rand(iSeed);
|
sl@0
|
997 |
TInt result;
|
sl@0
|
998 |
if (rnd&0x8) // Increase from aSize
|
sl@0
|
999 |
result=aSize*((rnd&0x7)+1);
|
sl@0
|
1000 |
else // Decrease from aSize
|
sl@0
|
1001 |
result=aSize/((rnd&0x7)+1);
|
sl@0
|
1002 |
return(result);
|
sl@0
|
1003 |
}
|
sl@0
|
1004 |
|
sl@0
|
1005 |
TInt TTestRects::RndMax(TInt aSize)
|
sl@0
|
1006 |
//
|
sl@0
|
1007 |
// Return a random from 0 to aSize inclusive
|
sl@0
|
1008 |
//
|
sl@0
|
1009 |
{
|
sl@0
|
1010 |
TInt64 tmpl=Math::Rand(iSeed);
|
sl@0
|
1011 |
TInt tmp = I64INT(tmpl) & 0xFFFF;
|
sl@0
|
1012 |
tmp*=aSize;
|
sl@0
|
1013 |
tmp/=0xFFFF;
|
sl@0
|
1014 |
return(tmp);
|
sl@0
|
1015 |
}
|
sl@0
|
1016 |
|
sl@0
|
1017 |
TInt TTestRects::RectCoord(TInt aSection,TInt aSize)
|
sl@0
|
1018 |
{
|
sl@0
|
1019 |
TInt result=0;
|
sl@0
|
1020 |
switch(aSection)
|
sl@0
|
1021 |
{
|
sl@0
|
1022 |
case 0:
|
sl@0
|
1023 |
result=-(1+Rnd(aSize));
|
sl@0
|
1024 |
break;
|
sl@0
|
1025 |
case 1:
|
sl@0
|
1026 |
result=0;
|
sl@0
|
1027 |
break;
|
sl@0
|
1028 |
case 2:
|
sl@0
|
1029 |
result=1+RndMax(aSize-2);
|
sl@0
|
1030 |
break;
|
sl@0
|
1031 |
case 3:
|
sl@0
|
1032 |
result=aSize;
|
sl@0
|
1033 |
break;
|
sl@0
|
1034 |
case 4:
|
sl@0
|
1035 |
result=aSize+1+Rnd(aSize);
|
sl@0
|
1036 |
break;
|
sl@0
|
1037 |
default:
|
sl@0
|
1038 |
AutoPanic(EAutoPanicTestRectsSection);
|
sl@0
|
1039 |
}
|
sl@0
|
1040 |
return(result);
|
sl@0
|
1041 |
}
|
sl@0
|
1042 |
|
sl@0
|
1043 |
void TTestRects::RectCoordPair(TInt &aTl, TInt &aBr, TInt aSection, TInt aSize)
|
sl@0
|
1044 |
{
|
sl@0
|
1045 |
do
|
sl@0
|
1046 |
{
|
sl@0
|
1047 |
aTl=RectCoord(aSection,aSize);
|
sl@0
|
1048 |
aBr=RectCoord(aSection,aSize);
|
sl@0
|
1049 |
} while(aTl==aBr && aSize>1);
|
sl@0
|
1050 |
if (aTl>aBr)
|
sl@0
|
1051 |
{
|
sl@0
|
1052 |
TInt tmp=aBr;
|
sl@0
|
1053 |
aBr=aTl;
|
sl@0
|
1054 |
aTl=tmp;
|
sl@0
|
1055 |
}
|
sl@0
|
1056 |
}
|
sl@0
|
1057 |
|
sl@0
|
1058 |
TRect TTestRects::operator[](TInt aIndex)
|
sl@0
|
1059 |
{
|
sl@0
|
1060 |
TRect rect;
|
sl@0
|
1061 |
if (aIndex<EMaxRectFromList)
|
sl@0
|
1062 |
{
|
sl@0
|
1063 |
const TRect *pRect=&iList[aIndex];
|
sl@0
|
1064 |
if (pRect->iTl.iX==pRect->iBr.iX)
|
sl@0
|
1065 |
RectCoordPair(rect.iTl.iX,rect.iBr.iX,pRect->iTl.iX,iSize.iWidth);
|
sl@0
|
1066 |
else
|
sl@0
|
1067 |
{
|
sl@0
|
1068 |
rect.iTl.iX=RectCoord(pRect->iTl.iX,iSize.iWidth);
|
sl@0
|
1069 |
rect.iBr.iX=RectCoord(pRect->iBr.iX,iSize.iWidth);
|
sl@0
|
1070 |
}
|
sl@0
|
1071 |
if (pRect->iTl.iY==pRect->iBr.iY)
|
sl@0
|
1072 |
RectCoordPair(rect.iTl.iY,rect.iBr.iY,pRect->iTl.iY,iSize.iHeight);
|
sl@0
|
1073 |
else
|
sl@0
|
1074 |
{
|
sl@0
|
1075 |
rect.iTl.iY=RectCoord(pRect->iTl.iX,iSize.iHeight);
|
sl@0
|
1076 |
rect.iBr.iY=RectCoord(pRect->iBr.iX,iSize.iHeight);
|
sl@0
|
1077 |
}
|
sl@0
|
1078 |
}
|
sl@0
|
1079 |
else if (aIndex<EMaxRectZeroSize)
|
sl@0
|
1080 |
{
|
sl@0
|
1081 |
rect.iTl.iX=RectCoord(((aIndex-EMaxRectFromList)%3)*2,iSize.iWidth);
|
sl@0
|
1082 |
rect.iTl.iY=RectCoord(((aIndex-EMaxRectFromList)/3)*2,iSize.iHeight);
|
sl@0
|
1083 |
rect.iBr=rect.iTl;
|
sl@0
|
1084 |
}
|
sl@0
|
1085 |
else if (aIndex<EMaxRectWide)
|
sl@0
|
1086 |
{
|
sl@0
|
1087 |
rect.iTl.iX=1;
|
sl@0
|
1088 |
rect.iBr.iX=iSize.iWidth-1;
|
sl@0
|
1089 |
rect.iTl.iY=1;
|
sl@0
|
1090 |
rect.iBr.iY=rect.iTl.iY+(aIndex-EMaxRectWide);
|
sl@0
|
1091 |
}
|
sl@0
|
1092 |
else if (aIndex<EMaxRectHigh)
|
sl@0
|
1093 |
{
|
sl@0
|
1094 |
rect.iTl.iX=1;
|
sl@0
|
1095 |
rect.iBr.iX=rect.iTl.iX+(aIndex-EMaxRectHigh);
|
sl@0
|
1096 |
rect.iTl.iY=1;
|
sl@0
|
1097 |
rect.iBr.iY=iSize.iHeight-1;
|
sl@0
|
1098 |
}
|
sl@0
|
1099 |
else
|
sl@0
|
1100 |
AutoPanic(EAutoPanicTestRectsIndex);
|
sl@0
|
1101 |
return(rect);
|
sl@0
|
1102 |
}
|
sl@0
|
1103 |
|
sl@0
|
1104 |
|
sl@0
|
1105 |
/*CBitmap*/
|
sl@0
|
1106 |
|
sl@0
|
1107 |
CBitmap* CBitmap::NewLC(const TSize& aSizeInPixels,TDisplayMode aDispMode)
|
sl@0
|
1108 |
{
|
sl@0
|
1109 |
return NewLC(0,aSizeInPixels,aDispMode);
|
sl@0
|
1110 |
}
|
sl@0
|
1111 |
|
sl@0
|
1112 |
CBitmap* CBitmap::NewL(const TSize& aSizeInPixels,TDisplayMode aDispMode)
|
sl@0
|
1113 |
{
|
sl@0
|
1114 |
CBitmap* self=NewLC(0,aSizeInPixels,aDispMode);
|
sl@0
|
1115 |
CleanupStack::Pop(self);
|
sl@0
|
1116 |
return self;
|
sl@0
|
1117 |
}
|
sl@0
|
1118 |
|
sl@0
|
1119 |
CBitmap* CBitmap::NewL(TInt aHandle)
|
sl@0
|
1120 |
{
|
sl@0
|
1121 |
CBitmap* self=NewLC(aHandle,TSize(),ENone);
|
sl@0
|
1122 |
CleanupStack::Pop(self);
|
sl@0
|
1123 |
return self;
|
sl@0
|
1124 |
}
|
sl@0
|
1125 |
|
sl@0
|
1126 |
CBitmap* CBitmap::NewL(TDesC& /*aFileName*/)
|
sl@0
|
1127 |
{
|
sl@0
|
1128 |
User::Leave(KErrNotSupported);
|
sl@0
|
1129 |
return NULL;
|
sl@0
|
1130 |
}
|
sl@0
|
1131 |
|
sl@0
|
1132 |
CBitmap* CBitmap::NewLC(TInt aHandle,const TSize& aSizeInPixels,TDisplayMode aDispMode)
|
sl@0
|
1133 |
{
|
sl@0
|
1134 |
CBitmap* self=new(ELeave) CBitmap();
|
sl@0
|
1135 |
CleanupStack::PushL(self);
|
sl@0
|
1136 |
self->ConstructL(aHandle, aSizeInPixels, aDispMode);
|
sl@0
|
1137 |
return self;
|
sl@0
|
1138 |
}
|
sl@0
|
1139 |
|
sl@0
|
1140 |
void CBitmap::ConstructL(TInt aHandle,const TSize& aSizeInPixels,TDisplayMode aDispMode)
|
sl@0
|
1141 |
{
|
sl@0
|
1142 |
iBitmap=new(ELeave) CFbsBitmap();
|
sl@0
|
1143 |
if (aHandle==0)
|
sl@0
|
1144 |
{
|
sl@0
|
1145 |
User::LeaveIfError(iBitmap->Create(aSizeInPixels,aDispMode));
|
sl@0
|
1146 |
}
|
sl@0
|
1147 |
else
|
sl@0
|
1148 |
{
|
sl@0
|
1149 |
User::LeaveIfError(iBitmap->Duplicate(aHandle));
|
sl@0
|
1150 |
}
|
sl@0
|
1151 |
iDevice=CFbsBitmapDevice::NewL(iBitmap);
|
sl@0
|
1152 |
User::LeaveIfError(iDevice->CreateContext(iGc));
|
sl@0
|
1153 |
}
|
sl@0
|
1154 |
|
sl@0
|
1155 |
CBitmap::~CBitmap()
|
sl@0
|
1156 |
{
|
sl@0
|
1157 |
delete iGc;
|
sl@0
|
1158 |
delete iDevice;
|
sl@0
|
1159 |
delete iBitmap;
|
sl@0
|
1160 |
}
|
sl@0
|
1161 |
|
sl@0
|
1162 |
|
sl@0
|
1163 |
// CTestBase //
|
sl@0
|
1164 |
|
sl@0
|
1165 |
CTestBase::CTestBase(const TDesC& aTitle,CTWsGraphicsBase* aTestBase)
|
sl@0
|
1166 |
{
|
sl@0
|
1167 |
iTestBase=aTestBase;
|
sl@0
|
1168 |
iTitle.Copy(aTitle);
|
sl@0
|
1169 |
|
sl@0
|
1170 |
iScreenNo = iTestBase->GetScreenFromIni();
|
sl@0
|
1171 |
|
sl@0
|
1172 |
TheClient=new(ELeave) TestClient();
|
sl@0
|
1173 |
|
sl@0
|
1174 |
if (CTestBase::iScreenNo == 1)
|
sl@0
|
1175 |
{
|
sl@0
|
1176 |
TheClient->SetScreenNumber(1);
|
sl@0
|
1177 |
iScreenNumber = 1;
|
sl@0
|
1178 |
}
|
sl@0
|
1179 |
else
|
sl@0
|
1180 |
{
|
sl@0
|
1181 |
TheClient->SetScreenNumber(0);
|
sl@0
|
1182 |
iScreenNumber = 0;
|
sl@0
|
1183 |
}
|
sl@0
|
1184 |
|
sl@0
|
1185 |
if (iScreenNumber == 1)
|
sl@0
|
1186 |
{
|
sl@0
|
1187 |
iMinWin = new(ELeave) CMinWin(iScreenNumber);
|
sl@0
|
1188 |
iMinWin->ConstructL();
|
sl@0
|
1189 |
}
|
sl@0
|
1190 |
|
sl@0
|
1191 |
iTestNum=CTestDriver::iTestNum;
|
sl@0
|
1192 |
TheClient->ConstructL();
|
sl@0
|
1193 |
TheClient->StdLogWindow().LogTest(iTitle,iTestNum);
|
sl@0
|
1194 |
iDriver=TheClient->Driver();
|
sl@0
|
1195 |
|
sl@0
|
1196 |
if (CTestBase::iScreenNo == 1)
|
sl@0
|
1197 |
{
|
sl@0
|
1198 |
TheClient->iWs.SetFocusScreen(1);
|
sl@0
|
1199 |
}
|
sl@0
|
1200 |
else
|
sl@0
|
1201 |
{
|
sl@0
|
1202 |
TheClient->iWs.SetFocusScreen(0);
|
sl@0
|
1203 |
}
|
sl@0
|
1204 |
|
sl@0
|
1205 |
iTestRects.Construct(*BaseWin->Win());
|
sl@0
|
1206 |
iStdTestWindowSize=BaseWin->Size();
|
sl@0
|
1207 |
iRedrawType=EPartialRedraw_Unknown; // Reset between tests
|
sl@0
|
1208 |
if (iMaxGrays+iMaxColors==0)
|
sl@0
|
1209 |
{
|
sl@0
|
1210 |
TheClient->iWs.GetDefModeMaxNumColors(iMaxColors,iMaxGrays);
|
sl@0
|
1211 |
iNormalPointerCursorArea=TheClient->iWs.PointerCursorArea();
|
sl@0
|
1212 |
}
|
sl@0
|
1213 |
}
|
sl@0
|
1214 |
|
sl@0
|
1215 |
CTestBase::~CTestBase()
|
sl@0
|
1216 |
{
|
sl@0
|
1217 |
delete iMinWin;
|
sl@0
|
1218 |
delete TheClient;
|
sl@0
|
1219 |
}
|
sl@0
|
1220 |
|
sl@0
|
1221 |
void CTestBase::CloseAllPanicWindows()
|
sl@0
|
1222 |
{
|
sl@0
|
1223 |
TInt idFocus = TheClient->iWs.GetFocusWindowGroup();
|
sl@0
|
1224 |
TWsEvent event;
|
sl@0
|
1225 |
event.SetType(EEventKey);
|
sl@0
|
1226 |
TKeyEvent *keyEvent = event.Key();
|
sl@0
|
1227 |
keyEvent->iCode = EKeyEscape;
|
sl@0
|
1228 |
keyEvent->iScanCode = EStdKeyEscape;
|
sl@0
|
1229 |
keyEvent->iModifiers = 0;
|
sl@0
|
1230 |
TInt theLimit = 50;
|
sl@0
|
1231 |
while(idFocus != NULL && (theLimit-- > 0))
|
sl@0
|
1232 |
{
|
sl@0
|
1233 |
TheClient->iWs.SendEventToAllWindowGroups(event);
|
sl@0
|
1234 |
idFocus = TheClient->iWs.GetFocusWindowGroup();
|
sl@0
|
1235 |
}
|
sl@0
|
1236 |
}
|
sl@0
|
1237 |
|
sl@0
|
1238 |
/**
|
sl@0
|
1239 |
Returns the size of the standard test windows.
|
sl@0
|
1240 |
@see iStdTestWindowSize
|
sl@0
|
1241 |
*/
|
sl@0
|
1242 |
const TSize& CTestBase::StdTestWindowSize()
|
sl@0
|
1243 |
{
|
sl@0
|
1244 |
return iStdTestWindowSize;
|
sl@0
|
1245 |
}
|
sl@0
|
1246 |
|
sl@0
|
1247 |
/** Returns the number of greys available in the richest grey mode */
|
sl@0
|
1248 |
TInt CTestBase::MaxGrays() const
|
sl@0
|
1249 |
{
|
sl@0
|
1250 |
return iMaxGrays;
|
sl@0
|
1251 |
}
|
sl@0
|
1252 |
|
sl@0
|
1253 |
/** Returns the number of colours available in the richest supported colour mode. */
|
sl@0
|
1254 |
TInt CTestBase::MaxColors() const
|
sl@0
|
1255 |
{
|
sl@0
|
1256 |
return iMaxColors;
|
sl@0
|
1257 |
}
|
sl@0
|
1258 |
|
sl@0
|
1259 |
void CTestBase::TriggerFail()
|
sl@0
|
1260 |
{
|
sl@0
|
1261 |
iFail=ETrue;
|
sl@0
|
1262 |
}
|
sl@0
|
1263 |
|
sl@0
|
1264 |
void CTestBase::LogLeave(TInt aErr)
|
sl@0
|
1265 |
{
|
sl@0
|
1266 |
TLogMessageText buf;
|
sl@0
|
1267 |
_LIT(Leave,"AUTO Left with error code %d in ");
|
sl@0
|
1268 |
buf.AppendFormat(Leave,aErr);
|
sl@0
|
1269 |
buf.Append(iSubTitle);
|
sl@0
|
1270 |
TheClient->LogMessage(buf);
|
sl@0
|
1271 |
}
|
sl@0
|
1272 |
|
sl@0
|
1273 |
void CTestBase::LogSubTest(const TDesC &aSubTitle)
|
sl@0
|
1274 |
{
|
sl@0
|
1275 |
Driver()->iSubTestNum++;
|
sl@0
|
1276 |
iSubTitle=aSubTitle;
|
sl@0
|
1277 |
iTestBase->Logger().Write(TheClient->StdLogWindow().LogSubTest(aSubTitle,iState));
|
sl@0
|
1278 |
}
|
sl@0
|
1279 |
|
sl@0
|
1280 |
void CTestBase::LogMessage(TInt aValue)
|
sl@0
|
1281 |
{
|
sl@0
|
1282 |
_LIT(WinID,"Win Id:");
|
sl@0
|
1283 |
TheClient->StdLogWindow().LogMessage(EFalse,WinID,aValue);
|
sl@0
|
1284 |
}
|
sl@0
|
1285 |
|
sl@0
|
1286 |
void CTestBase::LogSubState(TInt aSubState)
|
sl@0
|
1287 |
{
|
sl@0
|
1288 |
_LIT(SubTest,"SubState");
|
sl@0
|
1289 |
iTestBase->Logger().Write(TheClient->StdLogWindow().LogMessage(ETrue,SubTest,aSubState));
|
sl@0
|
1290 |
}
|
sl@0
|
1291 |
|
sl@0
|
1292 |
TBool DoCheckRectRWin(RWindowBase &aWin1,RWindowBase &aWin2,const TRect &aRect)
|
sl@0
|
1293 |
{
|
sl@0
|
1294 |
TRect rect1(aRect);
|
sl@0
|
1295 |
TRect rect2(aRect);
|
sl@0
|
1296 |
rect1.Move(aWin1.InquireOffset(*TheClient->iGroup->WinTreeNode()));
|
sl@0
|
1297 |
rect2.Move(aWin2.InquireOffset(*TheClient->iGroup->WinTreeNode()));
|
sl@0
|
1298 |
TBool match=TheClient->iScreen->RectCompare(rect1,rect2);
|
sl@0
|
1299 |
#if defined(__WINS__)
|
sl@0
|
1300 |
if (!match)
|
sl@0
|
1301 |
FindNonMatchingPixel(rect1.iTl,rect2.iTl,aRect.Size());
|
sl@0
|
1302 |
#endif
|
sl@0
|
1303 |
return match;
|
sl@0
|
1304 |
}
|
sl@0
|
1305 |
|
sl@0
|
1306 |
TBool DoCheckRectRWin(RWindowBase &aWin1,RWindowBase &aWin2,const TRect &aRect, TUint aFlags)
|
sl@0
|
1307 |
{
|
sl@0
|
1308 |
TRect rect1(aRect);
|
sl@0
|
1309 |
TRect rect2(aRect);
|
sl@0
|
1310 |
rect1.Move(aWin1.InquireOffset(*TheClient->iGroup->WinTreeNode()));
|
sl@0
|
1311 |
rect2.Move(aWin2.InquireOffset(*TheClient->iGroup->WinTreeNode()));
|
sl@0
|
1312 |
TBool match=TheClient->iScreen->RectCompare(rect1,rect2, aFlags);
|
sl@0
|
1313 |
#if defined(__WINS__)
|
sl@0
|
1314 |
if (!match)
|
sl@0
|
1315 |
FindNonMatchingPixel(rect1.iTl,rect2.iTl,aRect.Size());
|
sl@0
|
1316 |
#endif
|
sl@0
|
1317 |
return match;
|
sl@0
|
1318 |
}
|
sl@0
|
1319 |
|
sl@0
|
1320 |
TBool DoCheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect)
|
sl@0
|
1321 |
{
|
sl@0
|
1322 |
return DoCheckRectRWin(*aWin1->BaseWin(), *aWin2->BaseWin(), aRect);
|
sl@0
|
1323 |
}
|
sl@0
|
1324 |
|
sl@0
|
1325 |
TBool DoCheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2)
|
sl@0
|
1326 |
{
|
sl@0
|
1327 |
TSize winSize=aWin1->Size();
|
sl@0
|
1328 |
TRect rect1(aWin1->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),winSize);
|
sl@0
|
1329 |
TRect rect2(aWin2->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),winSize);
|
sl@0
|
1330 |
return TheClient->iScreen->RectCompare(rect1,rect2);
|
sl@0
|
1331 |
}
|
sl@0
|
1332 |
|
sl@0
|
1333 |
TBool DoCheckRect(CTBaseWin *aWin1, CTBaseWin *aWin2, const TRect &aRect, TUint aFlags)
|
sl@0
|
1334 |
{
|
sl@0
|
1335 |
return DoCheckRectRWin(*aWin1->BaseWin(), *aWin2->BaseWin(), aRect, aFlags);
|
sl@0
|
1336 |
}
|
sl@0
|
1337 |
|
sl@0
|
1338 |
|
sl@0
|
1339 |
/**
|
sl@0
|
1340 |
Compares the contents of 2 rectangular areas of the screen.
|
sl@0
|
1341 |
|
sl@0
|
1342 |
@param aPos1 The top left corner of the first rectangle.
|
sl@0
|
1343 |
@param aPos2 The top left corner of the second rectangle.
|
sl@0
|
1344 |
@param aSize The size of the rectangles
|
sl@0
|
1345 |
@return ETrue if the 2 areas have the same content, EFalse otherwise.
|
sl@0
|
1346 |
*/
|
sl@0
|
1347 |
TBool DoCheckRect(TPoint aPos1,TPoint aPos2,TSize aSize)
|
sl@0
|
1348 |
{
|
sl@0
|
1349 |
return TheClient->iScreen->RectCompare(TRect(aPos1,aSize),TRect(aPos2,aSize));
|
sl@0
|
1350 |
}
|
sl@0
|
1351 |
|
sl@0
|
1352 |
void CTestBase::DrawTestBackground(TBool aInvertColors, const TSize &aSize, TInt aGrays/*=16*/)
|
sl@0
|
1353 |
//
|
sl@0
|
1354 |
// Draws a standard test background with a mix of colors (shades).
|
sl@0
|
1355 |
// This is mainly used to test for graphic functions writing outside the intended area.
|
sl@0
|
1356 |
//
|
sl@0
|
1357 |
// This code assumes an TheGc is already active on the window to use.
|
sl@0
|
1358 |
//
|
sl@0
|
1359 |
{
|
sl@0
|
1360 |
TheGc->SetBrushColor(TRgb::Gray256(255));
|
sl@0
|
1361 |
TInt step=5;
|
sl@0
|
1362 |
TInt col=0;
|
sl@0
|
1363 |
TInt colorInc=(aGrays>9 ? 17 : 85);
|
sl@0
|
1364 |
TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
1365 |
TheGc->SetPenStyle(CGraphicsContext::ENullPen);
|
sl@0
|
1366 |
for(TInt row=0;row<aSize.iHeight;row+=step)
|
sl@0
|
1367 |
{
|
sl@0
|
1368 |
TheGc->SetBrushColor(TRgb::Gray256(aInvertColors ? 255-col:col));
|
sl@0
|
1369 |
TheGc->DrawRect(TRect(0,row,aSize.iWidth,row+step));
|
sl@0
|
1370 |
col=col+colorInc;
|
sl@0
|
1371 |
if (col>255)
|
sl@0
|
1372 |
col=0;
|
sl@0
|
1373 |
}
|
sl@0
|
1374 |
}
|
sl@0
|
1375 |
|
sl@0
|
1376 |
void CTestBase::AbortL()
|
sl@0
|
1377 |
{
|
sl@0
|
1378 |
CTestDriver* driver=iDriver;
|
sl@0
|
1379 |
iDriver->DestroyTest();
|
sl@0
|
1380 |
driver->TestComplete2();
|
sl@0
|
1381 |
User::Leave(ETestFailed);
|
sl@0
|
1382 |
}
|
sl@0
|
1383 |
|
sl@0
|
1384 |
/*CTWsGraphicsBase*/
|
sl@0
|
1385 |
|
sl@0
|
1386 |
CTWsGraphicsBase::CTWsGraphicsBase(CTestStep* aStep) : CTGraphicsBase(aStep)
|
sl@0
|
1387 |
{
|
sl@0
|
1388 |
}
|
sl@0
|
1389 |
|
sl@0
|
1390 |
CTWsGraphicsBase::~CTWsGraphicsBase()
|
sl@0
|
1391 |
{
|
sl@0
|
1392 |
delete iTest;
|
sl@0
|
1393 |
}
|
sl@0
|
1394 |
|
sl@0
|
1395 |
void CTWsGraphicsBase::CreateTestBaseL(CTTMSGraphicsStep* aTmsStep)
|
sl@0
|
1396 |
{
|
sl@0
|
1397 |
__ASSERT_ALWAYS(iTest==NULL,AutoPanic(EAutoPanicRecalledCreateTestBaseL));
|
sl@0
|
1398 |
iTest=new(ELeave) CTestBase(iStep->TestStepName(),this);
|
sl@0
|
1399 |
iTmsStep = aTmsStep;
|
sl@0
|
1400 |
}
|
sl@0
|
1401 |
/**
|
sl@0
|
1402 |
Gets the Screen Number from an .ini file supplied to the RUN_TEST_STEP. Screen number should
|
sl@0
|
1403 |
be put under the section [useScreen] as screen=0 or screen=1.
|
sl@0
|
1404 |
|
sl@0
|
1405 |
@return Screen number Defined in .ini file, otherwise 0.
|
sl@0
|
1406 |
*/
|
sl@0
|
1407 |
TInt CTWsGraphicsBase::GetScreenFromIni() const
|
sl@0
|
1408 |
{
|
sl@0
|
1409 |
_LIT(KUseScreenSection, "useScreen");
|
sl@0
|
1410 |
_LIT(KScreen, "screen");
|
sl@0
|
1411 |
|
sl@0
|
1412 |
TInt screen = 0;
|
sl@0
|
1413 |
TBool configAvailable = iStep->GetIntFromConfig(KUseScreenSection, KScreen, screen);
|
sl@0
|
1414 |
if(configAvailable)
|
sl@0
|
1415 |
{
|
sl@0
|
1416 |
return screen;
|
sl@0
|
1417 |
}
|
sl@0
|
1418 |
else
|
sl@0
|
1419 |
{
|
sl@0
|
1420 |
return 0;
|
sl@0
|
1421 |
}
|
sl@0
|
1422 |
}
|
sl@0
|
1423 |
|
sl@0
|
1424 |
void CTWsGraphicsBase::TestComplete()
|
sl@0
|
1425 |
{
|
sl@0
|
1426 |
_LIT(KTestComplete,"Test complete");
|
sl@0
|
1427 |
INFO_PRINTF1(KTestComplete);
|
sl@0
|
1428 |
CTGraphicsBase::TestComplete();
|
sl@0
|
1429 |
}
|
sl@0
|
1430 |
|
sl@0
|
1431 |
void CTWsGraphicsBase::LogMessage(const TText8* aFile,TInt aLine,TRefByValue<const TDesC> aFmt,...)
|
sl@0
|
1432 |
{
|
sl@0
|
1433 |
TLogMessageText buf;
|
sl@0
|
1434 |
VA_LIST list;
|
sl@0
|
1435 |
VA_START(list,aFmt);
|
sl@0
|
1436 |
buf.AppendFormatList(aFmt,list);
|
sl@0
|
1437 |
TheClient->LogMessage(buf);
|
sl@0
|
1438 |
Logger().LogExtra(aFile,aLine,ESevrInfo,buf);
|
sl@0
|
1439 |
VA_END(list);
|
sl@0
|
1440 |
}
|
sl@0
|
1441 |
|
sl@0
|
1442 |
TBool CTWsGraphicsBase::CheckRetValue(TBool aPass, const TDesC *aErrorMsg, const TDesC &aErrorFunction)
|
sl@0
|
1443 |
{
|
sl@0
|
1444 |
if (!aPass && aErrorMsg)
|
sl@0
|
1445 |
{
|
sl@0
|
1446 |
LOG_MESSAGE3(_L("%S %S failed"),aErrorMsg,&aErrorFunction);
|
sl@0
|
1447 |
iTmsStep->MQCTest(EFalse,((TText8*)__FILE__),__LINE__);
|
sl@0
|
1448 |
}
|
sl@0
|
1449 |
iStep->TEST(aPass);
|
sl@0
|
1450 |
return aPass;
|
sl@0
|
1451 |
}
|
sl@0
|
1452 |
|
sl@0
|
1453 |
void CTWsGraphicsBase::CompareWindowsSoftFailWinscw(const TText8* aFile, TInt aLine)
|
sl@0
|
1454 |
{
|
sl@0
|
1455 |
if (!DoCheckRect(BaseWin, TestWin, BaseWin->Size()))
|
sl@0
|
1456 |
{
|
sl@0
|
1457 |
#ifdef __WINS__
|
sl@0
|
1458 |
_LIT(KMessage,"ERROR: Test Failed but is ignored on WINSCW");
|
sl@0
|
1459 |
Logger().LogExtra(aFile, aLine, ESevrErr, KMessage);
|
sl@0
|
1460 |
#else // __WINS__
|
sl@0
|
1461 |
iStep->TEST(EFalse);
|
sl@0
|
1462 |
_LIT(KMessage,"ERROR: Test Failed");
|
sl@0
|
1463 |
Logger().LogExtra(aFile, aLine, ESevrErr, KMessage);
|
sl@0
|
1464 |
#endif // __WINS__
|
sl@0
|
1465 |
}
|
sl@0
|
1466 |
}
|
sl@0
|
1467 |
|
sl@0
|
1468 |
void CTWsGraphicsBase::CheckRect(TPoint aPos1,TPoint aPos2,TSize aSize, const TDesC *aErrorMsg)
|
sl@0
|
1469 |
{
|
sl@0
|
1470 |
CheckRetValue(DoCheckRect(aPos1,aPos2,aSize),aErrorMsg,_L("CheckRect()"));
|
sl@0
|
1471 |
}
|
sl@0
|
1472 |
|
sl@0
|
1473 |
void CTWsGraphicsBase::CheckRect(TPoint aPos1,TPoint aPos2,TSize aSize, const TDesC &aErrorMsg)
|
sl@0
|
1474 |
{
|
sl@0
|
1475 |
CheckRect(aPos1,aPos2,aSize,&aErrorMsg);
|
sl@0
|
1476 |
}
|
sl@0
|
1477 |
|
sl@0
|
1478 |
void CTWsGraphicsBase::CheckRectNoMatch(TPoint aPos1,TPoint aPos2,TSize aSize, const TDesC *aErrorMsg)
|
sl@0
|
1479 |
{
|
sl@0
|
1480 |
CheckRetValue(!DoCheckRect(aPos1,aPos2,aSize),aErrorMsg,_L("CheckRectNoMatch()"));
|
sl@0
|
1481 |
}
|
sl@0
|
1482 |
|
sl@0
|
1483 |
void CTWsGraphicsBase::CheckRectNoMatch(TPoint aPos1,TPoint aPos2,TSize aSize, const TDesC &aErrorMsg)
|
sl@0
|
1484 |
{
|
sl@0
|
1485 |
CheckRectNoMatch(aPos1,aPos2,aSize,&aErrorMsg);
|
sl@0
|
1486 |
}
|
sl@0
|
1487 |
|
sl@0
|
1488 |
void CTWsGraphicsBase::CheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2, const TDesC *aErrorMsg)
|
sl@0
|
1489 |
{
|
sl@0
|
1490 |
CheckRetValue(DoCheckRect(aWin1,aWin2),aErrorMsg,_L("CheckRect()"));
|
sl@0
|
1491 |
}
|
sl@0
|
1492 |
|
sl@0
|
1493 |
void CTWsGraphicsBase::CheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2, const TDesC &aErrorMsg)
|
sl@0
|
1494 |
{
|
sl@0
|
1495 |
CheckRect(aWin1,aWin2,&aErrorMsg);
|
sl@0
|
1496 |
}
|
sl@0
|
1497 |
|
sl@0
|
1498 |
void CTWsGraphicsBase::CheckRectNoMatch(CTBaseWin *aWin1,CTBaseWin *aWin2, const TDesC *aErrorMsg)
|
sl@0
|
1499 |
{
|
sl@0
|
1500 |
CheckRetValue(!DoCheckRect(aWin1,aWin2),aErrorMsg,_L("CheckRectNoMatch()"));
|
sl@0
|
1501 |
}
|
sl@0
|
1502 |
|
sl@0
|
1503 |
void CTWsGraphicsBase::CheckRectNoMatch(CTBaseWin *aWin1,CTBaseWin *aWin2, const TDesC &aErrorMsg)
|
sl@0
|
1504 |
{
|
sl@0
|
1505 |
CheckRectNoMatch(aWin1,aWin2,&aErrorMsg);
|
sl@0
|
1506 |
}
|
sl@0
|
1507 |
|
sl@0
|
1508 |
TBool CTWsGraphicsBase::CheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, const TDesC *aErrorMsg)
|
sl@0
|
1509 |
{
|
sl@0
|
1510 |
return CheckRetValue(DoCheckRect(aWin1,aWin2,aRect),aErrorMsg,_L("CheckRect()"));
|
sl@0
|
1511 |
}
|
sl@0
|
1512 |
|
sl@0
|
1513 |
TBool CTWsGraphicsBase::CheckRect(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, const TDesC &aErrorMsg)
|
sl@0
|
1514 |
{
|
sl@0
|
1515 |
return CheckRect(aWin1,aWin2,aRect,&aErrorMsg);
|
sl@0
|
1516 |
}
|
sl@0
|
1517 |
|
sl@0
|
1518 |
void CTWsGraphicsBase::CheckRectNoMatch(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, const TDesC *aErrorMsg)
|
sl@0
|
1519 |
{
|
sl@0
|
1520 |
CheckRetValue(!DoCheckRect(aWin1,aWin2,aRect),aErrorMsg,_L("CheckRectNoMatch()"));
|
sl@0
|
1521 |
}
|
sl@0
|
1522 |
|
sl@0
|
1523 |
void CTWsGraphicsBase::CheckRectNoMatch(CTBaseWin *aWin1,CTBaseWin *aWin2,const TRect &aRect, const TDesC &aErrorMsg)
|
sl@0
|
1524 |
{
|
sl@0
|
1525 |
CheckRectNoMatch(aWin1,aWin2,aRect,&aErrorMsg);
|
sl@0
|
1526 |
}
|
sl@0
|
1527 |
|
sl@0
|
1528 |
void CTWsGraphicsBase::CompareWindows(const TRect &aRect, const TDesC *aErrorMsg)
|
sl@0
|
1529 |
{
|
sl@0
|
1530 |
CheckRetValue(DoCheckRect(BaseWin,TestWin,aRect),aErrorMsg,_L("CompareWindows()"));
|
sl@0
|
1531 |
}
|
sl@0
|
1532 |
|
sl@0
|
1533 |
TBool CTWsGraphicsBase::CompareWindows(const TDesC *aErrorMsg)
|
sl@0
|
1534 |
{
|
sl@0
|
1535 |
return CheckRetValue(DoCheckRect(BaseWin,TestWin,TRect(BaseWin->Size())),aErrorMsg,_L("CompareWindows()"));
|
sl@0
|
1536 |
}
|
sl@0
|
1537 |
|
sl@0
|
1538 |
void CTWsGraphicsBase::CompareWindows(const TRect &aRect, const TDesC &aErrorMsg)
|
sl@0
|
1539 |
{
|
sl@0
|
1540 |
CompareWindows(aRect,&aErrorMsg);
|
sl@0
|
1541 |
}
|
sl@0
|
1542 |
|
sl@0
|
1543 |
TBool CTWsGraphicsBase::CompareWindows(const TDesC &aErrorMsg)
|
sl@0
|
1544 |
{
|
sl@0
|
1545 |
return CompareWindows(&aErrorMsg);
|
sl@0
|
1546 |
}
|
sl@0
|
1547 |
|
sl@0
|
1548 |
/**
|
sl@0
|
1549 |
Returns the size of the standard test windows.
|
sl@0
|
1550 |
|
sl@0
|
1551 |
Several tests use 3 windows : one is a log window, one is a reference window
|
sl@0
|
1552 |
and one is the actual output of the test. All these windows have the same width which is roughly
|
sl@0
|
1553 |
1/3 of the screen. They also have the same height which is roughly equal to the screen height.
|
sl@0
|
1554 |
*/
|
sl@0
|
1555 |
const TSize& CTWsGraphicsBase::StdTestWindowSize()
|
sl@0
|
1556 |
{
|
sl@0
|
1557 |
return iTest->StdTestWindowSize();
|
sl@0
|
1558 |
}
|
sl@0
|
1559 |
|
sl@0
|
1560 |
/** Returns the number of greys available in the richest grey mode */
|
sl@0
|
1561 |
TInt CTWsGraphicsBase::MaxGrays() const
|
sl@0
|
1562 |
{
|
sl@0
|
1563 |
return iTest->MaxGrays();
|
sl@0
|
1564 |
}
|
sl@0
|
1565 |
|
sl@0
|
1566 |
/** Returns the number of colours available in the richest supported colour mode. */
|
sl@0
|
1567 |
TInt CTWsGraphicsBase::MaxColors() const
|
sl@0
|
1568 |
{
|
sl@0
|
1569 |
return iTest->MaxColors();
|
sl@0
|
1570 |
}
|
sl@0
|
1571 |
|
sl@0
|
1572 |
//
|
sl@0
|
1573 |
// Panic testing //
|
sl@0
|
1574 |
//
|
sl@0
|
1575 |
|
sl@0
|
1576 |
LOCAL_C TInt PanicThreadFunc(TAny *aPtr)
|
sl@0
|
1577 |
{
|
sl@0
|
1578 |
CTrapCleanup* CleanUpStack=CTrapCleanup::New();
|
sl@0
|
1579 |
SPanicParams *ptr=(SPanicParams *)aPtr;
|
sl@0
|
1580 |
TInt ret;
|
sl@0
|
1581 |
TRAP(ret,ret=(*ptr->func)(ptr->num,ptr->ptr));
|
sl@0
|
1582 |
delete CleanUpStack;
|
sl@0
|
1583 |
if (ret==EWsExitReasonBad)
|
sl@0
|
1584 |
AutoPanic(EAutoPanicPanicFailed);
|
sl@0
|
1585 |
return(ret);
|
sl@0
|
1586 |
}
|
sl@0
|
1587 |
|
sl@0
|
1588 |
TInt CTestBase::LaunchPanicThread(RThread &aThread, SPanicParams *aPtr)
|
sl@0
|
1589 |
{
|
sl@0
|
1590 |
TBuf<32> threadName;
|
sl@0
|
1591 |
threadName.Format(TRefByValue<const TDesC>(_L("AutoPanicThread%d")),iThreadNumber++);
|
sl@0
|
1592 |
return(aThread.Create(threadName,PanicThreadFunc,KDefaultStackSize,KPanicThreadHeapSize,KPanicThreadHeapSize,aPtr,EOwnerThread));
|
sl@0
|
1593 |
}
|
sl@0
|
1594 |
|
sl@0
|
1595 |
TInt CTestBase::TestPanicL(SPanicParams *aPtr, TInt aExitReason, const TDesC &aCategory, TBool* aTestFinished)
|
sl@0
|
1596 |
{
|
sl@0
|
1597 |
RThread thread;
|
sl@0
|
1598 |
TRequestStatus stat;
|
sl@0
|
1599 |
TInt err=LaunchPanicThread(thread, aPtr);
|
sl@0
|
1600 |
if (err==KErrAlreadyExists)
|
sl@0
|
1601 |
{
|
sl@0
|
1602 |
// wait for kernel to clear up old threads
|
sl@0
|
1603 |
// and have several attempts at starting the thread
|
sl@0
|
1604 |
// if unsuccessful the first time
|
sl@0
|
1605 |
for (TInt i=0;i<3;i++)
|
sl@0
|
1606 |
{
|
sl@0
|
1607 |
User::After(TTimeIntervalMicroSeconds32(100000)); //0.1 secs
|
sl@0
|
1608 |
err=LaunchPanicThread(thread, aPtr);
|
sl@0
|
1609 |
if (err!=KErrAlreadyExists)
|
sl@0
|
1610 |
break;
|
sl@0
|
1611 |
}
|
sl@0
|
1612 |
}
|
sl@0
|
1613 |
User::LeaveIfError(err);
|
sl@0
|
1614 |
thread.Logon(stat);
|
sl@0
|
1615 |
User::SetJustInTime(EFalse);
|
sl@0
|
1616 |
thread.Resume();
|
sl@0
|
1617 |
User::WaitForRequest(stat);
|
sl@0
|
1618 |
User::SetJustInTime(ETrue);
|
sl@0
|
1619 |
|
sl@0
|
1620 |
TBool testFinished=EFalse;
|
sl@0
|
1621 |
TBool testPassed=ETrue;
|
sl@0
|
1622 |
if (thread.ExitType()==EExitKill)
|
sl@0
|
1623 |
{
|
sl@0
|
1624 |
User::LeaveIfError(thread.ExitReason());
|
sl@0
|
1625 |
if(thread.ExitReason()!=EWsExitReasonFinished)
|
sl@0
|
1626 |
{
|
sl@0
|
1627 |
testPassed=EFalse;
|
sl@0
|
1628 |
}
|
sl@0
|
1629 |
testFinished=ETrue; // Finish tests
|
sl@0
|
1630 |
}
|
sl@0
|
1631 |
else
|
sl@0
|
1632 |
{
|
sl@0
|
1633 |
if ((thread.ExitCategory().Compare(aCategory)!=0)
|
sl@0
|
1634 |
|| (aExitReason!=EWservNoPanic && thread.ExitReason()!=aExitReason)
|
sl@0
|
1635 |
|| (thread.ExitType()!=EExitPanic))
|
sl@0
|
1636 |
{
|
sl@0
|
1637 |
testPassed=EFalse;
|
sl@0
|
1638 |
}
|
sl@0
|
1639 |
}
|
sl@0
|
1640 |
|
sl@0
|
1641 |
if(aTestFinished)
|
sl@0
|
1642 |
*aTestFinished=testFinished;
|
sl@0
|
1643 |
thread.Close();
|
sl@0
|
1644 |
return(testPassed);
|
sl@0
|
1645 |
}
|
sl@0
|
1646 |
|
sl@0
|
1647 |
TInt CTestBase::TestWsPanicL(TPanicFunction aFunction, TClientPanic aExitReason, TInt aInt, TAny *aPtr, TBool* aTestFinished)
|
sl@0
|
1648 |
{
|
sl@0
|
1649 |
return TestPanicL(aFunction,aExitReason,aInt,aPtr,KWSERV, aTestFinished);
|
sl@0
|
1650 |
}
|
sl@0
|
1651 |
|
sl@0
|
1652 |
TInt CTestBase::TestW32PanicL(TPanicFunction aFunction, TW32Panic aExitReason, TInt aInt, TAny *aPtr, TBool* aTestFinished)
|
sl@0
|
1653 |
{
|
sl@0
|
1654 |
return TestPanicL(aFunction,aExitReason,aInt,aPtr,KW32,aTestFinished);
|
sl@0
|
1655 |
}
|
sl@0
|
1656 |
|
sl@0
|
1657 |
TInt CTestBase::TestWservPanicL(TPanicFunction aFunction, TWservPanic aExitReason, TInt aInt, TAny *aPtr)
|
sl@0
|
1658 |
{
|
sl@0
|
1659 |
_LIT(KWSERV1,"Wserv Internal Panic");
|
sl@0
|
1660 |
return TestPanicL(aFunction,aExitReason,aInt,aPtr,KWSERV1);
|
sl@0
|
1661 |
}
|
sl@0
|
1662 |
|
sl@0
|
1663 |
TInt CTestBase::TestPanicL(TPanicFunction aFunction, TInt aExitReason, TInt aInt, TAny *aPtr, const TDesC &aCategory, TBool* aTestFinished)
|
sl@0
|
1664 |
{
|
sl@0
|
1665 |
SPanicParams params;
|
sl@0
|
1666 |
params.num=aInt;
|
sl@0
|
1667 |
params.func=aFunction;
|
sl@0
|
1668 |
params.ptr=aPtr;
|
sl@0
|
1669 |
return TestPanicL(¶ms, aExitReason, aCategory, aTestFinished);
|
sl@0
|
1670 |
}
|
sl@0
|
1671 |
|
sl@0
|
1672 |
TBool CTestBase::IsFullRomL()
|
sl@0
|
1673 |
{
|
sl@0
|
1674 |
TBool isFullRom = EFalse;
|
sl@0
|
1675 |
_LIT(KWinName,"EikonServer");
|
sl@0
|
1676 |
TInt numWinGroups=TheClient->iWs.NumWindowGroups();
|
sl@0
|
1677 |
CArrayFixFlat<TInt>* list=new(ELeave) CArrayFixFlat<TInt>(numWinGroups);
|
sl@0
|
1678 |
TheClient->iWs.WindowGroupList(list);
|
sl@0
|
1679 |
numWinGroups=list->Count(); // Just in case it changed between originally getting it and getting the actual list
|
sl@0
|
1680 |
TBuf<64> name;
|
sl@0
|
1681 |
TInt ii;
|
sl@0
|
1682 |
for(ii=0;ii<numWinGroups;++ii)
|
sl@0
|
1683 |
{
|
sl@0
|
1684 |
TheClient->iWs.GetWindowGroupNameFromIdentifier((*list)[ii],name);
|
sl@0
|
1685 |
#ifndef DISABLE_FAIL_DIALOG
|
sl@0
|
1686 |
TInt ordinalPos=0;
|
sl@0
|
1687 |
ordinalPos+=ordinalPos; //To stop a warning
|
sl@0
|
1688 |
ordinalPos=
|
sl@0
|
1689 |
#endif
|
sl@0
|
1690 |
TheClient->iWs.GetWindowGroupOrdinalPriority((*list)[ii]);
|
sl@0
|
1691 |
if (name==KWinName)
|
sl@0
|
1692 |
{
|
sl@0
|
1693 |
isFullRom = ETrue;
|
sl@0
|
1694 |
break;
|
sl@0
|
1695 |
}
|
sl@0
|
1696 |
}
|
sl@0
|
1697 |
delete list;
|
sl@0
|
1698 |
return isFullRom;
|
sl@0
|
1699 |
}
|
sl@0
|
1700 |
|
sl@0
|
1701 |
void CTestBase::DelayIfFullRomL()
|
sl@0
|
1702 |
{
|
sl@0
|
1703 |
if (IsFullRomL())
|
sl@0
|
1704 |
User::After(400000);
|
sl@0
|
1705 |
}
|
sl@0
|
1706 |
|
sl@0
|
1707 |
TPartialRedrawType CTestBase::RedrawStoreTypeL()
|
sl@0
|
1708 |
{
|
sl@0
|
1709 |
/* if (iRedrawType==EPartialRedraw_Unknown)
|
sl@0
|
1710 |
{
|
sl@0
|
1711 |
const TRgb KRed=TRgb(255,0,0);
|
sl@0
|
1712 |
const TRgb KGreen=TRgb(0,255,0);
|
sl@0
|
1713 |
const TRgb KBlue=TRgb(0,0,255);
|
sl@0
|
1714 |
CWsScreenDevice* scrDev=TheClient->iScreen;
|
sl@0
|
1715 |
TSize winSize=scrDev->SizeInPixels();
|
sl@0
|
1716 |
CBlankWindow* win=new(ELeave) CBlankWindow(KRed); //Window will be red if WSERV just draws in background color
|
sl@0
|
1717 |
CleanupStack::PushL(win);
|
sl@0
|
1718 |
TDisplayMode mode=EColor256;
|
sl@0
|
1719 |
win->SetUpL(TPoint(),winSize,TheClient->iGroup,*TheClient->iGc,&mode); //Window is activated
|
sl@0
|
1720 |
win->RealDraw(ETrue);
|
sl@0
|
1721 |
win->SetColor(KGreen);
|
sl@0
|
1722 |
CBlankWindow* win2=new(ELeave) CBlankWindow(KRed);
|
sl@0
|
1723 |
CleanupStack::PushL(win2);
|
sl@0
|
1724 |
win2->SetUpL(TPoint(),winSize,TheClient->iGroup,*TheClient->iGc,&mode); //New Window completely obscures other window
|
sl@0
|
1725 |
win2->RealDraw(ETrue);
|
sl@0
|
1726 |
win->CTWin::DrawNow(); //Window will be green if drawn from stored commands
|
sl@0
|
1727 |
win2->CTWin::DrawNow();
|
sl@0
|
1728 |
win2->SetVisible(EFalse);
|
sl@0
|
1729 |
TRgb col;
|
sl@0
|
1730 |
scrDev->GetPixel(col,TPoint(5,5)); //Pixel will be red if storing off by default and green otherwise
|
sl@0
|
1731 |
if (col==KRed)
|
sl@0
|
1732 |
{
|
sl@0
|
1733 |
win->Win()->EnableRedrawStore(ETrue);
|
sl@0
|
1734 |
win->CTWin::DrawNow(); //Create stored commands
|
sl@0
|
1735 |
}
|
sl@0
|
1736 |
else
|
sl@0
|
1737 |
__ASSERT_ALWAYS(col==KGreen,AutoPanic(EAutoPanicRedrawStoring));
|
sl@0
|
1738 |
win->SetColor(KBlue);
|
sl@0
|
1739 |
TRect redrawRect(TSize(10,10));
|
sl@0
|
1740 |
win->Invalidate(redrawRect);
|
sl@0
|
1741 |
win->Win()->BeginRedraw(redrawRect);
|
sl@0
|
1742 |
win->DrawNow(redrawRect); //Top left of Window will be blue if it draws itself
|
sl@0
|
1743 |
win->Win()->EndRedraw();
|
sl@0
|
1744 |
win2->SetVisible(ETrue);
|
sl@0
|
1745 |
win2->SetVisible(EFalse);
|
sl@0
|
1746 |
scrDev->GetPixel(col,TPoint(5,5)); //Pixel will be red if stored commands were lost
|
sl@0
|
1747 |
iRedrawType=EPartialRedraw_None;
|
sl@0
|
1748 |
if (col!=KRed)
|
sl@0
|
1749 |
{
|
sl@0
|
1750 |
__ASSERT_ALWAYS(col==KBlue,AutoPanic(EAutoPanicRedrawStoring));
|
sl@0
|
1751 |
TheClient->WaitForRedrawsToFinish();
|
sl@0
|
1752 |
win2->SetVisible(ETrue);
|
sl@0
|
1753 |
win2->SetVisible(EFalse);
|
sl@0
|
1754 |
scrDev->GetPixel(col,TPoint(15,15)); //Pixel will be blue if partial redraw triggers full redraw
|
sl@0
|
1755 |
iRedrawType=EPartialRedraw_PreserveStoredCmds;
|
sl@0
|
1756 |
if (col!=KBlue)
|
sl@0
|
1757 |
{
|
sl@0
|
1758 |
__ASSERT_ALWAYS(col==KGreen,AutoPanic(EAutoPanicRedrawStoring));
|
sl@0
|
1759 |
iRedrawType=EPartialRedraw_FullRedrawSupport;
|
sl@0
|
1760 |
}
|
sl@0
|
1761 |
}
|
sl@0
|
1762 |
CleanupStack::PopAndDestroy(2,win);
|
sl@0
|
1763 |
}
|
sl@0
|
1764 |
return iRedrawType;*/
|
sl@0
|
1765 |
return EPartialRedraw_FullRedrawSupport;
|
sl@0
|
1766 |
}
|
sl@0
|
1767 |
|
sl@0
|
1768 |
void CTestBase::SetUpMember(TSpriteMember &aMember)
|
sl@0
|
1769 |
{
|
sl@0
|
1770 |
aMember.iMaskBitmap=NULL;
|
sl@0
|
1771 |
aMember.iInvertMask=EFalse;
|
sl@0
|
1772 |
aMember.iDrawMode=CGraphicsContext::EDrawModePEN;
|
sl@0
|
1773 |
aMember.iOffset=TPoint();
|
sl@0
|
1774 |
aMember.iInterval=TTimeIntervalMicroSeconds32(0);
|
sl@0
|
1775 |
}
|
sl@0
|
1776 |
|
sl@0
|
1777 |
void CTestBase::SimulateKeyDownUpWithModifiers(TInt aScanCode,TUint aModifiers)
|
sl@0
|
1778 |
{
|
sl@0
|
1779 |
if (aModifiers&EModifierAlt)
|
sl@0
|
1780 |
SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftFunc);
|
sl@0
|
1781 |
if (aModifiers&EModifierCtrl)
|
sl@0
|
1782 |
SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftCtrl);
|
sl@0
|
1783 |
if (aModifiers&EModifierShift)
|
sl@0
|
1784 |
SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftShift);
|
sl@0
|
1785 |
SimulateKeyDownUp(aScanCode);
|
sl@0
|
1786 |
if (aModifiers&EModifierShift)
|
sl@0
|
1787 |
SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftShift);
|
sl@0
|
1788 |
if (aModifiers&EModifierCtrl)
|
sl@0
|
1789 |
SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftCtrl);
|
sl@0
|
1790 |
if (aModifiers&EModifierAlt)
|
sl@0
|
1791 |
SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftFunc);
|
sl@0
|
1792 |
}
|
sl@0
|
1793 |
|
sl@0
|
1794 |
void CTestBase::SimulateKeyDownUp(TInt aScanCode)
|
sl@0
|
1795 |
{
|
sl@0
|
1796 |
__ASSERT_DEBUG(aScanCode<'a' || aScanCode>'z',AutoPanic(EAutoPanicScanCapital));
|
sl@0
|
1797 |
SimulateKey(TRawEvent::EKeyDown,aScanCode);
|
sl@0
|
1798 |
SimulateKey(TRawEvent::EKeyUp,aScanCode);
|
sl@0
|
1799 |
}
|
sl@0
|
1800 |
|
sl@0
|
1801 |
void CTestBase::SimulatePointerDownUp(TInt aX, TInt aY)
|
sl@0
|
1802 |
{
|
sl@0
|
1803 |
SimulatePointer(TRawEvent::EButton1Down,aX,aY);
|
sl@0
|
1804 |
SimulatePointer(TRawEvent::EButton1Up,aX,aY);
|
sl@0
|
1805 |
}
|
sl@0
|
1806 |
|
sl@0
|
1807 |
void CTestBase::SimulateKey(TRawEvent::TType aType, TInt aScanCode)
|
sl@0
|
1808 |
{
|
sl@0
|
1809 |
TRawEvent rawEvent;
|
sl@0
|
1810 |
rawEvent.Set(aType,aScanCode);
|
sl@0
|
1811 |
TheClient->iWs.SimulateRawEvent(rawEvent);
|
sl@0
|
1812 |
}
|
sl@0
|
1813 |
|
sl@0
|
1814 |
/**
|
sl@0
|
1815 |
* Determine if the configuration supports pointer event testing.
|
sl@0
|
1816 |
*
|
sl@0
|
1817 |
* There are certain circumstances where we want to skip pointer event
|
sl@0
|
1818 |
* testing because we are simulating pointer events, and don't want to
|
sl@0
|
1819 |
* simulate a pointer event from an impossible co-ordinate. We'd rather
|
sl@0
|
1820 |
* just identify that there is no point in doing the test and skip over
|
sl@0
|
1821 |
* to the next test case.
|
sl@0
|
1822 |
*
|
sl@0
|
1823 |
* In particular, when a ROM configured with a digitiser is deployed on a
|
sl@0
|
1824 |
* Naviengine, with hardware configuration DIP switches which say that there
|
sl@0
|
1825 |
* is an external screen connected, then no touch pad is active.
|
sl@0
|
1826 |
* The base port under these conditions returns a digitiser area (0,0,0,0)
|
sl@0
|
1827 |
*
|
sl@0
|
1828 |
* @return ETrue if the configuration supports pointer event testing, otherwise
|
sl@0
|
1829 |
* return EFalse.
|
sl@0
|
1830 |
*/
|
sl@0
|
1831 |
TBool CTestBase::ConfigurationSupportsPointerEventTesting() const
|
sl@0
|
1832 |
{
|
sl@0
|
1833 |
if (iNormalPointerCursorArea.IsEmpty())
|
sl@0
|
1834 |
{
|
sl@0
|
1835 |
return EFalse;
|
sl@0
|
1836 |
}
|
sl@0
|
1837 |
return ETrue;
|
sl@0
|
1838 |
}
|
sl@0
|
1839 |
|
sl@0
|
1840 |
|
sl@0
|
1841 |
void CTestBase::SimulatePointer(TRawEvent::TType aType, TInt aX, TInt aY)
|
sl@0
|
1842 |
{
|
sl@0
|
1843 |
__ASSERT_DEBUG(ConfigurationSupportsPointerEventTesting(), AutoPanic(EAutoPanicNoDigitiser));
|
sl@0
|
1844 |
|
sl@0
|
1845 |
|
sl@0
|
1846 |
#ifdef WSERV_TAUTO_LOG_POINTER_EVENTS
|
sl@0
|
1847 |
TLogMessageText buf;
|
sl@0
|
1848 |
_LIT(KLog,"SimulatePointer Type=%d Pos=(%d,%d)");
|
sl@0
|
1849 |
buf.Format(KLog,aType,aX,aY);
|
sl@0
|
1850 |
TheClient->LogMessage(buf);
|
sl@0
|
1851 |
#endif
|
sl@0
|
1852 |
|
sl@0
|
1853 |
TRawEvent rawEvent;
|
sl@0
|
1854 |
rawEvent.Set(aType,aX,aY);
|
sl@0
|
1855 |
TheClient->iWs.SimulateRawEvent(rawEvent);
|
sl@0
|
1856 |
}
|
sl@0
|
1857 |
|
sl@0
|
1858 |
void CTestBase::SimulateEvent(TRawEvent::TType aType)
|
sl@0
|
1859 |
{
|
sl@0
|
1860 |
TRawEvent rawEvent;
|
sl@0
|
1861 |
rawEvent.Set(aType);
|
sl@0
|
1862 |
TheClient->iWs.SimulateRawEvent(rawEvent);
|
sl@0
|
1863 |
}
|
sl@0
|
1864 |
|
sl@0
|
1865 |
void CTestBase::LogColors(const CBitmapDevice& aDevice,TPoint aBasePoint, TPoint aStartPoint, TPoint aEndPoint)
|
sl@0
|
1866 |
{
|
sl@0
|
1867 |
_LIT(KPixel,"Pixel(%d,%d) R=%d G=%d B=%d");
|
sl@0
|
1868 |
TLogMessageText buf;
|
sl@0
|
1869 |
TBuf8<2560> screen;
|
sl@0
|
1870 |
const TRgb* pixel;
|
sl@0
|
1871 |
if (aStartPoint.iX==aEndPoint.iX)
|
sl@0
|
1872 |
++aEndPoint.iX;
|
sl@0
|
1873 |
if (aStartPoint.iY==aEndPoint.iY)
|
sl@0
|
1874 |
++aEndPoint.iY;
|
sl@0
|
1875 |
TInt width=aEndPoint.iX-aStartPoint.iX;
|
sl@0
|
1876 |
TInt xx,yy;
|
sl@0
|
1877 |
for (yy=aStartPoint.iY;yy<aEndPoint.iY;++yy)
|
sl@0
|
1878 |
{
|
sl@0
|
1879 |
xx=aStartPoint.iX;
|
sl@0
|
1880 |
aDevice.GetScanLine(screen,aBasePoint+TPoint(xx,yy),width,ERgb);
|
sl@0
|
1881 |
pixel=REINTERPRET_CAST(const TRgb*,screen.Ptr());
|
sl@0
|
1882 |
for (;xx<aEndPoint.iX;++xx,++pixel)
|
sl@0
|
1883 |
{
|
sl@0
|
1884 |
buf.Format(KPixel,xx,yy,pixel->Red(),pixel->Green(),pixel->Blue());
|
sl@0
|
1885 |
//RDebug::Print(buf);
|
sl@0
|
1886 |
TheClient->iWs.LogMessage(buf);
|
sl@0
|
1887 |
}
|
sl@0
|
1888 |
}
|
sl@0
|
1889 |
TheClient->iWs.Flush();
|
sl@0
|
1890 |
}
|
sl@0
|
1891 |
|
sl@0
|
1892 |
void CTestBase::LogColors4(const CBitmapDevice& aDevice,TPoint aStartPoint,TInt aLen)
|
sl@0
|
1893 |
{
|
sl@0
|
1894 |
_LIT(KValue,"Pixel(%d,%d) Byte %d, Value %d");
|
sl@0
|
1895 |
TLogMessageText buf;
|
sl@0
|
1896 |
TBuf8<2560> screen;
|
sl@0
|
1897 |
aDevice.GetScanLine(screen,aStartPoint,aLen,EGray4);
|
sl@0
|
1898 |
TInt len=(aLen+3)/4;
|
sl@0
|
1899 |
TInt ii;
|
sl@0
|
1900 |
for (ii=0;ii<len;++ii,aStartPoint.iX+=4)
|
sl@0
|
1901 |
{
|
sl@0
|
1902 |
buf.Format(KValue,aStartPoint.iX,aStartPoint.iY,ii,screen[ii]);
|
sl@0
|
1903 |
TheClient->iWs.LogMessage(buf);
|
sl@0
|
1904 |
}
|
sl@0
|
1905 |
}
|
sl@0
|
1906 |
|
sl@0
|
1907 |
void CTestBase::UpdateTestResults(TInt aNoOfTest, TInt aNoOfTestPass)
|
sl@0
|
1908 |
{
|
sl@0
|
1909 |
iNumberTests+=aNoOfTest;
|
sl@0
|
1910 |
iNumberTestsPass+=aNoOfTestPass;
|
sl@0
|
1911 |
}
|
sl@0
|
1912 |
|
sl@0
|
1913 |
TInt CTestBase::SaveScreen(const TDesC& aFileName)
|
sl@0
|
1914 |
{
|
sl@0
|
1915 |
return SaveScreen(aFileName,TheClient->iScreen->SizeInPixels(),TheClient->iScreen->DisplayMode());
|
sl@0
|
1916 |
}
|
sl@0
|
1917 |
|
sl@0
|
1918 |
TInt CTestBase::SaveScreen(const TDesC& aFileName,const TSize& aScreenSize,TDisplayMode aColorDepth)
|
sl@0
|
1919 |
{
|
sl@0
|
1920 |
TRAPD(err,SaveScreenL(aFileName,aScreenSize,aColorDepth));
|
sl@0
|
1921 |
return err;
|
sl@0
|
1922 |
}
|
sl@0
|
1923 |
|
sl@0
|
1924 |
void CTestBase::SaveScreenL(const TDesC& aFileName,const TSize& aScreenSize,TDisplayMode aColorDepth)
|
sl@0
|
1925 |
{
|
sl@0
|
1926 |
CBitmap* copyOfScreen=CBitmap::NewLC(aScreenSize,aColorDepth);
|
sl@0
|
1927 |
CFbsScreenDevice* scrDevice=CFbsScreenDevice::NewL(iScreenNumber,aColorDepth);
|
sl@0
|
1928 |
CleanupStack::PushL(scrDevice);
|
sl@0
|
1929 |
CFbsBitGc* gc;
|
sl@0
|
1930 |
User::LeaveIfError(scrDevice->CreateContext(gc));
|
sl@0
|
1931 |
CleanupStack::PushL(gc);
|
sl@0
|
1932 |
copyOfScreen->Gc().BitBlt(TPoint(),*gc);
|
sl@0
|
1933 |
User::LeaveIfError(copyOfScreen->Bitmap().Save(aFileName));
|
sl@0
|
1934 |
CleanupStack::PopAndDestroy(3,copyOfScreen);
|
sl@0
|
1935 |
}
|
sl@0
|
1936 |
|
sl@0
|
1937 |
|
sl@0
|
1938 |
/*CProcess*/
|
sl@0
|
1939 |
_LIT(KScreenTag,"Screen");
|
sl@0
|
1940 |
|
sl@0
|
1941 |
void CProcess::GetProcArg(const TWinCommand& aParam,TBufArg& aProcArg)
|
sl@0
|
1942 |
{
|
sl@0
|
1943 |
TInt pos = aParam.Find(KScreenTag);
|
sl@0
|
1944 |
if (pos!=KErrNotFound)
|
sl@0
|
1945 |
aProcArg = aParam.Left(pos-1);
|
sl@0
|
1946 |
else
|
sl@0
|
1947 |
aProcArg = aParam;
|
sl@0
|
1948 |
}
|
sl@0
|
1949 |
|
sl@0
|
1950 |
void CProcess::GetScreenArg(const TWinCommand& aParam, TInt& aScreenArg)
|
sl@0
|
1951 |
{
|
sl@0
|
1952 |
TInt pos = aParam.Find(KScreenTag);
|
sl@0
|
1953 |
if (pos!=KErrNotFound)
|
sl@0
|
1954 |
{
|
sl@0
|
1955 |
TBufArg secondArg(aParam.Right(aParam.Length()-pos));
|
sl@0
|
1956 |
if (secondArg.Length()>6)
|
sl@0
|
1957 |
{
|
sl@0
|
1958 |
TBuf<1> digit(secondArg.Mid(6,1));
|
sl@0
|
1959 |
TLex lex(digit);
|
sl@0
|
1960 |
lex.Val(aScreenArg);
|
sl@0
|
1961 |
}
|
sl@0
|
1962 |
}
|
sl@0
|
1963 |
}
|
sl@0
|
1964 |
|
sl@0
|
1965 |
TInt CProcess::Start(const TWinCommand& aParam)
|
sl@0
|
1966 |
{
|
sl@0
|
1967 |
// parse command line aParam to retrieve value of
|
sl@0
|
1968 |
// screen number if it is specified
|
sl@0
|
1969 |
//
|
sl@0
|
1970 |
// command line format: <process-id> [screen<id>]
|
sl@0
|
1971 |
//
|
sl@0
|
1972 |
TBufArg procArg(_L(""));
|
sl@0
|
1973 |
TInt screenArg = KDefaultScreen;
|
sl@0
|
1974 |
|
sl@0
|
1975 |
GetProcArg(aParam, procArg);
|
sl@0
|
1976 |
GetScreenArg(aParam, screenArg);
|
sl@0
|
1977 |
|
sl@0
|
1978 |
TInt ii;
|
sl@0
|
1979 |
for(ii=0;ii<eNumProcessCalls;ii++)
|
sl@0
|
1980 |
{
|
sl@0
|
1981 |
if (procArg==iFunctions[ii].iParam)
|
sl@0
|
1982 |
{
|
sl@0
|
1983 |
TRAPD(ret,iFunctions[ii].iFunction((TAny*)screenArg));
|
sl@0
|
1984 |
|
sl@0
|
1985 |
// need to pass test result to owning process
|
sl@0
|
1986 |
// for multiple display test
|
sl@0
|
1987 |
if (ii==eProcessMultiDisplayTest)
|
sl@0
|
1988 |
ret = TheTestResult;
|
sl@0
|
1989 |
|
sl@0
|
1990 |
return ret;
|
sl@0
|
1991 |
}
|
sl@0
|
1992 |
}
|
sl@0
|
1993 |
|
sl@0
|
1994 |
return KErrNone; //Shouldn't get here
|
sl@0
|
1995 |
}
|
sl@0
|
1996 |
|
sl@0
|
1997 |
CProcess* CProcess::NewL(TInt aFunctionNo,TInt aScreenNumber)
|
sl@0
|
1998 |
{
|
sl@0
|
1999 |
CProcess* self=new(ELeave) CProcess();
|
sl@0
|
2000 |
CleanupStack::PushL(self);
|
sl@0
|
2001 |
self->ConstructL(aFunctionNo,aScreenNumber);
|
sl@0
|
2002 |
CleanupStack::Pop(self);
|
sl@0
|
2003 |
return self;
|
sl@0
|
2004 |
}
|
sl@0
|
2005 |
|
sl@0
|
2006 |
CProcess* CProcess::NewTL(TInt aFunctionNo,TInt aScreenNumber,TRequestStatus* aStatus /*=NULL*/)
|
sl@0
|
2007 |
{
|
sl@0
|
2008 |
CProcess* self=new(ELeave) CProcess();
|
sl@0
|
2009 |
CleanupStack::PushL(self);
|
sl@0
|
2010 |
self->ConstructTL(aFunctionNo,aScreenNumber,aStatus);
|
sl@0
|
2011 |
CleanupStack::Pop(self);
|
sl@0
|
2012 |
return self;
|
sl@0
|
2013 |
}
|
sl@0
|
2014 |
|
sl@0
|
2015 |
CProcess* CProcess::NewThreadL(const TDesC& aName,TThreadFunction aFunction,TThreadStartUp* aPtr
|
sl@0
|
2016 |
,TRequestStatus* aStatus)
|
sl@0
|
2017 |
{
|
sl@0
|
2018 |
CProcess* self=new(ELeave) CProcess();
|
sl@0
|
2019 |
CleanupStack::PushL(self);
|
sl@0
|
2020 |
self->ConstructL(aName,aFunction,aPtr,aStatus);
|
sl@0
|
2021 |
CleanupStack::Pop(self);
|
sl@0
|
2022 |
return self;
|
sl@0
|
2023 |
}
|
sl@0
|
2024 |
|
sl@0
|
2025 |
CProcess* CProcess::NewThreadRendezvousL(const TDesC& aName,TThreadFunction aFunction,TThreadStartUp* aPtr ,TRequestStatus* aLogonStatus,TRequestStatus& aRendesvouzStatus)
|
sl@0
|
2026 |
{
|
sl@0
|
2027 |
CProcess* self=new(ELeave) CProcess();
|
sl@0
|
2028 |
CleanupStack::PushL(self);
|
sl@0
|
2029 |
self->ConstructRendezvousL(aName,aFunction,aPtr,aLogonStatus,aRendesvouzStatus);
|
sl@0
|
2030 |
CleanupStack::Pop(self);
|
sl@0
|
2031 |
return self;
|
sl@0
|
2032 |
}
|
sl@0
|
2033 |
|
sl@0
|
2034 |
CProcess* CProcess::NewThreadRendezvousL(const TDesC& aName,TThreadStartUp* aPtr,TRequestStatus& aRendesvouzStatus)
|
sl@0
|
2035 |
{
|
sl@0
|
2036 |
return NewThreadRendezvousL(aName,ThreadInit,aPtr,NULL,aRendesvouzStatus);
|
sl@0
|
2037 |
}
|
sl@0
|
2038 |
|
sl@0
|
2039 |
CProcess* CProcess::NewThreadL(const TDesC& aName,TThreadStartUp* aPtr)
|
sl@0
|
2040 |
{
|
sl@0
|
2041 |
return NewThreadL(aName,ThreadInit,aPtr,NULL);
|
sl@0
|
2042 |
}
|
sl@0
|
2043 |
|
sl@0
|
2044 |
CProcess* CProcess::NewSimpleThreadL(const TDesC& aName,TThreadStartUp* aPtr,TRequestStatus* aStatus/*=NULL*/)
|
sl@0
|
2045 |
{
|
sl@0
|
2046 |
return NewThreadL(aName,SimpleThreadInit,aPtr,aStatus);
|
sl@0
|
2047 |
}
|
sl@0
|
2048 |
|
sl@0
|
2049 |
_LIT(KSpace," ");
|
sl@0
|
2050 |
_LIT(KScreenFormat,"%d");
|
sl@0
|
2051 |
|
sl@0
|
2052 |
void CProcess::ConstructL(TInt aFunctionNo,TInt aScreenNumber/*=KDefaultScreen*/)
|
sl@0
|
2053 |
{
|
sl@0
|
2054 |
Close();
|
sl@0
|
2055 |
// add screen number into command line param
|
sl@0
|
2056 |
// format: <proc-id> [screen<id>]
|
sl@0
|
2057 |
//
|
sl@0
|
2058 |
TBuf<100> commandLine;
|
sl@0
|
2059 |
|
sl@0
|
2060 |
commandLine = iFunctions[aFunctionNo].iParam;
|
sl@0
|
2061 |
commandLine.Append(KSpace);
|
sl@0
|
2062 |
commandLine.Append(KScreenTag);
|
sl@0
|
2063 |
commandLine.AppendFormat(KScreenFormat,aScreenNumber);
|
sl@0
|
2064 |
User::LeaveIfError(iOther.Create(RProcess().FileName(),commandLine));
|
sl@0
|
2065 |
iCreated|=eOtherCreated;
|
sl@0
|
2066 |
iOther.Resume();
|
sl@0
|
2067 |
}
|
sl@0
|
2068 |
|
sl@0
|
2069 |
void CProcess::ConstructTL(TInt aFunctionNo,TInt aScreenNumber/*=KDefaultScreen*/,TRequestStatus* aStatus)
|
sl@0
|
2070 |
{
|
sl@0
|
2071 |
Close();
|
sl@0
|
2072 |
TUint flag=eThreadCreated;
|
sl@0
|
2073 |
TInt err=iThread.Create(iFunctions[aFunctionNo].iParam,iFunctions[aFunctionNo].iFunction
|
sl@0
|
2074 |
,KDefaultStackSize,KOtherProcHeapSize,KOtherProcHeapSize,(TAny*)aScreenNumber,EOwnerThread);
|
sl@0
|
2075 |
User::LeaveIfError(err);
|
sl@0
|
2076 |
iCreated|=flag;
|
sl@0
|
2077 |
if (aStatus)
|
sl@0
|
2078 |
Logon(*aStatus);
|
sl@0
|
2079 |
iThread.Resume();
|
sl@0
|
2080 |
}
|
sl@0
|
2081 |
|
sl@0
|
2082 |
|
sl@0
|
2083 |
void CProcess::ConstructL(const TDesC& aName,TThreadFunction aFunction,TThreadStartUp* aPtr,TRequestStatus* aStatus)
|
sl@0
|
2084 |
{
|
sl@0
|
2085 |
Close();
|
sl@0
|
2086 |
User::LeaveIfError(iThread.Create(aName,aFunction,KDefaultStackSize,KOtherProcHeapSize,KOtherProcHeapSize,aPtr,EOwnerThread));
|
sl@0
|
2087 |
iCreated|=eThreadCreated;
|
sl@0
|
2088 |
if (aStatus)
|
sl@0
|
2089 |
Logon(*aStatus);
|
sl@0
|
2090 |
iThread.Resume();
|
sl@0
|
2091 |
}
|
sl@0
|
2092 |
|
sl@0
|
2093 |
void CProcess::ConstructRendezvousL(const TDesC& aName,TThreadFunction aFunction,TThreadStartUp* aPtr,TRequestStatus* aLogonStatus,TRequestStatus& aRendezvousStatus)
|
sl@0
|
2094 |
{
|
sl@0
|
2095 |
Close();
|
sl@0
|
2096 |
User::LeaveIfError(iThread.Create(aName,aFunction,KDefaultStackSize,KOtherProcHeapSize,KOtherProcHeapSize,aPtr,EOwnerThread));
|
sl@0
|
2097 |
iCreated|=eThreadCreated;
|
sl@0
|
2098 |
if (aLogonStatus)
|
sl@0
|
2099 |
Logon(*aLogonStatus);
|
sl@0
|
2100 |
|
sl@0
|
2101 |
iThread.Rendezvous(aRendezvousStatus);
|
sl@0
|
2102 |
iThread.Resume();
|
sl@0
|
2103 |
}
|
sl@0
|
2104 |
|
sl@0
|
2105 |
void CProcess::Logon(TRequestStatus& aStatus) const
|
sl@0
|
2106 |
{
|
sl@0
|
2107 |
if (iCreated&eThreadCreated)
|
sl@0
|
2108 |
iThread.Logon(aStatus);
|
sl@0
|
2109 |
else
|
sl@0
|
2110 |
{
|
sl@0
|
2111 |
iOther.Logon(aStatus);
|
sl@0
|
2112 |
}
|
sl@0
|
2113 |
}
|
sl@0
|
2114 |
|
sl@0
|
2115 |
void CProcess::Terminate(TInt aReason)
|
sl@0
|
2116 |
{
|
sl@0
|
2117 |
if (iCreated&eThreadCreated)
|
sl@0
|
2118 |
iThread.Terminate(aReason);
|
sl@0
|
2119 |
else
|
sl@0
|
2120 |
{
|
sl@0
|
2121 |
iOther.Terminate(aReason);
|
sl@0
|
2122 |
}
|
sl@0
|
2123 |
Close();
|
sl@0
|
2124 |
}
|
sl@0
|
2125 |
|
sl@0
|
2126 |
void CProcess::Close()
|
sl@0
|
2127 |
{
|
sl@0
|
2128 |
if (iCreated&eOtherCreated)
|
sl@0
|
2129 |
iOther.Close();
|
sl@0
|
2130 |
if (iCreated&eThreadCreated)
|
sl@0
|
2131 |
iThread.Close();
|
sl@0
|
2132 |
iCreated=0;
|
sl@0
|
2133 |
}
|
sl@0
|
2134 |
|
sl@0
|
2135 |
CProcess::~CProcess()
|
sl@0
|
2136 |
{
|
sl@0
|
2137 |
Close();
|
sl@0
|
2138 |
}
|
sl@0
|
2139 |
|
sl@0
|
2140 |
TBool CProcess::StillAlive()
|
sl@0
|
2141 |
{
|
sl@0
|
2142 |
if (iCreated&eOtherCreated)
|
sl@0
|
2143 |
return iOther.ExitType()==EExitPending;
|
sl@0
|
2144 |
return iThread.ExitType()==EExitPending;
|
sl@0
|
2145 |
}
|
sl@0
|
2146 |
|
sl@0
|
2147 |
void CProcess::LeaveIfDied() //Can Leave
|
sl@0
|
2148 |
{
|
sl@0
|
2149 |
User::After(200000); //0.2 secs
|
sl@0
|
2150 |
if (StillAlive())
|
sl@0
|
2151 |
return;
|
sl@0
|
2152 |
if (iCreated&eOtherCreated)
|
sl@0
|
2153 |
User::Leave(iOther.ExitReason());
|
sl@0
|
2154 |
User::Leave(iThread.ExitReason());
|
sl@0
|
2155 |
}
|
sl@0
|
2156 |
|
sl@0
|
2157 |
const TInt KFirstInstanceId = 1;
|
sl@0
|
2158 |
const TInt KOtherInstanceId = 2;
|
sl@0
|
2159 |
|
sl@0
|
2160 |
TBool CProcess::ProcessDied(TInt aScreenNo/*=KDefaultScreen*/)
|
sl@0
|
2161 |
{
|
sl@0
|
2162 |
_LIT(pName,"TAutoServer*");
|
sl@0
|
2163 |
TFindProcess find(pName);
|
sl@0
|
2164 |
TFullName name;
|
sl@0
|
2165 |
|
sl@0
|
2166 |
TBool found = EFalse;
|
sl@0
|
2167 |
TInt instanceId = aScreenNo==KDefaultScreen? KFirstInstanceId : KOtherInstanceId;
|
sl@0
|
2168 |
// find the correct instance of the process
|
sl@0
|
2169 |
// required in multi display test
|
sl@0
|
2170 |
while (!found && find.Next(name)==KErrNone)
|
sl@0
|
2171 |
{
|
sl@0
|
2172 |
TPtrC scrId = name.Right(1);
|
sl@0
|
2173 |
TInt id;
|
sl@0
|
2174 |
TLex lex(scrId);
|
sl@0
|
2175 |
lex.Val(id);
|
sl@0
|
2176 |
if (id==instanceId)
|
sl@0
|
2177 |
found = ETrue;
|
sl@0
|
2178 |
}
|
sl@0
|
2179 |
if (!found)
|
sl@0
|
2180 |
return EFalse;
|
sl@0
|
2181 |
|
sl@0
|
2182 |
RProcess p;
|
sl@0
|
2183 |
p.Open(name);
|
sl@0
|
2184 |
if (p.Id()!=RProcess().Id())
|
sl@0
|
2185 |
return EFalse;
|
sl@0
|
2186 |
p.Close();
|
sl@0
|
2187 |
return (find.Next(name)!=KErrNone);
|
sl@0
|
2188 |
}
|
sl@0
|
2189 |
|
sl@0
|
2190 |
TInt CProcess::ThreadInit(TAny *aPtr)
|
sl@0
|
2191 |
{
|
sl@0
|
2192 |
__UHEAP_MARK;
|
sl@0
|
2193 |
TInt err=KErrNone;
|
sl@0
|
2194 |
CTrapCleanup* CleanUpStack=CTrapCleanup::New();
|
sl@0
|
2195 |
if (CleanUpStack==NULL)
|
sl@0
|
2196 |
err=KErrNoMemory;
|
sl@0
|
2197 |
else
|
sl@0
|
2198 |
{
|
sl@0
|
2199 |
TRAP(err,InitialiseL(STATIC_CAST(TThreadStartUp*,aPtr)))
|
sl@0
|
2200 |
delete CleanUpStack;
|
sl@0
|
2201 |
}
|
sl@0
|
2202 |
__UHEAP_MARKEND;
|
sl@0
|
2203 |
return(err);
|
sl@0
|
2204 |
}
|
sl@0
|
2205 |
|
sl@0
|
2206 |
void CProcess::InitialiseL(TThreadStartUp* aPtr)
|
sl@0
|
2207 |
{
|
sl@0
|
2208 |
CActiveScheduler* activeScheduler=new(ELeave) CActiveScheduler;
|
sl@0
|
2209 |
CActiveScheduler::Install(activeScheduler);
|
sl@0
|
2210 |
CleanupStack::PushL(activeScheduler);
|
sl@0
|
2211 |
aPtr->iInitFunction(aPtr->iParam);
|
sl@0
|
2212 |
CActiveScheduler::Start();
|
sl@0
|
2213 |
CleanupStack::PopAndDestroy(activeScheduler);
|
sl@0
|
2214 |
}
|
sl@0
|
2215 |
|
sl@0
|
2216 |
TInt CProcess::SimpleThreadInit(TAny *aPtr)
|
sl@0
|
2217 |
{
|
sl@0
|
2218 |
__UHEAP_MARK;
|
sl@0
|
2219 |
TInt err=KErrNone;
|
sl@0
|
2220 |
CTrapCleanup* CleanUpStack=CTrapCleanup::New();
|
sl@0
|
2221 |
if (CleanUpStack==NULL)
|
sl@0
|
2222 |
err=KErrNoMemory;
|
sl@0
|
2223 |
else
|
sl@0
|
2224 |
{
|
sl@0
|
2225 |
TThreadStartUp* ptr=STATIC_CAST(TThreadStartUp*,aPtr);
|
sl@0
|
2226 |
ptr->iInitFunction(ptr->iParam);
|
sl@0
|
2227 |
delete CleanUpStack;
|
sl@0
|
2228 |
}
|
sl@0
|
2229 |
__UHEAP_MARKEND;
|
sl@0
|
2230 |
return(err);
|
sl@0
|
2231 |
}
|
sl@0
|
2232 |
|
sl@0
|
2233 |
/*CMinWin*/
|
sl@0
|
2234 |
|
sl@0
|
2235 |
CMinWin::CMinWin(TInt aScreenNo): iScreenNo(aScreenNo)
|
sl@0
|
2236 |
{}
|
sl@0
|
2237 |
|
sl@0
|
2238 |
void CMinWin::ConstructL()
|
sl@0
|
2239 |
{
|
sl@0
|
2240 |
User::LeaveIfError(iWs.Connect());
|
sl@0
|
2241 |
iScr=new(ELeave) CWsScreenDevice(iWs);
|
sl@0
|
2242 |
User::LeaveIfError(iScr->Construct(iScreenNo));
|
sl@0
|
2243 |
iGroup=RWindowGroup(iWs);
|
sl@0
|
2244 |
User::LeaveIfError(iGroup.Construct(8970+iScreenNo,ETrue));
|
sl@0
|
2245 |
iWin=RWindow(iWs);
|
sl@0
|
2246 |
User::LeaveIfError(iWin.Construct((RWindowTreeNode)iGroup,(TUint32)this));
|
sl@0
|
2247 |
iRect=TSize(10,10);
|
sl@0
|
2248 |
iWin.SetExtent(TPoint(0,0),iRect.Size());
|
sl@0
|
2249 |
iWin.SetRequiredDisplayMode(EColor256);
|
sl@0
|
2250 |
iWin.SetBackgroundColor(KRgbGreen);
|
sl@0
|
2251 |
iWin.Activate();
|
sl@0
|
2252 |
iGc=new(ELeave) CWindowGc(iScr);
|
sl@0
|
2253 |
User::LeaveIfError(iGc->Construct());
|
sl@0
|
2254 |
|
sl@0
|
2255 |
Draw(iRect);
|
sl@0
|
2256 |
iWs.Flush();
|
sl@0
|
2257 |
}
|
sl@0
|
2258 |
|
sl@0
|
2259 |
CMinWin::~CMinWin()
|
sl@0
|
2260 |
{
|
sl@0
|
2261 |
delete iGc;
|
sl@0
|
2262 |
iWin.Close();
|
sl@0
|
2263 |
iGroup.Close();
|
sl@0
|
2264 |
delete iScr;
|
sl@0
|
2265 |
iWs.Close();
|
sl@0
|
2266 |
}
|
sl@0
|
2267 |
|
sl@0
|
2268 |
void CMinWin::Draw(const TRect& aRect)
|
sl@0
|
2269 |
{
|
sl@0
|
2270 |
iWin.BeginRedraw();
|
sl@0
|
2271 |
iGc->Activate(iWin);
|
sl@0
|
2272 |
iGc->SetPenStyle(CGraphicsContext::ENullPen);
|
sl@0
|
2273 |
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
2274 |
iGc->SetBrushColor(KRgbGreen);
|
sl@0
|
2275 |
iGc->DrawRect(aRect);
|
sl@0
|
2276 |
iGc->Deactivate();
|
sl@0
|
2277 |
iWin.EndRedraw();
|
sl@0
|
2278 |
}
|
sl@0
|
2279 |
|
sl@0
|
2280 |
|
sl@0
|
2281 |
/*CTimeOut*/
|
sl@0
|
2282 |
|
sl@0
|
2283 |
void CTimeOut::ConstructL()
|
sl@0
|
2284 |
{
|
sl@0
|
2285 |
CTimer::ConstructL();
|
sl@0
|
2286 |
CActiveScheduler::Add(this);
|
sl@0
|
2287 |
}
|
sl@0
|
2288 |
|
sl@0
|
2289 |
void CTimeOut::Start(TTimeIntervalMicroSeconds32 aInterval,TCallBack aCallBack)
|
sl@0
|
2290 |
{
|
sl@0
|
2291 |
iCallBack=aCallBack;
|
sl@0
|
2292 |
After(aInterval);
|
sl@0
|
2293 |
}
|
sl@0
|
2294 |
|
sl@0
|
2295 |
void CTimeOut::RunL()
|
sl@0
|
2296 |
{
|
sl@0
|
2297 |
iCallBack.CallBack();
|
sl@0
|
2298 |
}
|
sl@0
|
2299 |
|
sl@0
|
2300 |
/*
|
sl@0
|
2301 |
* Simply returns the DisplayMode as a string. Used to display mode details on test results.
|
sl@0
|
2302 |
*/
|
sl@0
|
2303 |
GLDEF_C TPtrC DisplayModeAsString(TDisplayMode aMode)
|
sl@0
|
2304 |
{
|
sl@0
|
2305 |
|
sl@0
|
2306 |
TPtrC modeAsString;
|
sl@0
|
2307 |
|
sl@0
|
2308 |
switch(aMode)
|
sl@0
|
2309 |
{
|
sl@0
|
2310 |
case ENone:
|
sl@0
|
2311 |
_LIT(KENoneMode,"ENone");
|
sl@0
|
2312 |
modeAsString.Set(KENoneMode);
|
sl@0
|
2313 |
break;
|
sl@0
|
2314 |
case EGray2:
|
sl@0
|
2315 |
_LIT(KEGray2Mode,"EGray2");
|
sl@0
|
2316 |
modeAsString.Set(KEGray2Mode);
|
sl@0
|
2317 |
break;
|
sl@0
|
2318 |
case EGray4:
|
sl@0
|
2319 |
_LIT(KEGray4Mode,"EGray4");
|
sl@0
|
2320 |
modeAsString.Set(KEGray4Mode);
|
sl@0
|
2321 |
break;
|
sl@0
|
2322 |
case EGray16:
|
sl@0
|
2323 |
_LIT(KEGray16Mode,"EGray16");
|
sl@0
|
2324 |
modeAsString.Set(KEGray16Mode);
|
sl@0
|
2325 |
break;
|
sl@0
|
2326 |
case EGray256:
|
sl@0
|
2327 |
_LIT(KEGray256Mode,"EGray256");
|
sl@0
|
2328 |
modeAsString.Set(KEGray256Mode);
|
sl@0
|
2329 |
break;
|
sl@0
|
2330 |
case EColor16:
|
sl@0
|
2331 |
_LIT(KEColor16Mode,"EColor16");
|
sl@0
|
2332 |
modeAsString.Set(KEColor16Mode);
|
sl@0
|
2333 |
break;
|
sl@0
|
2334 |
case EColor256:
|
sl@0
|
2335 |
_LIT(KEColor256Mode,"EColor256");
|
sl@0
|
2336 |
modeAsString.Set(KEColor256Mode);
|
sl@0
|
2337 |
break;
|
sl@0
|
2338 |
case EColor64K:
|
sl@0
|
2339 |
_LIT(KEColor64KMode,"EColor64K");
|
sl@0
|
2340 |
modeAsString.Set(KEColor64KMode);
|
sl@0
|
2341 |
break;
|
sl@0
|
2342 |
case EColor16M:
|
sl@0
|
2343 |
_LIT(KEColor16MMode,"EColor16M");
|
sl@0
|
2344 |
modeAsString.Set(KEColor16MMode);
|
sl@0
|
2345 |
break;
|
sl@0
|
2346 |
case EColor4K:
|
sl@0
|
2347 |
_LIT(KEColor4KMode,"EColor4K");
|
sl@0
|
2348 |
modeAsString.Set(KEColor4KMode);
|
sl@0
|
2349 |
break;
|
sl@0
|
2350 |
case EColor16MU:
|
sl@0
|
2351 |
_LIT(KEColor16MUMode,"EColor16MU");
|
sl@0
|
2352 |
modeAsString.Set(KEColor16MUMode);
|
sl@0
|
2353 |
break;
|
sl@0
|
2354 |
case EColor16MA:
|
sl@0
|
2355 |
_LIT(KEColor16MAMode,"EColor16MA");
|
sl@0
|
2356 |
modeAsString.Set(KEColor16MAMode);
|
sl@0
|
2357 |
break;
|
sl@0
|
2358 |
case EColor16MAP:
|
sl@0
|
2359 |
_LIT(KEColor16MAPMode,"EColor16MAP");
|
sl@0
|
2360 |
modeAsString.Set(KEColor16MAPMode);
|
sl@0
|
2361 |
break;
|
sl@0
|
2362 |
default:
|
sl@0
|
2363 |
_LIT(KUnknownMode,"Unknown");
|
sl@0
|
2364 |
modeAsString.Set(KUnknownMode);
|
sl@0
|
2365 |
break;
|
sl@0
|
2366 |
}
|
sl@0
|
2367 |
|
sl@0
|
2368 |
return modeAsString;
|
sl@0
|
2369 |
}
|
sl@0
|
2370 |
|
sl@0
|
2371 |
// Check if an area of a bitmap is of a certain color
|
sl@0
|
2372 |
GLDEF_C TBool LossyCheckBlankBitmap(const CFbsBitmap& aBitmap, const TRect aArea, const TRgb aCheckColor, TBool aLossyCompare)
|
sl@0
|
2373 |
{
|
sl@0
|
2374 |
const TReal errorLimit = (aLossyCompare ? 0.05 : 0.00); //Lossy(default) or exact compare?
|
sl@0
|
2375 |
|
sl@0
|
2376 |
TBool result = ETrue;
|
sl@0
|
2377 |
/* TInt mismatchedPixels = 0; */ // -- Useful for debugging
|
sl@0
|
2378 |
TRgb bitmapPix = TRgb(0,0,0,0); //testWin Pixel
|
sl@0
|
2379 |
for (TInt x = 0; x < aArea.Size().iWidth; x++)
|
sl@0
|
2380 |
{
|
sl@0
|
2381 |
for (TInt y = 0; y < aArea.Size().iHeight; y++)
|
sl@0
|
2382 |
{
|
sl@0
|
2383 |
aBitmap.GetPixel(bitmapPix, TPoint(x,y));
|
sl@0
|
2384 |
|
sl@0
|
2385 |
//Check if there are differeces in color between the bitmap and the test color
|
sl@0
|
2386 |
if(((TReal)abs(bitmapPix.Red() - aCheckColor.Red())/255) > errorLimit ||
|
sl@0
|
2387 |
((TReal)abs(bitmapPix.Blue() - aCheckColor.Blue())/255) > errorLimit ||
|
sl@0
|
2388 |
((TReal)abs(bitmapPix.Green() - aCheckColor.Green())/255) > errorLimit ||
|
sl@0
|
2389 |
((TReal)abs(bitmapPix.Alpha() - aCheckColor.Alpha())/255) > errorLimit)
|
sl@0
|
2390 |
{
|
sl@0
|
2391 |
/* mismatchedPixels++; */ // -- Useful for debugging
|
sl@0
|
2392 |
result = EFalse;
|
sl@0
|
2393 |
break;
|
sl@0
|
2394 |
}
|
sl@0
|
2395 |
}
|
sl@0
|
2396 |
}
|
sl@0
|
2397 |
|
sl@0
|
2398 |
/* INFO_PRINTF2(_L("Number of different pixels: %i"), mismatchedPixels); */ // -- Useful for debugging
|
sl@0
|
2399 |
return result;
|
sl@0
|
2400 |
}
|
sl@0
|
2401 |
|
sl@0
|
2402 |
// Compare a section of two bitmaps
|
sl@0
|
2403 |
GLDEF_C TBool LossyCompareBitmap(const CFbsBitmap& aBitmap1, const CFbsBitmap& aBitmap2, const TRect aCompareRect, TBool aLossyCompare)
|
sl@0
|
2404 |
{
|
sl@0
|
2405 |
const TReal errorLimit = (aLossyCompare ? 0.05 : 0.00); //Lossy or Exact compare?
|
sl@0
|
2406 |
|
sl@0
|
2407 |
TBool result = ETrue;
|
sl@0
|
2408 |
|
sl@0
|
2409 |
if (aBitmap1.DisplayMode() != aBitmap2.DisplayMode())
|
sl@0
|
2410 |
{
|
sl@0
|
2411 |
RDebug::Printf(" DisplayMode difference %d, %d", aBitmap1.DisplayMode(), aBitmap2.DisplayMode());
|
sl@0
|
2412 |
}
|
sl@0
|
2413 |
|
sl@0
|
2414 |
TRgb bitmap1Pix = TRgb(0,0,0,0);
|
sl@0
|
2415 |
TRgb bitmap2Pix = TRgb(0,0,0,0);
|
sl@0
|
2416 |
for (TInt x = 0; x < aCompareRect.Size().iWidth; x++)
|
sl@0
|
2417 |
{
|
sl@0
|
2418 |
for (TInt y = 0; y < aCompareRect.Size().iHeight; y++)
|
sl@0
|
2419 |
{
|
sl@0
|
2420 |
aBitmap1.GetPixel(bitmap1Pix, TPoint(x,y));
|
sl@0
|
2421 |
aBitmap2.GetPixel(bitmap2Pix, TPoint(x,y));
|
sl@0
|
2422 |
|
sl@0
|
2423 |
//Check if there are differences between the colors of the two bitmaps
|
sl@0
|
2424 |
if(((TReal)abs(bitmap1Pix.Red() - bitmap2Pix.Red())/255) > errorLimit ||
|
sl@0
|
2425 |
((TReal)abs(bitmap1Pix.Blue() - bitmap2Pix.Blue())/255) > errorLimit ||
|
sl@0
|
2426 |
((TReal)abs(bitmap1Pix.Green() - bitmap2Pix.Green())/255) > errorLimit ||
|
sl@0
|
2427 |
((TReal)abs(bitmap1Pix.Alpha() - bitmap2Pix.Alpha())/255) > errorLimit)
|
sl@0
|
2428 |
{
|
sl@0
|
2429 |
/*
|
sl@0
|
2430 |
* There was a difference so return without checking the rest of the
|
sl@0
|
2431 |
* bitmap. If you are seeing Lossy compare errors, and want to diagnose
|
sl@0
|
2432 |
* further, consider switching over to using a recording version of this
|
sl@0
|
2433 |
* function, LossyCompareBitmapRecord()
|
sl@0
|
2434 |
*/
|
sl@0
|
2435 |
result = EFalse;
|
sl@0
|
2436 |
break;
|
sl@0
|
2437 |
}
|
sl@0
|
2438 |
}
|
sl@0
|
2439 |
}
|
sl@0
|
2440 |
|
sl@0
|
2441 |
return result;
|
sl@0
|
2442 |
}
|
sl@0
|
2443 |
|
sl@0
|
2444 |
/**
|
sl@0
|
2445 |
* Compare two bitmaps, optionally a lossy comparison, recording any differences and saving bitmaps
|
sl@0
|
2446 |
*
|
sl@0
|
2447 |
* @param aBitmap1 Bitmap being checked
|
sl@0
|
2448 |
* @param aBitmap2 Reference Bitmap
|
sl@0
|
2449 |
* @param aCompareRect Area of bitmap to compare
|
sl@0
|
2450 |
* @param aLossyCompare ETrue means use a lossy compare strategy, else do an exact compare
|
sl@0
|
2451 |
* @param aPixelsDifferent Returned value representing the number of pixels which are different
|
sl@0
|
2452 |
* @param aLogger Facility for logging to be reported by this function
|
sl@0
|
2453 |
* @return ETrue if the bitmaps are the same (or similar).
|
sl@0
|
2454 |
* Otherwise EFalse, with logging reporting the differences, and bitmaps saved in c:\logs\
|
sl@0
|
2455 |
* @pre c:\logs directory must exist
|
sl@0
|
2456 |
*/
|
sl@0
|
2457 |
GLDEF_C TBool LossyCompareBitmapRecord(CFbsBitmap& aBitmap1, CFbsBitmap& aBitmap2, const TRect aCompareRect, TBool aLossyCompare, TInt& aPixelsDifferent, CTestExecuteLogger& aLogger)
|
sl@0
|
2458 |
{
|
sl@0
|
2459 |
const TReal errorLimit = (aLossyCompare ? 0.05 : 0.00); //Lossy or Exact compare?
|
sl@0
|
2460 |
|
sl@0
|
2461 |
TBool result = ETrue;
|
sl@0
|
2462 |
TInt mismatchedPixels = 0;
|
sl@0
|
2463 |
TRgb bitmap1Pix = TRgb(0,0,0,0);
|
sl@0
|
2464 |
TRgb bitmap2Pix = TRgb(0,0,0,0);
|
sl@0
|
2465 |
if (aBitmap1.DisplayMode() != aBitmap2.DisplayMode())
|
sl@0
|
2466 |
{
|
sl@0
|
2467 |
aLogger.LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo,
|
sl@0
|
2468 |
_L(" DisplayMode difference %d, %d"), aBitmap1.DisplayMode(), aBitmap2.DisplayMode());
|
sl@0
|
2469 |
}
|
sl@0
|
2470 |
for (TInt x = 0; x < aCompareRect.Size().iWidth; x++)
|
sl@0
|
2471 |
{
|
sl@0
|
2472 |
for (TInt y = 0; y < aCompareRect.Size().iHeight; y++)
|
sl@0
|
2473 |
{
|
sl@0
|
2474 |
aBitmap1.GetPixel(bitmap1Pix, TPoint(x,y));
|
sl@0
|
2475 |
aBitmap2.GetPixel(bitmap2Pix, TPoint(x,y));
|
sl@0
|
2476 |
|
sl@0
|
2477 |
//Check if there are differences between the colors of the two bitmaps
|
sl@0
|
2478 |
if(((TReal)abs(bitmap1Pix.Red() - bitmap2Pix.Red())/255) > errorLimit ||
|
sl@0
|
2479 |
((TReal)abs(bitmap1Pix.Blue() - bitmap2Pix.Blue())/255) > errorLimit ||
|
sl@0
|
2480 |
((TReal)abs(bitmap1Pix.Green() - bitmap2Pix.Green())/255) > errorLimit ||
|
sl@0
|
2481 |
((TReal)abs(bitmap1Pix.Alpha() - bitmap2Pix.Alpha())/255) > errorLimit)
|
sl@0
|
2482 |
{
|
sl@0
|
2483 |
mismatchedPixels++;
|
sl@0
|
2484 |
|
sl@0
|
2485 |
aLogger.LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo,
|
sl@0
|
2486 |
_L(" Pixel difference %d,%d: %d"),x,y, bitmap1Pix.Difference(bitmap2Pix));
|
sl@0
|
2487 |
result = EFalse;
|
sl@0
|
2488 |
// we loop around again to pick up all the differences
|
sl@0
|
2489 |
}
|
sl@0
|
2490 |
}
|
sl@0
|
2491 |
}
|
sl@0
|
2492 |
aPixelsDifferent = mismatchedPixels;
|
sl@0
|
2493 |
|
sl@0
|
2494 |
/*
|
sl@0
|
2495 |
* When the bitmaps are different, we store them locally in c:\\logs in
|
sl@0
|
2496 |
* timestamped files. Save() is a non-const method; this is why aBitmap1
|
sl@0
|
2497 |
* and aBitmap2 are non-const. Saving can fail, perhaps because we have
|
sl@0
|
2498 |
* exceeded storage limits.
|
sl@0
|
2499 |
*/
|
sl@0
|
2500 |
if (!result)
|
sl@0
|
2501 |
{
|
sl@0
|
2502 |
TTime now;
|
sl@0
|
2503 |
now.UniversalTime();
|
sl@0
|
2504 |
TInt timestamp = I64INT(now.Int64() & 0x7fffffffu);
|
sl@0
|
2505 |
timestamp/=1000; // a millisecond resolution is easier to track
|
sl@0
|
2506 |
TFileName mbmFileSrc;
|
sl@0
|
2507 |
mbmFileSrc.Format (_L("c:\\logs\\%d_LossyCompareBitmap1.mbm"), timestamp);
|
sl@0
|
2508 |
TFileName mbmFileDst;
|
sl@0
|
2509 |
mbmFileDst.Format (_L("c:\\logs\\%d_LossyCompareBitmap2.mbm"), timestamp);
|
sl@0
|
2510 |
TInt saveResult1;
|
sl@0
|
2511 |
TInt saveResult2;
|
sl@0
|
2512 |
saveResult1 = aBitmap1.Save(mbmFileSrc);
|
sl@0
|
2513 |
saveResult2 = aBitmap2.Save(mbmFileDst);
|
sl@0
|
2514 |
if (saveResult1 == KErrNone && saveResult2 == KErrNone)
|
sl@0
|
2515 |
{
|
sl@0
|
2516 |
aLogger.LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo,
|
sl@0
|
2517 |
_L(" Bitmaps are different: see %S, %S"), &mbmFileSrc, &mbmFileDst);
|
sl@0
|
2518 |
}
|
sl@0
|
2519 |
else
|
sl@0
|
2520 |
{
|
sl@0
|
2521 |
aLogger.LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo,
|
sl@0
|
2522 |
_L(" Bitmaps are different, but could not save files into c:\\logs : %d %d"), saveResult1, saveResult2);
|
sl@0
|
2523 |
}
|
sl@0
|
2524 |
}
|
sl@0
|
2525 |
|
sl@0
|
2526 |
return result;
|
sl@0
|
2527 |
}
|
sl@0
|
2528 |
|
sl@0
|
2529 |
// Check if an area of a screen is of a certain color
|
sl@0
|
2530 |
GLDEF_C TBool LossyCheckBlankWindow(const CWsScreenDevice& aScreen, CFbsBitmap& aBitmap, const TRect aArea, const TRgb aCheckColor)
|
sl@0
|
2531 |
{
|
sl@0
|
2532 |
aScreen.CopyScreenToBitmap(&aBitmap, aArea);
|
sl@0
|
2533 |
return LossyCheckBlankBitmap(aBitmap, aArea, aCheckColor);
|
sl@0
|
2534 |
}
|
sl@0
|
2535 |
|
sl@0
|
2536 |
// Compare a section of two windows on the screen
|
sl@0
|
2537 |
GLDEF_C TBool LossyCompareWindow(const CWsScreenDevice& aScreen, CFbsBitmap& aBitmap1, CFbsBitmap& aBitmap2, const TRect aCompareRect)
|
sl@0
|
2538 |
{
|
sl@0
|
2539 |
aScreen.CopyScreenToBitmap(&aBitmap1, aCompareRect);
|
sl@0
|
2540 |
aScreen.CopyScreenToBitmap(&aBitmap2, aCompareRect);
|
sl@0
|
2541 |
return LossyCompareBitmap(aBitmap1, aBitmap2, aCompareRect);
|
sl@0
|
2542 |
}
|
sl@0
|
2543 |
|