164
|
1 |
// Copyright (c) 1996-2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// Test screen mode switching
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@test
|
|
21 |
@internalComponent - Internal Symbian test code
|
|
22 |
*/
|
|
23 |
|
|
24 |
#include "TSCRMODE.H"
|
|
25 |
#include <hal.h>
|
|
26 |
#include <hal_data.h>
|
|
27 |
|
|
28 |
const TInt KBlankWinPosX=10;
|
|
29 |
const TInt KBlankWinPosY=20;
|
|
30 |
const TInt KBlankWinSizeX=30;
|
|
31 |
const TInt KBlankWinSizeY=25;
|
|
32 |
|
|
33 |
const TInt KScreenMode0=0;
|
|
34 |
const TInt KScreenMode1=1;
|
|
35 |
|
|
36 |
|
|
37 |
CTScrMode::CTScrMode(CTestStep* aStep) : CTWsGraphicsBase(aStep)
|
|
38 |
{}
|
|
39 |
|
|
40 |
//
|
|
41 |
// Static func to check windows
|
|
42 |
//
|
|
43 |
|
|
44 |
LOCAL_C TInt DoPanicTest(TInt aInt, TAny* aScreenNumber)
|
|
45 |
{
|
|
46 |
RWsSession ws;
|
|
47 |
CWsScreenDevice* screen=NULL;
|
|
48 |
if (ws.Connect()==KErrNone)
|
|
49 |
{
|
|
50 |
screen = new (ELeave) CWsScreenDevice(ws);
|
|
51 |
if (screen && screen->Construct((TInt)aScreenNumber)==KErrNone)
|
|
52 |
{
|
|
53 |
TPixelsTwipsAndRotation sar;
|
|
54 |
CFbsBitGc::TGraphicsOrientation rot=CFbsBitGc::EGraphicsOrientationNormal;
|
|
55 |
TInt mode=0;
|
|
56 |
switch(aInt)
|
|
57 |
{
|
|
58 |
case 0:
|
|
59 |
case 1:
|
|
60 |
screen->SetScreenMode(aInt==0?1000:-1);
|
|
61 |
break;
|
|
62 |
case 2:
|
|
63 |
case 3:
|
|
64 |
screen->GetScreenModeSizeAndRotation(aInt==2?screen->NumScreenModes():-100000, sar);
|
|
65 |
break;
|
|
66 |
case 4:
|
|
67 |
case 5:
|
|
68 |
screen->GetScreenModeSizeAndRotation(aInt==4?screen->NumScreenModes()+100:-10, sar);
|
|
69 |
break;
|
|
70 |
case 6:
|
|
71 |
mode=screen->NumScreenModes();
|
|
72 |
goto SetRot;
|
|
73 |
case 7:
|
|
74 |
mode=-55;
|
|
75 |
goto SetRot;
|
|
76 |
case 8:
|
|
77 |
mode=234;
|
|
78 |
goto SetRot;
|
|
79 |
case 9:
|
|
80 |
mode=screen->NumScreenModes()+2;
|
|
81 |
rot=CFbsBitGc::EGraphicsOrientationRotated270;
|
|
82 |
SetRot:
|
|
83 |
screen->SetCurrentRotations(mode,rot);
|
|
84 |
break;
|
|
85 |
case 10:
|
|
86 |
case 11:
|
|
87 |
ws.SetPointerCursorArea(aInt==10?1000:-1,TRect());
|
|
88 |
break;
|
|
89 |
case 12:
|
|
90 |
case 13:
|
|
91 |
ws.PointerCursorArea(aInt==12?1003:-2);
|
|
92 |
break;
|
|
93 |
case 14:
|
|
94 |
case 15:
|
|
95 |
{
|
|
96 |
CArrayFixFlat<TInt>* rotations=new(ELeave) CArrayFixFlat<TInt>(1);
|
|
97 |
screen->GetRotationsList(aInt==12?1003:-2,rotations);
|
|
98 |
}
|
|
99 |
break;
|
|
100 |
case 100:
|
|
101 |
rot=CFbsBitGc::EGraphicsOrientationRotated90;
|
|
102 |
goto SetRot;
|
|
103 |
case 101:
|
|
104 |
rot=CFbsBitGc::EGraphicsOrientationRotated270;
|
|
105 |
goto SetRot;
|
|
106 |
case 102:
|
|
107 |
mode=1;
|
|
108 |
rot=CFbsBitGc::EGraphicsOrientationRotated270;
|
|
109 |
goto SetRot;
|
|
110 |
case 103:
|
|
111 |
mode=1;
|
|
112 |
#if defined(__EPOC32__)
|
|
113 |
rot=CFbsBitGc::EGraphicsOrientationRotated180;
|
|
114 |
#else
|
|
115 |
rot=CFbsBitGc::EGraphicsOrientationNormal;
|
|
116 |
#endif
|
|
117 |
goto SetRot;
|
|
118 |
}
|
|
119 |
ws.Flush();
|
|
120 |
}
|
|
121 |
}
|
|
122 |
|
|
123 |
return(EWsExitReasonBad);
|
|
124 |
}
|
|
125 |
|
|
126 |
void SetupTestRWindowLC(RWindow& aWindow, const TPoint& aPos, const TSize& aSize, TDisplayMode aDisplayMode)
|
|
127 |
{
|
|
128 |
CleanupClosePushL(aWindow);
|
|
129 |
User::LeaveIfError(aWindow.Construct(*TheClient->iGroup->GroupWin(), (TUint)&aWindow));
|
|
130 |
aWindow.SetExtent(aPos, aSize);
|
|
131 |
User::LeaveIfError(aWindow.SetRequiredDisplayMode(aDisplayMode));
|
|
132 |
aWindow.SetBackgroundColor(TRgb(255,127,0)); //Orange
|
|
133 |
aWindow.Activate();
|
|
134 |
}
|
|
135 |
|
|
136 |
void CTScrMode::TestPanicsL()
|
|
137 |
{
|
|
138 |
TInt ii;
|
|
139 |
for (ii=0;ii<16;++ii)
|
|
140 |
TEST(iTest->TestWsPanicL(DoPanicTest,EWservPanicScreenModeNumber,ii,(TAny*)iTest->iScreenNumber));
|
|
141 |
for (ii=100;ii<104;++ii)
|
|
142 |
TEST(iTest->TestWsPanicL(DoPanicTest,EWservPanicRotation,ii,(TAny*)iTest->iScreenNumber));
|
|
143 |
iTest->CloseAllPanicWindows();
|
|
144 |
}
|
|
145 |
|
|
146 |
CTScrMode::~CTScrMode()
|
|
147 |
{
|
|
148 |
((CTScrModeStep*)iStep)->CloseTMSGraphicsStep();
|
|
149 |
delete iSecondConnection;
|
|
150 |
TheClient->iGroup->GroupWin()->DisableScreenChangeEvents();
|
|
151 |
SetScreenModeEnforcement(iOldEnfMode);
|
|
152 |
}
|
|
153 |
|
|
154 |
void CTScrMode::ConstructL()
|
|
155 |
{
|
|
156 |
//Remove next line when bitmaps are stored correctly
|
|
157 |
TestWin->Win()->EnableRedrawStore(EFalse);
|
|
158 |
BaseWin->Win()->EnableRedrawStore(EFalse);
|
|
159 |
//
|
|
160 |
TheClient->iGroup->GroupWin()->EnableScreenChangeEvents();
|
|
161 |
//
|
|
162 |
//TheClient->iWs.SetAutoFlush(ETrue);
|
|
163 |
ValidateWin(BaseWin,TRgb::Gray256(204));
|
|
164 |
ValidateWin(TestWin,TRgb::Gray256(204));
|
|
165 |
//
|
|
166 |
iWinState=0;
|
|
167 |
iWinPos=TPoint(2*TheClient->iGroup->Size().iWidth/3,0);
|
|
168 |
//
|
|
169 |
iSecondConnection=new(ELeave) CSecondConnection;
|
|
170 |
iSecondConnection->ConstructL(iTest->iScreenNumber, TRect(KBlankWinPosX,KBlankWinPosY,KBlankWinPosX+KBlankWinSizeX,KBlankWinPosY+KBlankWinSizeY),iTest,iStep);
|
|
171 |
//
|
|
172 |
iOldEnfMode=TheClient->iScreen->ScreenModeEnforcement();
|
|
173 |
if (TheClient->iScreenModes.Count()<2)
|
|
174 |
{
|
|
175 |
iTest->iState=1000; // Miss all tests
|
|
176 |
_LIT(KLog,"Skipping all tests as less that 2 screen size modes");
|
|
177 |
LOG_MESSAGE(KLog);
|
|
178 |
}
|
|
179 |
else
|
|
180 |
{
|
|
181 |
SetScreenModeEnforcement(ESizeEnforcementNone);
|
|
182 |
TheClient->iScreen->SetScreenMode(TheClient->iScreenModes[0]);
|
|
183 |
}
|
|
184 |
}
|
|
185 |
|
|
186 |
void CTScrMode::SetScreenModeEnforcement(TScreenModeEnforcement aMode)
|
|
187 |
{
|
|
188 |
iCurEnforcement=aMode;
|
|
189 |
TheClient->iScreen->SetScreenModeEnforcement(iCurEnforcement);
|
|
190 |
}
|
|
191 |
|
|
192 |
void CTScrMode::ScaledDrawingL()
|
|
193 |
{
|
|
194 |
const TInt KLineXPos=10;
|
|
195 |
const TInt KLineYPos=30;
|
|
196 |
const TInt KLineLength=10;
|
|
197 |
const TInt KXScaleFactor=4;
|
|
198 |
const TInt KYScaleFactor=3;
|
|
199 |
//
|
|
200 |
// Draw rectangle onto TestWin
|
|
201 |
CWindowGc* gc=TheClient->iGc;
|
|
202 |
gc->Activate(*(TestWin->Win()));
|
|
203 |
gc->SetBrushColor(KRgbBlack);
|
|
204 |
gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
205 |
gc->DrawRect(TRect(TPoint(KLineXPos,KLineYPos),TSize(KLineLength*KXScaleFactor,KYScaleFactor)));
|
|
206 |
gc->Deactivate();
|
|
207 |
//
|
|
208 |
// Draw scaled bitmap onto BaseWin
|
|
209 |
TSize bitSize(KLineLength,1);
|
|
210 |
TSize bitTwipSize(TheClient->iScreen->HorizontalPixelsToTwips(bitSize.iWidth*KXScaleFactor),
|
|
211 |
TheClient->iScreen->VerticalPixelsToTwips(bitSize.iHeight*KYScaleFactor));
|
|
212 |
CFbsBitGc* bitGc=NULL;
|
|
213 |
CFbsBitmapDevice* device=NULL;
|
|
214 |
CFbsBitmap* bitmap=NULL;
|
|
215 |
bitmap=new(ELeave) CFbsBitmap();
|
|
216 |
CleanupStack::PushL(bitmap);
|
|
217 |
User::LeaveIfError(bitmap->Create(bitSize,EGray16));
|
|
218 |
bitmap->SetSizeInTwips(bitTwipSize);
|
|
219 |
device=CFbsBitmapDevice::NewL(bitmap);
|
|
220 |
CleanupStack::PushL(device);
|
|
221 |
User::LeaveIfError(device->CreateContext(bitGc));
|
|
222 |
bitGc->SetBrushColor(KRgbBlack);
|
|
223 |
bitGc->Clear();
|
|
224 |
delete bitGc;
|
|
225 |
//
|
|
226 |
gc->Activate(*(BaseWin->Win()));
|
|
227 |
gc->DrawBitmap(TPoint(KLineXPos,KLineYPos),bitmap);
|
|
228 |
gc->Deactivate();
|
|
229 |
//
|
|
230 |
TheClient->iWs.Flush();
|
|
231 |
|
|
232 |
CleanupStack::PopAndDestroy(2); // bitmap,device
|
|
233 |
|
|
234 |
CompareWindows(_L("CTScrMode::ScaledDrawingL() CompareWindows() failed"));
|
|
235 |
}
|
|
236 |
|
|
237 |
void CTScrMode::ValidateWin(TestWindow* aWin, TRgb aColor)
|
|
238 |
{
|
|
239 |
aWin->Win()->Invalidate();
|
|
240 |
RedrawWin(*aWin->Win(),aColor);
|
|
241 |
}
|
|
242 |
|
|
243 |
void CTScrMode::RedrawWin(RWindow &aWin, TRgb aColor)
|
|
244 |
{
|
|
245 |
aWin.BeginRedraw();
|
|
246 |
TheClient->iGc->Activate(aWin);
|
|
247 |
TheClient->iGc->SetBrushColor(aColor);
|
|
248 |
TheClient->iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
249 |
TheClient->iGc->SetPenStyle(CGraphicsContext::ENullPen);
|
|
250 |
TheClient->iGc->Clear();
|
|
251 |
TheClient->iGc->Deactivate();
|
|
252 |
aWin.EndRedraw();
|
|
253 |
}
|
|
254 |
|
|
255 |
void CTScrMode::CheckWindows(TBool aWinIsVis)
|
|
256 |
{
|
|
257 |
iSecondConnection->SetWindow2Visibility(aWinIsVis);
|
|
258 |
TheClient->WaitForRedrawsToFinish();
|
|
259 |
TheClient->iWs.Finish();
|
|
260 |
CompareWindows(_L("CTScrMode::CheckWindows() CompareWindows() failed"));
|
|
261 |
}
|
|
262 |
|
|
263 |
void CTScrMode::ScreenRotationsL()
|
|
264 |
{
|
|
265 |
CWsScreenDevice* screen=TheClient->iScreen;
|
|
266 |
CArrayFixFlat<TInt>* rotations=new(ELeave) CArrayFixFlat<TInt>(1);
|
|
267 |
CFbsBitGc::TGraphicsOrientation currentRotation;
|
|
268 |
TPixelsAndRotation sizeAndRotation;
|
|
269 |
TPixelsTwipsAndRotation sizeAndRotation2;
|
|
270 |
TBool found;
|
|
271 |
TInt numModes=TheClient->iScreenModes.Count();
|
|
272 |
TInt count;
|
|
273 |
TInt ii,jj;
|
|
274 |
CleanupStack::PushL(rotations);
|
|
275 |
for (ii=0;ii<numModes;++ii)
|
|
276 |
{
|
|
277 |
TInt mode=TheClient->iScreenModes[ii];
|
|
278 |
User::LeaveIfError(screen->GetRotationsList(mode,rotations));
|
|
279 |
screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation);
|
|
280 |
screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation2);
|
|
281 |
TEST(sizeAndRotation.iPixelSize.iWidth==sizeAndRotation2.iPixelSize.iWidth);
|
|
282 |
TEST(sizeAndRotation.iPixelSize.iHeight==sizeAndRotation2.iPixelSize.iHeight);
|
|
283 |
if (sizeAndRotation.iPixelSize.iWidth!=sizeAndRotation2.iPixelSize.iWidth
|
|
284 |
|| sizeAndRotation.iPixelSize.iHeight!=sizeAndRotation2.iPixelSize.iHeight)
|
|
285 |
{
|
|
286 |
_LIT(KLog,"Height and/or Width don't match (%d,%d)!=(%d,%d) for mode %d");
|
|
287 |
LOG_MESSAGE6(KLog,sizeAndRotation.iPixelSize.iWidth,sizeAndRotation.iPixelSize.iHeight
|
|
288 |
,sizeAndRotation2.iPixelSize.iWidth,sizeAndRotation2.iPixelSize.iHeight,ii);
|
|
289 |
}
|
|
290 |
count=rotations->Count();
|
|
291 |
TEST(count>=1);
|
|
292 |
if (count<1)
|
|
293 |
{
|
|
294 |
_LIT(KLog,"No rotations supported for mode %d");
|
|
295 |
LOG_MESSAGE2(KLog,ii);
|
|
296 |
}
|
|
297 |
TBool match;
|
|
298 |
if (sizeAndRotation.iPixelSize.iWidth!=sizeAndRotation.iPixelSize.iHeight)
|
|
299 |
{
|
|
300 |
TEST(count<=2);
|
|
301 |
if (count>2)
|
|
302 |
{
|
|
303 |
_LIT(KLog,"Non-square mode %d supports more than 2 rotations (actual rotations=%d)");
|
|
304 |
LOG_MESSAGE3(KLog,ii,count);
|
|
305 |
}
|
|
306 |
if (count==2)
|
|
307 |
{
|
|
308 |
match=((*rotations)[0]+2==(*rotations)[1]);
|
|
309 |
TEST(match); //Must only have rotations 180 degrees apart
|
|
310 |
if (!match)
|
|
311 |
{
|
|
312 |
_LIT(KLog,"In non-square mode %d the two rotations do not differ by 180degrees, rot1=%d, rot2=%d");
|
|
313 |
LOG_MESSAGE4(KLog,ii,(*rotations)[0],(*rotations)[1]);
|
|
314 |
}
|
|
315 |
}
|
|
316 |
}
|
|
317 |
found=EFalse;
|
|
318 |
for (jj=0;jj<count;++jj)
|
|
319 |
{
|
|
320 |
if ((*rotations)[jj]==sizeAndRotation.iRotation)
|
|
321 |
{
|
|
322 |
match=((*rotations)[jj]==sizeAndRotation2.iRotation);
|
|
323 |
TEST(match);
|
|
324 |
if (!match)
|
|
325 |
{
|
|
326 |
_LIT(KLog,"Rotations don't match %d!=%d for mode %d");
|
|
327 |
LOG_MESSAGE4(KLog,sizeAndRotation.iRotation,sizeAndRotation2.iRotation,ii);
|
|
328 |
}
|
|
329 |
found=ETrue;
|
|
330 |
break;
|
|
331 |
}
|
|
332 |
}
|
|
333 |
TEST(found);
|
|
334 |
if (!found)
|
|
335 |
{
|
|
336 |
_LIT(KLog,"In mode %d the current rotation (%d) is not one of the allowable rotations");
|
|
337 |
LOG_MESSAGE3(KLog,ii,sizeAndRotation.iRotation);
|
|
338 |
}
|
|
339 |
|
|
340 |
if (count>1)
|
|
341 |
{
|
|
342 |
currentRotation=sizeAndRotation.iRotation;
|
|
343 |
for (jj=0;jj<count;++jj)
|
|
344 |
{
|
|
345 |
screen->SetCurrentRotations(mode,reinterpret_cast<CFbsBitGc::TGraphicsOrientation&>((*rotations)[jj]));
|
|
346 |
screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation);
|
|
347 |
screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation2);
|
|
348 |
match=(((*rotations)[jj]==sizeAndRotation.iRotation) && ((*rotations)[jj]==sizeAndRotation2.iRotation));
|
|
349 |
TEST(match);
|
|
350 |
if (!match)
|
|
351 |
{
|
|
352 |
_LIT(KLog,"Rotations don't match %d!=%d (both should be %d) after switching to rotation number %d of mode %d");
|
|
353 |
LOG_MESSAGE6(KLog,sizeAndRotation.iRotation,sizeAndRotation2.iRotation,(*rotations)[jj],jj,ii);
|
|
354 |
}
|
|
355 |
}
|
|
356 |
screen->SetCurrentRotations(mode,reinterpret_cast<CFbsBitGc::TGraphicsOrientation&>(currentRotation));
|
|
357 |
screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation);
|
|
358 |
screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation2);
|
|
359 |
match=((currentRotation==sizeAndRotation.iRotation) && (currentRotation==sizeAndRotation2.iRotation));
|
|
360 |
TEST(match);
|
|
361 |
if (!match)
|
|
362 |
{
|
|
363 |
_LIT(KLog,"Rotations don't match %d!=%d (both should be %d) after switching to the original rotation of mode %d");
|
|
364 |
LOG_MESSAGE5(KLog,sizeAndRotation.iRotation,sizeAndRotation2.iRotation,currentRotation,ii);
|
|
365 |
}
|
|
366 |
}
|
|
367 |
}
|
|
368 |
CleanupStack::PopAndDestroy(rotations);
|
|
369 |
}
|
|
370 |
/**
|
|
371 |
Validate that the screen orienation matchs wiht the screeen orientation stored/set by Wserv in the HAL storage attribute.
|
|
372 |
@param aGcOrientation Input orientation to valudate.
|
|
373 |
*/
|
|
374 |
void CTScrMode::CheckHalSetting(TInt aGcOrientation)
|
|
375 |
{
|
|
376 |
HALData::TDigitiserOrientation halOrientationExp = static_cast<HALData::TDigitiserOrientation>
|
|
377 |
(HALData::EDigitiserOrientation_000 + (aGcOrientation - CFbsBitGc::EGraphicsOrientationNormal));
|
|
378 |
TInt halOrientation;
|
|
379 |
TInt err = HAL::Get(iTest->iScreenNumber, HALData::EDigitiserOrientation, halOrientation);
|
|
380 |
// Validate if it's supported by HAL
|
|
381 |
if (err != KErrNotSupported)
|
|
382 |
{
|
|
383 |
if (err != KErrNone)
|
|
384 |
{
|
|
385 |
_LIT(KLog,"Getting HAL orientation attribute returned error %d when no error expected");
|
|
386 |
LOG_MESSAGE2(KLog,err);
|
|
387 |
}
|
|
388 |
TEST(err==KErrNone);
|
|
389 |
if (halOrientationExp != halOrientation)
|
|
390 |
{
|
|
391 |
_LIT(KLog,"HAL orientation is %d when expected to be %d");
|
|
392 |
LOG_MESSAGE3(KLog,halOrientation,halOrientationExp);
|
|
393 |
}
|
|
394 |
TEST(halOrientationExp==halOrientation);
|
|
395 |
}
|
|
396 |
else
|
|
397 |
{
|
|
398 |
_LIT(KLog,"HAL-Orientation HALData::EDigitiserOrientation isn't supported by Driver");
|
|
399 |
LOG_MESSAGE(KLog);
|
|
400 |
}
|
|
401 |
}
|
|
402 |
|
|
403 |
void CTScrMode::MoreScreenRotationsL()
|
|
404 |
{
|
|
405 |
RWindow shield64Color(TheClient->iWs);
|
|
406 |
SetupTestRWindowLC(shield64Color,TPoint(),TSize(100000,100000),EColor64K);
|
|
407 |
CWsScreenDevice* screen=TheClient->iScreen;
|
|
408 |
TPixelsAndRotation sizeAndRotation;
|
|
409 |
TInt currentRotation;
|
|
410 |
TInt currentMode=FindCurrentMode();
|
|
411 |
TInt numModes=TheClient->iScreenModes.Count();
|
|
412 |
TInt currentScreenMode;
|
|
413 |
TInt count;
|
|
414 |
TInt ii;
|
|
415 |
TInt jj;
|
|
416 |
CArrayFixFlat<TInt>* currentRotations=new(ELeave) CArrayFixFlat<TInt>(1);
|
|
417 |
CleanupStack::PushL(currentRotations);
|
|
418 |
currentRotations->ResizeL(numModes);
|
|
419 |
CArrayFixFlat<TInt>* originalRotation=new(ELeave) CArrayFixFlat<TInt>(1);
|
|
420 |
CleanupStack::PushL(originalRotation);
|
|
421 |
originalRotation->ResizeL(numModes);
|
|
422 |
CArrayFixFlat<TInt>* rotations=new(ELeave) CArrayFixFlat<TInt>(1);
|
|
423 |
CleanupStack::PushL(rotations);
|
|
424 |
for (ii=0;ii<numModes;++ii)
|
|
425 |
{
|
|
426 |
TInt mode=TheClient->iScreenModes[ii];
|
|
427 |
screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation);
|
|
428 |
(*currentRotations)[ii]=sizeAndRotation.iRotation;
|
|
429 |
(*originalRotation)[ii]=sizeAndRotation.iRotation;
|
|
430 |
}
|
|
431 |
_LIT(KModeSwitchFail,"Change to screen mode %d, resulted in screen being in mode %d");
|
|
432 |
_LIT(KRotDiff,"Rotations dont match %d!=%d for mode %d");
|
|
433 |
for (ii=0;ii<numModes;++ii)
|
|
434 |
{
|
|
435 |
TInt mode=TheClient->iScreenModes[ii];
|
|
436 |
screen->SetScreenMode(mode);
|
|
437 |
currentScreenMode=screen->CurrentScreenMode();
|
|
438 |
TEST(currentScreenMode==mode);
|
|
439 |
if (currentScreenMode!=mode)
|
|
440 |
LOG_MESSAGE3(KModeSwitchFail,mode,currentScreenMode);
|
|
441 |
|
|
442 |
screen->GetDefaultScreenSizeAndRotation(sizeAndRotation);
|
|
443 |
currentRotation=sizeAndRotation.iRotation;
|
|
444 |
TEST((*currentRotations)[ii]==currentRotation);
|
|
445 |
if ((*currentRotations)[ii]!=currentRotation)
|
|
446 |
LOG_MESSAGE4(KRotDiff,(*currentRotations)[ii],currentRotation,ii);
|
|
447 |
screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation);
|
|
448 |
TEST(sizeAndRotation.iRotation==currentRotation);
|
|
449 |
if (sizeAndRotation.iRotation!=currentRotation)
|
|
450 |
LOG_MESSAGE4(KRotDiff,sizeAndRotation.iRotation,currentRotation,ii);
|
|
451 |
CheckHalSetting(currentRotation);
|
|
452 |
|
|
453 |
User::LeaveIfError(screen->GetRotationsList(mode,rotations));
|
|
454 |
count=rotations->Count();
|
|
455 |
if (count>1)
|
|
456 |
{
|
|
457 |
for (jj=0;jj<count;)
|
|
458 |
{
|
|
459 |
if ((*rotations)[jj++]==currentRotation)
|
|
460 |
break;
|
|
461 |
}
|
|
462 |
if (jj==count)
|
|
463 |
jj=0;
|
|
464 |
currentRotation=(*rotations)[jj];
|
|
465 |
screen->SetCurrentRotations(mode,reinterpret_cast<CFbsBitGc::TGraphicsOrientation&>(currentRotation));
|
|
466 |
(*currentRotations)[ii]=currentRotation;
|
|
467 |
}
|
|
468 |
}
|
|
469 |
for (ii=0;ii<numModes;++ii)
|
|
470 |
{
|
|
471 |
TInt mode=TheClient->iScreenModes[ii];
|
|
472 |
screen->SetScreenMode(mode);
|
|
473 |
currentScreenMode=screen->CurrentScreenMode();
|
|
474 |
TEST(currentScreenMode==mode);
|
|
475 |
if (currentScreenMode!=mode)
|
|
476 |
LOG_MESSAGE3(KModeSwitchFail,mode,currentScreenMode);
|
|
477 |
|
|
478 |
_LIT(KRotDiff,"Switching to mode %d with rotations %d caused the rotation to become %d");
|
|
479 |
screen->GetDefaultScreenSizeAndRotation(sizeAndRotation);
|
|
480 |
currentRotation=(*currentRotations)[ii];
|
|
481 |
TEST(sizeAndRotation.iRotation==currentRotation);
|
|
482 |
if (sizeAndRotation.iRotation!=currentRotation)
|
|
483 |
{
|
|
484 |
_LIT(KRotDiff,"Switching to mode %d with rotations %d caused the rotation to become %d");
|
|
485 |
LOG_MESSAGE4(KRotDiff,mode,currentRotation,sizeAndRotation.iRotation);
|
|
486 |
}
|
|
487 |
screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation);
|
|
488 |
TEST(sizeAndRotation.iRotation==currentRotation);
|
|
489 |
if (sizeAndRotation.iRotation!=currentRotation)
|
|
490 |
LOG_MESSAGE4(KRotDiff,sizeAndRotation.iRotation,currentRotation,ii);
|
|
491 |
CheckHalSetting(currentRotation);
|
|
492 |
|
|
493 |
if (currentRotation!=(*originalRotation)[ii])
|
|
494 |
{
|
|
495 |
screen->SetCurrentRotations(mode,reinterpret_cast<CFbsBitGc::TGraphicsOrientation&>((*originalRotation)[ii]));
|
|
496 |
CheckHalSetting(currentRotation);
|
|
497 |
}
|
|
498 |
}
|
|
499 |
screen->SetScreenMode(currentMode);
|
|
500 |
currentScreenMode=screen->CurrentScreenMode();
|
|
501 |
TEST(currentScreenMode==currentMode);
|
|
502 |
if (currentScreenMode!=currentMode)
|
|
503 |
LOG_MESSAGE3(KModeSwitchFail,currentMode,currentScreenMode);
|
|
504 |
|
|
505 |
CleanupStack::PopAndDestroy(4,&shield64Color);
|
|
506 |
}
|
|
507 |
|
|
508 |
TInt CTScrMode::FindCurrentMode()
|
|
509 |
{
|
|
510 |
CWsScreenDevice* screen=TheClient->iScreen;
|
|
511 |
TPixelsTwipsAndRotation sizeAndRotation;
|
|
512 |
TPixelsTwipsAndRotation sizeAndRotation2;
|
|
513 |
TInt numModes=TheClient->iScreenModes.Count();
|
|
514 |
TInt ii;
|
|
515 |
screen->GetDefaultScreenSizeAndRotation(sizeAndRotation);
|
|
516 |
for (ii=0;ii<numModes;++ii)
|
|
517 |
{
|
|
518 |
TInt mode=TheClient->iScreenModes[ii];
|
|
519 |
screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation2);
|
|
520 |
if (Equal(sizeAndRotation,sizeAndRotation2))
|
|
521 |
return mode;
|
|
522 |
}
|
|
523 |
TEST(EFalse);
|
|
524 |
return -1;
|
|
525 |
}
|
|
526 |
|
|
527 |
TBool CTScrMode::Equal(const TPixelsTwipsAndRotation& aLeft,const TPixelsTwipsAndRotation& aRight)
|
|
528 |
{
|
|
529 |
if (aLeft.iPixelSize!=aRight.iPixelSize)
|
|
530 |
return EFalse;
|
|
531 |
if (aLeft.iRotation!=aRight.iRotation)
|
|
532 |
return EFalse;
|
|
533 |
if (aLeft.iTwipsSize!=aRight.iTwipsSize)
|
|
534 |
return EFalse;
|
|
535 |
return ETrue;
|
|
536 |
}
|
|
537 |
|
|
538 |
TBool CTScrMode::RectClearBugL()
|
|
539 |
{
|
|
540 |
CWsScreenDevice* screen=TheClient->iScreen;
|
|
541 |
TPixelsTwipsAndRotation sizeAndRotation1;
|
|
542 |
TPixelsTwipsAndRotation sizeAndRotation2;
|
|
543 |
TInt screenMode=FindCurrentMode();
|
|
544 |
TInt largeMode=0;
|
|
545 |
TInt smallMode=1;
|
|
546 |
INFO_PRINTF1(_L("Rotation 1"));
|
|
547 |
screen->GetScreenModeSizeAndRotation(0,sizeAndRotation1);
|
|
548 |
INFO_PRINTF1(_L("Rotation 2"));
|
|
549 |
screen->GetScreenModeSizeAndRotation(1,sizeAndRotation2);
|
|
550 |
TSize winSize=TSize(Max(sizeAndRotation1.iPixelSize.iWidth,sizeAndRotation2.iPixelSize.iWidth)
|
|
551 |
,Max(sizeAndRotation1.iPixelSize.iHeight,sizeAndRotation2.iPixelSize.iHeight));
|
|
552 |
if (sizeAndRotation1.iPixelSize.iWidth<=sizeAndRotation2.iPixelSize.iWidth
|
|
553 |
&& sizeAndRotation1.iPixelSize.iHeight<=sizeAndRotation2.iPixelSize.iHeight)
|
|
554 |
{
|
|
555 |
largeMode=1;
|
|
556 |
smallMode=0;
|
|
557 |
}
|
|
558 |
if (screenMode!=largeMode)
|
|
559 |
{
|
|
560 |
INFO_PRINTF2(_L("Large Mode %d\r\n"),largeMode);
|
|
561 |
screen->SetScreenMode(largeMode);
|
|
562 |
}
|
|
563 |
CBlankWindow* blankWin=new(ELeave) CBlankWindow(TRgb::Gray256(204));
|
|
564 |
CleanupStack::PushL(blankWin);
|
|
565 |
blankWin->SetUpL(TPoint(),winSize,TheClient->iGroup,*TheClient->iGc);
|
|
566 |
TheClient->iGc->Activate(*blankWin->Win()); //blankWin->Win()->Invalidate();
|
|
567 |
blankWin->Draw();
|
|
568 |
TheClient->iWs.Flush();
|
|
569 |
blankWin->Win()->SetRequiredDisplayMode(EGray4);
|
|
570 |
INFO_PRINTF2(_L("Small Mode %d\r\n"),smallMode);
|
|
571 |
screen->SetScreenMode(smallMode);
|
|
572 |
TheClient->iWs.Flush();
|
|
573 |
TheClient->iGc->Deactivate();
|
|
574 |
CleanupStack::PopAndDestroy();
|
|
575 |
if (screenMode!=smallMode)
|
|
576 |
{
|
|
577 |
INFO_PRINTF2(_L("Screen Mode %d\r\n"),screenMode);
|
|
578 |
screen->SetScreenMode(screenMode);
|
|
579 |
}
|
|
580 |
|
|
581 |
return ETrue;
|
|
582 |
}
|
|
583 |
|
|
584 |
void CTScrMode::ScreenModeChange1L()
|
|
585 |
{
|
|
586 |
CTWin* color64win;
|
|
587 |
color64win=new(ELeave) CTWin();
|
|
588 |
CleanupStack::PushL(color64win);
|
|
589 |
color64win->ConstructL(*TheClient->iGroup);
|
|
590 |
color64win->BaseWin()->SetRequiredDisplayMode(EColor64K);
|
|
591 |
//color64win->SetBackgroundColor(TRgb(0,0,255));
|
|
592 |
color64win->Win()->SetBackgroundColor();
|
|
593 |
color64win->Activate();
|
|
594 |
TheClient->Flush();
|
|
595 |
CTWin* color4win;
|
|
596 |
color4win=new(ELeave) CTWin();
|
|
597 |
CleanupStack::PushL(color4win);
|
|
598 |
color4win->ConstructL(*TheClient->iGroup);
|
|
599 |
color4win->BaseWin()->SetRequiredDisplayMode(EColor4K);
|
|
600 |
//color4win->SetBackgroundColor(TRgb(255,0,0));
|
|
601 |
color4win->Win()->SetBackgroundColor();
|
|
602 |
color4win->SetSize(TSize(600,200));
|
|
603 |
color4win->Activate();
|
|
604 |
TheClient->Flush();
|
|
605 |
color4win->SetSize(TSize(640,240));
|
|
606 |
TheClient->Flush();
|
|
607 |
color64win->SetSize(TSize(20,20));
|
|
608 |
color64win->WinTreeNode()->SetOrdinalPosition(0);
|
|
609 |
TheClient->Flush();
|
|
610 |
CleanupStack::Pop(2,color64win);
|
|
611 |
delete color64win;
|
|
612 |
TheClient->Flush();
|
|
613 |
delete color4win;
|
|
614 |
//CleanupStack::PopAndDestroy(2,color64win);
|
|
615 |
}
|
|
616 |
|
|
617 |
void CTScrMode::ScreenModeChange2L()
|
|
618 |
{
|
|
619 |
CTBlankWindow* color64win;
|
|
620 |
color64win=new(ELeave) CTBlankWindow();
|
|
621 |
CleanupStack::PushL(color64win);
|
|
622 |
color64win->ConstructL(*TheClient->iGroup);
|
|
623 |
color64win->BaseWin()->SetRequiredDisplayMode(EColor64K);
|
|
624 |
color64win->SetColor(TRgb(0,0,255));
|
|
625 |
//color64win->SetColor();
|
|
626 |
color64win->Activate();
|
|
627 |
TheClient->Flush();
|
|
628 |
CTBlankWindow* color4win;
|
|
629 |
color4win=new(ELeave) CTBlankWindow();
|
|
630 |
CleanupStack::PushL(color4win);
|
|
631 |
color4win->ConstructL(*TheClient->iGroup);
|
|
632 |
color4win->BaseWin()->SetRequiredDisplayMode(EColor4K);
|
|
633 |
color4win->SetColor(TRgb(255,0,0));
|
|
634 |
//color4win->SetColor();
|
|
635 |
color4win->SetSize(TSize(600,200));
|
|
636 |
color4win->Activate();
|
|
637 |
TheClient->Flush();
|
|
638 |
color4win->SetSize(TSize(640,240));
|
|
639 |
TheClient->Flush();
|
|
640 |
color64win->SetSize(TSize(20,20));
|
|
641 |
color64win->WinTreeNode()->SetOrdinalPosition(0);
|
|
642 |
TheClient->Flush();
|
|
643 |
CleanupStack::Pop(2,color64win);
|
|
644 |
delete color64win;
|
|
645 |
TheClient->Flush();
|
|
646 |
delete color4win;
|
|
647 |
//CleanupStack::PopAndDestroy(2,color64win);
|
|
648 |
}
|
|
649 |
|
|
650 |
LOCAL_C void ResetAndDestroyWindows(TAny* aPointerArray)
|
|
651 |
{
|
|
652 |
static_cast<RPointerArray<CBlankWindow>*>(aPointerArray)->ResetAndDestroy();
|
|
653 |
}
|
|
654 |
|
|
655 |
LOCAL_C TBool WalkThroughTree(RPointerArray<CBlankWindow> aListOfWindows)
|
|
656 |
{
|
|
657 |
TBool ret=ETrue;
|
|
658 |
TInt count = aListOfWindows.Count();
|
|
659 |
while (--count>=0 && ret)
|
|
660 |
{
|
|
661 |
RRegion region;
|
|
662 |
((aListOfWindows)[count])->Win()->GetInvalidRegion(region);
|
|
663 |
ret=region.IsEmpty();
|
|
664 |
}
|
|
665 |
return ret;
|
|
666 |
}
|
|
667 |
|
|
668 |
void CTScrMode::InvisibleWndAndInfiniteRedrawBugL()
|
|
669 |
{
|
|
670 |
// Current Test client state
|
|
671 |
CTClient* clientA=TheClient;
|
|
672 |
CWsScreenDevice* screenClientA=clientA->iScreen;
|
|
673 |
const TScreenModeEnforcement screenModeEnforcement = screenClientA->ScreenModeEnforcement();
|
|
674 |
const TInt currentScreenMode=FindCurrentMode();
|
|
675 |
TPixelsTwipsAndRotation sizeAndRotation;
|
|
676 |
screenClientA->GetScreenModeSizeAndRotation(currentScreenMode,sizeAndRotation);
|
|
677 |
|
|
678 |
|
|
679 |
SecondClientConnection* clientB = new(ELeave) SecondClientConnection();
|
|
680 |
CleanupStack::PushL(clientB);
|
|
681 |
clientB->SetScreenNumber(iTest->iScreenNumber);
|
|
682 |
clientB->ConstructL(currentScreenMode, sizeAndRotation);
|
|
683 |
|
|
684 |
// Start test
|
|
685 |
CWindowGc& gc=*clientB->iGc;
|
|
686 |
RWsSession ws=clientB->iWs;
|
|
687 |
CTWindowGroup* group=clientB->iGroup;
|
|
688 |
|
|
689 |
const TInt shrinkFactor = 5;
|
|
690 |
TRect parentRect(0,0, sizeAndRotation.iPixelSize.iWidth, sizeAndRotation.iPixelSize.iHeight);
|
|
691 |
RPointerArray<CBlankWindow> windows;
|
|
692 |
CleanupStack::PushL(TCleanupItem(ResetAndDestroyWindows, &windows));
|
|
693 |
// create several children
|
|
694 |
const TInt count = (iTest->iTestLevel==iTest->ELevelQuick ? 5 : 7);
|
|
695 |
CBlankWindow* blankWin=NULL;
|
|
696 |
CTWinBase* parent=group;
|
|
697 |
for (TInt childNum=0; childNum<count; ++childNum)
|
|
698 |
{
|
|
699 |
blankWin=new(ELeave) CBlankWindow();
|
|
700 |
CleanupStack::PushL(blankWin);
|
|
701 |
User::LeaveIfError(windows.Append(blankWin));
|
|
702 |
CleanupStack::Pop(blankWin);
|
|
703 |
blankWin->SetUpL(parentRect.iTl, parentRect.Size(), parent, gc);
|
|
704 |
// make it visible and draw it
|
|
705 |
blankWin->Win()->Invalidate();
|
|
706 |
gc.Activate(*blankWin->Win());
|
|
707 |
blankWin->Draw();
|
|
708 |
ws.Flush();
|
|
709 |
gc.Deactivate();
|
|
710 |
// prepare for next window
|
|
711 |
parent=blankWin;
|
|
712 |
parentRect.Shrink(shrinkFactor, shrinkFactor);
|
|
713 |
}
|
|
714 |
|
|
715 |
// change screen mode and check visibility of all windows
|
|
716 |
|
|
717 |
const TInt newScreenMode = (currentScreenMode==KScreenMode0?KScreenMode1:KScreenMode0);
|
|
718 |
TPixelsTwipsAndRotation sizeAndRotationForDifferentScreenMode;
|
|
719 |
screenClientA->GetScreenModeSizeAndRotation(newScreenMode, sizeAndRotationForDifferentScreenMode);
|
|
720 |
screenClientA->SetScreenSizeAndRotation(sizeAndRotationForDifferentScreenMode);
|
|
721 |
screenClientA->SetScreenMode(newScreenMode);
|
|
722 |
|
|
723 |
TheClient->WaitForRedrawsToFinish();
|
|
724 |
TBool retVal = WalkThroughTree(windows);
|
|
725 |
TEST(retVal);
|
|
726 |
if (!retVal)
|
|
727 |
INFO_PRINTF3(_L("WalkThroughTree(windows) return value - Expected: %d, Actual: %d"), ETrue, retVal);
|
|
728 |
|
|
729 |
|
|
730 |
screenClientA->SetScreenModeEnforcement(screenModeEnforcement);
|
|
731 |
screenClientA->SetScreenMode(currentScreenMode);
|
|
732 |
screenClientA->SetScreenSizeAndRotation(sizeAndRotation);
|
|
733 |
|
|
734 |
// destroy all windows
|
|
735 |
CleanupStack::PopAndDestroy(2, clientB); // ResetAndDestroyWindows and client
|
|
736 |
// Needed to get system back into a good state as this test can leave the shell in front of the test app
|
|
737 |
TheClient->iGroup->GroupWin()->SetOrdinalPosition(0);
|
|
738 |
}
|
|
739 |
|
|
740 |
//To test the APIs GetScreenModeDisplayMode() & GetDefModeMaxNumColors()
|
|
741 |
void CTScrMode::GetScreenDisplayMode()
|
|
742 |
{
|
|
743 |
TInt color,gray;
|
|
744 |
CWsScreenDevice* screen=TheClient->iScreen;
|
|
745 |
TInt currentScreenMode=screen->CurrentScreenMode(); //finding the current screen mode
|
|
746 |
screen->SetScreenMode(KScreenMode1); //changing the current screen mode to 1
|
|
747 |
|
|
748 |
//testing the display mode of Screen Mode using the API GetScreenModeDisplayMode()
|
|
749 |
TDisplayMode displayMode=screen->GetScreenModeDisplayMode(KScreenMode1);
|
|
750 |
|
|
751 |
TEST(displayMode!=ENone);
|
|
752 |
TEST(displayMode!=ERgb);
|
|
753 |
//testing the default mode of Screen Mode using the API GetDefModeMaxNumColors()
|
|
754 |
TDisplayMode defaultMode=TheClient->iWs.GetDefModeMaxNumColors(color,gray);
|
|
755 |
TDisplayMode defaultModeForScreen=TheClient->iWs.GetDefModeMaxNumColors(screen->GetScreenNumber(),color,gray);
|
|
756 |
TEST(defaultMode==defaultModeForScreen);
|
|
757 |
TEST(defaultMode!=ENone);
|
|
758 |
TEST(defaultMode!=ERgb);
|
|
759 |
TEST(color == 16777216 || color == 0 || color == 16 || color == 256 || color == 4096 || color == 65536);
|
|
760 |
TEST(gray == 0 || gray == 2 || gray == 4 || gray == 16 || gray == 256);
|
|
761 |
screen->SetScreenMode(currentScreenMode);
|
|
762 |
|
|
763 |
CArrayFixFlat<TInt>* modeList=new CArrayFixFlat<TInt>(15);
|
|
764 |
TEST(modeList != NULL);
|
|
765 |
if(!modeList)
|
|
766 |
{
|
|
767 |
return;
|
|
768 |
}
|
|
769 |
TInt res = TheClient->iWs.GetColorModeList(modeList);
|
|
770 |
TEST(res == KErrNone);
|
|
771 |
TDisplayMode modeMax = ENone;
|
|
772 |
for(TInt index = 0; index < modeList->Count(); index++)
|
|
773 |
{
|
|
774 |
TDisplayMode mode = (TDisplayMode) ((*modeList)[index]);
|
|
775 |
if(mode > modeMax)
|
|
776 |
{
|
|
777 |
modeMax = mode;
|
|
778 |
}
|
|
779 |
}
|
|
780 |
modeList->Reset();
|
|
781 |
delete modeList;
|
|
782 |
TInt realColor = 0;
|
|
783 |
TInt realGray = 0;
|
|
784 |
switch(modeMax)
|
|
785 |
{
|
|
786 |
case EGray2:
|
|
787 |
realColor = 2;
|
|
788 |
realGray = 2;
|
|
789 |
break;
|
|
790 |
case EGray4:
|
|
791 |
realColor = 4;
|
|
792 |
realGray = 4;
|
|
793 |
break;
|
|
794 |
case EGray16:
|
|
795 |
realColor = 16;
|
|
796 |
realGray = 16;
|
|
797 |
break;
|
|
798 |
case EGray256:
|
|
799 |
realColor = 256;
|
|
800 |
realGray = 256;
|
|
801 |
break;
|
|
802 |
case EColor16:
|
|
803 |
realColor = 16;
|
|
804 |
break;
|
|
805 |
case EColor256:
|
|
806 |
realColor = 256;
|
|
807 |
break;
|
|
808 |
case EColor4K:
|
|
809 |
realColor = 4096;
|
|
810 |
break;
|
|
811 |
case EColor64K:
|
|
812 |
realColor = 65536;
|
|
813 |
break;
|
|
814 |
case EColor16M:
|
|
815 |
case EColor16MU:
|
|
816 |
case EColor16MA:
|
|
817 |
case EColor16MAP:
|
|
818 |
realColor = 16777216;
|
|
819 |
break;
|
|
820 |
default:
|
|
821 |
break;
|
|
822 |
}
|
|
823 |
|
|
824 |
if (realColor > 0)
|
|
825 |
TEST(realColor == color);
|
|
826 |
if (realGray > 0)
|
|
827 |
TEST(gray == realGray);
|
|
828 |
}
|
|
829 |
|
|
830 |
void CTScrMode::SetScreenModeAfterScreenDeviceDeletedL()
|
|
831 |
{
|
|
832 |
// A separate session is needed, because this test will delete the primary screen device
|
|
833 |
RWsSession ws;
|
|
834 |
User::LeaveIfError(ws.Connect());
|
|
835 |
|
|
836 |
// Push the secondary screen device first onto the cleanup stack
|
|
837 |
// so that we can pop and destroy the primary screen device first
|
|
838 |
CWsScreenDevice* secondaryScreenDevice = new (ELeave) CWsScreenDevice(ws);
|
|
839 |
CleanupStack::PushL(secondaryScreenDevice);
|
|
840 |
|
|
841 |
CWsScreenDevice* primaryScreenDevice = new (ELeave) CWsScreenDevice(ws);
|
|
842 |
CleanupStack::PushL(primaryScreenDevice);
|
|
843 |
|
|
844 |
// Construct the primary screen device first to ensure that it is
|
|
845 |
// used by the group window
|
|
846 |
User::LeaveIfError(primaryScreenDevice->Construct(iTest->iScreenNumber));
|
|
847 |
User::LeaveIfError(secondaryScreenDevice->Construct(iTest->iScreenNumber));
|
|
848 |
|
|
849 |
RWindowGroup group(ws);
|
|
850 |
User::LeaveIfError(group.Construct(888));
|
|
851 |
group.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close
|
|
852 |
|
|
853 |
RArray<TInt> screenModes;
|
|
854 |
primaryScreenDevice->GetScreenSizeModeList(&screenModes);
|
|
855 |
primaryScreenDevice->SetScreenMode(screenModes[0]);
|
|
856 |
|
|
857 |
// Prematurely destroy the primary screen device used by the group window
|
|
858 |
CleanupStack::PopAndDestroy(primaryScreenDevice);
|
|
859 |
|
|
860 |
// Simulate screen rotation - call SetScreenMode()
|
|
861 |
// This would trigger the defective behaviour and wserv would panic if broken
|
|
862 |
secondaryScreenDevice->SetScreenMode(screenModes[0]);
|
|
863 |
|
|
864 |
// Tidy up
|
|
865 |
screenModes.Close();
|
|
866 |
group.Close();
|
|
867 |
CleanupStack::PopAndDestroy(secondaryScreenDevice);
|
|
868 |
ws.Flush();
|
|
869 |
ws.Close();
|
|
870 |
}
|
|
871 |
|
|
872 |
void CTScrMode::DrawTestBmpL(CFbsBitmap* aTestBitmap)
|
|
873 |
{
|
|
874 |
CFbsBitmapDevice* device=CFbsBitmapDevice::NewL(aTestBitmap);
|
|
875 |
CleanupStack::PushL(device);
|
|
876 |
CGraphicsContext* bmpgc;
|
|
877 |
User::LeaveIfError(device->CreateContext(bmpgc));
|
|
878 |
CleanupStack::PushL(bmpgc);
|
|
879 |
bmpgc->SetPenColor(KRgbDarkRed);
|
|
880 |
bmpgc->SetBrushColor(KRgbYellow);
|
|
881 |
bmpgc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
882 |
bmpgc->SetPenStyle(CGraphicsContext::ESolidPen);
|
|
883 |
bmpgc->DrawRect(TRect(aTestBitmap->SizeInPixels()));
|
|
884 |
CleanupStack::PopAndDestroy(2,device);
|
|
885 |
}
|
|
886 |
|
|
887 |
void CTScrMode::TestDrawingToWindows(CWindowGc* aWinGc1, CWindowGc* aWinGc2, RWindow& aWindow1,RWindow& aWindow2,CFbsBitmap* aBitmap64K,CFbsBitmap* aBitmap16M,CFbsFont* aFont, TBool aAllInRedraw, TBool aUseSystemGc, TBool aUseBmp16M)
|
|
888 |
{
|
|
889 |
CFbsBitmap* bitmap=aUseBmp16M?aBitmap16M:aBitmap64K;
|
|
890 |
TInt ascent=aFont->AscentInPixels();
|
|
891 |
for(TInt win=0;win<2;win++)
|
|
892 |
{
|
|
893 |
RWindow* winPtr=(win==0)?&aWindow1:&aWindow2;
|
|
894 |
winPtr->Invalidate();
|
|
895 |
winPtr->BeginRedraw();
|
|
896 |
CWindowGc* winGc;
|
|
897 |
if (aUseSystemGc)
|
|
898 |
{
|
|
899 |
winGc=TheClient->iGc;
|
|
900 |
winGc->Activate(*winPtr);
|
|
901 |
}
|
|
902 |
else
|
|
903 |
{
|
|
904 |
winGc=(win==0)?aWinGc1:aWinGc2;
|
|
905 |
winGc->Reset();
|
|
906 |
}
|
|
907 |
winGc->SetBrushColor(KRgbBlue);
|
|
908 |
winGc->Clear();
|
|
909 |
if (!aAllInRedraw)
|
|
910 |
winPtr->EndRedraw();
|
|
911 |
//
|
|
912 |
winGc->BitBlt(TPoint(0,0),bitmap);
|
|
913 |
winGc->UseFont(aFont);
|
|
914 |
_LIT(KTestText123,"Test text 123");
|
|
915 |
winGc->DrawText(KTestText123,TPoint(0,ascent));
|
|
916 |
if (aAllInRedraw)
|
|
917 |
winPtr->EndRedraw();
|
|
918 |
if (aUseSystemGc)
|
|
919 |
winGc->Deactivate();
|
|
920 |
}
|
|
921 |
TBool winCheck=DoCheckRectRWin(aWindow1,aWindow2,TRect(aWindow1.Size()));
|
|
922 |
if (!winCheck)
|
|
923 |
{
|
|
924 |
TBuf<256> errBuf(_L("Rot-mode test failed"));
|
|
925 |
if (aAllInRedraw)
|
|
926 |
errBuf.Append(_L(", All in Redraw"));
|
|
927 |
if (aUseSystemGc)
|
|
928 |
errBuf.Append(_L(", System Gc"));
|
|
929 |
if (aUseBmp16M)
|
|
930 |
errBuf.Append(_L(", 16M bmp"));
|
|
931 |
else
|
|
932 |
errBuf.Append(_L(", 64K bmp"));
|
|
933 |
INFO_PRINTF1(errBuf);
|
|
934 |
}
|
|
935 |
TEST(winCheck);
|
|
936 |
}
|
|
937 |
|
|
938 |
void SetWsAndAppScreenModes(TInt aMode)
|
|
939 |
{
|
|
940 |
TheClient->iScreen->SetScreenMode(aMode);
|
|
941 |
TheClient->iScreen->SetAppScreenMode(aMode);
|
|
942 |
}
|
|
943 |
|
|
944 |
TDisplayMode HighestMatch(CArrayFixFlat<TInt>* aModeList,TInt &aMaxBpp)
|
|
945 |
{
|
|
946 |
TDisplayMode highMode=ENone;
|
|
947 |
TInt highBpp=0;
|
|
948 |
for(TInt loop=aModeList->Count()-1;loop>=0;loop--)
|
|
949 |
{
|
|
950 |
TDisplayMode mode=(TDisplayMode)(*aModeList)[loop];
|
|
951 |
TInt bpp;
|
|
952 |
switch(mode)
|
|
953 |
{
|
|
954 |
case EGray2:
|
|
955 |
bpp=1;
|
|
956 |
break;
|
|
957 |
case EGray4:
|
|
958 |
bpp=2;
|
|
959 |
break;
|
|
960 |
case EGray16:
|
|
961 |
case EColor16:
|
|
962 |
bpp=4;
|
|
963 |
break;
|
|
964 |
case EColor256:
|
|
965 |
case EGray256:
|
|
966 |
bpp=8;
|
|
967 |
break;
|
|
968 |
case EColor64K:
|
|
969 |
bpp=16;
|
|
970 |
break;
|
|
971 |
case EColor4K:
|
|
972 |
bpp=12;
|
|
973 |
break;
|
|
974 |
case EColor16M:
|
|
975 |
case EColor16MU:
|
|
976 |
case EColor16MA:
|
|
977 |
case EColor16MAP:
|
|
978 |
bpp=32;
|
|
979 |
break;
|
|
980 |
default:
|
|
981 |
bpp=0;
|
|
982 |
break;
|
|
983 |
}
|
|
984 |
if (bpp>highBpp && bpp<aMaxBpp)
|
|
985 |
{
|
|
986 |
highBpp=bpp;
|
|
987 |
highMode=mode;
|
|
988 |
}
|
|
989 |
}
|
|
990 |
aMaxBpp=highBpp;
|
|
991 |
return(highMode);
|
|
992 |
}
|
|
993 |
|
|
994 |
void CTScrMode::TestRotateAndScreenModeL()
|
|
995 |
{
|
|
996 |
TheClient->iGroup->GroupWin()->SetOrdinalPosition(0);
|
|
997 |
// When switching colour modes Wserv takes into account the full device size, not the clipped size
|
|
998 |
// associated with any specific screen mode. Therefore any windows designed to influence the screen
|
|
999 |
// mode must use the appropriately rotated device base screen size, not any cutdown screen mode sizes.
|
|
1000 |
TSize baseScreenSize=TheClient->iScreen->SizeInPixels();
|
|
1001 |
TSize rotatedBaseSize(baseScreenSize.iHeight,baseScreenSize.iWidth);
|
|
1002 |
TInt maxScreenDimension=Max(baseScreenSize.iHeight,baseScreenSize.iWidth);
|
|
1003 |
//
|
|
1004 |
CArrayFixFlat<TInt>* modeList=new(ELeave) CArrayFixFlat<TInt>(15);
|
|
1005 |
CleanupStack::PushL(modeList);
|
|
1006 |
User::LeaveIfError(TheClient->iWs.GetColorModeList(modeList));
|
|
1007 |
TInt maxBpp=KMaxTInt;
|
|
1008 |
TDisplayMode testDispModeHigh=HighestMatch(modeList,maxBpp);
|
|
1009 |
TDisplayMode testDispModeLow=HighestMatch(modeList,maxBpp);
|
|
1010 |
CleanupStack::PopAndDestroy(modeList);
|
|
1011 |
// If only one available display mode skip tests
|
|
1012 |
if (testDispModeLow==ENone)
|
|
1013 |
return;
|
|
1014 |
//
|
|
1015 |
CFbsFont* font;
|
|
1016 |
TFontSpec fspec;
|
|
1017 |
fspec.iHeight=240;
|
|
1018 |
User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips((CFont*&)font,fspec));
|
|
1019 |
// Create a massive 16M window to make sure 16M is the fallback mode when any area of the screen is exposed
|
|
1020 |
RWindow shield16M(TheClient->iWs);
|
|
1021 |
SetupTestRWindowLC(shield16M,TPoint(),TSize(100000,100000),testDispModeHigh);
|
|
1022 |
RedrawWin(shield16M,KRgbBlack);
|
|
1023 |
//
|
|
1024 |
TInt numModes=TheClient->iScreenModes.Count();
|
|
1025 |
for(TInt modeIndex=0;modeIndex<numModes;modeIndex++)
|
|
1026 |
{
|
|
1027 |
TInt screenMode=TheClient->iScreenModes[modeIndex];
|
|
1028 |
TPoint origin=TheClient->iScreen->GetScreenModeScaledOrigin(screenMode);
|
|
1029 |
if (origin.iX!=0 || origin.iY!=0)
|
|
1030 |
continue;
|
|
1031 |
TPixelsTwipsAndRotation sar;
|
|
1032 |
TheClient->iScreen->GetScreenModeSizeAndRotation(screenMode,sar);
|
|
1033 |
TSize screenSize=sar.iPixelSize;
|
|
1034 |
if (screenSize.iWidth>baseScreenSize.iWidth || screenSize.iHeight>baseScreenSize.iHeight)
|
|
1035 |
continue;
|
|
1036 |
TSize rotatedScreenDeviceSize(sar.iRotation==CFbsBitGc::EGraphicsOrientationRotated90 || sar.iRotation==CFbsBitGc::EGraphicsOrientationRotated270?
|
|
1037 |
rotatedBaseSize:baseScreenSize);
|
|
1038 |
//
|
|
1039 |
TheClient->iScreen->SetScreenMode(screenMode);
|
|
1040 |
//
|
|
1041 |
TSize screenSize1 = screenSize;
|
|
1042 |
screenSize1.iWidth = Min(screenSize1.iWidth, rotatedScreenDeviceSize.iWidth); //this is to guarantee we won't compare beyond screen size
|
|
1043 |
TSize testSize(screenSize1.iWidth/2,screenSize1.iHeight);
|
|
1044 |
TSize testBmpSize(testSize.iWidth,testSize.iHeight/4);
|
|
1045 |
//
|
|
1046 |
CFbsBitmap* testBitmap64=new(ELeave) CFbsBitmap;
|
|
1047 |
CleanupStack::PushL(testBitmap64);
|
|
1048 |
User::LeaveIfError(testBitmap64->Create(testBmpSize,testDispModeLow));
|
|
1049 |
DrawTestBmpL(testBitmap64);
|
|
1050 |
//
|
|
1051 |
CFbsBitmap* testBitmap16M=new(ELeave) CFbsBitmap;
|
|
1052 |
CleanupStack::PushL(testBitmap16M);
|
|
1053 |
User::LeaveIfError(testBitmap16M->Create(testBmpSize,testDispModeHigh));
|
|
1054 |
DrawTestBmpL(testBitmap16M);
|
|
1055 |
//
|
|
1056 |
RWindow window(TheClient->iWs);
|
|
1057 |
SetupTestRWindowLC(window,TPoint(0,0), testSize,testDispModeHigh);
|
|
1058 |
RWindow window2(TheClient->iWs);
|
|
1059 |
SetupTestRWindowLC(window2,TPoint(testSize.iWidth,0),testSize,testDispModeHigh);
|
|
1060 |
//
|
|
1061 |
CWindowGc* winGc1=new(ELeave) CWindowGc(TheClient->iScreen);
|
|
1062 |
CleanupStack::PushL(winGc1);
|
|
1063 |
User::LeaveIfError(winGc1->Construct());
|
|
1064 |
winGc1->Activate(window);
|
|
1065 |
CWindowGc* winGc2=new(ELeave) CWindowGc(TheClient->iScreen);
|
|
1066 |
CleanupStack::PushL(winGc2);
|
|
1067 |
User::LeaveIfError(winGc2->Construct());
|
|
1068 |
winGc2->Activate(window2);
|
|
1069 |
//
|
|
1070 |
for(TInt modeIndex2=0;modeIndex2<numModes;modeIndex2++)
|
|
1071 |
{
|
|
1072 |
if (modeIndex==modeIndex2)
|
|
1073 |
continue;
|
|
1074 |
TInt screenMode2=TheClient->iScreenModes[modeIndex2];
|
|
1075 |
TPoint origin2=TheClient->iScreen->GetScreenModeScaledOrigin(screenMode2);
|
|
1076 |
if (origin2.iX!=0 || origin2.iY!=0)
|
|
1077 |
continue;
|
|
1078 |
TDisplayMode baseDisplayMode=TheClient->iScreen->DisplayMode();
|
|
1079 |
INFO_PRINTF5(_L("Testing with screen modes %d/%d, display modes %d/%d"),modeIndex,modeIndex2,testDispModeLow,testDispModeHigh);
|
|
1080 |
SetWsAndAppScreenModes(screenMode2);
|
|
1081 |
TDisplayMode dispMode11 = TheClient->iScreen->DisplayMode();
|
|
1082 |
TPixelsTwipsAndRotation sar1;
|
|
1083 |
TheClient->iScreen->GetScreenModeSizeAndRotation(screenMode2, sar1);
|
|
1084 |
if(sar1.iRotation == sar.iRotation)
|
|
1085 |
{
|
|
1086 |
continue;
|
|
1087 |
}
|
|
1088 |
//
|
|
1089 |
RWindow window64K(TheClient->iWs);
|
|
1090 |
SetupTestRWindowLC(window64K,TPoint(),TSize(maxScreenDimension,maxScreenDimension),testDispModeLow);
|
|
1091 |
RedrawWin(window64K,KRgbGreen);
|
|
1092 |
// Should now have switched Wserv to 64K mode
|
|
1093 |
TEST(TheClient->iScreen->DisplayMode()==testDispModeLow);
|
|
1094 |
//
|
|
1095 |
RWindow window16M(TheClient->iWs);
|
|
1096 |
SetupTestRWindowLC(window16M,TPoint(),TSize(maxScreenDimension/2,maxScreenDimension/2),testDispModeHigh);
|
|
1097 |
RedrawWin(window16M,KRgbCyan);
|
|
1098 |
// Should switch Wserv back to 16M mode
|
|
1099 |
TEST(TheClient->iScreen->DisplayMode()==testDispModeHigh);
|
|
1100 |
//
|
|
1101 |
window64K.SetOrdinalPosition(-1);
|
|
1102 |
window16M.SetOrdinalPosition(-1);
|
|
1103 |
SetWsAndAppScreenModes(screenMode);
|
|
1104 |
TEST(TheClient->iScreen->DisplayMode()==baseDisplayMode);
|
|
1105 |
//
|
|
1106 |
const TInt KNumTestFlags=3;
|
|
1107 |
const TInt KMaxTestFlags=1<<KNumTestFlags;
|
|
1108 |
for(TUint testFlags=0;testFlags<KMaxTestFlags;testFlags++)
|
|
1109 |
{
|
|
1110 |
TestDrawingToWindows(winGc1,winGc2,window,window2,testBitmap64,testBitmap16M,font,testFlags&0x1,testFlags&0x2,testFlags&0x4);
|
|
1111 |
}
|
|
1112 |
// Test various functions change the display mode appropriately
|
|
1113 |
window64K.SetOrdinalPosition(0);
|
|
1114 |
TEST(TheClient->iScreen->DisplayMode()==testDispModeLow);
|
|
1115 |
window64K.SetVisible(EFalse);
|
|
1116 |
TEST(TheClient->iScreen->DisplayMode()==baseDisplayMode);
|
|
1117 |
window64K.SetVisible(ETrue);
|
|
1118 |
TEST(TheClient->iScreen->DisplayMode()==testDispModeLow);
|
|
1119 |
window64K.SetSize(rotatedScreenDeviceSize);
|
|
1120 |
TEST(TheClient->iScreen->DisplayMode()==testDispModeLow);
|
|
1121 |
// Changing screen mode now should expose the 16M window
|
|
1122 |
SetWsAndAppScreenModes(screenMode2);
|
|
1123 |
TEST(TheClient->iScreen->DisplayMode()==testDispModeHigh);
|
|
1124 |
SetWsAndAppScreenModes(screenMode);
|
|
1125 |
// And back to the 64K win covering the screen
|
|
1126 |
TEST(TheClient->iScreen->DisplayMode()==testDispModeLow);
|
|
1127 |
// Create a new group with a 16M window and switching ordinal pos to back and back to front
|
|
1128 |
RWindowGroup testGroup(TheClient->iWs);
|
|
1129 |
CleanupClosePushL(testGroup);
|
|
1130 |
User::LeaveIfError(testGroup.Construct(111,EFalse));
|
|
1131 |
RWindow testGroupWin(TheClient->iWs);
|
|
1132 |
CleanupClosePushL(testGroupWin);
|
|
1133 |
User::LeaveIfError(testGroupWin.Construct(testGroup, 112));
|
|
1134 |
testGroupWin.SetExtent(TPoint(), TSize(1,1)); // Just enough to change mode
|
|
1135 |
testGroupWin.SetRequiredDisplayMode(testDispModeHigh);
|
|
1136 |
testGroupWin.Activate();
|
|
1137 |
TEST(TheClient->iScreen->DisplayMode()==testDispModeHigh);
|
|
1138 |
TInt oldPos=testGroup.OrdinalPosition();
|
|
1139 |
testGroup.SetOrdinalPosition(oldPos+1);
|
|
1140 |
TEST(TheClient->iScreen->DisplayMode()==testDispModeLow);
|
|
1141 |
testGroup.SetOrdinalPosition(oldPos);
|
|
1142 |
TEST(TheClient->iScreen->DisplayMode()==testDispModeHigh);
|
|
1143 |
CleanupStack::PopAndDestroy(2,&testGroup);
|
|
1144 |
TEST(TheClient->iScreen->DisplayMode()==testDispModeLow);
|
|
1145 |
//
|
|
1146 |
CleanupStack::PopAndDestroy(2,&window64K);
|
|
1147 |
}
|
|
1148 |
CleanupStack::PopAndDestroy(2,winGc1);
|
|
1149 |
CleanupStack::PopAndDestroy(2,&window);
|
|
1150 |
CleanupStack::PopAndDestroy(2,testBitmap64);
|
|
1151 |
}
|
|
1152 |
CleanupStack::PopAndDestroy(&shield16M);
|
|
1153 |
TheClient->iScreen->ReleaseFont(font);
|
|
1154 |
SetWsAndAppScreenModes(TheClient->iScreenModes[0]);
|
|
1155 |
}
|
|
1156 |
|
|
1157 |
void CTScrMode::RunTestCaseL(TInt /*aCurTestCase*/)
|
|
1158 |
{
|
|
1159 |
_LIT(KTest1,"Orientation1");
|
|
1160 |
_LIT(KTest2,"Orientation2");
|
|
1161 |
_LIT(KTest3,"Rect Clear Defect");
|
|
1162 |
_LIT(KTest4,"ScreenModeChange");
|
|
1163 |
_LIT(KScreenModeDisplayMode,"GetScreenModeDisplayMode");
|
|
1164 |
TBuf<32> buf;
|
|
1165 |
TBool checkWindowParam=EFalse;
|
|
1166 |
TInt count=0;
|
|
1167 |
TInt mode=0;
|
|
1168 |
TBool enable=EFalse;
|
|
1169 |
TBool disable=EFalse;
|
|
1170 |
TInt retVal;
|
|
1171 |
|
|
1172 |
switch(++iTest->iState)
|
|
1173 |
{
|
|
1174 |
/**
|
|
1175 |
@SYMTestCaseID GRAPHICS-WSERV-0296
|
|
1176 |
|
|
1177 |
@SYMTestCaseDesc Test that sizes and rotations returned by the various
|
|
1178 |
GetScreenModeSizeAndRotation function are consistent.
|
|
1179 |
Also test that the rotations can be set within each mode.
|
|
1180 |
|
|
1181 |
@SYMTestPriority High
|
|
1182 |
|
|
1183 |
@SYMTestStatus Implemented
|
|
1184 |
|
|
1185 |
@SYMTestActions Read the size and rotation of each mode
|
|
1186 |
and set all allowable rotations.
|
|
1187 |
|
|
1188 |
@SYMTestExpectedResults The rotations and sizes are consistent
|
|
1189 |
and the rotations get set correctly.
|
|
1190 |
*/
|
|
1191 |
case 1:
|
|
1192 |
((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0296"));
|
|
1193 |
iTest->LogSubTest(KTest1);
|
|
1194 |
ScreenRotationsL();
|
|
1195 |
break;
|
|
1196 |
|
|
1197 |
/**
|
|
1198 |
@SYMTestCaseID GRAPHICS-WSERV-0297
|
|
1199 |
|
|
1200 |
@SYMTestCaseDesc That right rotation is achieved when screen mode is changed.
|
|
1201 |
|
|
1202 |
@SYMTestPriority High
|
|
1203 |
|
|
1204 |
@SYMTestStatus Implemented
|
|
1205 |
|
|
1206 |
@SYMTestActions Change the screen modes and rotations in each screen mode (where possible).
|
|
1207 |
|
|
1208 |
@SYMTestExpectedResults The screen ends up in the right rotation
|
|
1209 |
*/
|
|
1210 |
case 2:
|
|
1211 |
((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0297"));
|
|
1212 |
iTest->LogSubTest(KTest2);
|
|
1213 |
MoreScreenRotationsL();
|
|
1214 |
iSubState=0;
|
|
1215 |
break;
|
|
1216 |
|
|
1217 |
/**
|
|
1218 |
@SYMTestCaseID GRAPHICS-WSERV-0298
|
|
1219 |
|
|
1220 |
@SYMDEF DEF081259
|
|
1221 |
|
|
1222 |
@SYMTestCaseDesc Test for the rect clear defect while setting screen mode
|
|
1223 |
|
|
1224 |
@SYMTestPriority High
|
|
1225 |
|
|
1226 |
@SYMTestStatus Implemented
|
|
1227 |
|
|
1228 |
@SYMTestActions Change the screen mode and check the rect clear defect is
|
|
1229 |
not present
|
|
1230 |
|
|
1231 |
@SYMTestExpectedResults The defect is not present
|
|
1232 |
*/
|
|
1233 |
case 3:
|
|
1234 |
((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0298"));
|
|
1235 |
iTest->LogSubTest(KTest3);
|
|
1236 |
RectClearBugL();
|
|
1237 |
break;
|
|
1238 |
|
|
1239 |
/**
|
|
1240 |
@SYMTestCaseID GRAPHICS-WSERV-0299
|
|
1241 |
|
|
1242 |
@SYMDEF DEF081259
|
|
1243 |
|
|
1244 |
@SYMTestCaseDesc Test display mode can be set for test windows and
|
|
1245 |
that the windows then function correctly
|
|
1246 |
|
|
1247 |
@SYMTestPriority High
|
|
1248 |
|
|
1249 |
@SYMTestStatus Implemented
|
|
1250 |
|
|
1251 |
@SYMTestActions Set the display mode in two test windows and then call
|
|
1252 |
methods on the windows
|
|
1253 |
|
|
1254 |
@SYMTestExpectedResults The windows function correctly
|
|
1255 |
|
|
1256 |
*/
|
|
1257 |
case 4:
|
|
1258 |
((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0299"));
|
|
1259 |
iTest->LogSubTest(KTest4);
|
|
1260 |
ScreenModeChange1L();
|
|
1261 |
ScreenModeChange2L();
|
|
1262 |
break;
|
|
1263 |
|
|
1264 |
/**
|
|
1265 |
@SYMTestCaseID GRAPHICS-WSERV-0300
|
|
1266 |
|
|
1267 |
@SYMDEF DEF081259
|
|
1268 |
|
|
1269 |
@SYMTestCaseDesc Test display mode can be set and retrieved
|
|
1270 |
|
|
1271 |
@SYMTestPriority High
|
|
1272 |
|
|
1273 |
@SYMTestStatus Implemented
|
|
1274 |
|
|
1275 |
@SYMTestActions Set the display mode in a window and the retrieve it
|
|
1276 |
|
|
1277 |
@SYMTestExpectedResults The display mode retrieved is the same as the
|
|
1278 |
one set.
|
|
1279 |
*/
|
|
1280 |
case 5:
|
|
1281 |
((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0300"));
|
|
1282 |
iTest->LogSubTest(KScreenModeDisplayMode);
|
|
1283 |
GetScreenDisplayMode();
|
|
1284 |
break;
|
|
1285 |
|
|
1286 |
#if defined(SCREEN_MODE_TESTING)
|
|
1287 |
/**
|
|
1288 |
@SYMTestCaseID GRAPHICS-WSERV-0301
|
|
1289 |
|
|
1290 |
@SYMDEF DEF081259
|
|
1291 |
|
|
1292 |
@SYMTestCaseDesc Case 101 to 105 tests that the screen is drawn correctly
|
|
1293 |
as different screen modes and screen orientation are
|
|
1294 |
set for the screen
|
|
1295 |
|
|
1296 |
@SYMTestPriority High
|
|
1297 |
|
|
1298 |
@SYMTestStatus Implemented
|
|
1299 |
|
|
1300 |
@SYMTestActions Set different screen modes and orientations for the screen and
|
|
1301 |
redraw the screen
|
|
1302 |
|
|
1303 |
@SYMTestExpectedResults The screen is drawn correctly for each setting
|
|
1304 |
*/
|
|
1305 |
case 101:
|
|
1306 |
((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0301"));
|
|
1307 |
iSubState = 0;
|
|
1308 |
buf.Format(TRefByValue<const TDesC>(_L("Screen mode %d:%d")),101,iSubState);
|
|
1309 |
INFO_PRINTF1(buf);
|
|
1310 |
checkWindowParam=ETrue;
|
|
1311 |
mode=1;
|
|
1312 |
if (iCurEnforcement==ESizeEnforcementPixelsAndRotation)
|
|
1313 |
count+=3;
|
|
1314 |
else if (iCurEnforcement==ESizeEnforcementPixelsTwipsAndRotation)
|
|
1315 |
count+=6;
|
|
1316 |
if (iSecondConnection->DeviceMessageCount()!=count)
|
|
1317 |
{
|
|
1318 |
TLogMessageText buf;
|
|
1319 |
_LIT(KFailCount,"Event Mismatch, Exp=%d, Act=%d");
|
|
1320 |
buf.Format(KFailCount,count,iSecondConnection->DeviceMessageCount());
|
|
1321 |
TheClient->iWs.LogMessage(buf);
|
|
1322 |
TheClient->iWs.Flush();
|
|
1323 |
}
|
|
1324 |
retVal = iSecondConnection->DeviceMessageCount();
|
|
1325 |
TEST(retVal==count);
|
|
1326 |
if (retVal!=count)
|
|
1327 |
INFO_PRINTF3(_L("(iSecondConnection->DeviceMessageCount() return value - Expected: %d, Actual: %d"),count ,retVal);
|
|
1328 |
|
|
1329 |
CheckWindows(iCurEnforcement==ESizeEnforcementNone?ETrue:checkWindowParam);
|
|
1330 |
if (enable)
|
|
1331 |
iSecondConnection->EnableMessages();
|
|
1332 |
if (disable)
|
|
1333 |
iSecondConnection->DisableMessages();
|
|
1334 |
TheClient->iScreen->SetScreenMode(mode);
|
|
1335 |
TheClient->iWs.Flush();
|
|
1336 |
iSubState++;
|
|
1337 |
break;
|
|
1338 |
|
|
1339 |
/**
|
|
1340 |
@SYMTestCaseID GRAPHICS-WSERV-0521
|
|
1341 |
*/
|
|
1342 |
case 102:
|
|
1343 |
((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0521"));
|
|
1344 |
buf.Format(TRefByValue<const TDesC>(_L("Screen mode %d:%d")),101,iSubState);
|
|
1345 |
INFO_PRINTF1(buf);
|
|
1346 |
checkWindowParam=EFalse;
|
|
1347 |
enable=ETrue;
|
|
1348 |
if (iCurEnforcement==ESizeEnforcementPixelsAndRotation)
|
|
1349 |
count+=3;
|
|
1350 |
else if (iCurEnforcement==ESizeEnforcementPixelsTwipsAndRotation)
|
|
1351 |
count+=6;
|
|
1352 |
if (iSecondConnection->DeviceMessageCount()!=count)
|
|
1353 |
{
|
|
1354 |
TLogMessageText buf;
|
|
1355 |
_LIT(KFailCount,"Event Mismatch, Exp=%d, Act=%d");
|
|
1356 |
buf.Format(KFailCount,count,iSecondConnection->DeviceMessageCount());
|
|
1357 |
TheClient->iWs.LogMessage(buf);
|
|
1358 |
TheClient->iWs.Flush();
|
|
1359 |
}
|
|
1360 |
retVal = iSecondConnection->DeviceMessageCount();
|
|
1361 |
TEST(retVal==count);
|
|
1362 |
if (retVal!=count)
|
|
1363 |
INFO_PRINTF3(_L("(iSecondConnection->DeviceMessageCount() return value - Expected: %d, Actual: %d"),count ,retVal);
|
|
1364 |
|
|
1365 |
if (enable)
|
|
1366 |
iSecondConnection->EnableMessages();
|
|
1367 |
if (disable)
|
|
1368 |
iSecondConnection->DisableMessages();
|
|
1369 |
TheClient->iScreen->SetScreenMode(mode);
|
|
1370 |
TheClient->iWs.Flush();
|
|
1371 |
iSubState++;
|
|
1372 |
break;
|
|
1373 |
|
|
1374 |
/**
|
|
1375 |
@SYMTestCaseID GRAPHICS-WSERV-0522
|
|
1376 |
*/
|
|
1377 |
case 103:
|
|
1378 |
((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0522"));
|
|
1379 |
buf.Format(TRefByValue<const TDesC>(_L("Screen mode %d:%d")),101,iSubState);
|
|
1380 |
INFO_PRINTF1(buf);
|
|
1381 |
count=1;
|
|
1382 |
mode=1;
|
|
1383 |
checkWindowParam=ETrue;
|
|
1384 |
if (iCurEnforcement==ESizeEnforcementPixelsAndRotation)
|
|
1385 |
count+=3;
|
|
1386 |
else if (iCurEnforcement==ESizeEnforcementPixelsTwipsAndRotation)
|
|
1387 |
count+=6;
|
|
1388 |
if (iSecondConnection->DeviceMessageCount()!=count)
|
|
1389 |
{
|
|
1390 |
TLogMessageText buf;
|
|
1391 |
_LIT(KFailCount,"Event Mismatch, Exp=%d, Act=%d");
|
|
1392 |
buf.Format(KFailCount,count,iSecondConnection->DeviceMessageCount());
|
|
1393 |
TheClient->iWs.LogMessage(buf);
|
|
1394 |
TheClient->iWs.Flush();
|
|
1395 |
}
|
|
1396 |
retVal = iSecondConnection->DeviceMessageCount();
|
|
1397 |
TEST(retVal==count);
|
|
1398 |
if (retVal!=count)
|
|
1399 |
INFO_PRINTF3(_L("(iSecondConnection->DeviceMessageCount() return value - Expected: %d, Actual: %d"),count ,retVal);
|
|
1400 |
|
|
1401 |
CheckWindows(iCurEnforcement==ESizeEnforcementNone?ETrue:checkWindowParam);
|
|
1402 |
if (enable)
|
|
1403 |
iSecondConnection->EnableMessages();
|
|
1404 |
if (disable)
|
|
1405 |
iSecondConnection->DisableMessages();
|
|
1406 |
TheClient->iScreen->SetScreenMode(mode);
|
|
1407 |
TheClient->iWs.Flush();
|
|
1408 |
iSubState++;
|
|
1409 |
break;
|
|
1410 |
|
|
1411 |
/**
|
|
1412 |
@SYMTestCaseID GRAPHICS-WSERV-0523
|
|
1413 |
*/
|
|
1414 |
case 104:
|
|
1415 |
((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0523"));
|
|
1416 |
buf.Format(TRefByValue<const TDesC>(_L("Screen mode %d:%d")),101,iSubState);
|
|
1417 |
INFO_PRINTF1(buf);
|
|
1418 |
checkWindowParam=ETrue;
|
|
1419 |
count=2;
|
|
1420 |
disable=ETrue;
|
|
1421 |
if (iCurEnforcement==ESizeEnforcementPixelsAndRotation)
|
|
1422 |
count+=3;
|
|
1423 |
else if (iCurEnforcement==ESizeEnforcementPixelsTwipsAndRotation)
|
|
1424 |
count+=6;
|
|
1425 |
if (iSecondConnection->DeviceMessageCount()!=count)
|
|
1426 |
{
|
|
1427 |
TLogMessageText buf;
|
|
1428 |
_LIT(KFailCount,"Event Mismatch, Exp=%d, Act=%d");
|
|
1429 |
buf.Format(KFailCount,count,iSecondConnection->DeviceMessageCount());
|
|
1430 |
TheClient->iWs.LogMessage(buf);
|
|
1431 |
TheClient->iWs.Flush();
|
|
1432 |
}
|
|
1433 |
retVal = iSecondConnection->DeviceMessageCount();
|
|
1434 |
TEST(retVal==count);
|
|
1435 |
if (retVal!=count)
|
|
1436 |
INFO_PRINTF3(_L("(iSecondConnection->DeviceMessageCount() return value - Expected: %d, Actual: %d"),count ,retVal);
|
|
1437 |
|
|
1438 |
if (enable)
|
|
1439 |
iSecondConnection->EnableMessages();
|
|
1440 |
if (disable)
|
|
1441 |
iSecondConnection->DisableMessages();
|
|
1442 |
TheClient->iScreen->SetScreenMode(mode);
|
|
1443 |
TheClient->iWs.Flush();
|
|
1444 |
iSubState++;
|
|
1445 |
break;
|
|
1446 |
|
|
1447 |
/**
|
|
1448 |
@SYMTestCaseID GRAPHICS-WSERV-0524
|
|
1449 |
*/
|
|
1450 |
case 105:
|
|
1451 |
((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0524"));
|
|
1452 |
buf.Format(TRefByValue<const TDesC>(_L("Screen mode %d:%d")),101,iSubState);
|
|
1453 |
INFO_PRINTF1(buf);
|
|
1454 |
checkWindowParam=EFalse;
|
|
1455 |
count=2;
|
|
1456 |
enable=ETrue;
|
|
1457 |
if (iCurEnforcement==ESizeEnforcementPixelsAndRotation)
|
|
1458 |
count+=3;
|
|
1459 |
else if (iCurEnforcement==ESizeEnforcementPixelsTwipsAndRotation)
|
|
1460 |
count+=6;
|
|
1461 |
if (iSecondConnection->DeviceMessageCount()!=count)
|
|
1462 |
{
|
|
1463 |
TLogMessageText buf;
|
|
1464 |
_LIT(KFailCount,"Event Mismatch, Exp=%d, Act=%d");
|
|
1465 |
buf.Format(KFailCount,count,iSecondConnection->DeviceMessageCount());
|
|
1466 |
TheClient->iWs.LogMessage(buf);
|
|
1467 |
TheClient->iWs.Flush();
|
|
1468 |
}
|
|
1469 |
retVal = iSecondConnection->DeviceMessageCount();
|
|
1470 |
TEST(retVal==count);
|
|
1471 |
if (retVal!=count)
|
|
1472 |
INFO_PRINTF3(_L("(iSecondConnection->DeviceMessageCount() return value - Expected: %d, Actual: %d"),count ,retVal);
|
|
1473 |
|
|
1474 |
CheckWindows(iCurEnforcement==ESizeEnforcementNone?ETrue:checkWindowParam);
|
|
1475 |
if (enable)
|
|
1476 |
iSecondConnection->EnableMessages();
|
|
1477 |
if (disable)
|
|
1478 |
iSecondConnection->DisableMessages();
|
|
1479 |
TheClient->iScreen->SetScreenMode(mode);
|
|
1480 |
TheClient->iWs.Flush();
|
|
1481 |
|
|
1482 |
|
|
1483 |
iSecondConnection->DisableMessages();
|
|
1484 |
if (iCurEnforcement==ESizeEnforcementNone)
|
|
1485 |
{ // Do it again with different enforcement mode
|
|
1486 |
SetScreenModeEnforcement(ESizeEnforcementPixelsAndRotation);
|
|
1487 |
ResetCounter(100);
|
|
1488 |
}
|
|
1489 |
else if (iCurEnforcement==ESizeEnforcementPixelsAndRotation)
|
|
1490 |
{ // Do it again with different enforcement mode
|
|
1491 |
SetScreenModeEnforcement(ESizeEnforcementPixelsTwipsAndRotation);
|
|
1492 |
ResetCounter(100);
|
|
1493 |
}
|
|
1494 |
else
|
|
1495 |
{
|
|
1496 |
SetScreenModeEnforcement(ESizeEnforcementNone);
|
|
1497 |
delete iSecondConnection;
|
|
1498 |
iSecondConnection=NULL;
|
|
1499 |
}
|
|
1500 |
TheClient->iWs.Flush();
|
|
1501 |
break;
|
|
1502 |
|
|
1503 |
/**
|
|
1504 |
@SYMTestCaseID GRAPHICS-WSERV-0302
|
|
1505 |
|
|
1506 |
@SYMDEF DEF099638
|
|
1507 |
|
|
1508 |
@SYMTestCaseDesc Test that a drawing can be scaled while different screen
|
|
1509 |
modes are set
|
|
1510 |
|
|
1511 |
@SYMTestPriority High
|
|
1512 |
|
|
1513 |
@SYMTestStatus Implemented
|
|
1514 |
|
|
1515 |
@SYMTestActions Set different screen modes and scale a drawing
|
|
1516 |
|
|
1517 |
@SYMTestExpectedResults The drawing is redrawn to scale
|
|
1518 |
*/
|
|
1519 |
case 110:
|
|
1520 |
((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0302"));
|
|
1521 |
// Ensure that the TestWin and BaseWin will be drawn properly in all screen modes
|
|
1522 |
SetScreenModeEnforcement(ESizeEnforcementPixelsAndRotation);
|
|
1523 |
TheClient->SetTestClientScreenMode(0);
|
|
1524 |
INFO_PRINTF1(_L("Scaled drawing - screen mode 0"));
|
|
1525 |
ScaledDrawingL();
|
|
1526 |
TheClient->SetTestClientScreenMode(1);
|
|
1527 |
INFO_PRINTF1(_L("Scaled drawing - screen mode 1"));
|
|
1528 |
ScaledDrawingL();
|
|
1529 |
// Restore screen mode and enforcement mode
|
|
1530 |
TheClient->SetTestClientScreenMode(0);
|
|
1531 |
SetScreenModeEnforcement(iOldEnfMode);
|
|
1532 |
break;
|
|
1533 |
|
|
1534 |
/**
|
|
1535 |
@SYMTestCaseID GRAPHICS-WSERV-0303
|
|
1536 |
|
|
1537 |
@SYMDEF DEF081259
|
|
1538 |
|
|
1539 |
@SYMTestCaseDesc Test screen mode and rotation panic messages
|
|
1540 |
|
|
1541 |
@SYMTestPriority High
|
|
1542 |
|
|
1543 |
@SYMTestStatus Implemented
|
|
1544 |
|
|
1545 |
@SYMTestActions Test the panics fro screen mode and rotation respond as
|
|
1546 |
expected
|
|
1547 |
|
|
1548 |
@SYMTestExpectedResults Panics respond as expected
|
|
1549 |
*/
|
|
1550 |
case 111:
|
|
1551 |
((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0303"));
|
|
1552 |
INFO_PRINTF1(_L("Panic"));
|
|
1553 |
TestPanicsL();
|
|
1554 |
break;
|
|
1555 |
#endif
|
|
1556 |
|
|
1557 |
/**
|
|
1558 |
@SYMTestCaseID GRAPHICS-WSERV-0304
|
|
1559 |
|
|
1560 |
@SYMDEF DEF081259
|
|
1561 |
|
|
1562 |
@SYMTestCaseDesc Test that if there are invisible windows and then the
|
|
1563 |
screen mode is changed, the windows are redrawn correctly
|
|
1564 |
|
|
1565 |
@SYMTestPriority High
|
|
1566 |
|
|
1567 |
@SYMTestStatus Implemented
|
|
1568 |
|
|
1569 |
@SYMTestActions Create some windows, make some invisible, change the screen
|
|
1570 |
mode and redraw the windows
|
|
1571 |
|
|
1572 |
@SYMTestExpectedResults The windows are redrawn without error
|
|
1573 |
*/
|
|
1574 |
case 112:
|
|
1575 |
((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0304"));
|
|
1576 |
INFO_PRINTF1(_L("Invisible Wnds And Infinite Redraw Bugs")); // two defects one problem
|
|
1577 |
InvisibleWndAndInfiniteRedrawBugL();
|
|
1578 |
break;
|
|
1579 |
|
|
1580 |
/**
|
|
1581 |
@SYMTestCaseID GRAPHICS-WSERV-0358
|
|
1582 |
|
|
1583 |
@SYMDEF PDEF096151
|
|
1584 |
|
|
1585 |
@SYMTestCaseDesc Ensure that wserv does not panic when calling CWsScreenDevice::SetScreenMode()
|
|
1586 |
after a client has deleted a screen device used by an active group window
|
|
1587 |
|
|
1588 |
@SYMTestPriority Critical
|
|
1589 |
|
|
1590 |
@SYMTestStatus Implemented
|
|
1591 |
|
|
1592 |
@SYMTestActions Creates a RWsSession
|
|
1593 |
Creates a primary screen device
|
|
1594 |
Creates another screen device
|
|
1595 |
Creates a group window
|
|
1596 |
Gets all the valid screen modes
|
|
1597 |
Deletes the primary screen device
|
|
1598 |
Calls SetScreenMode on the second screen device
|
|
1599 |
(this step triggered the defect - panicking wserv)
|
|
1600 |
Cleans up the above
|
|
1601 |
|
|
1602 |
@SYMTestExpectedResults The call to SetScreenMode should not cause wserv to panic
|
|
1603 |
*/
|
|
1604 |
case 113:
|
|
1605 |
((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0358"));
|
|
1606 |
INFO_PRINTF1(_L("Set screen mode after a client has deleted the screen device"));
|
|
1607 |
SetScreenModeAfterScreenDeviceDeletedL();
|
|
1608 |
break;
|
|
1609 |
|
|
1610 |
/**
|
|
1611 |
@SYMTestCaseID GRAPHICS-WSERV-0525
|
|
1612 |
*/
|
|
1613 |
case 114:
|
|
1614 |
INFO_PRINTF1(_L("Rotate/screen mode test"));
|
|
1615 |
((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0525"));
|
|
1616 |
TestRotateAndScreenModeL();
|
|
1617 |
break;
|
|
1618 |
default:
|
|
1619 |
((CTScrModeStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
|
1620 |
if (iTest->iState==115 || iTest->iState>1000)
|
|
1621 |
TestComplete();
|
|
1622 |
break;
|
|
1623 |
}
|
|
1624 |
((CTScrModeStep*)iStep)->RecordTestResultL();
|
|
1625 |
}
|
|
1626 |
|
|
1627 |
//
|
|
1628 |
// CSecondConnection
|
|
1629 |
//
|
|
1630 |
|
|
1631 |
CSecondConnection::~CSecondConnection()
|
|
1632 |
{
|
|
1633 |
delete iWindow;
|
|
1634 |
delete iWindow2;
|
|
1635 |
iGroup->GroupWin()->EnableReceiptOfFocus(EFalse); // Stop auto group switching on close
|
|
1636 |
delete iGroup;
|
|
1637 |
delete iClient;
|
|
1638 |
}
|
|
1639 |
|
|
1640 |
void CSecondConnection::ConstructL(TInt aScreenNumber,const TRect &aWinRect, CTestBase* aTest, CTestStep* aTestStep)
|
|
1641 |
{
|
|
1642 |
iClient=new(ELeave) CTClient;
|
|
1643 |
iClient->SetScreenNumber(aScreenNumber);
|
|
1644 |
iClient->ConstructL();
|
|
1645 |
iGroup=new(ELeave) CSecondConnectionGroup(iClient,this,aTest,aTestStep);
|
|
1646 |
iGroup->ConstructL();
|
|
1647 |
//
|
|
1648 |
iWindow=new(ELeave) CTBlankWindow;
|
|
1649 |
iWindow->ConstructL(*iGroup);
|
|
1650 |
iWindow->BaseWin()->SetShadowDisabled(ETrue);
|
|
1651 |
iWindow->SetColor(TRgb::Gray4(1));
|
|
1652 |
TPoint offset=BaseWin->BaseWin()->InquireOffset((*iGroup->GroupWin()));
|
|
1653 |
iWindow->SetExtL(offset+aWinRect.iTl,aWinRect.Size());
|
|
1654 |
iWindow->Activate();
|
|
1655 |
//
|
|
1656 |
iWindow2=new(ELeave) CTBlankWindow;
|
|
1657 |
iWindow2->ConstructL(*iGroup);
|
|
1658 |
iWindow2->BaseWin()->SetShadowDisabled(ETrue);
|
|
1659 |
iWindow2->SetColor(TRgb::Gray4(1));
|
|
1660 |
TPoint offset2=TestWin->BaseWin()->InquireOffset((*iGroup->GroupWin()));
|
|
1661 |
iWindow2->SetExtL(offset2+aWinRect.iTl,aWinRect.Size());
|
|
1662 |
iWindow2->BaseWin()->SetVisible(EFalse);
|
|
1663 |
iWindow2->Activate();
|
|
1664 |
}
|
|
1665 |
|
|
1666 |
void CSecondConnection::SetWindow2Visibility(TBool aVisible)
|
|
1667 |
{
|
|
1668 |
iWindow2->BaseWin()->SetVisible(aVisible);
|
|
1669 |
iClient->iWs.Flush();
|
|
1670 |
iClient->iWs.Finish();
|
|
1671 |
}
|
|
1672 |
|
|
1673 |
void CSecondConnection::EnableMessages()
|
|
1674 |
{
|
|
1675 |
iGroup->GroupWin()->EnableScreenChangeEvents();
|
|
1676 |
iClient->iWs.Flush();
|
|
1677 |
}
|
|
1678 |
|
|
1679 |
void CSecondConnection::DisableMessages()
|
|
1680 |
{
|
|
1681 |
iGroup->GroupWin()->DisableScreenChangeEvents();
|
|
1682 |
iClient->iWs.Flush();
|
|
1683 |
}
|
|
1684 |
|
|
1685 |
TInt CSecondConnection::DeviceMessageCount() const
|
|
1686 |
{
|
|
1687 |
return(iMessageCount);
|
|
1688 |
}
|
|
1689 |
|
|
1690 |
void CSecondConnection::ScreenDeviceChanged()
|
|
1691 |
{
|
|
1692 |
iMessageCount++;
|
|
1693 |
}
|
|
1694 |
|
|
1695 |
//
|
|
1696 |
// CSecondConnectionGroup
|
|
1697 |
//
|
|
1698 |
|
|
1699 |
CSecondConnectionGroup::CSecondConnectionGroup(CTClient* aClient, CSecondConnection* aSecondConnection, CTestBase* aTest, CTestStep* aTestStep) : CTWindowGroup(aClient), iTest(aTest), iSecondConnection(aSecondConnection), iTestStep(aTestStep)
|
|
1700 |
{}
|
|
1701 |
|
|
1702 |
void CSecondConnectionGroup::ScreenDeviceChanged()
|
|
1703 |
{
|
|
1704 |
iSecondConnection->ScreenDeviceChanged();
|
|
1705 |
TPixelsTwipsAndRotation sar;
|
|
1706 |
Client()->iScreen->GetDefaultScreenSizeAndRotation(sar);
|
|
1707 |
Client()->iScreen->SetScreenSizeAndRotation(sar);
|
|
1708 |
//
|
|
1709 |
iTestStep->TEST(Client()->iScreen->SizeInPixels()==sar.iPixelSize);
|
|
1710 |
iTestStep->TEST(Client()->iScreen->SizeInTwips()==sar.iTwipsSize);
|
|
1711 |
TSize pixelConv;
|
|
1712 |
pixelConv.iWidth=Client()->iScreen->HorizontalTwipsToPixels(sar.iTwipsSize.iWidth);
|
|
1713 |
pixelConv.iHeight=Client()->iScreen->VerticalTwipsToPixels(sar.iTwipsSize.iHeight);
|
|
1714 |
iTestStep->TEST(pixelConv==sar.iPixelSize);
|
|
1715 |
}
|
|
1716 |
|
|
1717 |
|
|
1718 |
//
|
|
1719 |
// SecondClientConnection
|
|
1720 |
//
|
|
1721 |
|
|
1722 |
SecondClientConnection::SecondClientConnection()
|
|
1723 |
{
|
|
1724 |
}
|
|
1725 |
|
|
1726 |
SecondClientConnection::~SecondClientConnection()
|
|
1727 |
{
|
|
1728 |
}
|
|
1729 |
|
|
1730 |
void SecondClientConnection::ConstructL(TInt aScreenMode, const TPixelsTwipsAndRotation& aSizeAndRotation)
|
|
1731 |
{
|
|
1732 |
CTClient::ConstructL();
|
|
1733 |
iGroup=new(ELeave) TestWindowGroup(this);
|
|
1734 |
iGroup->ConstructL();
|
|
1735 |
iScreen->SetScreenModeEnforcement(ESizeEnforcementPixelsAndRotation);
|
|
1736 |
iScreen->SetScreenSizeAndRotation(aSizeAndRotation);
|
|
1737 |
iScreen->SetScreenMode(aScreenMode);
|
|
1738 |
}
|
|
1739 |
|
|
1740 |
__WS_CONSTRUCT_STEP__(ScrMode)
|