|
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Test Fading and UnFading of windows |
|
15 // |
|
16 // |
|
17 |
|
18 #include "TFADE.H" |
|
19 #define __DISPLAY_MODE_64K_COLOR |
|
20 |
|
21 //CRedrawWin |
|
22 |
|
23 CRedrawWin::CRedrawWin(CTFade *aTest) : CTWin(), iTest(aTest) |
|
24 {} |
|
25 |
|
26 CRedrawWin::~CRedrawWin() |
|
27 { |
|
28 } |
|
29 |
|
30 void CRedrawWin::ConstructL(TRect aArea) |
|
31 { |
|
32 |
|
33 ConstructExtLD(*TheClient->iGroup,aArea.iTl,aArea.Size()); |
|
34 AssignGC(*TheClient->iGc); |
|
35 Activate(); |
|
36 iWin.BeginRedraw(); |
|
37 iWin.EndRedraw(); |
|
38 } |
|
39 |
|
40 void CRedrawWin::Draw() |
|
41 { |
|
42 iTest->Drawing(iTest->Content(),iGc); |
|
43 } |
|
44 |
|
45 |
|
46 //CFadeTest |
|
47 |
|
48 CTFade::CTFade(CTestStep* aStep) : CTWsGraphicsBase(aStep) |
|
49 { |
|
50 #if defined (__MARM_THUMB__) |
|
51 CanFade = false; |
|
52 CanFadeSet = false; |
|
53 #endif |
|
54 } |
|
55 |
|
56 void CTFade::ConstructL() |
|
57 { |
|
58 iDeviceDisplayMode=TheClient->iScreen->DisplayMode(); |
|
59 iTestWinSize=StdTestWindowSize(); |
|
60 iFadeDrawMode = iDeviceDisplayMode; |
|
61 iTestWinCopy = new (ELeave) CFbsBitmap(); |
|
62 iTestWinCopy->Create(iTestWinSize,TheClient->iScreen->DisplayMode()); |
|
63 iCheckWinCopy = new (ELeave) CFbsBitmap(); |
|
64 iCheckWinCopy->Create(iTestWinSize,TheClient->iScreen->DisplayMode()); |
|
65 } |
|
66 |
|
67 CTFade::~CTFade() |
|
68 { |
|
69 __ASSERT_ALWAYS(!iBlankWin,AutoPanic(EAutoFadeWindow)); |
|
70 delete iTestWinCopy; |
|
71 delete iCheckWinCopy; |
|
72 } |
|
73 |
|
74 TInt CTFade::Content() |
|
75 { |
|
76 return iContent; |
|
77 } |
|
78 |
|
79 void CTFade::CreateBlankWindowL() |
|
80 { |
|
81 __ASSERT_ALWAYS(!iBlankWin,AutoPanic(EAutoFadeWindow)); |
|
82 TSize scrSize(TheClient->iScreen->SizeInPixels()); |
|
83 iTestWinSize.SetSize(2*scrSize.iWidth/3-6,scrSize.iHeight-6); |
|
84 iBlankWin=new(ELeave) CTBlankWindow(); |
|
85 iWindowRect.SetRect(TPoint(3+scrSize.iWidth/3,3),iTestWinSize); |
|
86 iBlankWin->SetUpL(iWindowRect.iTl,iTestWinSize,TheClient->iGroup,*TheClient->iGc); |
|
87 iBlankWin->BaseWin()->SetRequiredDisplayMode(EGray16); |
|
88 } |
|
89 |
|
90 void CTFade::DestroyBlankWindow() |
|
91 { |
|
92 __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow)); |
|
93 delete iBlankWin; |
|
94 iBlankWin=NULL; |
|
95 } |
|
96 |
|
97 void CTFade::CreateBackupWindowL(TBool aMaintainBackup) |
|
98 { |
|
99 __ASSERT_ALWAYS(!iWin,AutoPanic(EAutoFadeWindow)); |
|
100 CTBackedUpWin* backUpWin=new(ELeave) CTBackedUpWin(MODE_LT_64K(iDeviceDisplayMode)?iFadeDrawMode:iDeviceDisplayMode); |
|
101 iWin=backUpWin; |
|
102 iOwnWindow=ETrue; |
|
103 iWindowRect.SetRect(TPoint(2*iTestWinSize.iWidth+35,7),iTestWinSize); |
|
104 backUpWin->ConstructExtLD(*TheClient->iGroup,iWindowRect.iTl,iTestWinSize); |
|
105 if (aMaintainBackup) |
|
106 backUpWin->BackedUpWin()->MaintainBackup(); |
|
107 backUpWin->Activate(); |
|
108 TheClient->WaitForRedrawsToFinish(); //Without this bitmaps won't draw into the window |
|
109 } |
|
110 |
|
111 void CTFade::CreateRedrawWindowL() |
|
112 { |
|
113 __ASSERT_ALWAYS(!iWin,AutoPanic(EAutoFadeWindow)); |
|
114 iWindowRect.SetRect(TPoint(2*iTestWinSize.iWidth+35,7),iTestWinSize); |
|
115 CRedrawWin* redrawWin=new(ELeave) CRedrawWin(this); |
|
116 redrawWin->ConstructL(iWindowRect); |
|
117 redrawWin->Win()->EnableRedrawStore(EFalse); |
|
118 iWin=redrawWin; |
|
119 iOwnWindow=ETrue; |
|
120 iWin->BaseWin()->SetRequiredDisplayMode(iFadeDrawMode); |
|
121 } |
|
122 |
|
123 void CTFade::DestroyDrawableWindow() |
|
124 { |
|
125 __ASSERT_ALWAYS(iWin,AutoPanic(EAutoFadeWindow)); |
|
126 if (iOwnWindow) |
|
127 delete iWin; |
|
128 iWin=NULL; |
|
129 } |
|
130 |
|
131 void CTFade::CreateBitmapsL() |
|
132 { |
|
133 iTestWinSize=BaseWin->Size(); |
|
134 iBaseRect.SetRect(BaseWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),iTestWinSize); |
|
135 iNormalBitmap.Create(iTestWinSize,MODE_LT_64K(iDeviceDisplayMode)?iFadeDrawMode:iDeviceDisplayMode); |
|
136 iFadedBitmap.Create(iTestWinSize,MODE_LT_64K(iDeviceDisplayMode)?iFadeDrawMode:iDeviceDisplayMode); |
|
137 iNormalBitmapDevice=CFbsBitmapDevice::NewL(&iNormalBitmap); |
|
138 iFadedBitmapDevice=CFbsBitmapDevice::NewL(&iFadedBitmap); |
|
139 User::LeaveIfError(iNormalBitmapDevice->CreateContext(iNormalBitGc)); |
|
140 User::LeaveIfError(iFadedBitmapDevice->CreateContext(iFadedBitGc)); |
|
141 iFadedBitGc->SetFadeMode(ETrue); |
|
142 iBaseWinMode=BaseWin->BaseWin()->DisplayMode(); |
|
143 BaseWin->BaseWin()->SetRequiredDisplayMode(iFadeDrawMode); |
|
144 } |
|
145 |
|
146 void CTFade::DestroyBitmaps() |
|
147 { |
|
148 delete iNormalBitGc; |
|
149 delete iFadedBitGc; |
|
150 delete iNormalBitmapDevice; |
|
151 delete iFadedBitmapDevice; |
|
152 BaseWin->BaseWin()->SetRequiredDisplayMode(iBaseWinMode); |
|
153 } |
|
154 |
|
155 void CTFade::Drawing(TInt aDrawFunc, CBitmapContext *gc) |
|
156 { |
|
157 TRgb grey=TRgb::Gray4(2); |
|
158 TInt ii; |
|
159 gc->Reset(); |
|
160 switch (aDrawFunc) |
|
161 { |
|
162 case 1: |
|
163 case 2: |
|
164 Draw(0,&grey,gc); |
|
165 gc->Reset(); |
|
166 Draw(1,NULL,gc); |
|
167 if (aDrawFunc==1) |
|
168 break; |
|
169 gc->Reset(); |
|
170 Draw(3,NULL,gc); |
|
171 break; |
|
172 case 3: |
|
173 Draw(0,&grey,gc); |
|
174 gc->Reset(); |
|
175 Draw(3,NULL,gc); |
|
176 break; |
|
177 case 4: |
|
178 grey=TRgb::Gray4(1); |
|
179 gc->Reset(); |
|
180 Draw(0,&grey,gc); |
|
181 gc->Reset(); |
|
182 for (ii=1;ii<37;ii+=7) |
|
183 Draw(2,&ii,gc); |
|
184 break; |
|
185 case 5: |
|
186 Draw(0,&grey,gc); |
|
187 gc->Reset(); |
|
188 Draw(1,NULL,gc); |
|
189 gc->Reset(); |
|
190 for (ii=2;ii<60;ii+=11) |
|
191 Draw(2,&ii,gc); |
|
192 break; |
|
193 case 6: |
|
194 case 7: |
|
195 Draw(0,&grey,gc); |
|
196 gc->Reset(); |
|
197 Draw(3,NULL,gc); |
|
198 gc->Reset(); |
|
199 for (ii=3;ii<70;ii+=13) |
|
200 Draw(2,&ii,gc); |
|
201 if (aDrawFunc==6) |
|
202 break; |
|
203 gc->Reset(); |
|
204 Draw(1,NULL,gc); |
|
205 break; |
|
206 default:; |
|
207 } |
|
208 } |
|
209 |
|
210 void CTFade::Draw(TInt aDrawFunc, TAny *aParam, TBool aAlternativeFade/*=EFalse*/, TBool aFade/*=EFalse*/) |
|
211 { |
|
212 CWindowGc *gc=TheClient->iGc; |
|
213 gc->Activate(*iWin->DrawableWin()); |
|
214 gc->Reset(); |
|
215 if (aFade) |
|
216 gc->SetFaded(ETrue); |
|
217 iNormalBitGc->Reset(); |
|
218 iFadedBitGc->Reset(); |
|
219 iFadedBitGc->SetFadeMode(ETrue); |
|
220 if (aAlternativeFade) |
|
221 iFadedBitGc->SetFadingParameters(BLACK_ALTERNATE,WHITE_ALTERNATE); |
|
222 Draw(aDrawFunc,aParam,gc); |
|
223 Draw(aDrawFunc,aParam,iNormalBitGc); |
|
224 Draw(aDrawFunc,aParam,iFadedBitGc); |
|
225 gc->Deactivate(); |
|
226 if (aAlternativeFade) |
|
227 iFadedBitGc->SetFadingParameters(BLACK_NORMAL,WHITE_NORMAL); |
|
228 } |
|
229 |
|
230 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA // CWindowGc fading is deprecated in NGA |
|
231 void CTFade::GCDraw(TInt aDrawFunc, TAny *aParam, TBool aAlternativeFade) |
|
232 { |
|
233 CWindowGc *gc=TheClient->iGc; |
|
234 gc->Activate(*iWin->DrawableWin()); |
|
235 gc->Reset(); |
|
236 Draw(aDrawFunc,aParam,gc); |
|
237 gc->Deactivate(); |
|
238 gc->Activate(*BaseWin->DrawableWin()); |
|
239 gc->Reset(); |
|
240 gc->SetFaded(ETrue); |
|
241 if (aAlternativeFade) |
|
242 gc->SetFadingParameters(BLACK_ALTERNATE,WHITE_ALTERNATE); |
|
243 Draw(aDrawFunc,aParam,gc); |
|
244 gc->Deactivate(); |
|
245 } |
|
246 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
247 |
|
248 void CTFade::Draw(TInt aDrawFunc, TAny *aParam, CBitmapContext *aGc) |
|
249 { |
|
250 switch(aDrawFunc) |
|
251 { |
|
252 case 0: |
|
253 aGc->SetBrushColor(*((TRgb *)aParam)); |
|
254 aGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
255 aGc->SetPenStyle(CGraphicsContext::ENullPen); |
|
256 aGc->DrawRect(TRect(iTestWinSize)); |
|
257 break; |
|
258 case 1: |
|
259 { |
|
260 TSize half(iTestWinSize.iWidth/2,iTestWinSize.iHeight/2); |
|
261 TRect rect(half); |
|
262 aGc->DrawEllipse(rect); |
|
263 aGc->DrawEllipse(TRect(TPoint(0,half.iHeight),half)); |
|
264 aGc->SetOrigin(TPoint(half.iWidth,0)); |
|
265 aGc->SetClippingRect(rect); |
|
266 aGc->DrawEllipse(rect); |
|
267 aGc->SetOrigin(TPoint(half.iWidth,half.iHeight)); |
|
268 aGc->SetClippingRect(rect); |
|
269 aGc->DrawEllipse(rect); |
|
270 aGc->SetOrigin(TPoint()); |
|
271 aGc->CancelClippingRect(); |
|
272 } |
|
273 break; |
|
274 case 2: |
|
275 { |
|
276 TInt param= *((TInt *)aParam); |
|
277 if (param&0x1) |
|
278 aGc->DrawLine(TPoint(param+(param*27)%iTestWinSize.iWidth,0), |
|
279 TPoint(iTestWinSize.iWidth-((param<<1)+(param*19)%iTestWinSize.iWidth),iTestWinSize.iHeight)); |
|
280 else |
|
281 aGc->DrawLine(TPoint(0, (param<<1)+(param*7)%iTestWinSize.iHeight), |
|
282 TPoint(iTestWinSize.iWidth,param+(param*13)%iTestWinSize.iHeight)); |
|
283 } |
|
284 break; |
|
285 case 3: |
|
286 { |
|
287 TPoint pos; |
|
288 for(;pos.iX<iTestWinSize.iWidth;pos.iX+=10) |
|
289 aGc->DrawLine(pos,pos+TSize(0,iTestWinSize.iHeight)); |
|
290 for(pos.iX=0;pos.iY<iTestWinSize.iHeight;pos.iY+=10) |
|
291 aGc->DrawLine(pos,pos+TSize(iTestWinSize.iWidth,0)); |
|
292 } |
|
293 break; |
|
294 } |
|
295 } |
|
296 |
|
297 void CTFade::CompareWithBitmap(TBool aFade) |
|
298 { |
|
299 TBool match; |
|
300 CWindowGc& gc=*TheClient->iGc; |
|
301 CFbsBitmap* bitmap; |
|
302 TheClient->iWs.Flush(); |
|
303 if (aFade) |
|
304 bitmap=&iFadedBitmap; |
|
305 else |
|
306 bitmap=&iNormalBitmap; |
|
307 gc.Activate(*BaseWin->DrawableWin()); |
|
308 gc.Reset(); |
|
309 gc.BitBlt(TPoint(),bitmap); |
|
310 gc.Deactivate(); |
|
311 TheClient->iWs.Flush(); |
|
312 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
313 match=TheClient->iScreen->RectCompare(iBaseRect,iWindowRect); |
|
314 #else // In NGA comparison has to be lossy because fading can be implemented on hardware |
|
315 match=LossyCompareWindow(*TheClient->iScreen, *iTestWinCopy, *iCheckWinCopy, iWindowRect); |
|
316 #endif |
|
317 TEST(match); |
|
318 if (!match) |
|
319 { |
|
320 _LIT(KLog,"Windows content don't match when they should"); |
|
321 LOG_MESSAGE(KLog); |
|
322 } |
|
323 } |
|
324 |
|
325 void CTFade::CompareWindows(TBool aAlternativeFade/*=EFalse*/) |
|
326 { |
|
327 if (aAlternativeFade) |
|
328 iWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly,BLACK_ALTERNATE,WHITE_ALTERNATE); |
|
329 else |
|
330 iWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly); |
|
331 TheClient->iWs.Flush(); |
|
332 TBool retVal = TheClient->iScreen->RectCompare(iBaseRect,iWindowRect); |
|
333 TEST(retVal); |
|
334 if (!retVal) |
|
335 INFO_PRINTF3(_L("TheClient->iScreen->RectCompare(iBaseRect,iWindowRect) return value - Expected: %d, Actual: %d"), ETrue, retVal); |
|
336 |
|
337 iWin->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly); |
|
338 TheClient->iWs.Flush(); |
|
339 TheClient->WaitForRedrawsToFinish(); |
|
340 } |
|
341 |
|
342 #define FADE(n,col) n/2+col/2 |
|
343 TInt CTFade::Fade4(TInt aGray4) |
|
344 { |
|
345 #if defined(__WINS__) |
|
346 return FADE(4,aGray4); |
|
347 #elif defined (__MARM_THUMB__) |
|
348 return (CanFade ? FADE(4,aGray4):aGray4); |
|
349 #elif defined (__MARM__) |
|
350 return FADE(4,aGray4); |
|
351 #else |
|
352 return aGray4; |
|
353 #endif |
|
354 } |
|
355 |
|
356 TInt CTFade::Fade16(TInt aGray16) |
|
357 { |
|
358 #if defined(__WINS__) |
|
359 return FADE(16,aGray16); |
|
360 #elif defined (__MARM_THUMB__) |
|
361 return (CanFade ? FADE(16,aGray16):aGray16); |
|
362 #elif defined (__MARM__) |
|
363 return FADE(16,aGray16); |
|
364 #else |
|
365 return aGray16; |
|
366 #endif |
|
367 } |
|
368 |
|
369 TRgb CTFade::FadeRgb(TRgb aColor) |
|
370 { |
|
371 switch (iFadeDrawMode) |
|
372 { |
|
373 case EColor16M: |
|
374 case EColor16MU: |
|
375 case EColor16MA: |
|
376 case EColor16MAP: |
|
377 break; |
|
378 default: |
|
379 aColor=TRgb::Color64K(aColor.Color64K()); |
|
380 break; |
|
381 } |
|
382 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA // Color fading calculation differs in NGA |
|
383 TInt fadeMapFactor=WHITE_NORMAL-BLACK_NORMAL+1; |
|
384 #else |
|
385 TInt fadeMapFactor=WHITE_NORMAL-BLACK_NORMAL; |
|
386 #endif |
|
387 TInt fadeMapOffset=BLACK_NORMAL; |
|
388 TInt value = aColor.Internal(); |
|
389 |
|
390 TInt b = (((value & 0x000000ff) * fadeMapFactor) >> 8) + fadeMapOffset; |
|
391 TInt g = (((value & 0x0000ff00) * fadeMapFactor) >> 16) + fadeMapOffset; |
|
392 TInt r = (((value & 0x00ff0000) * fadeMapFactor) >> 24) + fadeMapOffset; |
|
393 return TRgb(r,g,b); |
|
394 } |
|
395 |
|
396 TRgb CTFade::FadeRgb(TRgb aColor, TInt aFadeMapFactor, TInt aFadeMapOffset) |
|
397 { |
|
398 switch (iFadeDrawMode) |
|
399 { |
|
400 case EColor16M: |
|
401 case EColor16MU: |
|
402 case EColor16MA: |
|
403 case EColor16MAP: |
|
404 break; |
|
405 default: |
|
406 aColor=TRgb::Color64K(aColor.Color64K()); |
|
407 break; |
|
408 } |
|
409 TInt value = aColor.Internal(); |
|
410 |
|
411 TInt b = (((value & 0x000000ff) * aFadeMapFactor) >> 8) + aFadeMapOffset; |
|
412 TInt g = (((value & 0x0000ff00) * aFadeMapFactor) >> 16) + aFadeMapOffset; |
|
413 TInt r = (((value & 0x00ff0000) * aFadeMapFactor) >> 24) + aFadeMapOffset; |
|
414 return TRgb(r,g,b); |
|
415 } |
|
416 |
|
417 inline void CTFade::ViewDelay() |
|
418 // |
|
419 //This routine can provide a delay which will allow the user to see the colors changing |
|
420 // |
|
421 { |
|
422 TheClient->iWs.Finish(); |
|
423 /*TheClient->iWs.Flush(); |
|
424 User::After(1000000);*/ // 1 sec |
|
425 } |
|
426 |
|
427 void CTFade::ColorTest() |
|
428 { |
|
429 __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow)); |
|
430 TBool retVal; |
|
431 TSize size(iTestWinSize); |
|
432 #if defined(SMALL_RECTS) |
|
433 size.iWidth=Min(SIZE_X,size.iWidth); |
|
434 size.iHeight=Min(SIZE_Y,size.iHeight); |
|
435 #endif |
|
436 TRect windowRect(iBlankWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),size); |
|
437 TInt ii; |
|
438 iBlankWin->BaseWin()->SetRequiredDisplayMode(EGray4); |
|
439 TheClient->WaitForRedrawsToFinish(); //Force the screen into 4 gray mode |
|
440 TRgb fadedColor; |
|
441 for (ii=1;ii<4;ii+=2) //0 and 3 now give dithered colors when fading so causing this test to fail |
|
442 { |
|
443 iBlankWin->SetColor(TRgb::Gray4(ii)); |
|
444 ViewDelay(); |
|
445 INFO_PRINTF1(_L(" Testing Normal Color")); |
|
446 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
447 retVal = CheckBlankWindow(windowRect,TRgb::Gray4(ii),TheClient->iScreen); |
|
448 #else |
|
449 TheClient->iScreen->CopyScreenToBitmap(iTestWinCopy, windowRect); |
|
450 retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray4(ii)); |
|
451 #endif |
|
452 TEST(retVal); |
|
453 if (!retVal) |
|
454 INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray4(ii),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal); |
|
455 iBlankWin->BaseWin()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly); |
|
456 ViewDelay(); |
|
457 fadedColor=MODE_LT_64K(iDeviceDisplayMode)?TRgb::Gray4(Fade4(ii)):FadeRgb(TRgb::Gray4(ii)); |
|
458 #if defined (__MARM_THUMB__) |
|
459 if (ii==1) |
|
460 { |
|
461 CanFade=!CheckBlankWindow(windowRect,fadedColor,TheClient->iScreen); |
|
462 CanFadeSet=ETrue; |
|
463 fadedColor=MODE_LT_64K(iDeviceDisplayMode)?TRgb::Gray4(Fade4(ii)):FadeRgb(TRgb::Gray4(ii)); |
|
464 } |
|
465 #endif |
|
466 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
467 retVal = CheckBlankWindow(windowRect,fadedColor,TheClient->iScreen); |
|
468 #else |
|
469 retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, fadedColor); |
|
470 #endif |
|
471 TEST(retVal); |
|
472 if (!retVal) |
|
473 INFO_PRINTF3(_L("CheckBlankWindow(windowRect,fadedColor,TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal); |
|
474 |
|
475 iBlankWin->BaseWin()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly); |
|
476 ViewDelay(); |
|
477 INFO_PRINTF1(_L(" Testing Unfaded Color")); |
|
478 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
479 retVal = CheckBlankWindow(windowRect,TRgb::Gray4(ii),TheClient->iScreen); |
|
480 #else |
|
481 retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray4(ii)); |
|
482 #endif |
|
483 TEST(retVal); |
|
484 if (!retVal) |
|
485 INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray4(ii),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal); |
|
486 } |
|
487 iBlankWin->BaseWin()->SetRequiredDisplayMode(EGray16); |
|
488 |
|
489 if (MaxGrays()==0 && MaxColors()<256) |
|
490 return; |
|
491 |
|
492 INFO_PRINTF1(_L(" Doing 16 Gray Colors")); |
|
493 for (ii=0;ii<16;++ii) |
|
494 { |
|
495 iBlankWin->SetColor(TRgb::Gray16(ii)); |
|
496 ViewDelay(); |
|
497 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
498 retVal = CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen); |
|
499 #else |
|
500 retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray16(ii)); |
|
501 #endif |
|
502 TEST(retVal); |
|
503 if (!retVal) |
|
504 INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal); |
|
505 |
|
506 iBlankWin->BaseWin()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly); |
|
507 ViewDelay(); |
|
508 fadedColor=MODE_LT_64K(iDeviceDisplayMode)?TRgb::Gray16(Fade16(ii)):FadeRgb(TRgb::Gray16(ii)); |
|
509 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
510 retVal = CheckBlankWindow(windowRect,fadedColor,TheClient->iScreen); |
|
511 #else |
|
512 retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, fadedColor); |
|
513 #endif |
|
514 TEST(retVal); |
|
515 if (!retVal) |
|
516 INFO_PRINTF3(_L("CheckBlankWindow(windowRect,fadedColor,TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal); |
|
517 |
|
518 iBlankWin->BaseWin()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly); |
|
519 ViewDelay(); |
|
520 |
|
521 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
522 retVal = CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen); |
|
523 #else |
|
524 retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray16(ii)); |
|
525 #endif |
|
526 TEST(retVal); |
|
527 if (!retVal) |
|
528 INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal); |
|
529 } |
|
530 } |
|
531 |
|
532 void CTFade::BlankWindowL() |
|
533 { |
|
534 TBool retVal; |
|
535 if (MaxGrays()==0 && MaxColors()<256) |
|
536 return; |
|
537 |
|
538 __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow)); |
|
539 CTBlankWindow* blankWin=new(ELeave) CTBlankWindow(); |
|
540 TRect testArea(iWindowRect); |
|
541 TRect windowRect(testArea); |
|
542 #if defined(SMALL_RECTS) |
|
543 TSize size(testArea.Size()); |
|
544 size.iWidth=Min(2*SIZE_X,size.iWidth); |
|
545 size.iHeight=Min(2*SIZE_Y,size.iHeight); |
|
546 testArea.SetHeight(size.iHeight); |
|
547 testArea.iTl.iX=testArea.iBr.iX-size.iWidth; |
|
548 windowRect=testArea; |
|
549 windowRect.Shrink(size.iWidth/4,size.iHeight/4); |
|
550 #else |
|
551 windowRect.Shrink(30,30); |
|
552 #endif |
|
553 blankWin->SetUpL(windowRect.iTl,windowRect.Size(),TheClient->iGroup,*TheClient->iGc); |
|
554 for (TInt col=2;col<16;col+=6) |
|
555 { |
|
556 iBlankWin->SetColor(TRgb::Gray16(col)); |
|
557 TheClient->iScreen->CopyScreenToBitmap(iTestWinCopy, windowRect); |
|
558 iBlankWin->BaseWin()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly); |
|
559 blankWin->SetVisible(EFalse); |
|
560 TheClient->iWs.Finish(); |
|
561 TRgb fadedColor=MODE_LT_64K(iDeviceDisplayMode)?TRgb::Gray16(Fade16(col)):FadeRgb(TRgb::Gray16(col)); |
|
562 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
563 retVal = CheckBlankWindow(testArea,fadedColor,TheClient->iScreen); |
|
564 #else |
|
565 retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, fadedColor); |
|
566 #endif |
|
567 TEST(retVal); |
|
568 if (!retVal) |
|
569 INFO_PRINTF3(_L("LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, fadedColor) return value - Expected: %d, Actual: %d"), ETrue, retVal); |
|
570 |
|
571 blankWin->SetVisible(ETrue); |
|
572 iBlankWin->BaseWin()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly); |
|
573 blankWin->SetVisible(EFalse); |
|
574 TheClient->iWs.Finish(); |
|
575 retVal = CheckBlankWindow(testArea,TRgb::Gray16(col),TheClient->iScreen); |
|
576 TEST(retVal); |
|
577 if (!retVal) |
|
578 INFO_PRINTF3(_L("CheckBlankWindow(testArea,TRgb::Gray16(col),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal); |
|
579 |
|
580 blankWin->SetVisible(ETrue); |
|
581 iBlankWin->SetPos(iWindowRect.iTl+TPoint(15,-15)); |
|
582 iBlankWin->BaseWin()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly); |
|
583 blankWin->SetVisible(EFalse); |
|
584 iBlankWin->SetPos(iWindowRect.iTl); |
|
585 fadedColor=MODE_LT_64K(iDeviceDisplayMode)?TRgb::Gray16(Fade16(col)):FadeRgb(TRgb::Gray16(col)); |
|
586 TheClient->iWs.Finish(); |
|
587 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
588 retVal = CheckBlankWindow(testArea,fadedColor,TheClient->iScreen); |
|
589 #else |
|
590 retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, fadedColor); |
|
591 #endif |
|
592 TEST(retVal); |
|
593 if (!retVal) |
|
594 INFO_PRINTF3(_L("LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, fadedColor) return value - Expected: %d, Actual: %d"), ETrue, retVal); |
|
595 |
|
596 blankWin->SetVisible(ETrue); |
|
597 iBlankWin->SetPos(iWindowRect.iTl+TPoint(15,-15)); |
|
598 iBlankWin->BaseWin()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly); |
|
599 blankWin->SetVisible(EFalse); |
|
600 iBlankWin->SetPos(iWindowRect.iTl); |
|
601 TheClient->iWs.Finish(); |
|
602 retVal = CheckBlankWindow(testArea,TRgb::Gray16(col),TheClient->iScreen); |
|
603 TEST(retVal); |
|
604 if (!retVal) |
|
605 INFO_PRINTF3(_L("CheckBlankWindow(testArea,TRgb::Gray16(col),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal); |
|
606 |
|
607 blankWin->SetVisible(ETrue); |
|
608 } |
|
609 delete blankWin; |
|
610 } |
|
611 |
|
612 void CTFade::TestStrips(TRect aRect,TInt aHeight,TInt aNumNotFaded,TBool aInvert/*=EFalse*/) |
|
613 { |
|
614 TBool isFaded; |
|
615 TInt ii; |
|
616 TRgb col; |
|
617 for (ii=0;ii<16;++ii) |
|
618 { |
|
619 isFaded=((!aInvert)==(!(ii<aNumNotFaded))); |
|
620 if (isFaded) |
|
621 col=MODE_LT_64K(iDeviceDisplayMode)?TRgb::Gray16(Fade16(ii)):FadeRgb(TRgb::Gray16(ii)); |
|
622 else |
|
623 col=TRgb::Gray16(ii); |
|
624 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
625 TBool retVal = CheckBlankWindow(aRect,col,TheClient->iScreen); |
|
626 #else |
|
627 TBool retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, aRect, col); |
|
628 #endif |
|
629 TEST(retVal); |
|
630 if (!retVal) |
|
631 INFO_PRINTF3(_L("CheckBlankWindow(aRect,col,TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal); |
|
632 |
|
633 aRect.Move(0,aHeight); |
|
634 } |
|
635 } |
|
636 |
|
637 void CTFade::FadeChildrenL() |
|
638 { |
|
639 if (MaxGrays()==0 && MaxColors()<256) |
|
640 return; |
|
641 |
|
642 TInt retVal; |
|
643 TBool retBool; |
|
644 |
|
645 __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow)); |
|
646 iBlankWin->BaseWin()->SetRequiredDisplayMode(EGray16); |
|
647 iBlankWin->SetColor(TRgb::Gray16(0)); |
|
648 CTBlankWindow* win[16]; |
|
649 win[0]=iBlankWin; |
|
650 TRect rect(iTestWinSize); |
|
651 TInt height=iTestWinSize.iHeight/16; |
|
652 rect.iTl.iY=height; |
|
653 TInt ii; |
|
654 for (ii=1;ii<16;++ii) //Causes memory leakage under OOM |
|
655 { |
|
656 win[ii]=new(ELeave) CTBlankWindow(); |
|
657 win[ii]->SetUpL(rect.iTl,rect.Size(),win[ii-1],*TheClient->iGc); |
|
658 win[ii]->BaseWin()->SetRequiredDisplayMode(EGray16); |
|
659 win[ii]->SetColor(TRgb::Gray16(ii)); |
|
660 rect.iBr.iY-=height; |
|
661 } |
|
662 rect=iWindowRect; |
|
663 rect.SetHeight(height); |
|
664 #if defined(SMALL_RECTS) |
|
665 TSize size(rect.Size()); |
|
666 size.iWidth=Min(SIZE_X,size.iWidth); |
|
667 size.iHeight=Min(SIZE_Y,size.iHeight); |
|
668 rect.SetSize(size); |
|
669 #endif |
|
670 for (ii=0;ii<15;++ii) |
|
671 { |
|
672 win[ii]->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren); |
|
673 retVal = win[ii]->BaseWin()->IsFaded(); |
|
674 TEST(retVal==1); |
|
675 if (retVal!=1) |
|
676 INFO_PRINTF3(_L("win[ii]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), 1, retVal); |
|
677 |
|
678 TestStrips(rect,height,ii); |
|
679 win[ii]->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren); |
|
680 retBool = !win[ii]->BaseWin()->IsFaded(); |
|
681 TEST(retBool); |
|
682 if (!retBool) |
|
683 INFO_PRINTF3(_L("!win[ii]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
684 |
|
685 TestStrips(rect,height,16); |
|
686 } |
|
687 TheClient->iGroup->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren); |
|
688 TestStrips(rect,height,0); |
|
689 TheClient->iGroup->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren); |
|
690 TestStrips(rect,height,16); |
|
691 for (ii=0;ii<16;++ii) |
|
692 { |
|
693 win[ii]->BaseWin()->FadeBehind(ETrue); |
|
694 retBool = !win[ii]->BaseWin()->IsFaded(); |
|
695 TEST(retBool); |
|
696 if (!retBool) |
|
697 INFO_PRINTF3(_L("!win[ii]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
698 |
|
699 retVal = win[0]->BaseWin()->IsFaded(); |
|
700 TEST(retVal==(ii>0)); |
|
701 if (retVal!=(ii>0)) |
|
702 INFO_PRINTF3(_L("win[0]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), (ii>0), retVal); |
|
703 |
|
704 TestStrips(rect,height,ii,ETrue); |
|
705 win[ii]->BaseWin()->FadeBehind(EFalse); |
|
706 TestStrips(rect,height,16); |
|
707 } |
|
708 iBlankWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren); |
|
709 TestStrips(rect,height,0); |
|
710 iBlankWin->WinTreeNode()->SetNonFading(ETrue); |
|
711 TestStrips(rect,height,16); |
|
712 win[8]->WinTreeNode()->SetNonFading(EFalse); |
|
713 TestStrips(rect,height,8); |
|
714 iBlankWin->WinTreeNode()->SetNonFading(EFalse); |
|
715 TestStrips(rect,height,0); |
|
716 iBlankWin->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren); |
|
717 TestStrips(rect,height,16); |
|
718 win[8]->WinTreeNode()->SetNonFading(ETrue); |
|
719 TestStrips(rect,height,16); |
|
720 iBlankWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren); |
|
721 TestStrips(rect,height,8,ETrue); |
|
722 win[8]->WinTreeNode()->SetNonFading(EFalse); |
|
723 TestStrips(rect,height,0); |
|
724 iBlankWin->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren); |
|
725 TestStrips(rect,height,16); |
|
726 for (ii=15;ii>0;--ii) |
|
727 delete win[ii]; |
|
728 } |
|
729 |
|
730 static void ResetAndDestroyWindows(TAny* aPtr) |
|
731 { |
|
732 RPointerArray<CTBlankWindow>& win = *(static_cast<RPointerArray<CTBlankWindow>*>(aPtr)); |
|
733 win.Remove(0); |
|
734 win.ResetAndDestroy(); |
|
735 win.Close(); |
|
736 } |
|
737 |
|
738 void CTFade::FadeChildrenAfterNewChildIsCreatedL() |
|
739 { |
|
740 if (MaxGrays()==0 && MaxColors()<256) |
|
741 return; |
|
742 |
|
743 TBool retBool; |
|
744 TInt retVal; |
|
745 |
|
746 __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow)); |
|
747 iBlankWin->BaseWin()->SetRequiredDisplayMode(iFadeDrawMode); |
|
748 iBlankWin->SetColor(TRgb::Gray16(0)); |
|
749 RPointerArray<CTBlankWindow> win; |
|
750 CleanupStack::PushL(TCleanupItem(ResetAndDestroyWindows, &win)); |
|
751 TInt height=iTestWinSize.iHeight/NUMBER_OF_WINDOWS; |
|
752 CTBlankWindow* window=NULL; |
|
753 TInt ii; |
|
754 for (TInt firstLoop=0;firstLoop<NUMBER_OF_WINDOWS-1;) |
|
755 { |
|
756 win.ResetAndDestroy(); |
|
757 TheClient->iGroup->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren); |
|
758 TRect rect(iTestWinSize); |
|
759 rect.iTl.iY=height; |
|
760 CTBlankWindow* parent=iBlankWin; |
|
761 for (TInt secondLoop=0;secondLoop<=firstLoop;) |
|
762 { |
|
763 window=new(ELeave) CTBlankWindow(); |
|
764 CleanupStack::PushL(window); |
|
765 User::LeaveIfError(win.Append(window)); |
|
766 CleanupStack::Pop(window); |
|
767 window->SetUpL(rect.iTl,rect.Size(),parent,*TheClient->iGc); |
|
768 window->BaseWin()->SetRequiredDisplayMode(iFadeDrawMode); |
|
769 window->SetColor(TRgb::Gray16(++secondLoop)); |
|
770 rect.iBr.iY-=height; |
|
771 parent=window; |
|
772 retBool = window->BaseWin()->IsFaded(); |
|
773 TEST(retBool); |
|
774 if (!retBool) |
|
775 INFO_PRINTF3(_L("window->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
776 |
|
777 } |
|
778 ++firstLoop; |
|
779 TheClient->iGroup->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren); |
|
780 const TInt count=win.Count(); |
|
781 for(TInt index=0;index<count;++index) |
|
782 { |
|
783 retBool = win[index]->BaseWin()->IsFaded(); |
|
784 TEST(!retBool); |
|
785 if (retBool) |
|
786 INFO_PRINTF3(_L("win[index]->BaseWin()->IsFaded return value - Expected: %d, Actual: %d"), EFalse, retBool); |
|
787 |
|
788 } |
|
789 } |
|
790 User::LeaveIfError(win.Insert(iBlankWin,0)); |
|
791 TRect testRect=iWindowRect; |
|
792 testRect.SetHeight(height); |
|
793 #if defined(SMALL_RECTS) |
|
794 TSize size(testRect.Size()); |
|
795 size.iWidth=Min(SIZE_X,size.iWidth); |
|
796 size.iHeight=Min(SIZE_Y,size.iHeight); |
|
797 testRect.SetSize(size); |
|
798 #endif |
|
799 for (ii=0;ii<NUMBER_OF_WINDOWS;++ii) |
|
800 { |
|
801 win[ii]->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren); |
|
802 retVal = win[ii]->BaseWin()->IsFaded(); |
|
803 TEST(retVal==1); |
|
804 if (retVal!=1) |
|
805 INFO_PRINTF3(_L("win[index]->BaseWin()->IsFaded return value - Expected: %d, Actual: %d"), 1, retVal); |
|
806 |
|
807 TestStrips(testRect,height,ii); |
|
808 win[ii]->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren); |
|
809 retBool = !win[ii]->BaseWin()->IsFaded(); |
|
810 TEST(retBool); |
|
811 if (!retBool) |
|
812 INFO_PRINTF3(_L("!win[ii]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), EFalse, retBool); |
|
813 |
|
814 TestStrips(testRect,height,NUMBER_OF_WINDOWS); |
|
815 } |
|
816 TheClient->iGroup->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren); |
|
817 TestStrips(testRect,height,0); |
|
818 TheClient->iGroup->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren); |
|
819 TestStrips(testRect,height,16); |
|
820 for (ii=0;ii<NUMBER_OF_WINDOWS;++ii) |
|
821 { |
|
822 win[ii]->BaseWin()->FadeBehind(ETrue); |
|
823 retBool = !win[ii]->BaseWin()->IsFaded(); |
|
824 TEST(retBool); |
|
825 if (!retBool) |
|
826 INFO_PRINTF3(_L("!win[ii]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), EFalse, retBool); |
|
827 |
|
828 retVal = win[0]->BaseWin()->IsFaded(); |
|
829 TEST(retVal==(ii>0)); |
|
830 if (retVal!=(ii>0)) |
|
831 INFO_PRINTF3(_L("win[index]->BaseWin()->IsFaded return value - Expected: %d, Actual: %d"), (ii>0), retVal); |
|
832 |
|
833 TestStrips(testRect,height,ii,ETrue); |
|
834 win[ii]->BaseWin()->FadeBehind(EFalse); |
|
835 TestStrips(testRect,height,NUMBER_OF_WINDOWS); |
|
836 } |
|
837 iBlankWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren); |
|
838 TestStrips(testRect,height,0); |
|
839 iBlankWin->WinTreeNode()->SetNonFading(ETrue); |
|
840 TestStrips(testRect,height,NUMBER_OF_WINDOWS); |
|
841 win[8]->WinTreeNode()->SetNonFading(EFalse); |
|
842 TestStrips(testRect,height,NUMBER_OF_WINDOWS/2); |
|
843 iBlankWin->WinTreeNode()->SetNonFading(EFalse); |
|
844 TestStrips(testRect,height,0); |
|
845 iBlankWin->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren); |
|
846 TestStrips(testRect,height,NUMBER_OF_WINDOWS); |
|
847 win[8]->WinTreeNode()->SetNonFading(ETrue); |
|
848 TestStrips(testRect,height,NUMBER_OF_WINDOWS); |
|
849 iBlankWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren); |
|
850 TestStrips(testRect,height,NUMBER_OF_WINDOWS/2,ETrue); |
|
851 win[8]->WinTreeNode()->SetNonFading(EFalse); |
|
852 TestStrips(testRect,height,0); |
|
853 iBlankWin->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren); |
|
854 TestStrips(testRect,height,NUMBER_OF_WINDOWS); |
|
855 |
|
856 CleanupStack::PopAndDestroy(&win); |
|
857 } |
|
858 |
|
859 void CTFade::TestBlocks(TRect aRect,TSize aSize,TInt aNumNotFaded,TBool aInvert/*=EFalse*/) |
|
860 { |
|
861 TInt count=0; |
|
862 TInt ii,jj; |
|
863 TRgb col; |
|
864 for (ii=0;ii<4;++ii) |
|
865 { |
|
866 for (jj=0;jj<4;++jj) |
|
867 { |
|
868 if ((!aInvert)!=(!(count<aNumNotFaded))) |
|
869 col=TRgb::Gray16(count); |
|
870 else |
|
871 { |
|
872 col = TRgb::Gray16(count); |
|
873 col = MODE_LT_64K(iDeviceDisplayMode)?TRgb::Gray16(Fade16(count)):FadeRgb(col); |
|
874 } |
|
875 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
876 TBool retBool = CheckBlankWindow(aRect,col,TheClient->iScreen); |
|
877 #else |
|
878 TBool retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, aRect, col); |
|
879 #endif |
|
880 TEST(retBool); |
|
881 if (!retBool) |
|
882 INFO_PRINTF3(_L("CheckBlankWindow(aRect,col,TheClient->iScreen) return value - Expected: %d, Actual: %d"), EFalse, retBool); |
|
883 |
|
884 aRect.Move(0,aSize.iHeight); |
|
885 count++; |
|
886 } |
|
887 aRect.Move(aSize.iWidth,-jj*aSize.iHeight); |
|
888 } |
|
889 } |
|
890 |
|
891 void CTFade::FadeBehindL() |
|
892 { |
|
893 if (MaxGrays()==0 && MaxColors()<256) |
|
894 return; |
|
895 |
|
896 TBool retBool; |
|
897 TInt retVal; |
|
898 |
|
899 __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow)); |
|
900 iBlankWin->BaseWin()->SetRequiredDisplayMode(EGray16); |
|
901 iBlankWin->SetColor(TRgb::Gray16(0)); |
|
902 CTBlankWindow* win[4][4]; |
|
903 win[0][0]=iBlankWin; |
|
904 TSize size=iTestWinSize; |
|
905 TInt height=iTestWinSize.iHeight/4; |
|
906 TInt width=iTestWinSize.iWidth/4; |
|
907 TRect rect(iWindowRect.iTl,TSize(width,height)); |
|
908 TSize rectSize(rect.Size()); |
|
909 TPoint offset(0,height); |
|
910 TPoint topLeft; |
|
911 TInt ii,jj; |
|
912 CTWinBase* parent; |
|
913 #if defined(SMALL_RECTS) |
|
914 TSize rSize(rectSize); |
|
915 rSize.iWidth=Min(SIZE_X,rSize.iWidth); |
|
916 rSize.iHeight=Min(SIZE_Y,rSize.iHeight); |
|
917 rect.SetSize(rSize); |
|
918 #endif |
|
919 for (ii=0;ii<4;++ii) //Causes memory leakage under OOM |
|
920 { |
|
921 parent=TheClient->iGroup; |
|
922 topLeft=iWindowRect.iTl+TPoint(ii*width,0); |
|
923 size.iHeight=iTestWinSize.iHeight; |
|
924 for (jj=0;jj<4;++jj) |
|
925 { |
|
926 if (ii+jj>0) |
|
927 { |
|
928 win[ii][jj]=new(ELeave) CTBlankWindow(); |
|
929 win[ii][jj]->SetUpL(topLeft,size,parent,*TheClient->iGc); |
|
930 win[ii][jj]->BaseWin()->SetRequiredDisplayMode(EGray16); |
|
931 win[ii][jj]->SetColor(TRgb::Gray16(4*ii+jj)); |
|
932 } |
|
933 size.iHeight-=height; |
|
934 topLeft=offset; |
|
935 parent=win[ii][jj]; |
|
936 } |
|
937 size.iWidth-=width; |
|
938 } |
|
939 for (ii=0;ii<4;++ii) |
|
940 { |
|
941 for (jj=0;jj<4;++jj) |
|
942 { |
|
943 win[ii][jj]->BaseWin()->FadeBehind(ETrue); |
|
944 retVal = win[0][0]->BaseWin()->IsFaded(); |
|
945 TEST(retVal==(ii>0||jj>0)); |
|
946 if (retVal!=(ii>0||jj>0)) |
|
947 INFO_PRINTF3(_L("win[0][0]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), (ii>0||jj>0), retVal); |
|
948 |
|
949 retBool = !win[ii][jj]->BaseWin()->IsFaded(); |
|
950 TEST(retBool); |
|
951 if (!retBool) |
|
952 INFO_PRINTF3(_L("!win[ii][jj]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
953 |
|
954 TestBlocks(rect,rectSize,4*ii+jj,ETrue); |
|
955 win[ii][jj]->BaseWin()->FadeBehind(EFalse); |
|
956 TestBlocks(rect,rectSize,16); |
|
957 } |
|
958 } |
|
959 for (ii=0;ii<4;++ii) |
|
960 { |
|
961 for (jj=0;jj<4;++jj) |
|
962 { |
|
963 win[ii][jj]->BaseWin()->FadeBehind(ETrue); |
|
964 TestBlocks(rect,rectSize,4*ii+jj,ETrue); |
|
965 } |
|
966 retVal = win[ii][0]->BaseWin()->IsFaded(); |
|
967 TEST(retVal==3); |
|
968 if (retVal!=3) |
|
969 INFO_PRINTF3(_L("win[ii][0]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), 3, retVal); |
|
970 } |
|
971 for (ii=3;ii>=0;--ii) |
|
972 { |
|
973 retVal = win[ii][0]->BaseWin()->IsFaded(); |
|
974 TEST(retVal==3); |
|
975 if (retVal!=3) |
|
976 INFO_PRINTF3(_L("win[ii][0]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), 3, retVal); |
|
977 |
|
978 for (jj=3;jj>=0;--jj) |
|
979 { |
|
980 TestBlocks(rect,rectSize,4*ii+jj,ETrue); |
|
981 win[ii][jj]->BaseWin()->FadeBehind(EFalse); |
|
982 } |
|
983 } |
|
984 TestBlocks(rect,rectSize,0,ETrue); |
|
985 for (ii=0;ii<4;++ii) |
|
986 { |
|
987 for (jj=0;jj<4;++jj) |
|
988 { |
|
989 win[ii][jj]->BaseWin()->FadeBehind(ETrue); |
|
990 } |
|
991 } |
|
992 TInt fadeCount; |
|
993 for (ii=0;ii<4;++ii) |
|
994 { |
|
995 for (jj=0;jj<4;++jj) |
|
996 { |
|
997 fadeCount=15-(4*ii+jj); |
|
998 retVal = win[0][0]->BaseWin()->IsFaded(); |
|
999 TEST(retVal==Min(15,fadeCount+1)); |
|
1000 if (retVal!=Min(15,fadeCount+1)) |
|
1001 INFO_PRINTF3(_L("win[0][0]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), Min(15,fadeCount+1), retVal); |
|
1002 |
|
1003 retVal = win[ii][jj]->BaseWin()->IsFaded(); |
|
1004 TEST(retVal==Max(0,fadeCount)); |
|
1005 if (retVal!=Max(0,fadeCount)) |
|
1006 INFO_PRINTF3(_L("win[ii][jj]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), Max(0,fadeCount), retVal); |
|
1007 |
|
1008 TestBlocks(rect,rectSize,15,ETrue); |
|
1009 win[ii][jj]->BaseWin()->FadeBehind(EFalse); |
|
1010 retVal = win[ii][jj]->BaseWin()->IsFaded(); |
|
1011 TEST(retVal==Max(0,fadeCount)); |
|
1012 if (retVal!=Max(0,fadeCount)) |
|
1013 INFO_PRINTF3(_L("win[ii][jj]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), Max(0,fadeCount), retVal); |
|
1014 |
|
1015 } |
|
1016 } |
|
1017 TestBlocks(rect,rectSize,0,ETrue); |
|
1018 if (Fade16(15)==15) |
|
1019 { |
|
1020 win[3][3]->BaseWin()->FadeBehind(ETrue); //All faded as the only unfaded one is white |
|
1021 for (ii=3;ii>=0;--ii) |
|
1022 { |
|
1023 retVal = win[ii][0]->BaseWin()->IsFaded(); |
|
1024 TEST(retVal==1); |
|
1025 if (retVal!=1) |
|
1026 INFO_PRINTF3(_L("win[ii][0]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), 1, retVal); |
|
1027 |
|
1028 retBool = !win[ii][1]->BaseWin()->IsNonFading(); |
|
1029 TEST(retBool); |
|
1030 if (!retBool) |
|
1031 INFO_PRINTF3(_L("!win[ii][1]->BaseWin()->IsNonFading() return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
1032 |
|
1033 win[ii][0]->WinTreeNode()->SetNonFading(ETrue); |
|
1034 retBool = win[ii][1]->BaseWin()->IsNonFading(); |
|
1035 TEST(retBool); |
|
1036 if (!retBool) |
|
1037 INFO_PRINTF3(_L("win[ii][1]->BaseWin()->IsNonFading() return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
1038 |
|
1039 TestBlocks(rect,rectSize,4*ii,ETrue); |
|
1040 } |
|
1041 for (ii=3;ii>=0;--ii) |
|
1042 { |
|
1043 retVal = win[ii][0]->BaseWin()->IsFaded(); |
|
1044 TEST(retVal==1); |
|
1045 if (retVal!=1) |
|
1046 INFO_PRINTF3(_L("win[ii][0]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), 1, retVal); |
|
1047 |
|
1048 retBool = win[ii][1]->BaseWin()->IsNonFading(); |
|
1049 TEST(retBool); |
|
1050 if (!retBool) |
|
1051 INFO_PRINTF3(_L("win[ii][1]->BaseWin()->IsNonFading() return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
1052 |
|
1053 win[ii][0]->WinTreeNode()->SetNonFading(EFalse); |
|
1054 retBool = !win[ii][1]->BaseWin()->IsNonFading(); |
|
1055 TEST(retBool); |
|
1056 if (!retBool) |
|
1057 INFO_PRINTF3(_L("win[ii][1]->BaseWin()->IsNonFading() return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
1058 |
|
1059 TestBlocks(rect,rectSize,4*ii); |
|
1060 } |
|
1061 win[3][3]->BaseWin()->FadeBehind(EFalse); |
|
1062 } |
|
1063 for (ii=3;ii>=0;--ii) |
|
1064 { |
|
1065 for (jj=3;jj>=0;--jj) |
|
1066 { |
|
1067 if (ii+jj>0) |
|
1068 delete win[ii][jj]; |
|
1069 } |
|
1070 } |
|
1071 } |
|
1072 |
|
1073 void CTFade::ColorTest2() |
|
1074 { |
|
1075 #if defined(__MARM__) |
|
1076 return; |
|
1077 #else |
|
1078 __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow)); |
|
1079 TSize size=iTestWinSize; |
|
1080 #if defined(SMALL_RECTS) |
|
1081 size.iWidth=Min(SIZE_X,size.iWidth); |
|
1082 size.iHeight=Min(SIZE_Y,size.iHeight); |
|
1083 #endif |
|
1084 if (MaxGrays()==0 && MaxColors()<256) |
|
1085 return; |
|
1086 TRect windowRect(iBlankWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),size); |
|
1087 TUint8 bm; |
|
1088 TUint8 wm; |
|
1089 TInt test=0; |
|
1090 TInt ii; |
|
1091 FOREVER |
|
1092 { |
|
1093 TInt fadeMapFactor = 0; |
|
1094 TInt fadeMapOffset = 0; |
|
1095 |
|
1096 switch (test) |
|
1097 { |
|
1098 case 0: //Nothing |
|
1099 bm=0; |
|
1100 wm=15; |
|
1101 break; |
|
1102 case 1: //Shadowing or Quartz fading |
|
1103 bm=0; |
|
1104 wm=7; |
|
1105 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
1106 TheClient->iWs.SetDefaultFadingParameters(0,127); |
|
1107 fadeMapFactor = 128; |
|
1108 #else |
|
1109 TheClient->iWs.SetDefaultFadingParameters(STATIC_CAST(TUint8,bm*17),127); |
|
1110 fadeMapFactor = 127-STATIC_CAST(TUint8,bm*17); |
|
1111 #endif |
|
1112 break; |
|
1113 default: |
|
1114 TheClient->iWs.SetDefaultFadingParameters(BLACK_NORMAL,WHITE_NORMAL); |
|
1115 return; |
|
1116 } |
|
1117 if (wm!=7) |
|
1118 { |
|
1119 fadeMapOffset = STATIC_CAST(TUint8,bm*17); |
|
1120 fadeMapFactor = STATIC_CAST(TUint8,wm*17) - fadeMapOffset; |
|
1121 TheClient->iWs.SetDefaultFadingParameters(STATIC_CAST(TUint8,bm*17),STATIC_CAST(TUint8,wm*17)); |
|
1122 } |
|
1123 |
|
1124 for (ii=0;ii<16;ii+=5) |
|
1125 { |
|
1126 iBlankWin->SetColor(TRgb::Gray16(ii)); |
|
1127 ViewDelay(); |
|
1128 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
1129 TBool retBool=CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen); |
|
1130 #else |
|
1131 TBool retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray16(ii)); |
|
1132 #endif |
|
1133 TEST(retBool); |
|
1134 if (!retBool) |
|
1135 { |
|
1136 _LIT(KLog,"Setting color on blank window failed mappings=%d color=%d"); |
|
1137 LOG_MESSAGE3(KLog,test,ii); |
|
1138 } |
|
1139 iBlankWin->BaseWin()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly); |
|
1140 ViewDelay(); |
|
1141 |
|
1142 TRgb col1 = FadeRgb(TRgb::Gray16(ii), fadeMapFactor, fadeMapOffset); |
|
1143 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
1144 retBool=CheckBlankWindow(windowRect,col1,TheClient->iScreen); |
|
1145 #else |
|
1146 retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, col1); |
|
1147 #endif |
|
1148 TEST(retBool); |
|
1149 if (!retBool) |
|
1150 { |
|
1151 _LIT(KLog,"Fading the window gave wrong color mappings=%d color=%d"); |
|
1152 LOG_MESSAGE3(KLog,test,ii); |
|
1153 } |
|
1154 iBlankWin->BaseWin()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly); |
|
1155 ViewDelay(); |
|
1156 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
1157 retBool=CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen); |
|
1158 #else |
|
1159 retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray16(ii)); |
|
1160 #endif |
|
1161 TEST(retBool); |
|
1162 if (!retBool) |
|
1163 { |
|
1164 _LIT(KLog,"Unfading the window gave wrong color mappings=%d color=%d"); |
|
1165 LOG_MESSAGE3(KLog,test,ii); |
|
1166 } |
|
1167 } |
|
1168 ++test; |
|
1169 } |
|
1170 #endif //__MARM__ |
|
1171 } |
|
1172 |
|
1173 void CTFade::FadeTest() |
|
1174 { |
|
1175 #if defined(__MARM__) |
|
1176 return; |
|
1177 #else |
|
1178 __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow)); |
|
1179 TSize size=iTestWinSize; |
|
1180 #if defined(SMALL_RECTS) |
|
1181 size.iWidth=Min(SIZE_X,size.iWidth); |
|
1182 size.iHeight=Min(SIZE_Y,size.iHeight); |
|
1183 #endif |
|
1184 if (MaxGrays()==0 && MaxColors()<256) |
|
1185 return; |
|
1186 TRect windowRect(iBlankWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),size); |
|
1187 TUint8 bm; |
|
1188 TUint8 wm; |
|
1189 TUint8 fb; |
|
1190 TUint8 fw; |
|
1191 TInt test=0; |
|
1192 TInt ii; |
|
1193 FOREVER |
|
1194 { |
|
1195 TInt fadeMapFactor = 0; |
|
1196 TInt fadeMapOffset = 0; |
|
1197 fw=0; |
|
1198 switch (test) |
|
1199 { |
|
1200 case 0: //Nothing |
|
1201 bm=0; |
|
1202 wm=15; |
|
1203 break; |
|
1204 case 1: //Shadowing or Quartz fading |
|
1205 |
|
1206 bm=0; |
|
1207 wm=7; |
|
1208 fw=127; |
|
1209 break; |
|
1210 default: |
|
1211 return; |
|
1212 } |
|
1213 fb=STATIC_CAST(TUint8,17*bm); |
|
1214 if (!fw) |
|
1215 fw=STATIC_CAST(TUint8,17*wm); |
|
1216 fadeMapFactor = fw - fb; |
|
1217 fadeMapOffset = fb; |
|
1218 for (ii=0;ii<16;ii+=5) |
|
1219 { |
|
1220 iBlankWin->SetColor(TRgb::Gray16(ii)); |
|
1221 ViewDelay(); |
|
1222 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
1223 TBool retBool = CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen); |
|
1224 #else |
|
1225 TBool retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray16(ii)); |
|
1226 #endif |
|
1227 TEST(retBool); |
|
1228 if (!retBool) |
|
1229 INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
1230 |
|
1231 TRgb col3 = TRgb::Gray16(ii).Internal(); |
|
1232 TRgb col1 = FadeRgb(col3, fadeMapFactor, fadeMapOffset); |
|
1233 iBlankWin->BaseWin()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly,fb,fw); |
|
1234 ViewDelay(); |
|
1235 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
1236 retBool = CheckBlankWindow(windowRect,col1,TheClient->iScreen); |
|
1237 #else |
|
1238 retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, col1); |
|
1239 #endif |
|
1240 TEST(retBool); |
|
1241 if (!retBool) |
|
1242 INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray16((ii*wb+add)/15),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
1243 |
|
1244 iBlankWin->BaseWin()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly); |
|
1245 ViewDelay(); |
|
1246 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
1247 retBool = CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen); |
|
1248 #else |
|
1249 retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray16(ii)); |
|
1250 #endif |
|
1251 TEST(retBool); |
|
1252 if (!retBool) |
|
1253 INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
1254 |
|
1255 } |
|
1256 ++test; |
|
1257 } |
|
1258 #endif //__MARM__ |
|
1259 } |
|
1260 |
|
1261 void CTFade::Draw(TBool aAlternativeFade/*=EFalse*/) |
|
1262 { |
|
1263 __ASSERT_ALWAYS(iWin,AutoPanic(EAutoFadeWindow)); |
|
1264 TRgb grey=TRgb::Gray4(2); |
|
1265 Draw(0,&grey,aAlternativeFade); |
|
1266 Draw(1,NULL,aAlternativeFade); |
|
1267 iContent=1; |
|
1268 CompareWithBitmap(EFalse); |
|
1269 if (aAlternativeFade) |
|
1270 iWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly,BLACK_ALTERNATE,WHITE_ALTERNATE); |
|
1271 else |
|
1272 iWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly); |
|
1273 CompareWithBitmap(ETrue); |
|
1274 Draw(3,NULL,aAlternativeFade); |
|
1275 iContent=2; |
|
1276 CompareWithBitmap(ETrue); |
|
1277 iWin->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly); |
|
1278 CompareWithBitmap(EFalse); |
|
1279 } |
|
1280 |
|
1281 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
1282 void CTFade::GCDraw() |
|
1283 { |
|
1284 __ASSERT_ALWAYS(iWin,AutoPanic(EAutoFadeWindow)); |
|
1285 TRgb grey=TRgb::Gray4(2); |
|
1286 TInt ii; |
|
1287 GCDraw(0,&grey); |
|
1288 GCDraw(3,NULL); |
|
1289 for (ii=3;ii<70;ii+=13) |
|
1290 GCDraw(2,&ii); |
|
1291 iContent=6; |
|
1292 CompareWindows(); |
|
1293 GCDraw(0,&grey,ETrue); |
|
1294 GCDraw(3,NULL,ETrue); |
|
1295 for (ii=3;ii<70;ii+=13) |
|
1296 GCDraw(2,&ii,ETrue); |
|
1297 GCDraw(1,NULL,ETrue); |
|
1298 iContent=7; |
|
1299 CompareWindows(ETrue); |
|
1300 } |
|
1301 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
1302 |
|
1303 void CTFade::ObscuredL() |
|
1304 { |
|
1305 CTBlankWindow* blankWin=new(ELeave) CTBlankWindow(); |
|
1306 TRect windowRect(iWindowRect); |
|
1307 windowRect.Shrink(30,30); |
|
1308 blankWin->SetUpL(windowRect.iTl,windowRect.Size(),TheClient->iGroup,*TheClient->iGc); |
|
1309 |
|
1310 __ASSERT_ALWAYS(iWin,AutoPanic(EAutoFadeWindow)); |
|
1311 TRgb grey=TRgb::Gray4(2); |
|
1312 Draw(0,&grey); |
|
1313 Draw(3,NULL); |
|
1314 iContent=3; |
|
1315 iWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly); |
|
1316 blankWin->SetVisible(EFalse); |
|
1317 CompareWithBitmap(ETrue); |
|
1318 blankWin->SetVisible(ETrue); |
|
1319 grey=TRgb::Gray4(1); |
|
1320 Draw(0,&grey); |
|
1321 for (TInt ii=1;ii<37;ii+=7) |
|
1322 Draw(2,&ii); |
|
1323 iContent=4; |
|
1324 blankWin->SetVisible(EFalse); |
|
1325 CompareWithBitmap(ETrue); |
|
1326 blankWin->SetVisible(ETrue); |
|
1327 iWin->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly); |
|
1328 blankWin->SetVisible(EFalse); |
|
1329 CompareWithBitmap(EFalse); |
|
1330 |
|
1331 delete blankWin; |
|
1332 } |
|
1333 |
|
1334 void CTFade::MovingL() |
|
1335 { |
|
1336 CTBlankWindow* blankWin=new(ELeave) CTBlankWindow(); |
|
1337 TRect windowRect(iWindowRect); |
|
1338 windowRect.Shrink(40,40); |
|
1339 blankWin->SetUpL(windowRect.iTl,windowRect.Size(),TheClient->iGroup,*TheClient->iGc); |
|
1340 |
|
1341 __ASSERT_ALWAYS(iWin,AutoPanic(EAutoFadeWindow)); |
|
1342 TRgb grey=TRgb::Gray4(2); |
|
1343 Draw(0,&grey); |
|
1344 Draw(1,NULL); |
|
1345 for (TInt ii=2;ii<60;ii+=11) |
|
1346 Draw(2,&ii); |
|
1347 iContent=5; |
|
1348 blankWin->SetPos(windowRect.iTl+TPoint(25,-25)); |
|
1349 iWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly); |
|
1350 blankWin->SetPos(windowRect.iTl+TPoint(10,25)); |
|
1351 blankWin->SetVisible(EFalse); |
|
1352 CompareWithBitmap(ETrue); |
|
1353 blankWin->SetVisible(ETrue); |
|
1354 blankWin->SetPos(windowRect.iTl+TPoint(25,-25)); |
|
1355 iWin->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly); |
|
1356 blankWin->SetPos(windowRect.iTl+TPoint(-5,10)); |
|
1357 blankWin->SetVisible(EFalse); |
|
1358 CompareWithBitmap(EFalse); |
|
1359 |
|
1360 delete blankWin; |
|
1361 } |
|
1362 |
|
1363 void CTFade::SystemFadeL() |
|
1364 { |
|
1365 if (MaxGrays()==0 && MaxColors()<256) |
|
1366 return; |
|
1367 |
|
1368 CTBlankWindow* win[16]; |
|
1369 TInt height=iTestWinSize.iHeight/16; |
|
1370 TRect rect(iWindowRect); |
|
1371 rect.SetHeight(height); |
|
1372 TInt ii; |
|
1373 for (ii=0;ii<16;++ii) //Causes memory leakage under OOM |
|
1374 { |
|
1375 win[ii]=new(ELeave) CTBlankWindow(); |
|
1376 win[ii]->SetUpL(rect.iTl,rect.Size(),TheClient->iGroup,*TheClient->iGc); |
|
1377 win[ii]->BaseWin()->SetRequiredDisplayMode(EGray16); |
|
1378 win[ii]->SetColor(TRgb::Gray16(ii)); |
|
1379 rect.Move(0,height); |
|
1380 } |
|
1381 rect=iWindowRect; |
|
1382 rect.SetHeight(height); |
|
1383 #if defined(SMALL_RECTS) |
|
1384 TSize size(rect.Size()); |
|
1385 size.iWidth=Min(SIZE_X,size.iWidth); |
|
1386 size.iHeight=Min(SIZE_Y,size.iHeight); |
|
1387 rect.SetSize(size); |
|
1388 #endif |
|
1389 |
|
1390 TBool retBool; |
|
1391 |
|
1392 // system fade on |
|
1393 TheClient->iWs.SetSystemFaded(ETrue); |
|
1394 for (ii=0;ii<16;++ii) |
|
1395 { |
|
1396 retBool = win[ii]->BaseWin()->IsFaded(); |
|
1397 TEST(retBool); |
|
1398 if (!retBool) |
|
1399 INFO_PRINTF3(_L("win[ii]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
1400 } |
|
1401 TestStrips(rect,height,0); |
|
1402 |
|
1403 // system fade off |
|
1404 TheClient->iWs.SetSystemFaded(EFalse); |
|
1405 for (ii=0;ii<16;++ii) |
|
1406 { |
|
1407 retBool = !win[ii]->BaseWin()->IsFaded(); |
|
1408 TEST(retBool); |
|
1409 if (!retBool) |
|
1410 INFO_PRINTF3(_L("!win[ii]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
1411 } |
|
1412 TestStrips(rect,height,16); |
|
1413 |
|
1414 // Now with half non fading |
|
1415 for (ii=8;ii<16;++ii) |
|
1416 win[ii]->WinTreeNode()->SetNonFading(ETrue); |
|
1417 |
|
1418 // system fade on |
|
1419 TheClient->iWs.SetSystemFaded(ETrue); |
|
1420 TestStrips(rect,height,8,ETrue); |
|
1421 |
|
1422 // system fade off |
|
1423 TheClient->iWs.SetSystemFaded(EFalse); |
|
1424 TestStrips(rect,height,16); |
|
1425 |
|
1426 for (ii=0;ii<16;++ii) |
|
1427 delete win[ii]; |
|
1428 } |
|
1429 |
|
1430 void CTFade::SystemAlternateFadeL() |
|
1431 { |
|
1432 #if defined(__MARM__) |
|
1433 return; |
|
1434 #else |
|
1435 __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow)); |
|
1436 TSize size=iTestWinSize; |
|
1437 #if defined(SMALL_RECTS) |
|
1438 size.iWidth=Min(SIZE_X,size.iWidth); |
|
1439 size.iHeight=Min(SIZE_Y,size.iHeight); |
|
1440 #endif |
|
1441 if (MaxGrays()==0 && MaxColors()<256) |
|
1442 return; |
|
1443 TRect windowRect(iBlankWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),size); |
|
1444 TUint8 bm; |
|
1445 TUint8 wm; |
|
1446 TUint8 fb; |
|
1447 TUint8 fw; |
|
1448 TInt wb; |
|
1449 TInt add; |
|
1450 TInt test=0; |
|
1451 TInt ii; |
|
1452 TBool retBool; |
|
1453 FOREVER |
|
1454 { |
|
1455 TInt fadeMapFactor = 0; |
|
1456 TInt fadeMapOffset = 0; |
|
1457 fw=0; |
|
1458 switch (test) |
|
1459 { |
|
1460 case 0: //Nothing |
|
1461 bm=0; |
|
1462 wm=15; |
|
1463 break; |
|
1464 case 1: //Shadowing or Quartz fading |
|
1465 bm=0; |
|
1466 wm=7; |
|
1467 fw=127; |
|
1468 break; |
|
1469 default: |
|
1470 return; |
|
1471 } |
|
1472 wb=wm-bm; |
|
1473 add=15*bm+7; |
|
1474 fb=STATIC_CAST(TUint8,17*bm); |
|
1475 if (!fw) |
|
1476 fw=STATIC_CAST(TUint8,17*wm); |
|
1477 fadeMapFactor = fw - fb; |
|
1478 fadeMapOffset = fb; |
|
1479 for (ii=0;ii<16;ii+=5) |
|
1480 { |
|
1481 iBlankWin->SetColor(TRgb::Gray16(ii)); |
|
1482 ViewDelay(); |
|
1483 TheClient->iWs.Finish(); |
|
1484 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
1485 retBool = CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen); |
|
1486 #else |
|
1487 retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray16(ii)); |
|
1488 #endif |
|
1489 TEST(retBool); |
|
1490 if (!retBool) |
|
1491 INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
1492 |
|
1493 TheClient->iWs.SetSystemFaded(ETrue,fb,fw); |
|
1494 ViewDelay(); |
|
1495 |
|
1496 TRgb col3 = TRgb::Gray16(ii).Internal(); |
|
1497 TRgb col1 = FadeRgb(col3, fadeMapFactor, fadeMapOffset); |
|
1498 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
1499 retBool = CheckBlankWindow(windowRect,col1,TheClient->iScreen); |
|
1500 #else |
|
1501 retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, col1); |
|
1502 #endif |
|
1503 TEST(retBool); |
|
1504 if (!retBool) |
|
1505 INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray16((ii*wb+add)/15),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
1506 |
|
1507 TheClient->iWs.SetSystemFaded(EFalse); |
|
1508 ViewDelay(); |
|
1509 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
1510 retBool = CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen); |
|
1511 #else |
|
1512 retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray16(ii)); |
|
1513 #endif |
|
1514 TEST(retBool); |
|
1515 if (!retBool) |
|
1516 INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
1517 } |
|
1518 ++test; |
|
1519 } |
|
1520 #endif //__MARM__ |
|
1521 } |
|
1522 |
|
1523 void CTFade::FadeBehindWhenMovedL() |
|
1524 { |
|
1525 __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow)); |
|
1526 TDisplayMode displayMode=iBlankWin->BaseWin()->DisplayMode(); |
|
1527 iBlankWin->BaseWin()->SetRequiredDisplayMode(EGray16); |
|
1528 iBlankWin->SetColor(TRgb::Gray16(1)); |
|
1529 TSize size(iTestWinSize.iHeight/4,iTestWinSize.iWidth/4); |
|
1530 CTBlankWindow* blankWinTemp=new(ELeave) CTBlankWindow(); |
|
1531 CleanupStack::PushL(blankWinTemp); |
|
1532 blankWinTemp->SetUpL(TPoint(5,5),size,iBlankWin,*TheClient->iGc); |
|
1533 blankWinTemp->BaseWin()->SetRequiredDisplayMode(EGray16); |
|
1534 blankWinTemp->SetColor(TRgb::Gray16(15)); |
|
1535 blankWinTemp->BaseWin()->FadeBehind(ETrue); |
|
1536 TheClient->Flush(); |
|
1537 blankWinTemp->SetPos(TPoint(5,120)); |
|
1538 //Check whether the back window is faded or not |
|
1539 TBool retBool = iBlankWin->BaseWin()->IsFaded(); |
|
1540 TEST(retBool); |
|
1541 if (!retBool) |
|
1542 INFO_PRINTF3(_L("iBlankWin->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), ETrue, retBool); |
|
1543 |
|
1544 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
1545 CheckRect(iWindowRect.iTl+TPoint(5,5),iWindowRect.iTl+TPoint(75,5),size,_L("CTFade::FadeBehindWhenMovedL()")); |
|
1546 #else |
|
1547 TInt res = LossyCompareWindow(*TheClient->iScreen, *iTestWinCopy, *iCheckWinCopy, TRect(iWindowRect.iTl+TPoint(75,5),size)); |
|
1548 TEST(res); |
|
1549 #endif |
|
1550 |
|
1551 //Check whether the area behind the moved window and any other area on same window are identical |
|
1552 blankWinTemp->BaseWin()->FadeBehind(EFalse); |
|
1553 iBlankWin->BaseWin()->SetRequiredDisplayMode(displayMode); |
|
1554 CleanupStack::PopAndDestroy(blankWinTemp); |
|
1555 } |
|
1556 |
|
1557 void CTFade::FadeBehindTransparentWindowL() |
|
1558 { |
|
1559 const TInt KNumberOfWindows = 3; |
|
1560 CRedrawWin* win[KNumberOfWindows]; |
|
1561 TRect rect(iWindowRect); |
|
1562 rect.Resize(-iWindowRect.Width()/3,-iWindowRect.Height()/3); |
|
1563 rect.Move(iWindowRect.Width()/10,iWindowRect.Height()/5); |
|
1564 TRect rectWin[KNumberOfWindows]; |
|
1565 |
|
1566 for (TInt ii=0; ii<KNumberOfWindows; ++ii) //Causes memory leakage under OOM |
|
1567 { |
|
1568 rectWin[ii] = rect; |
|
1569 win[ii]=new(ELeave) CRedrawWin(this); |
|
1570 win[ii]->ConstructExtLD(*TheClient->iGroup,rectWin[ii].iTl,rectWin[ii].Size()); |
|
1571 win[ii]->AssignGC(*TheClient->iGc); |
|
1572 win[ii]->Win()->EnableRedrawStore(EFalse); |
|
1573 win[ii]->BaseWin()->SetRequiredDisplayMode(EColor16MA); |
|
1574 if (ii==0) |
|
1575 { |
|
1576 win[ii]->Win()->SetBackgroundColor(TRgb(200,0,0,255)); |
|
1577 } |
|
1578 else |
|
1579 { |
|
1580 TEST(KErrNone == win[ii]->Win()->SetTransparencyAlphaChannel()); |
|
1581 if (iStep->TestStepResult() != EPass) |
|
1582 { |
|
1583 INFO_PRINTF1(_L("Transparency Alpha channel failed to be enabled")); |
|
1584 } |
|
1585 win[ii]->Win()->SetBackgroundColor(TRgb(40,100,0,0)); //RGB colour is of minor importance, as the window is fully transparent (Alpha=0) |
|
1586 } |
|
1587 win[ii]->Activate(); |
|
1588 |
|
1589 //Make sure each window is drawn to the screen now when the new background |
|
1590 //colour have been set but before the call to SetFaded |
|
1591 win[ii]->Win()->BeginRedraw(); |
|
1592 win[ii]->Win()->EndRedraw(); |
|
1593 |
|
1594 rect.Resize(0,-iWindowRect.Height()/10); |
|
1595 rect.Move(iWindowRect.Width()/10,iWindowRect.Height()/20); |
|
1596 } |
|
1597 TheClient->iWs.Flush(); |
|
1598 TheClient->iWs.Finish(); |
|
1599 |
|
1600 win[0]->Win()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly); |
|
1601 win[1]->Win()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly); |
|
1602 win[2]->Win()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly); |
|
1603 |
|
1604 TheClient->iWs.Flush(); |
|
1605 TheClient->iWs.Finish(); |
|
1606 |
|
1607 // As the windows ovelap on their left side, compare the top left corners of the faded windows in order to verify that |
|
1608 // for the opaque window the directly on top faded area and the faded area under the transparent window (the area that |
|
1609 // overlaps with the transparent windows) have the same colour. |
|
1610 TRgb rgbWin[KNumberOfWindows]; |
|
1611 TheClient->iScreen->GetPixel(rgbWin[0], rectWin[0].iTl); |
|
1612 TheClient->iScreen->GetPixel(rgbWin[1], rectWin[1].iTl); |
|
1613 TheClient->iScreen->GetPixel(rgbWin[2], rectWin[2].iTl); |
|
1614 |
|
1615 TEST( ETrue == (rgbWin[0].Red()==rgbWin[1].Red())&&(rgbWin[0].Green()==rgbWin[1].Green())&&(rgbWin[0].Blue()==rgbWin[1].Blue()) ); |
|
1616 TEST( ETrue == (rgbWin[0].Red()==rgbWin[2].Red())&&(rgbWin[0].Green()==rgbWin[2].Green())&&(rgbWin[0].Blue()==rgbWin[2].Blue()) ); |
|
1617 |
|
1618 for (TInt ii=0; ii<KNumberOfWindows; ++ii) |
|
1619 { |
|
1620 delete win[ii]; |
|
1621 } |
|
1622 } |
|
1623 |
|
1624 #define BACKUPWIN 11 |
|
1625 #define REDRAWWIN 20 |
|
1626 void CTFade::RunTestCaseL(TInt /*aCurTestCase*/) |
|
1627 { |
|
1628 ((CTFadeStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); |
|
1629 switch(++iTest->iState) |
|
1630 { |
|
1631 /** |
|
1632 @SYMTestCaseID GRAPHICS-WSERV-0218 |
|
1633 |
|
1634 @SYMDEF DEF081259 |
|
1635 |
|
1636 @SYMTestCaseDesc Test fading colours in windows |
|
1637 |
|
1638 @SYMTestPriority High |
|
1639 |
|
1640 @SYMTestStatus Implemented |
|
1641 |
|
1642 @SYMTestActions Fade the colours in windows and check they fade correctly |
|
1643 |
|
1644 @SYMTestExpectedResults Colour fade correctly |
|
1645 */ |
|
1646 case 1: |
|
1647 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0218")); |
|
1648 iTest->LogSubTest(_L("Color Check")); |
|
1649 CreateBlankWindowL(); |
|
1650 ColorTest(); |
|
1651 //iTest->iState=5; |
|
1652 break; |
|
1653 /** |
|
1654 @SYMTestCaseID GRAPHICS-WSERV-0219 |
|
1655 |
|
1656 @SYMDEF DEF081259 |
|
1657 |
|
1658 @SYMTestCaseDesc Test fading in a blank window |
|
1659 |
|
1660 @SYMTestPriority High |
|
1661 |
|
1662 @SYMTestStatus Implemented |
|
1663 |
|
1664 @SYMTestActions Fade in a blank window and check the fading occurs correctly |
|
1665 |
|
1666 @SYMTestExpectedResults Fading in a blank window occurs correctly |
|
1667 */ |
|
1668 case 2: |
|
1669 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0219")); |
|
1670 iTest->LogSubTest(_L("Blank Window")); |
|
1671 BlankWindowL(); |
|
1672 break; |
|
1673 /** |
|
1674 @SYMTestCaseID GRAPHICS-WSERV-0220 |
|
1675 |
|
1676 @SYMDEF DEF081259 |
|
1677 |
|
1678 @SYMTestCaseDesc Test fading in child windows |
|
1679 |
|
1680 @SYMTestPriority High |
|
1681 |
|
1682 @SYMTestStatus Implemented |
|
1683 |
|
1684 @SYMTestActions Fade in child windows and check the fading occurs correctly |
|
1685 |
|
1686 @SYMTestExpectedResults Fading in the child windows occurs correctly |
|
1687 */ |
|
1688 case 3: |
|
1689 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0220")); |
|
1690 iTest->LogSubTest(_L("Fade Children")); |
|
1691 FadeChildrenL(); |
|
1692 break; |
|
1693 /** |
|
1694 @SYMTestCaseID GRAPHICS-WSERV-0221 |
|
1695 |
|
1696 @SYMDEF DEF081259 |
|
1697 |
|
1698 @SYMTestCaseDesc Test fading in newly created child windows |
|
1699 |
|
1700 @SYMTestPriority High |
|
1701 |
|
1702 @SYMTestStatus Implemented |
|
1703 |
|
1704 @SYMTestActions Fade in newly created child windows and check the fading occurs correctly |
|
1705 |
|
1706 @SYMTestExpectedResults Fading in the newly created child windows occurs correctly |
|
1707 */ |
|
1708 case 4: |
|
1709 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0221")); |
|
1710 iTest->LogSubTest(_L("Fade Children newly created")); |
|
1711 FadeChildrenAfterNewChildIsCreatedL(); |
|
1712 break; |
|
1713 /** |
|
1714 @SYMTestCaseID GRAPHICS-WSERV-0222 |
|
1715 |
|
1716 @SYMDEF DEF081259 |
|
1717 |
|
1718 @SYMTestCaseDesc Test fading in window behind another window |
|
1719 |
|
1720 @SYMTestPriority High |
|
1721 |
|
1722 @SYMTestStatus Implemented |
|
1723 |
|
1724 @SYMTestActions Fade in window behind another window and check the fading occurs correctly |
|
1725 |
|
1726 @SYMTestExpectedResults Fading in window occurs correctly |
|
1727 */ |
|
1728 case 5: |
|
1729 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0222")); |
|
1730 iTest->LogSubTest(_L("Fade Behind")); |
|
1731 FadeBehindL(); |
|
1732 break; |
|
1733 /** |
|
1734 @SYMTestCaseID GRAPHICS-WSERV-0223 |
|
1735 |
|
1736 @SYMDEF DEF081259 |
|
1737 |
|
1738 @SYMTestCaseDesc Test differnt fading techniques in a window |
|
1739 |
|
1740 @SYMTestPriority High |
|
1741 |
|
1742 @SYMTestStatus Implemented |
|
1743 |
|
1744 @SYMTestActions Fade using different fading techniques in a window |
|
1745 and check the fading occurs correctly |
|
1746 |
|
1747 @SYMTestExpectedResults Fading in window occurs correctly |
|
1748 */ |
|
1749 case 6: |
|
1750 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0223")); |
|
1751 #if(defined(__DISPLAY_MODE_64K_COLOR)) //The test case Alternative Fadings1&2 & System Fade are not executed for EColor64k |
|
1752 iTest->LogSubTest(_L("Alternative Fadings1")); |
|
1753 ColorTest2(); |
|
1754 #else |
|
1755 LOG_MESSAGE(_L("Alternative Fadings1 test not run")); |
|
1756 #endif |
|
1757 break; |
|
1758 /** |
|
1759 @SYMTestCaseID GRAPHICS-WSERV-0224 |
|
1760 |
|
1761 @SYMDEF DEF081259 |
|
1762 |
|
1763 @SYMTestCaseDesc Test differnt fading techniques in a window |
|
1764 |
|
1765 @SYMTestPriority High |
|
1766 |
|
1767 @SYMTestStatus Implemented |
|
1768 |
|
1769 @SYMTestActions Fade using different fading techniques in a window |
|
1770 and check the fading occurs correctly |
|
1771 |
|
1772 @SYMTestExpectedResults Fading in window occurs correctly |
|
1773 */ |
|
1774 case 7: |
|
1775 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0224")); |
|
1776 #if(defined(__DISPLAY_MODE_64K_COLOR)) //The test case Alternative Fadings1&2 & System Fade are not executed for EColor64k |
|
1777 iTest->LogSubTest(_L("Alternative Fadings2")); |
|
1778 FadeTest(); |
|
1779 #else |
|
1780 LOG_MESSAGE(_L("Alternative Fadings2 test not run")); |
|
1781 #endif |
|
1782 break; |
|
1783 /** |
|
1784 @SYMTestCaseID GRAPHICS-WSERV-0225 |
|
1785 |
|
1786 @SYMDEF DEF081259 |
|
1787 |
|
1788 @SYMTestCaseDesc Test differnt system wide fading techniques in a window |
|
1789 |
|
1790 @SYMTestPriority High |
|
1791 |
|
1792 @SYMTestStatus Implemented |
|
1793 |
|
1794 @SYMTestActions Fade using different system wide fading techniques in a window |
|
1795 and check the fading occurs correctly |
|
1796 |
|
1797 @SYMTestExpectedResults Fading in system occurs correctly |
|
1798 */ |
|
1799 case 8: |
|
1800 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0225")); |
|
1801 iTest->LogSubTest(_L("System Fade")); |
|
1802 SystemFadeL(); |
|
1803 SystemAlternateFadeL(); |
|
1804 break; |
|
1805 /** |
|
1806 @SYMTestCaseID GRAPHICS-WSERV-0226 |
|
1807 |
|
1808 @SYMDEF DEF081259 |
|
1809 |
|
1810 @SYMTestCaseDesc Test fading in window behind another window when the window has been moved |
|
1811 |
|
1812 @SYMTestPriority High |
|
1813 |
|
1814 @SYMTestStatus Implemented |
|
1815 |
|
1816 @SYMTestActions Fade in window behind another window and check the fading occurs correctly |
|
1817 |
|
1818 @SYMTestExpectedResults Fading in window occurs correctly |
|
1819 */ |
|
1820 case 9: |
|
1821 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0226")); |
|
1822 iTest->LogSubTest(_L("Fade behind moved")); |
|
1823 FadeBehindWhenMovedL(); |
|
1824 break; |
|
1825 /** |
|
1826 @SYMTestCaseID GRAPHICS-WSERV-0227 |
|
1827 |
|
1828 @SYMDEF DEF081259 |
|
1829 |
|
1830 @SYMTestCaseDesc Destroy the blnk window used for fading |
|
1831 |
|
1832 @SYMTestPriority High |
|
1833 |
|
1834 @SYMTestStatus Implemented |
|
1835 |
|
1836 @SYMTestActions Destroy the blnk window used for fading and check it was deleted correctly |
|
1837 |
|
1838 @SYMTestExpectedResults The window is destroyed |
|
1839 */ |
|
1840 case 10: |
|
1841 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0227")); |
|
1842 DestroyBlankWindow(); |
|
1843 break; |
|
1844 /** |
|
1845 @SYMTestCaseID GRAPHICS-WSERV-0228 |
|
1846 |
|
1847 @SYMDEF DEF081259 |
|
1848 |
|
1849 @SYMTestCaseDesc Test backup window creation and drawing |
|
1850 |
|
1851 @SYMTestPriority High |
|
1852 |
|
1853 @SYMTestStatus Implemented |
|
1854 |
|
1855 @SYMTestActions Create a backup window and draw in it |
|
1856 |
|
1857 @SYMTestExpectedResults The drawing is correct in the window |
|
1858 */ |
|
1859 case BACKUPWIN: |
|
1860 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0228")); |
|
1861 iTest->LogSubTest(_L("BackupWin Draw")); |
|
1862 CreateBitmapsL(); |
|
1863 CreateBackupWindowL(EFalse); |
|
1864 Draw(); |
|
1865 break; |
|
1866 /** |
|
1867 @SYMTestCaseID GRAPHICS-WSERV-0229 |
|
1868 |
|
1869 @SYMDEF DEF081259 |
|
1870 |
|
1871 @SYMTestCaseDesc Test fading with backup window obscured |
|
1872 |
|
1873 @SYMTestPriority High |
|
1874 |
|
1875 @SYMTestStatus Implemented |
|
1876 |
|
1877 @SYMTestActions Test fading with the backup window obscured |
|
1878 |
|
1879 @SYMTestExpectedResults Fading occurs correctly with window obscured |
|
1880 */ |
|
1881 case BACKUPWIN+1: |
|
1882 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0229")); |
|
1883 iTest->LogSubTest(_L("BackupWin Obscured")); |
|
1884 ObscuredL(); |
|
1885 break; |
|
1886 /** |
|
1887 @SYMTestCaseID GRAPHICS-WSERV-0230 |
|
1888 |
|
1889 @SYMDEF DEF081259 |
|
1890 |
|
1891 @SYMTestCaseDesc Test fading with backup window being moved |
|
1892 |
|
1893 @SYMTestPriority High |
|
1894 |
|
1895 @SYMTestStatus Implemented |
|
1896 |
|
1897 @SYMTestActions Test fading with the backup window being moved |
|
1898 |
|
1899 @SYMTestExpectedResults Fading occurs correctly with window moved |
|
1900 */ |
|
1901 case BACKUPWIN+2: |
|
1902 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0230")); |
|
1903 iTest->LogSubTest(_L("BackupWin Moving")); |
|
1904 MovingL(); |
|
1905 DestroyDrawableWindow(); |
|
1906 break; |
|
1907 /** |
|
1908 @SYMTestCaseID GRAPHICS-WSERV-0231 |
|
1909 |
|
1910 @SYMDEF DEF081259 |
|
1911 |
|
1912 @SYMTestCaseDesc Test backup window creation and drawing |
|
1913 |
|
1914 @SYMTestPriority High |
|
1915 |
|
1916 @SYMTestStatus Implemented |
|
1917 |
|
1918 @SYMTestActions Create a backup window and draw in it |
|
1919 |
|
1920 @SYMTestExpectedResults The drawing is correct in the window |
|
1921 */ |
|
1922 case BACKUPWIN+3: |
|
1923 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0231")); |
|
1924 iTest->LogSubTest(_L("BackupWin Draw")); |
|
1925 CreateBackupWindowL(ETrue); |
|
1926 Draw(); |
|
1927 break; |
|
1928 /** |
|
1929 @SYMTestCaseID GRAPHICS-WSERV-0232 |
|
1930 |
|
1931 @SYMDEF DEF081259 |
|
1932 |
|
1933 @SYMTestCaseDesc Test fading with backup window obscured |
|
1934 |
|
1935 @SYMTestPriority High |
|
1936 |
|
1937 @SYMTestStatus Implemented |
|
1938 |
|
1939 @SYMTestActions Test fading with the backup window obscured |
|
1940 |
|
1941 @SYMTestExpectedResults Fading occurs correctly with window obscured |
|
1942 */ |
|
1943 case BACKUPWIN+4: |
|
1944 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0232")); |
|
1945 iTest->LogSubTest(_L("BackupWin Obscured")); |
|
1946 ObscuredL(); |
|
1947 break; |
|
1948 /** |
|
1949 @SYMTestCaseID GRAPHICS-WSERV-0233 |
|
1950 |
|
1951 @SYMDEF DEF081259 |
|
1952 |
|
1953 @SYMTestCaseDesc Test fading with backup window being moved |
|
1954 |
|
1955 @SYMTestPriority High |
|
1956 |
|
1957 @SYMTestStatus Implemented |
|
1958 |
|
1959 @SYMTestActions Test fading with the backup window being moved |
|
1960 |
|
1961 @SYMTestExpectedResults Fading occurs correctly with window moved |
|
1962 */ |
|
1963 case BACKUPWIN+5: |
|
1964 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0233")); |
|
1965 iTest->LogSubTest(_L("BackupWin Moving")); |
|
1966 MovingL(); |
|
1967 DestroyDrawableWindow(); |
|
1968 break; |
|
1969 /** |
|
1970 @SYMTestCaseID GRAPHICS-WSERV-0234 |
|
1971 |
|
1972 @SYMDEF DEF081259 |
|
1973 |
|
1974 @SYMTestCaseDesc Test redraw window creation and drawing |
|
1975 |
|
1976 @SYMTestPriority High |
|
1977 |
|
1978 @SYMTestStatus Implemented |
|
1979 |
|
1980 @SYMTestActions Create a redraw window and draw in it |
|
1981 |
|
1982 @SYMTestExpectedResults The drawing is correct in the window |
|
1983 */ |
|
1984 case REDRAWWIN: |
|
1985 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0234")); |
|
1986 iTest->LogSubTest(_L("RedrawWin Draw")); |
|
1987 CreateRedrawWindowL(); |
|
1988 Draw(); |
|
1989 break; |
|
1990 /** |
|
1991 @SYMTestCaseID GRAPHICS-WSERV-0235 |
|
1992 |
|
1993 @SYMDEF DEF081259 |
|
1994 |
|
1995 @SYMTestCaseDesc Test fading with redraw window obscured |
|
1996 |
|
1997 @SYMTestPriority High |
|
1998 |
|
1999 @SYMTestStatus Implemented |
|
2000 |
|
2001 @SYMTestActions Test fading with the redraw window obscured |
|
2002 |
|
2003 @SYMTestExpectedResults Fading occurs correctly with window obscured |
|
2004 */ |
|
2005 case REDRAWWIN+1: |
|
2006 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0235")); |
|
2007 iTest->LogSubTest(_L("RedrawWin Obscured")); |
|
2008 ObscuredL(); |
|
2009 break; |
|
2010 /** |
|
2011 @SYMTestCaseID GRAPHICS-WSERV-0236 |
|
2012 |
|
2013 @SYMDEF DEF081259 |
|
2014 |
|
2015 @SYMTestCaseDesc Test fading with redraw window being moved |
|
2016 |
|
2017 @SYMTestPriority High |
|
2018 |
|
2019 @SYMTestStatus Implemented |
|
2020 |
|
2021 @SYMTestActions Test fading with the redraw window being moved |
|
2022 |
|
2023 @SYMTestExpectedResults Fading occurs correctly with window moved |
|
2024 */ |
|
2025 case REDRAWWIN+2: |
|
2026 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0236")); |
|
2027 iTest->LogSubTest(_L("RedrawWin Moving")); |
|
2028 MovingL(); |
|
2029 break; |
|
2030 /** |
|
2031 @SYMTestCaseID GRAPHICS-WSERV-0237 |
|
2032 |
|
2033 @SYMDEF DEF081259 |
|
2034 |
|
2035 @SYMTestCaseDesc Test different fading techniques within a redraw window |
|
2036 |
|
2037 @SYMTestPriority High |
|
2038 |
|
2039 @SYMTestStatus Implemented |
|
2040 |
|
2041 @SYMTestActions Test different fading techniques within a redraw window |
|
2042 |
|
2043 @SYMTestExpectedResults Fading occurs correctly for the different techniques |
|
2044 */ |
|
2045 case REDRAWWIN+3: |
|
2046 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0237")); |
|
2047 iTest->LogSubTest(_L("AlternativeFadeDraw")); |
|
2048 Draw(ETrue); |
|
2049 break; |
|
2050 |
|
2051 /** |
|
2052 @SYMTestCaseID GRAPHICS-WSERV-0238 |
|
2053 |
|
2054 @SYMDEF DEF081259 |
|
2055 |
|
2056 @SYMTestCaseDesc Test fading within a redraw window using the graphic context |
|
2057 |
|
2058 @SYMTestPriority High |
|
2059 |
|
2060 @SYMTestStatus Implemented |
|
2061 |
|
2062 @SYMTestActions Test fading within a redraw window using the graphic context |
|
2063 |
|
2064 @SYMTestExpectedResults Fading occurs correctly in the window |
|
2065 */ |
|
2066 case REDRAWWIN+4: |
|
2067 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0238")); |
|
2068 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
2069 iTest->LogSubTest(_L("GC Test")); |
|
2070 GCDraw(); |
|
2071 DestroyDrawableWindow(); |
|
2072 DestroyBitmaps(); |
|
2073 #endif |
|
2074 break; |
|
2075 |
|
2076 /** |
|
2077 @SYMTestCaseID GRAPHICS-WSERV-0538 |
|
2078 |
|
2079 @SYMDEF DEF120965 |
|
2080 |
|
2081 @SYMTestCaseDesc Test fading under transparent window |
|
2082 |
|
2083 @SYMTestPriority High |
|
2084 |
|
2085 @SYMTestStatus Implemented |
|
2086 |
|
2087 @SYMTestActions Construct opaque window lying under two transparent windows. Fade the opaque and the transparent windows. |
|
2088 |
|
2089 @SYMTestExpectedResults Each of the overlapping areas should be faded only once. |
|
2090 */ |
|
2091 case REDRAWWIN+5: |
|
2092 { |
|
2093 ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0538")); |
|
2094 iTest->LogSubTest(_L("Fade behind transparent window")); |
|
2095 CRedrawWin* win = new(ELeave) CRedrawWin(this); |
|
2096 win->ConstructL(TRect(0,0,0,0)); |
|
2097 TInt transparency = win->Win()->SetTransparencyAlphaChannel(); |
|
2098 if (transparency!=KErrNotSupported) |
|
2099 { |
|
2100 FadeBehindTransparentWindowL(); |
|
2101 } |
|
2102 else |
|
2103 { |
|
2104 WARN_PRINTF1(_L("Transparency not supported. Skipping test.")); |
|
2105 } |
|
2106 delete win; |
|
2107 break; |
|
2108 } |
|
2109 case REDRAWWIN+6: |
|
2110 ((CTFadeStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); |
|
2111 iTest->LogSubTest(_L("Test complete\n")); |
|
2112 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA |
|
2113 DestroyDrawableWindow(); |
|
2114 DestroyBitmaps(); |
|
2115 #endif |
|
2116 ((CTFadeStep*)iStep)->CloseTMSGraphicsStep(); |
|
2117 TestComplete(); |
|
2118 break; |
|
2119 default: |
|
2120 ((CTFadeStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); |
|
2121 break; |
|
2122 } |
|
2123 ((CTFadeStep*)iStep)->RecordTestResultL(); |
|
2124 } |
|
2125 |
|
2126 __WS_CONSTRUCT_STEP__(Fade) |