1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/TFADE.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,2126 @@
1.4 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Test Fading and UnFading of windows
1.18 +//
1.19 +//
1.20 +
1.21 +#include "TFADE.H"
1.22 +#define __DISPLAY_MODE_64K_COLOR
1.23 +
1.24 +//CRedrawWin
1.25 +
1.26 +CRedrawWin::CRedrawWin(CTFade *aTest) : CTWin(), iTest(aTest)
1.27 + {}
1.28 +
1.29 +CRedrawWin::~CRedrawWin()
1.30 + {
1.31 + }
1.32 +
1.33 +void CRedrawWin::ConstructL(TRect aArea)
1.34 + {
1.35 +
1.36 + ConstructExtLD(*TheClient->iGroup,aArea.iTl,aArea.Size());
1.37 + AssignGC(*TheClient->iGc);
1.38 + Activate();
1.39 + iWin.BeginRedraw();
1.40 + iWin.EndRedraw();
1.41 + }
1.42 +
1.43 +void CRedrawWin::Draw()
1.44 + {
1.45 + iTest->Drawing(iTest->Content(),iGc);
1.46 + }
1.47 +
1.48 +
1.49 +//CFadeTest
1.50 +
1.51 +CTFade::CTFade(CTestStep* aStep) : CTWsGraphicsBase(aStep)
1.52 + {
1.53 +#if defined (__MARM_THUMB__)
1.54 + CanFade = false;
1.55 + CanFadeSet = false;
1.56 +#endif
1.57 + }
1.58 +
1.59 +void CTFade::ConstructL()
1.60 + {
1.61 + iDeviceDisplayMode=TheClient->iScreen->DisplayMode();
1.62 + iTestWinSize=StdTestWindowSize();
1.63 + iFadeDrawMode = iDeviceDisplayMode;
1.64 + iTestWinCopy = new (ELeave) CFbsBitmap();
1.65 + iTestWinCopy->Create(iTestWinSize,TheClient->iScreen->DisplayMode());
1.66 + iCheckWinCopy = new (ELeave) CFbsBitmap();
1.67 + iCheckWinCopy->Create(iTestWinSize,TheClient->iScreen->DisplayMode());
1.68 + }
1.69 +
1.70 +CTFade::~CTFade()
1.71 + {
1.72 + __ASSERT_ALWAYS(!iBlankWin,AutoPanic(EAutoFadeWindow));
1.73 + delete iTestWinCopy;
1.74 + delete iCheckWinCopy;
1.75 + }
1.76 +
1.77 +TInt CTFade::Content()
1.78 + {
1.79 + return iContent;
1.80 + }
1.81 +
1.82 +void CTFade::CreateBlankWindowL()
1.83 + {
1.84 + __ASSERT_ALWAYS(!iBlankWin,AutoPanic(EAutoFadeWindow));
1.85 + TSize scrSize(TheClient->iScreen->SizeInPixels());
1.86 + iTestWinSize.SetSize(2*scrSize.iWidth/3-6,scrSize.iHeight-6);
1.87 + iBlankWin=new(ELeave) CTBlankWindow();
1.88 + iWindowRect.SetRect(TPoint(3+scrSize.iWidth/3,3),iTestWinSize);
1.89 + iBlankWin->SetUpL(iWindowRect.iTl,iTestWinSize,TheClient->iGroup,*TheClient->iGc);
1.90 + iBlankWin->BaseWin()->SetRequiredDisplayMode(EGray16);
1.91 + }
1.92 +
1.93 +void CTFade::DestroyBlankWindow()
1.94 + {
1.95 + __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow));
1.96 + delete iBlankWin;
1.97 + iBlankWin=NULL;
1.98 + }
1.99 +
1.100 +void CTFade::CreateBackupWindowL(TBool aMaintainBackup)
1.101 + {
1.102 + __ASSERT_ALWAYS(!iWin,AutoPanic(EAutoFadeWindow));
1.103 + CTBackedUpWin* backUpWin=new(ELeave) CTBackedUpWin(MODE_LT_64K(iDeviceDisplayMode)?iFadeDrawMode:iDeviceDisplayMode);
1.104 + iWin=backUpWin;
1.105 + iOwnWindow=ETrue;
1.106 + iWindowRect.SetRect(TPoint(2*iTestWinSize.iWidth+35,7),iTestWinSize);
1.107 + backUpWin->ConstructExtLD(*TheClient->iGroup,iWindowRect.iTl,iTestWinSize);
1.108 + if (aMaintainBackup)
1.109 + backUpWin->BackedUpWin()->MaintainBackup();
1.110 + backUpWin->Activate();
1.111 + TheClient->WaitForRedrawsToFinish(); //Without this bitmaps won't draw into the window
1.112 + }
1.113 +
1.114 +void CTFade::CreateRedrawWindowL()
1.115 + {
1.116 + __ASSERT_ALWAYS(!iWin,AutoPanic(EAutoFadeWindow));
1.117 + iWindowRect.SetRect(TPoint(2*iTestWinSize.iWidth+35,7),iTestWinSize);
1.118 + CRedrawWin* redrawWin=new(ELeave) CRedrawWin(this);
1.119 + redrawWin->ConstructL(iWindowRect);
1.120 + redrawWin->Win()->EnableRedrawStore(EFalse);
1.121 + iWin=redrawWin;
1.122 + iOwnWindow=ETrue;
1.123 + iWin->BaseWin()->SetRequiredDisplayMode(iFadeDrawMode);
1.124 + }
1.125 +
1.126 +void CTFade::DestroyDrawableWindow()
1.127 + {
1.128 + __ASSERT_ALWAYS(iWin,AutoPanic(EAutoFadeWindow));
1.129 + if (iOwnWindow)
1.130 + delete iWin;
1.131 + iWin=NULL;
1.132 + }
1.133 +
1.134 +void CTFade::CreateBitmapsL()
1.135 + {
1.136 + iTestWinSize=BaseWin->Size();
1.137 + iBaseRect.SetRect(BaseWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),iTestWinSize);
1.138 + iNormalBitmap.Create(iTestWinSize,MODE_LT_64K(iDeviceDisplayMode)?iFadeDrawMode:iDeviceDisplayMode);
1.139 + iFadedBitmap.Create(iTestWinSize,MODE_LT_64K(iDeviceDisplayMode)?iFadeDrawMode:iDeviceDisplayMode);
1.140 + iNormalBitmapDevice=CFbsBitmapDevice::NewL(&iNormalBitmap);
1.141 + iFadedBitmapDevice=CFbsBitmapDevice::NewL(&iFadedBitmap);
1.142 + User::LeaveIfError(iNormalBitmapDevice->CreateContext(iNormalBitGc));
1.143 + User::LeaveIfError(iFadedBitmapDevice->CreateContext(iFadedBitGc));
1.144 + iFadedBitGc->SetFadeMode(ETrue);
1.145 + iBaseWinMode=BaseWin->BaseWin()->DisplayMode();
1.146 + BaseWin->BaseWin()->SetRequiredDisplayMode(iFadeDrawMode);
1.147 + }
1.148 +
1.149 +void CTFade::DestroyBitmaps()
1.150 + {
1.151 + delete iNormalBitGc;
1.152 + delete iFadedBitGc;
1.153 + delete iNormalBitmapDevice;
1.154 + delete iFadedBitmapDevice;
1.155 + BaseWin->BaseWin()->SetRequiredDisplayMode(iBaseWinMode);
1.156 + }
1.157 +
1.158 +void CTFade::Drawing(TInt aDrawFunc, CBitmapContext *gc)
1.159 + {
1.160 + TRgb grey=TRgb::Gray4(2);
1.161 + TInt ii;
1.162 + gc->Reset();
1.163 + switch (aDrawFunc)
1.164 + {
1.165 + case 1:
1.166 + case 2:
1.167 + Draw(0,&grey,gc);
1.168 + gc->Reset();
1.169 + Draw(1,NULL,gc);
1.170 + if (aDrawFunc==1)
1.171 + break;
1.172 + gc->Reset();
1.173 + Draw(3,NULL,gc);
1.174 + break;
1.175 + case 3:
1.176 + Draw(0,&grey,gc);
1.177 + gc->Reset();
1.178 + Draw(3,NULL,gc);
1.179 + break;
1.180 + case 4:
1.181 + grey=TRgb::Gray4(1);
1.182 + gc->Reset();
1.183 + Draw(0,&grey,gc);
1.184 + gc->Reset();
1.185 + for (ii=1;ii<37;ii+=7)
1.186 + Draw(2,&ii,gc);
1.187 + break;
1.188 + case 5:
1.189 + Draw(0,&grey,gc);
1.190 + gc->Reset();
1.191 + Draw(1,NULL,gc);
1.192 + gc->Reset();
1.193 + for (ii=2;ii<60;ii+=11)
1.194 + Draw(2,&ii,gc);
1.195 + break;
1.196 + case 6:
1.197 + case 7:
1.198 + Draw(0,&grey,gc);
1.199 + gc->Reset();
1.200 + Draw(3,NULL,gc);
1.201 + gc->Reset();
1.202 + for (ii=3;ii<70;ii+=13)
1.203 + Draw(2,&ii,gc);
1.204 + if (aDrawFunc==6)
1.205 + break;
1.206 + gc->Reset();
1.207 + Draw(1,NULL,gc);
1.208 + break;
1.209 + default:;
1.210 + }
1.211 + }
1.212 +
1.213 +void CTFade::Draw(TInt aDrawFunc, TAny *aParam, TBool aAlternativeFade/*=EFalse*/, TBool aFade/*=EFalse*/)
1.214 + {
1.215 + CWindowGc *gc=TheClient->iGc;
1.216 + gc->Activate(*iWin->DrawableWin());
1.217 + gc->Reset();
1.218 + if (aFade)
1.219 + gc->SetFaded(ETrue);
1.220 + iNormalBitGc->Reset();
1.221 + iFadedBitGc->Reset();
1.222 + iFadedBitGc->SetFadeMode(ETrue);
1.223 + if (aAlternativeFade)
1.224 + iFadedBitGc->SetFadingParameters(BLACK_ALTERNATE,WHITE_ALTERNATE);
1.225 + Draw(aDrawFunc,aParam,gc);
1.226 + Draw(aDrawFunc,aParam,iNormalBitGc);
1.227 + Draw(aDrawFunc,aParam,iFadedBitGc);
1.228 + gc->Deactivate();
1.229 + if (aAlternativeFade)
1.230 + iFadedBitGc->SetFadingParameters(BLACK_NORMAL,WHITE_NORMAL);
1.231 + }
1.232 +
1.233 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA // CWindowGc fading is deprecated in NGA
1.234 +void CTFade::GCDraw(TInt aDrawFunc, TAny *aParam, TBool aAlternativeFade)
1.235 + {
1.236 + CWindowGc *gc=TheClient->iGc;
1.237 + gc->Activate(*iWin->DrawableWin());
1.238 + gc->Reset();
1.239 + Draw(aDrawFunc,aParam,gc);
1.240 + gc->Deactivate();
1.241 + gc->Activate(*BaseWin->DrawableWin());
1.242 + gc->Reset();
1.243 + gc->SetFaded(ETrue);
1.244 + if (aAlternativeFade)
1.245 + gc->SetFadingParameters(BLACK_ALTERNATE,WHITE_ALTERNATE);
1.246 + Draw(aDrawFunc,aParam,gc);
1.247 + gc->Deactivate();
1.248 + }
1.249 +#endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.250 +
1.251 +void CTFade::Draw(TInt aDrawFunc, TAny *aParam, CBitmapContext *aGc)
1.252 + {
1.253 + switch(aDrawFunc)
1.254 + {
1.255 + case 0:
1.256 + aGc->SetBrushColor(*((TRgb *)aParam));
1.257 + aGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.258 + aGc->SetPenStyle(CGraphicsContext::ENullPen);
1.259 + aGc->DrawRect(TRect(iTestWinSize));
1.260 + break;
1.261 + case 1:
1.262 + {
1.263 + TSize half(iTestWinSize.iWidth/2,iTestWinSize.iHeight/2);
1.264 + TRect rect(half);
1.265 + aGc->DrawEllipse(rect);
1.266 + aGc->DrawEllipse(TRect(TPoint(0,half.iHeight),half));
1.267 + aGc->SetOrigin(TPoint(half.iWidth,0));
1.268 + aGc->SetClippingRect(rect);
1.269 + aGc->DrawEllipse(rect);
1.270 + aGc->SetOrigin(TPoint(half.iWidth,half.iHeight));
1.271 + aGc->SetClippingRect(rect);
1.272 + aGc->DrawEllipse(rect);
1.273 + aGc->SetOrigin(TPoint());
1.274 + aGc->CancelClippingRect();
1.275 + }
1.276 + break;
1.277 + case 2:
1.278 + {
1.279 + TInt param= *((TInt *)aParam);
1.280 + if (param&0x1)
1.281 + aGc->DrawLine(TPoint(param+(param*27)%iTestWinSize.iWidth,0),
1.282 + TPoint(iTestWinSize.iWidth-((param<<1)+(param*19)%iTestWinSize.iWidth),iTestWinSize.iHeight));
1.283 + else
1.284 + aGc->DrawLine(TPoint(0, (param<<1)+(param*7)%iTestWinSize.iHeight),
1.285 + TPoint(iTestWinSize.iWidth,param+(param*13)%iTestWinSize.iHeight));
1.286 + }
1.287 + break;
1.288 + case 3:
1.289 + {
1.290 + TPoint pos;
1.291 + for(;pos.iX<iTestWinSize.iWidth;pos.iX+=10)
1.292 + aGc->DrawLine(pos,pos+TSize(0,iTestWinSize.iHeight));
1.293 + for(pos.iX=0;pos.iY<iTestWinSize.iHeight;pos.iY+=10)
1.294 + aGc->DrawLine(pos,pos+TSize(iTestWinSize.iWidth,0));
1.295 + }
1.296 + break;
1.297 + }
1.298 + }
1.299 +
1.300 +void CTFade::CompareWithBitmap(TBool aFade)
1.301 + {
1.302 + TBool match;
1.303 + CWindowGc& gc=*TheClient->iGc;
1.304 + CFbsBitmap* bitmap;
1.305 + TheClient->iWs.Flush();
1.306 + if (aFade)
1.307 + bitmap=&iFadedBitmap;
1.308 + else
1.309 + bitmap=&iNormalBitmap;
1.310 + gc.Activate(*BaseWin->DrawableWin());
1.311 + gc.Reset();
1.312 + gc.BitBlt(TPoint(),bitmap);
1.313 + gc.Deactivate();
1.314 + TheClient->iWs.Flush();
1.315 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.316 + match=TheClient->iScreen->RectCompare(iBaseRect,iWindowRect);
1.317 +#else // In NGA comparison has to be lossy because fading can be implemented on hardware
1.318 + match=LossyCompareWindow(*TheClient->iScreen, *iTestWinCopy, *iCheckWinCopy, iWindowRect);
1.319 +#endif
1.320 + TEST(match);
1.321 + if (!match)
1.322 + {
1.323 + _LIT(KLog,"Windows content don't match when they should");
1.324 + LOG_MESSAGE(KLog);
1.325 + }
1.326 + }
1.327 +
1.328 +void CTFade::CompareWindows(TBool aAlternativeFade/*=EFalse*/)
1.329 + {
1.330 + if (aAlternativeFade)
1.331 + iWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly,BLACK_ALTERNATE,WHITE_ALTERNATE);
1.332 + else
1.333 + iWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly);
1.334 + TheClient->iWs.Flush();
1.335 + TBool retVal = TheClient->iScreen->RectCompare(iBaseRect,iWindowRect);
1.336 + TEST(retVal);
1.337 + if (!retVal)
1.338 + INFO_PRINTF3(_L("TheClient->iScreen->RectCompare(iBaseRect,iWindowRect) return value - Expected: %d, Actual: %d"), ETrue, retVal);
1.339 +
1.340 + iWin->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly);
1.341 + TheClient->iWs.Flush();
1.342 + TheClient->WaitForRedrawsToFinish();
1.343 + }
1.344 +
1.345 +#define FADE(n,col) n/2+col/2
1.346 +TInt CTFade::Fade4(TInt aGray4)
1.347 + {
1.348 +#if defined(__WINS__)
1.349 + return FADE(4,aGray4);
1.350 +#elif defined (__MARM_THUMB__)
1.351 + return (CanFade ? FADE(4,aGray4):aGray4);
1.352 +#elif defined (__MARM__)
1.353 + return FADE(4,aGray4);
1.354 +#else
1.355 + return aGray4;
1.356 +#endif
1.357 + }
1.358 +
1.359 +TInt CTFade::Fade16(TInt aGray16)
1.360 + {
1.361 +#if defined(__WINS__)
1.362 + return FADE(16,aGray16);
1.363 +#elif defined (__MARM_THUMB__)
1.364 + return (CanFade ? FADE(16,aGray16):aGray16);
1.365 +#elif defined (__MARM__)
1.366 + return FADE(16,aGray16);
1.367 +#else
1.368 + return aGray16;
1.369 +#endif
1.370 + }
1.371 +
1.372 +TRgb CTFade::FadeRgb(TRgb aColor)
1.373 + {
1.374 + switch (iFadeDrawMode)
1.375 + {
1.376 + case EColor16M:
1.377 + case EColor16MU:
1.378 + case EColor16MA:
1.379 + case EColor16MAP:
1.380 + break;
1.381 + default:
1.382 + aColor=TRgb::Color64K(aColor.Color64K());
1.383 + break;
1.384 + }
1.385 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA // Color fading calculation differs in NGA
1.386 + TInt fadeMapFactor=WHITE_NORMAL-BLACK_NORMAL+1;
1.387 +#else
1.388 + TInt fadeMapFactor=WHITE_NORMAL-BLACK_NORMAL;
1.389 +#endif
1.390 + TInt fadeMapOffset=BLACK_NORMAL;
1.391 + TInt value = aColor.Internal();
1.392 +
1.393 + TInt b = (((value & 0x000000ff) * fadeMapFactor) >> 8) + fadeMapOffset;
1.394 + TInt g = (((value & 0x0000ff00) * fadeMapFactor) >> 16) + fadeMapOffset;
1.395 + TInt r = (((value & 0x00ff0000) * fadeMapFactor) >> 24) + fadeMapOffset;
1.396 + return TRgb(r,g,b);
1.397 + }
1.398 +
1.399 +TRgb CTFade::FadeRgb(TRgb aColor, TInt aFadeMapFactor, TInt aFadeMapOffset)
1.400 + {
1.401 + switch (iFadeDrawMode)
1.402 + {
1.403 + case EColor16M:
1.404 + case EColor16MU:
1.405 + case EColor16MA:
1.406 + case EColor16MAP:
1.407 + break;
1.408 + default:
1.409 + aColor=TRgb::Color64K(aColor.Color64K());
1.410 + break;
1.411 + }
1.412 + TInt value = aColor.Internal();
1.413 +
1.414 + TInt b = (((value & 0x000000ff) * aFadeMapFactor) >> 8) + aFadeMapOffset;
1.415 + TInt g = (((value & 0x0000ff00) * aFadeMapFactor) >> 16) + aFadeMapOffset;
1.416 + TInt r = (((value & 0x00ff0000) * aFadeMapFactor) >> 24) + aFadeMapOffset;
1.417 + return TRgb(r,g,b);
1.418 + }
1.419 +
1.420 +inline void CTFade::ViewDelay()
1.421 + //
1.422 + //This routine can provide a delay which will allow the user to see the colors changing
1.423 + //
1.424 + {
1.425 + TheClient->iWs.Finish();
1.426 + /*TheClient->iWs.Flush();
1.427 + User::After(1000000);*/ // 1 sec
1.428 + }
1.429 +
1.430 +void CTFade::ColorTest()
1.431 + {
1.432 + __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow));
1.433 + TBool retVal;
1.434 + TSize size(iTestWinSize);
1.435 +#if defined(SMALL_RECTS)
1.436 + size.iWidth=Min(SIZE_X,size.iWidth);
1.437 + size.iHeight=Min(SIZE_Y,size.iHeight);
1.438 +#endif
1.439 + TRect windowRect(iBlankWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),size);
1.440 + TInt ii;
1.441 + iBlankWin->BaseWin()->SetRequiredDisplayMode(EGray4);
1.442 + TheClient->WaitForRedrawsToFinish(); //Force the screen into 4 gray mode
1.443 + TRgb fadedColor;
1.444 + for (ii=1;ii<4;ii+=2) //0 and 3 now give dithered colors when fading so causing this test to fail
1.445 + {
1.446 + iBlankWin->SetColor(TRgb::Gray4(ii));
1.447 + ViewDelay();
1.448 + INFO_PRINTF1(_L(" Testing Normal Color"));
1.449 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.450 + retVal = CheckBlankWindow(windowRect,TRgb::Gray4(ii),TheClient->iScreen);
1.451 +#else
1.452 + TheClient->iScreen->CopyScreenToBitmap(iTestWinCopy, windowRect);
1.453 + retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray4(ii));
1.454 +#endif
1.455 + TEST(retVal);
1.456 + if (!retVal)
1.457 + INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray4(ii),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal);
1.458 + iBlankWin->BaseWin()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly);
1.459 + ViewDelay();
1.460 + fadedColor=MODE_LT_64K(iDeviceDisplayMode)?TRgb::Gray4(Fade4(ii)):FadeRgb(TRgb::Gray4(ii));
1.461 +#if defined (__MARM_THUMB__)
1.462 + if (ii==1)
1.463 + {
1.464 + CanFade=!CheckBlankWindow(windowRect,fadedColor,TheClient->iScreen);
1.465 + CanFadeSet=ETrue;
1.466 + fadedColor=MODE_LT_64K(iDeviceDisplayMode)?TRgb::Gray4(Fade4(ii)):FadeRgb(TRgb::Gray4(ii));
1.467 + }
1.468 +#endif
1.469 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.470 + retVal = CheckBlankWindow(windowRect,fadedColor,TheClient->iScreen);
1.471 +#else
1.472 + retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, fadedColor);
1.473 +#endif
1.474 + TEST(retVal);
1.475 + if (!retVal)
1.476 + INFO_PRINTF3(_L("CheckBlankWindow(windowRect,fadedColor,TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal);
1.477 +
1.478 + iBlankWin->BaseWin()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly);
1.479 + ViewDelay();
1.480 + INFO_PRINTF1(_L(" Testing Unfaded Color"));
1.481 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.482 + retVal = CheckBlankWindow(windowRect,TRgb::Gray4(ii),TheClient->iScreen);
1.483 +#else
1.484 + retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray4(ii));
1.485 +#endif
1.486 + TEST(retVal);
1.487 + if (!retVal)
1.488 + INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray4(ii),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal);
1.489 + }
1.490 + iBlankWin->BaseWin()->SetRequiredDisplayMode(EGray16);
1.491 +
1.492 + if (MaxGrays()==0 && MaxColors()<256)
1.493 + return;
1.494 +
1.495 + INFO_PRINTF1(_L(" Doing 16 Gray Colors"));
1.496 + for (ii=0;ii<16;++ii)
1.497 + {
1.498 + iBlankWin->SetColor(TRgb::Gray16(ii));
1.499 + ViewDelay();
1.500 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.501 + retVal = CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen);
1.502 +#else
1.503 + retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray16(ii));
1.504 +#endif
1.505 + TEST(retVal);
1.506 + if (!retVal)
1.507 + INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal);
1.508 +
1.509 + iBlankWin->BaseWin()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly);
1.510 + ViewDelay();
1.511 + fadedColor=MODE_LT_64K(iDeviceDisplayMode)?TRgb::Gray16(Fade16(ii)):FadeRgb(TRgb::Gray16(ii));
1.512 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.513 + retVal = CheckBlankWindow(windowRect,fadedColor,TheClient->iScreen);
1.514 +#else
1.515 + retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, fadedColor);
1.516 +#endif
1.517 + TEST(retVal);
1.518 + if (!retVal)
1.519 + INFO_PRINTF3(_L("CheckBlankWindow(windowRect,fadedColor,TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal);
1.520 +
1.521 + iBlankWin->BaseWin()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly);
1.522 + ViewDelay();
1.523 +
1.524 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.525 + retVal = CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen);
1.526 +#else
1.527 + retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray16(ii));
1.528 +#endif
1.529 + TEST(retVal);
1.530 + if (!retVal)
1.531 + INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal);
1.532 + }
1.533 + }
1.534 +
1.535 +void CTFade::BlankWindowL()
1.536 + {
1.537 + TBool retVal;
1.538 + if (MaxGrays()==0 && MaxColors()<256)
1.539 + return;
1.540 +
1.541 + __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow));
1.542 + CTBlankWindow* blankWin=new(ELeave) CTBlankWindow();
1.543 + TRect testArea(iWindowRect);
1.544 + TRect windowRect(testArea);
1.545 +#if defined(SMALL_RECTS)
1.546 + TSize size(testArea.Size());
1.547 + size.iWidth=Min(2*SIZE_X,size.iWidth);
1.548 + size.iHeight=Min(2*SIZE_Y,size.iHeight);
1.549 + testArea.SetHeight(size.iHeight);
1.550 + testArea.iTl.iX=testArea.iBr.iX-size.iWidth;
1.551 + windowRect=testArea;
1.552 + windowRect.Shrink(size.iWidth/4,size.iHeight/4);
1.553 +#else
1.554 + windowRect.Shrink(30,30);
1.555 +#endif
1.556 + blankWin->SetUpL(windowRect.iTl,windowRect.Size(),TheClient->iGroup,*TheClient->iGc);
1.557 + for (TInt col=2;col<16;col+=6)
1.558 + {
1.559 + iBlankWin->SetColor(TRgb::Gray16(col));
1.560 + TheClient->iScreen->CopyScreenToBitmap(iTestWinCopy, windowRect);
1.561 + iBlankWin->BaseWin()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly);
1.562 + blankWin->SetVisible(EFalse);
1.563 + TheClient->iWs.Finish();
1.564 + TRgb fadedColor=MODE_LT_64K(iDeviceDisplayMode)?TRgb::Gray16(Fade16(col)):FadeRgb(TRgb::Gray16(col));
1.565 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.566 + retVal = CheckBlankWindow(testArea,fadedColor,TheClient->iScreen);
1.567 +#else
1.568 + retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, fadedColor);
1.569 +#endif
1.570 + TEST(retVal);
1.571 + if (!retVal)
1.572 + INFO_PRINTF3(_L("LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, fadedColor) return value - Expected: %d, Actual: %d"), ETrue, retVal);
1.573 +
1.574 + blankWin->SetVisible(ETrue);
1.575 + iBlankWin->BaseWin()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly);
1.576 + blankWin->SetVisible(EFalse);
1.577 + TheClient->iWs.Finish();
1.578 + retVal = CheckBlankWindow(testArea,TRgb::Gray16(col),TheClient->iScreen);
1.579 + TEST(retVal);
1.580 + if (!retVal)
1.581 + INFO_PRINTF3(_L("CheckBlankWindow(testArea,TRgb::Gray16(col),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal);
1.582 +
1.583 + blankWin->SetVisible(ETrue);
1.584 + iBlankWin->SetPos(iWindowRect.iTl+TPoint(15,-15));
1.585 + iBlankWin->BaseWin()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly);
1.586 + blankWin->SetVisible(EFalse);
1.587 + iBlankWin->SetPos(iWindowRect.iTl);
1.588 + fadedColor=MODE_LT_64K(iDeviceDisplayMode)?TRgb::Gray16(Fade16(col)):FadeRgb(TRgb::Gray16(col));
1.589 + TheClient->iWs.Finish();
1.590 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.591 + retVal = CheckBlankWindow(testArea,fadedColor,TheClient->iScreen);
1.592 +#else
1.593 + retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, fadedColor);
1.594 +#endif
1.595 + TEST(retVal);
1.596 + if (!retVal)
1.597 + INFO_PRINTF3(_L("LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, fadedColor) return value - Expected: %d, Actual: %d"), ETrue, retVal);
1.598 +
1.599 + blankWin->SetVisible(ETrue);
1.600 + iBlankWin->SetPos(iWindowRect.iTl+TPoint(15,-15));
1.601 + iBlankWin->BaseWin()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly);
1.602 + blankWin->SetVisible(EFalse);
1.603 + iBlankWin->SetPos(iWindowRect.iTl);
1.604 + TheClient->iWs.Finish();
1.605 + retVal = CheckBlankWindow(testArea,TRgb::Gray16(col),TheClient->iScreen);
1.606 + TEST(retVal);
1.607 + if (!retVal)
1.608 + INFO_PRINTF3(_L("CheckBlankWindow(testArea,TRgb::Gray16(col),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal);
1.609 +
1.610 + blankWin->SetVisible(ETrue);
1.611 + }
1.612 + delete blankWin;
1.613 + }
1.614 +
1.615 +void CTFade::TestStrips(TRect aRect,TInt aHeight,TInt aNumNotFaded,TBool aInvert/*=EFalse*/)
1.616 + {
1.617 + TBool isFaded;
1.618 + TInt ii;
1.619 + TRgb col;
1.620 + for (ii=0;ii<16;++ii)
1.621 + {
1.622 + isFaded=((!aInvert)==(!(ii<aNumNotFaded)));
1.623 + if (isFaded)
1.624 + col=MODE_LT_64K(iDeviceDisplayMode)?TRgb::Gray16(Fade16(ii)):FadeRgb(TRgb::Gray16(ii));
1.625 + else
1.626 + col=TRgb::Gray16(ii);
1.627 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.628 + TBool retVal = CheckBlankWindow(aRect,col,TheClient->iScreen);
1.629 +#else
1.630 + TBool retVal = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, aRect, col);
1.631 +#endif
1.632 + TEST(retVal);
1.633 + if (!retVal)
1.634 + INFO_PRINTF3(_L("CheckBlankWindow(aRect,col,TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retVal);
1.635 +
1.636 + aRect.Move(0,aHeight);
1.637 + }
1.638 + }
1.639 +
1.640 +void CTFade::FadeChildrenL()
1.641 + {
1.642 + if (MaxGrays()==0 && MaxColors()<256)
1.643 + return;
1.644 +
1.645 + TInt retVal;
1.646 + TBool retBool;
1.647 +
1.648 + __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow));
1.649 + iBlankWin->BaseWin()->SetRequiredDisplayMode(EGray16);
1.650 + iBlankWin->SetColor(TRgb::Gray16(0));
1.651 + CTBlankWindow* win[16];
1.652 + win[0]=iBlankWin;
1.653 + TRect rect(iTestWinSize);
1.654 + TInt height=iTestWinSize.iHeight/16;
1.655 + rect.iTl.iY=height;
1.656 + TInt ii;
1.657 + for (ii=1;ii<16;++ii) //Causes memory leakage under OOM
1.658 + {
1.659 + win[ii]=new(ELeave) CTBlankWindow();
1.660 + win[ii]->SetUpL(rect.iTl,rect.Size(),win[ii-1],*TheClient->iGc);
1.661 + win[ii]->BaseWin()->SetRequiredDisplayMode(EGray16);
1.662 + win[ii]->SetColor(TRgb::Gray16(ii));
1.663 + rect.iBr.iY-=height;
1.664 + }
1.665 + rect=iWindowRect;
1.666 + rect.SetHeight(height);
1.667 +#if defined(SMALL_RECTS)
1.668 + TSize size(rect.Size());
1.669 + size.iWidth=Min(SIZE_X,size.iWidth);
1.670 + size.iHeight=Min(SIZE_Y,size.iHeight);
1.671 + rect.SetSize(size);
1.672 +#endif
1.673 + for (ii=0;ii<15;++ii)
1.674 + {
1.675 + win[ii]->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren);
1.676 + retVal = win[ii]->BaseWin()->IsFaded();
1.677 + TEST(retVal==1);
1.678 + if (retVal!=1)
1.679 + INFO_PRINTF3(_L("win[ii]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), 1, retVal);
1.680 +
1.681 + TestStrips(rect,height,ii);
1.682 + win[ii]->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren);
1.683 + retBool = !win[ii]->BaseWin()->IsFaded();
1.684 + TEST(retBool);
1.685 + if (!retBool)
1.686 + INFO_PRINTF3(_L("!win[ii]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.687 +
1.688 + TestStrips(rect,height,16);
1.689 + }
1.690 + TheClient->iGroup->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren);
1.691 + TestStrips(rect,height,0);
1.692 + TheClient->iGroup->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren);
1.693 + TestStrips(rect,height,16);
1.694 + for (ii=0;ii<16;++ii)
1.695 + {
1.696 + win[ii]->BaseWin()->FadeBehind(ETrue);
1.697 + retBool = !win[ii]->BaseWin()->IsFaded();
1.698 + TEST(retBool);
1.699 + if (!retBool)
1.700 + INFO_PRINTF3(_L("!win[ii]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.701 +
1.702 + retVal = win[0]->BaseWin()->IsFaded();
1.703 + TEST(retVal==(ii>0));
1.704 + if (retVal!=(ii>0))
1.705 + INFO_PRINTF3(_L("win[0]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), (ii>0), retVal);
1.706 +
1.707 + TestStrips(rect,height,ii,ETrue);
1.708 + win[ii]->BaseWin()->FadeBehind(EFalse);
1.709 + TestStrips(rect,height,16);
1.710 + }
1.711 + iBlankWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren);
1.712 + TestStrips(rect,height,0);
1.713 + iBlankWin->WinTreeNode()->SetNonFading(ETrue);
1.714 + TestStrips(rect,height,16);
1.715 + win[8]->WinTreeNode()->SetNonFading(EFalse);
1.716 + TestStrips(rect,height,8);
1.717 + iBlankWin->WinTreeNode()->SetNonFading(EFalse);
1.718 + TestStrips(rect,height,0);
1.719 + iBlankWin->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren);
1.720 + TestStrips(rect,height,16);
1.721 + win[8]->WinTreeNode()->SetNonFading(ETrue);
1.722 + TestStrips(rect,height,16);
1.723 + iBlankWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren);
1.724 + TestStrips(rect,height,8,ETrue);
1.725 + win[8]->WinTreeNode()->SetNonFading(EFalse);
1.726 + TestStrips(rect,height,0);
1.727 + iBlankWin->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren);
1.728 + TestStrips(rect,height,16);
1.729 + for (ii=15;ii>0;--ii)
1.730 + delete win[ii];
1.731 + }
1.732 +
1.733 +static void ResetAndDestroyWindows(TAny* aPtr)
1.734 + {
1.735 + RPointerArray<CTBlankWindow>& win = *(static_cast<RPointerArray<CTBlankWindow>*>(aPtr));
1.736 + win.Remove(0);
1.737 + win.ResetAndDestroy();
1.738 + win.Close();
1.739 + }
1.740 +
1.741 +void CTFade::FadeChildrenAfterNewChildIsCreatedL()
1.742 + {
1.743 + if (MaxGrays()==0 && MaxColors()<256)
1.744 + return;
1.745 +
1.746 + TBool retBool;
1.747 + TInt retVal;
1.748 +
1.749 + __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow));
1.750 + iBlankWin->BaseWin()->SetRequiredDisplayMode(iFadeDrawMode);
1.751 + iBlankWin->SetColor(TRgb::Gray16(0));
1.752 + RPointerArray<CTBlankWindow> win;
1.753 + CleanupStack::PushL(TCleanupItem(ResetAndDestroyWindows, &win));
1.754 + TInt height=iTestWinSize.iHeight/NUMBER_OF_WINDOWS;
1.755 + CTBlankWindow* window=NULL;
1.756 + TInt ii;
1.757 + for (TInt firstLoop=0;firstLoop<NUMBER_OF_WINDOWS-1;)
1.758 + {
1.759 + win.ResetAndDestroy();
1.760 + TheClient->iGroup->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren);
1.761 + TRect rect(iTestWinSize);
1.762 + rect.iTl.iY=height;
1.763 + CTBlankWindow* parent=iBlankWin;
1.764 + for (TInt secondLoop=0;secondLoop<=firstLoop;)
1.765 + {
1.766 + window=new(ELeave) CTBlankWindow();
1.767 + CleanupStack::PushL(window);
1.768 + User::LeaveIfError(win.Append(window));
1.769 + CleanupStack::Pop(window);
1.770 + window->SetUpL(rect.iTl,rect.Size(),parent,*TheClient->iGc);
1.771 + window->BaseWin()->SetRequiredDisplayMode(iFadeDrawMode);
1.772 + window->SetColor(TRgb::Gray16(++secondLoop));
1.773 + rect.iBr.iY-=height;
1.774 + parent=window;
1.775 + retBool = window->BaseWin()->IsFaded();
1.776 + TEST(retBool);
1.777 + if (!retBool)
1.778 + INFO_PRINTF3(_L("window->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.779 +
1.780 + }
1.781 + ++firstLoop;
1.782 + TheClient->iGroup->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren);
1.783 + const TInt count=win.Count();
1.784 + for(TInt index=0;index<count;++index)
1.785 + {
1.786 + retBool = win[index]->BaseWin()->IsFaded();
1.787 + TEST(!retBool);
1.788 + if (retBool)
1.789 + INFO_PRINTF3(_L("win[index]->BaseWin()->IsFaded return value - Expected: %d, Actual: %d"), EFalse, retBool);
1.790 +
1.791 + }
1.792 + }
1.793 + User::LeaveIfError(win.Insert(iBlankWin,0));
1.794 + TRect testRect=iWindowRect;
1.795 + testRect.SetHeight(height);
1.796 +#if defined(SMALL_RECTS)
1.797 + TSize size(testRect.Size());
1.798 + size.iWidth=Min(SIZE_X,size.iWidth);
1.799 + size.iHeight=Min(SIZE_Y,size.iHeight);
1.800 + testRect.SetSize(size);
1.801 +#endif
1.802 + for (ii=0;ii<NUMBER_OF_WINDOWS;++ii)
1.803 + {
1.804 + win[ii]->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren);
1.805 + retVal = win[ii]->BaseWin()->IsFaded();
1.806 + TEST(retVal==1);
1.807 + if (retVal!=1)
1.808 + INFO_PRINTF3(_L("win[index]->BaseWin()->IsFaded return value - Expected: %d, Actual: %d"), 1, retVal);
1.809 +
1.810 + TestStrips(testRect,height,ii);
1.811 + win[ii]->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren);
1.812 + retBool = !win[ii]->BaseWin()->IsFaded();
1.813 + TEST(retBool);
1.814 + if (!retBool)
1.815 + INFO_PRINTF3(_L("!win[ii]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), EFalse, retBool);
1.816 +
1.817 + TestStrips(testRect,height,NUMBER_OF_WINDOWS);
1.818 + }
1.819 + TheClient->iGroup->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren);
1.820 + TestStrips(testRect,height,0);
1.821 + TheClient->iGroup->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren);
1.822 + TestStrips(testRect,height,16);
1.823 + for (ii=0;ii<NUMBER_OF_WINDOWS;++ii)
1.824 + {
1.825 + win[ii]->BaseWin()->FadeBehind(ETrue);
1.826 + retBool = !win[ii]->BaseWin()->IsFaded();
1.827 + TEST(retBool);
1.828 + if (!retBool)
1.829 + INFO_PRINTF3(_L("!win[ii]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), EFalse, retBool);
1.830 +
1.831 + retVal = win[0]->BaseWin()->IsFaded();
1.832 + TEST(retVal==(ii>0));
1.833 + if (retVal!=(ii>0))
1.834 + INFO_PRINTF3(_L("win[index]->BaseWin()->IsFaded return value - Expected: %d, Actual: %d"), (ii>0), retVal);
1.835 +
1.836 + TestStrips(testRect,height,ii,ETrue);
1.837 + win[ii]->BaseWin()->FadeBehind(EFalse);
1.838 + TestStrips(testRect,height,NUMBER_OF_WINDOWS);
1.839 + }
1.840 + iBlankWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren);
1.841 + TestStrips(testRect,height,0);
1.842 + iBlankWin->WinTreeNode()->SetNonFading(ETrue);
1.843 + TestStrips(testRect,height,NUMBER_OF_WINDOWS);
1.844 + win[8]->WinTreeNode()->SetNonFading(EFalse);
1.845 + TestStrips(testRect,height,NUMBER_OF_WINDOWS/2);
1.846 + iBlankWin->WinTreeNode()->SetNonFading(EFalse);
1.847 + TestStrips(testRect,height,0);
1.848 + iBlankWin->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren);
1.849 + TestStrips(testRect,height,NUMBER_OF_WINDOWS);
1.850 + win[8]->WinTreeNode()->SetNonFading(ETrue);
1.851 + TestStrips(testRect,height,NUMBER_OF_WINDOWS);
1.852 + iBlankWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeIncludeChildren);
1.853 + TestStrips(testRect,height,NUMBER_OF_WINDOWS/2,ETrue);
1.854 + win[8]->WinTreeNode()->SetNonFading(EFalse);
1.855 + TestStrips(testRect,height,0);
1.856 + iBlankWin->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeIncludeChildren);
1.857 + TestStrips(testRect,height,NUMBER_OF_WINDOWS);
1.858 +
1.859 + CleanupStack::PopAndDestroy(&win);
1.860 + }
1.861 +
1.862 +void CTFade::TestBlocks(TRect aRect,TSize aSize,TInt aNumNotFaded,TBool aInvert/*=EFalse*/)
1.863 + {
1.864 + TInt count=0;
1.865 + TInt ii,jj;
1.866 + TRgb col;
1.867 + for (ii=0;ii<4;++ii)
1.868 + {
1.869 + for (jj=0;jj<4;++jj)
1.870 + {
1.871 + if ((!aInvert)!=(!(count<aNumNotFaded)))
1.872 + col=TRgb::Gray16(count);
1.873 + else
1.874 + {
1.875 + col = TRgb::Gray16(count);
1.876 + col = MODE_LT_64K(iDeviceDisplayMode)?TRgb::Gray16(Fade16(count)):FadeRgb(col);
1.877 + }
1.878 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.879 + TBool retBool = CheckBlankWindow(aRect,col,TheClient->iScreen);
1.880 +#else
1.881 + TBool retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, aRect, col);
1.882 +#endif
1.883 + TEST(retBool);
1.884 + if (!retBool)
1.885 + INFO_PRINTF3(_L("CheckBlankWindow(aRect,col,TheClient->iScreen) return value - Expected: %d, Actual: %d"), EFalse, retBool);
1.886 +
1.887 + aRect.Move(0,aSize.iHeight);
1.888 + count++;
1.889 + }
1.890 + aRect.Move(aSize.iWidth,-jj*aSize.iHeight);
1.891 + }
1.892 + }
1.893 +
1.894 +void CTFade::FadeBehindL()
1.895 + {
1.896 + if (MaxGrays()==0 && MaxColors()<256)
1.897 + return;
1.898 +
1.899 + TBool retBool;
1.900 + TInt retVal;
1.901 +
1.902 + __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow));
1.903 + iBlankWin->BaseWin()->SetRequiredDisplayMode(EGray16);
1.904 + iBlankWin->SetColor(TRgb::Gray16(0));
1.905 + CTBlankWindow* win[4][4];
1.906 + win[0][0]=iBlankWin;
1.907 + TSize size=iTestWinSize;
1.908 + TInt height=iTestWinSize.iHeight/4;
1.909 + TInt width=iTestWinSize.iWidth/4;
1.910 + TRect rect(iWindowRect.iTl,TSize(width,height));
1.911 + TSize rectSize(rect.Size());
1.912 + TPoint offset(0,height);
1.913 + TPoint topLeft;
1.914 + TInt ii,jj;
1.915 + CTWinBase* parent;
1.916 +#if defined(SMALL_RECTS)
1.917 + TSize rSize(rectSize);
1.918 + rSize.iWidth=Min(SIZE_X,rSize.iWidth);
1.919 + rSize.iHeight=Min(SIZE_Y,rSize.iHeight);
1.920 + rect.SetSize(rSize);
1.921 +#endif
1.922 + for (ii=0;ii<4;++ii) //Causes memory leakage under OOM
1.923 + {
1.924 + parent=TheClient->iGroup;
1.925 + topLeft=iWindowRect.iTl+TPoint(ii*width,0);
1.926 + size.iHeight=iTestWinSize.iHeight;
1.927 + for (jj=0;jj<4;++jj)
1.928 + {
1.929 + if (ii+jj>0)
1.930 + {
1.931 + win[ii][jj]=new(ELeave) CTBlankWindow();
1.932 + win[ii][jj]->SetUpL(topLeft,size,parent,*TheClient->iGc);
1.933 + win[ii][jj]->BaseWin()->SetRequiredDisplayMode(EGray16);
1.934 + win[ii][jj]->SetColor(TRgb::Gray16(4*ii+jj));
1.935 + }
1.936 + size.iHeight-=height;
1.937 + topLeft=offset;
1.938 + parent=win[ii][jj];
1.939 + }
1.940 + size.iWidth-=width;
1.941 + }
1.942 + for (ii=0;ii<4;++ii)
1.943 + {
1.944 + for (jj=0;jj<4;++jj)
1.945 + {
1.946 + win[ii][jj]->BaseWin()->FadeBehind(ETrue);
1.947 + retVal = win[0][0]->BaseWin()->IsFaded();
1.948 + TEST(retVal==(ii>0||jj>0));
1.949 + if (retVal!=(ii>0||jj>0))
1.950 + INFO_PRINTF3(_L("win[0][0]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), (ii>0||jj>0), retVal);
1.951 +
1.952 + retBool = !win[ii][jj]->BaseWin()->IsFaded();
1.953 + TEST(retBool);
1.954 + if (!retBool)
1.955 + INFO_PRINTF3(_L("!win[ii][jj]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.956 +
1.957 + TestBlocks(rect,rectSize,4*ii+jj,ETrue);
1.958 + win[ii][jj]->BaseWin()->FadeBehind(EFalse);
1.959 + TestBlocks(rect,rectSize,16);
1.960 + }
1.961 + }
1.962 + for (ii=0;ii<4;++ii)
1.963 + {
1.964 + for (jj=0;jj<4;++jj)
1.965 + {
1.966 + win[ii][jj]->BaseWin()->FadeBehind(ETrue);
1.967 + TestBlocks(rect,rectSize,4*ii+jj,ETrue);
1.968 + }
1.969 + retVal = win[ii][0]->BaseWin()->IsFaded();
1.970 + TEST(retVal==3);
1.971 + if (retVal!=3)
1.972 + INFO_PRINTF3(_L("win[ii][0]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), 3, retVal);
1.973 + }
1.974 + for (ii=3;ii>=0;--ii)
1.975 + {
1.976 + retVal = win[ii][0]->BaseWin()->IsFaded();
1.977 + TEST(retVal==3);
1.978 + if (retVal!=3)
1.979 + INFO_PRINTF3(_L("win[ii][0]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), 3, retVal);
1.980 +
1.981 + for (jj=3;jj>=0;--jj)
1.982 + {
1.983 + TestBlocks(rect,rectSize,4*ii+jj,ETrue);
1.984 + win[ii][jj]->BaseWin()->FadeBehind(EFalse);
1.985 + }
1.986 + }
1.987 + TestBlocks(rect,rectSize,0,ETrue);
1.988 + for (ii=0;ii<4;++ii)
1.989 + {
1.990 + for (jj=0;jj<4;++jj)
1.991 + {
1.992 + win[ii][jj]->BaseWin()->FadeBehind(ETrue);
1.993 + }
1.994 + }
1.995 + TInt fadeCount;
1.996 + for (ii=0;ii<4;++ii)
1.997 + {
1.998 + for (jj=0;jj<4;++jj)
1.999 + {
1.1000 + fadeCount=15-(4*ii+jj);
1.1001 + retVal = win[0][0]->BaseWin()->IsFaded();
1.1002 + TEST(retVal==Min(15,fadeCount+1));
1.1003 + if (retVal!=Min(15,fadeCount+1))
1.1004 + INFO_PRINTF3(_L("win[0][0]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), Min(15,fadeCount+1), retVal);
1.1005 +
1.1006 + retVal = win[ii][jj]->BaseWin()->IsFaded();
1.1007 + TEST(retVal==Max(0,fadeCount));
1.1008 + if (retVal!=Max(0,fadeCount))
1.1009 + INFO_PRINTF3(_L("win[ii][jj]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), Max(0,fadeCount), retVal);
1.1010 +
1.1011 + TestBlocks(rect,rectSize,15,ETrue);
1.1012 + win[ii][jj]->BaseWin()->FadeBehind(EFalse);
1.1013 + retVal = win[ii][jj]->BaseWin()->IsFaded();
1.1014 + TEST(retVal==Max(0,fadeCount));
1.1015 + if (retVal!=Max(0,fadeCount))
1.1016 + INFO_PRINTF3(_L("win[ii][jj]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), Max(0,fadeCount), retVal);
1.1017 +
1.1018 + }
1.1019 + }
1.1020 + TestBlocks(rect,rectSize,0,ETrue);
1.1021 + if (Fade16(15)==15)
1.1022 + {
1.1023 + win[3][3]->BaseWin()->FadeBehind(ETrue); //All faded as the only unfaded one is white
1.1024 + for (ii=3;ii>=0;--ii)
1.1025 + {
1.1026 + retVal = win[ii][0]->BaseWin()->IsFaded();
1.1027 + TEST(retVal==1);
1.1028 + if (retVal!=1)
1.1029 + INFO_PRINTF3(_L("win[ii][0]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), 1, retVal);
1.1030 +
1.1031 + retBool = !win[ii][1]->BaseWin()->IsNonFading();
1.1032 + TEST(retBool);
1.1033 + if (!retBool)
1.1034 + INFO_PRINTF3(_L("!win[ii][1]->BaseWin()->IsNonFading() return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.1035 +
1.1036 + win[ii][0]->WinTreeNode()->SetNonFading(ETrue);
1.1037 + retBool = win[ii][1]->BaseWin()->IsNonFading();
1.1038 + TEST(retBool);
1.1039 + if (!retBool)
1.1040 + INFO_PRINTF3(_L("win[ii][1]->BaseWin()->IsNonFading() return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.1041 +
1.1042 + TestBlocks(rect,rectSize,4*ii,ETrue);
1.1043 + }
1.1044 + for (ii=3;ii>=0;--ii)
1.1045 + {
1.1046 + retVal = win[ii][0]->BaseWin()->IsFaded();
1.1047 + TEST(retVal==1);
1.1048 + if (retVal!=1)
1.1049 + INFO_PRINTF3(_L("win[ii][0]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), 1, retVal);
1.1050 +
1.1051 + retBool = win[ii][1]->BaseWin()->IsNonFading();
1.1052 + TEST(retBool);
1.1053 + if (!retBool)
1.1054 + INFO_PRINTF3(_L("win[ii][1]->BaseWin()->IsNonFading() return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.1055 +
1.1056 + win[ii][0]->WinTreeNode()->SetNonFading(EFalse);
1.1057 + retBool = !win[ii][1]->BaseWin()->IsNonFading();
1.1058 + TEST(retBool);
1.1059 + if (!retBool)
1.1060 + INFO_PRINTF3(_L("win[ii][1]->BaseWin()->IsNonFading() return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.1061 +
1.1062 + TestBlocks(rect,rectSize,4*ii);
1.1063 + }
1.1064 + win[3][3]->BaseWin()->FadeBehind(EFalse);
1.1065 + }
1.1066 + for (ii=3;ii>=0;--ii)
1.1067 + {
1.1068 + for (jj=3;jj>=0;--jj)
1.1069 + {
1.1070 + if (ii+jj>0)
1.1071 + delete win[ii][jj];
1.1072 + }
1.1073 + }
1.1074 + }
1.1075 +
1.1076 +void CTFade::ColorTest2()
1.1077 + {
1.1078 +#if defined(__MARM__)
1.1079 + return;
1.1080 +#else
1.1081 + __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow));
1.1082 + TSize size=iTestWinSize;
1.1083 +#if defined(SMALL_RECTS)
1.1084 + size.iWidth=Min(SIZE_X,size.iWidth);
1.1085 + size.iHeight=Min(SIZE_Y,size.iHeight);
1.1086 +#endif
1.1087 + if (MaxGrays()==0 && MaxColors()<256)
1.1088 + return;
1.1089 + TRect windowRect(iBlankWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),size);
1.1090 + TUint8 bm;
1.1091 + TUint8 wm;
1.1092 + TInt test=0;
1.1093 + TInt ii;
1.1094 + FOREVER
1.1095 + {
1.1096 + TInt fadeMapFactor = 0;
1.1097 + TInt fadeMapOffset = 0;
1.1098 +
1.1099 + switch (test)
1.1100 + {
1.1101 + case 0: //Nothing
1.1102 + bm=0;
1.1103 + wm=15;
1.1104 + break;
1.1105 + case 1: //Shadowing or Quartz fading
1.1106 + bm=0;
1.1107 + wm=7;
1.1108 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.1109 + TheClient->iWs.SetDefaultFadingParameters(0,127);
1.1110 + fadeMapFactor = 128;
1.1111 +#else
1.1112 + TheClient->iWs.SetDefaultFadingParameters(STATIC_CAST(TUint8,bm*17),127);
1.1113 + fadeMapFactor = 127-STATIC_CAST(TUint8,bm*17);
1.1114 +#endif
1.1115 + break;
1.1116 + default:
1.1117 + TheClient->iWs.SetDefaultFadingParameters(BLACK_NORMAL,WHITE_NORMAL);
1.1118 + return;
1.1119 + }
1.1120 + if (wm!=7)
1.1121 + {
1.1122 + fadeMapOffset = STATIC_CAST(TUint8,bm*17);
1.1123 + fadeMapFactor = STATIC_CAST(TUint8,wm*17) - fadeMapOffset;
1.1124 + TheClient->iWs.SetDefaultFadingParameters(STATIC_CAST(TUint8,bm*17),STATIC_CAST(TUint8,wm*17));
1.1125 + }
1.1126 +
1.1127 + for (ii=0;ii<16;ii+=5)
1.1128 + {
1.1129 + iBlankWin->SetColor(TRgb::Gray16(ii));
1.1130 + ViewDelay();
1.1131 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.1132 + TBool retBool=CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen);
1.1133 +#else
1.1134 + TBool retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray16(ii));
1.1135 +#endif
1.1136 + TEST(retBool);
1.1137 + if (!retBool)
1.1138 + {
1.1139 + _LIT(KLog,"Setting color on blank window failed mappings=%d color=%d");
1.1140 + LOG_MESSAGE3(KLog,test,ii);
1.1141 + }
1.1142 + iBlankWin->BaseWin()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly);
1.1143 + ViewDelay();
1.1144 +
1.1145 + TRgb col1 = FadeRgb(TRgb::Gray16(ii), fadeMapFactor, fadeMapOffset);
1.1146 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.1147 + retBool=CheckBlankWindow(windowRect,col1,TheClient->iScreen);
1.1148 +#else
1.1149 + retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, col1);
1.1150 +#endif
1.1151 + TEST(retBool);
1.1152 + if (!retBool)
1.1153 + {
1.1154 + _LIT(KLog,"Fading the window gave wrong color mappings=%d color=%d");
1.1155 + LOG_MESSAGE3(KLog,test,ii);
1.1156 + }
1.1157 + iBlankWin->BaseWin()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly);
1.1158 + ViewDelay();
1.1159 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.1160 + retBool=CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen);
1.1161 +#else
1.1162 + retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray16(ii));
1.1163 +#endif
1.1164 + TEST(retBool);
1.1165 + if (!retBool)
1.1166 + {
1.1167 + _LIT(KLog,"Unfading the window gave wrong color mappings=%d color=%d");
1.1168 + LOG_MESSAGE3(KLog,test,ii);
1.1169 + }
1.1170 + }
1.1171 + ++test;
1.1172 + }
1.1173 +#endif //__MARM__
1.1174 + }
1.1175 +
1.1176 +void CTFade::FadeTest()
1.1177 + {
1.1178 +#if defined(__MARM__)
1.1179 + return;
1.1180 +#else
1.1181 + __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow));
1.1182 + TSize size=iTestWinSize;
1.1183 +#if defined(SMALL_RECTS)
1.1184 + size.iWidth=Min(SIZE_X,size.iWidth);
1.1185 + size.iHeight=Min(SIZE_Y,size.iHeight);
1.1186 +#endif
1.1187 + if (MaxGrays()==0 && MaxColors()<256)
1.1188 + return;
1.1189 + TRect windowRect(iBlankWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),size);
1.1190 + TUint8 bm;
1.1191 + TUint8 wm;
1.1192 + TUint8 fb;
1.1193 + TUint8 fw;
1.1194 + TInt test=0;
1.1195 + TInt ii;
1.1196 + FOREVER
1.1197 + {
1.1198 + TInt fadeMapFactor = 0;
1.1199 + TInt fadeMapOffset = 0;
1.1200 + fw=0;
1.1201 + switch (test)
1.1202 + {
1.1203 + case 0: //Nothing
1.1204 + bm=0;
1.1205 + wm=15;
1.1206 + break;
1.1207 + case 1: //Shadowing or Quartz fading
1.1208 +
1.1209 + bm=0;
1.1210 + wm=7;
1.1211 + fw=127;
1.1212 + break;
1.1213 + default:
1.1214 + return;
1.1215 + }
1.1216 + fb=STATIC_CAST(TUint8,17*bm);
1.1217 + if (!fw)
1.1218 + fw=STATIC_CAST(TUint8,17*wm);
1.1219 + fadeMapFactor = fw - fb;
1.1220 + fadeMapOffset = fb;
1.1221 + for (ii=0;ii<16;ii+=5)
1.1222 + {
1.1223 + iBlankWin->SetColor(TRgb::Gray16(ii));
1.1224 + ViewDelay();
1.1225 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.1226 + TBool retBool = CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen);
1.1227 +#else
1.1228 + TBool retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray16(ii));
1.1229 +#endif
1.1230 + TEST(retBool);
1.1231 + if (!retBool)
1.1232 + INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.1233 +
1.1234 + TRgb col3 = TRgb::Gray16(ii).Internal();
1.1235 + TRgb col1 = FadeRgb(col3, fadeMapFactor, fadeMapOffset);
1.1236 + iBlankWin->BaseWin()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly,fb,fw);
1.1237 + ViewDelay();
1.1238 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.1239 + retBool = CheckBlankWindow(windowRect,col1,TheClient->iScreen);
1.1240 +#else
1.1241 + retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, col1);
1.1242 +#endif
1.1243 + TEST(retBool);
1.1244 + if (!retBool)
1.1245 + INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray16((ii*wb+add)/15),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.1246 +
1.1247 + iBlankWin->BaseWin()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly);
1.1248 + ViewDelay();
1.1249 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.1250 + retBool = CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen);
1.1251 +#else
1.1252 + retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray16(ii));
1.1253 +#endif
1.1254 + TEST(retBool);
1.1255 + if (!retBool)
1.1256 + INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.1257 +
1.1258 + }
1.1259 + ++test;
1.1260 + }
1.1261 +#endif //__MARM__
1.1262 + }
1.1263 +
1.1264 +void CTFade::Draw(TBool aAlternativeFade/*=EFalse*/)
1.1265 + {
1.1266 + __ASSERT_ALWAYS(iWin,AutoPanic(EAutoFadeWindow));
1.1267 + TRgb grey=TRgb::Gray4(2);
1.1268 + Draw(0,&grey,aAlternativeFade);
1.1269 + Draw(1,NULL,aAlternativeFade);
1.1270 + iContent=1;
1.1271 + CompareWithBitmap(EFalse);
1.1272 + if (aAlternativeFade)
1.1273 + iWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly,BLACK_ALTERNATE,WHITE_ALTERNATE);
1.1274 + else
1.1275 + iWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly);
1.1276 + CompareWithBitmap(ETrue);
1.1277 + Draw(3,NULL,aAlternativeFade);
1.1278 + iContent=2;
1.1279 + CompareWithBitmap(ETrue);
1.1280 + iWin->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly);
1.1281 + CompareWithBitmap(EFalse);
1.1282 + }
1.1283 +
1.1284 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.1285 +void CTFade::GCDraw()
1.1286 + {
1.1287 + __ASSERT_ALWAYS(iWin,AutoPanic(EAutoFadeWindow));
1.1288 + TRgb grey=TRgb::Gray4(2);
1.1289 + TInt ii;
1.1290 + GCDraw(0,&grey);
1.1291 + GCDraw(3,NULL);
1.1292 + for (ii=3;ii<70;ii+=13)
1.1293 + GCDraw(2,&ii);
1.1294 + iContent=6;
1.1295 + CompareWindows();
1.1296 + GCDraw(0,&grey,ETrue);
1.1297 + GCDraw(3,NULL,ETrue);
1.1298 + for (ii=3;ii<70;ii+=13)
1.1299 + GCDraw(2,&ii,ETrue);
1.1300 + GCDraw(1,NULL,ETrue);
1.1301 + iContent=7;
1.1302 + CompareWindows(ETrue);
1.1303 + }
1.1304 +#endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.1305 +
1.1306 +void CTFade::ObscuredL()
1.1307 + {
1.1308 + CTBlankWindow* blankWin=new(ELeave) CTBlankWindow();
1.1309 + TRect windowRect(iWindowRect);
1.1310 + windowRect.Shrink(30,30);
1.1311 + blankWin->SetUpL(windowRect.iTl,windowRect.Size(),TheClient->iGroup,*TheClient->iGc);
1.1312 +
1.1313 + __ASSERT_ALWAYS(iWin,AutoPanic(EAutoFadeWindow));
1.1314 + TRgb grey=TRgb::Gray4(2);
1.1315 + Draw(0,&grey);
1.1316 + Draw(3,NULL);
1.1317 + iContent=3;
1.1318 + iWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly);
1.1319 + blankWin->SetVisible(EFalse);
1.1320 + CompareWithBitmap(ETrue);
1.1321 + blankWin->SetVisible(ETrue);
1.1322 + grey=TRgb::Gray4(1);
1.1323 + Draw(0,&grey);
1.1324 + for (TInt ii=1;ii<37;ii+=7)
1.1325 + Draw(2,&ii);
1.1326 + iContent=4;
1.1327 + blankWin->SetVisible(EFalse);
1.1328 + CompareWithBitmap(ETrue);
1.1329 + blankWin->SetVisible(ETrue);
1.1330 + iWin->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly);
1.1331 + blankWin->SetVisible(EFalse);
1.1332 + CompareWithBitmap(EFalse);
1.1333 +
1.1334 + delete blankWin;
1.1335 + }
1.1336 +
1.1337 +void CTFade::MovingL()
1.1338 + {
1.1339 + CTBlankWindow* blankWin=new(ELeave) CTBlankWindow();
1.1340 + TRect windowRect(iWindowRect);
1.1341 + windowRect.Shrink(40,40);
1.1342 + blankWin->SetUpL(windowRect.iTl,windowRect.Size(),TheClient->iGroup,*TheClient->iGc);
1.1343 +
1.1344 + __ASSERT_ALWAYS(iWin,AutoPanic(EAutoFadeWindow));
1.1345 + TRgb grey=TRgb::Gray4(2);
1.1346 + Draw(0,&grey);
1.1347 + Draw(1,NULL);
1.1348 + for (TInt ii=2;ii<60;ii+=11)
1.1349 + Draw(2,&ii);
1.1350 + iContent=5;
1.1351 + blankWin->SetPos(windowRect.iTl+TPoint(25,-25));
1.1352 + iWin->WinTreeNode()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly);
1.1353 + blankWin->SetPos(windowRect.iTl+TPoint(10,25));
1.1354 + blankWin->SetVisible(EFalse);
1.1355 + CompareWithBitmap(ETrue);
1.1356 + blankWin->SetVisible(ETrue);
1.1357 + blankWin->SetPos(windowRect.iTl+TPoint(25,-25));
1.1358 + iWin->WinTreeNode()->SetFaded(EFalse,RWindowTreeNode::EFadeWindowOnly);
1.1359 + blankWin->SetPos(windowRect.iTl+TPoint(-5,10));
1.1360 + blankWin->SetVisible(EFalse);
1.1361 + CompareWithBitmap(EFalse);
1.1362 +
1.1363 + delete blankWin;
1.1364 + }
1.1365 +
1.1366 +void CTFade::SystemFadeL()
1.1367 + {
1.1368 + if (MaxGrays()==0 && MaxColors()<256)
1.1369 + return;
1.1370 +
1.1371 + CTBlankWindow* win[16];
1.1372 + TInt height=iTestWinSize.iHeight/16;
1.1373 + TRect rect(iWindowRect);
1.1374 + rect.SetHeight(height);
1.1375 + TInt ii;
1.1376 + for (ii=0;ii<16;++ii) //Causes memory leakage under OOM
1.1377 + {
1.1378 + win[ii]=new(ELeave) CTBlankWindow();
1.1379 + win[ii]->SetUpL(rect.iTl,rect.Size(),TheClient->iGroup,*TheClient->iGc);
1.1380 + win[ii]->BaseWin()->SetRequiredDisplayMode(EGray16);
1.1381 + win[ii]->SetColor(TRgb::Gray16(ii));
1.1382 + rect.Move(0,height);
1.1383 + }
1.1384 + rect=iWindowRect;
1.1385 + rect.SetHeight(height);
1.1386 +#if defined(SMALL_RECTS)
1.1387 + TSize size(rect.Size());
1.1388 + size.iWidth=Min(SIZE_X,size.iWidth);
1.1389 + size.iHeight=Min(SIZE_Y,size.iHeight);
1.1390 + rect.SetSize(size);
1.1391 +#endif
1.1392 +
1.1393 + TBool retBool;
1.1394 +
1.1395 + // system fade on
1.1396 + TheClient->iWs.SetSystemFaded(ETrue);
1.1397 + for (ii=0;ii<16;++ii)
1.1398 + {
1.1399 + retBool = win[ii]->BaseWin()->IsFaded();
1.1400 + TEST(retBool);
1.1401 + if (!retBool)
1.1402 + INFO_PRINTF3(_L("win[ii]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.1403 + }
1.1404 + TestStrips(rect,height,0);
1.1405 +
1.1406 + // system fade off
1.1407 + TheClient->iWs.SetSystemFaded(EFalse);
1.1408 + for (ii=0;ii<16;++ii)
1.1409 + {
1.1410 + retBool = !win[ii]->BaseWin()->IsFaded();
1.1411 + TEST(retBool);
1.1412 + if (!retBool)
1.1413 + INFO_PRINTF3(_L("!win[ii]->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.1414 + }
1.1415 + TestStrips(rect,height,16);
1.1416 +
1.1417 + // Now with half non fading
1.1418 + for (ii=8;ii<16;++ii)
1.1419 + win[ii]->WinTreeNode()->SetNonFading(ETrue);
1.1420 +
1.1421 + // system fade on
1.1422 + TheClient->iWs.SetSystemFaded(ETrue);
1.1423 + TestStrips(rect,height,8,ETrue);
1.1424 +
1.1425 + // system fade off
1.1426 + TheClient->iWs.SetSystemFaded(EFalse);
1.1427 + TestStrips(rect,height,16);
1.1428 +
1.1429 + for (ii=0;ii<16;++ii)
1.1430 + delete win[ii];
1.1431 + }
1.1432 +
1.1433 +void CTFade::SystemAlternateFadeL()
1.1434 + {
1.1435 +#if defined(__MARM__)
1.1436 + return;
1.1437 +#else
1.1438 + __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow));
1.1439 + TSize size=iTestWinSize;
1.1440 +#if defined(SMALL_RECTS)
1.1441 + size.iWidth=Min(SIZE_X,size.iWidth);
1.1442 + size.iHeight=Min(SIZE_Y,size.iHeight);
1.1443 +#endif
1.1444 + if (MaxGrays()==0 && MaxColors()<256)
1.1445 + return;
1.1446 + TRect windowRect(iBlankWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),size);
1.1447 + TUint8 bm;
1.1448 + TUint8 wm;
1.1449 + TUint8 fb;
1.1450 + TUint8 fw;
1.1451 + TInt wb;
1.1452 + TInt add;
1.1453 + TInt test=0;
1.1454 + TInt ii;
1.1455 + TBool retBool;
1.1456 + FOREVER
1.1457 + {
1.1458 + TInt fadeMapFactor = 0;
1.1459 + TInt fadeMapOffset = 0;
1.1460 + fw=0;
1.1461 + switch (test)
1.1462 + {
1.1463 + case 0: //Nothing
1.1464 + bm=0;
1.1465 + wm=15;
1.1466 + break;
1.1467 + case 1: //Shadowing or Quartz fading
1.1468 + bm=0;
1.1469 + wm=7;
1.1470 + fw=127;
1.1471 + break;
1.1472 + default:
1.1473 + return;
1.1474 + }
1.1475 + wb=wm-bm;
1.1476 + add=15*bm+7;
1.1477 + fb=STATIC_CAST(TUint8,17*bm);
1.1478 + if (!fw)
1.1479 + fw=STATIC_CAST(TUint8,17*wm);
1.1480 + fadeMapFactor = fw - fb;
1.1481 + fadeMapOffset = fb;
1.1482 + for (ii=0;ii<16;ii+=5)
1.1483 + {
1.1484 + iBlankWin->SetColor(TRgb::Gray16(ii));
1.1485 + ViewDelay();
1.1486 + TheClient->iWs.Finish();
1.1487 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.1488 + retBool = CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen);
1.1489 +#else
1.1490 + retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray16(ii));
1.1491 +#endif
1.1492 + TEST(retBool);
1.1493 + if (!retBool)
1.1494 + INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.1495 +
1.1496 + TheClient->iWs.SetSystemFaded(ETrue,fb,fw);
1.1497 + ViewDelay();
1.1498 +
1.1499 + TRgb col3 = TRgb::Gray16(ii).Internal();
1.1500 + TRgb col1 = FadeRgb(col3, fadeMapFactor, fadeMapOffset);
1.1501 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.1502 + retBool = CheckBlankWindow(windowRect,col1,TheClient->iScreen);
1.1503 +#else
1.1504 + retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, col1);
1.1505 +#endif
1.1506 + TEST(retBool);
1.1507 + if (!retBool)
1.1508 + INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray16((ii*wb+add)/15),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.1509 +
1.1510 + TheClient->iWs.SetSystemFaded(EFalse);
1.1511 + ViewDelay();
1.1512 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.1513 + retBool = CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen);
1.1514 +#else
1.1515 + retBool = LossyCheckBlankWindow(*TheClient->iScreen, *iTestWinCopy, windowRect, TRgb::Gray16(ii));
1.1516 +#endif
1.1517 + TEST(retBool);
1.1518 + if (!retBool)
1.1519 + INFO_PRINTF3(_L("CheckBlankWindow(windowRect,TRgb::Gray16(ii),TheClient->iScreen) return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.1520 + }
1.1521 + ++test;
1.1522 + }
1.1523 +#endif //__MARM__
1.1524 + }
1.1525 +
1.1526 +void CTFade::FadeBehindWhenMovedL()
1.1527 + {
1.1528 + __ASSERT_ALWAYS(iBlankWin,AutoPanic(EAutoFadeWindow));
1.1529 + TDisplayMode displayMode=iBlankWin->BaseWin()->DisplayMode();
1.1530 + iBlankWin->BaseWin()->SetRequiredDisplayMode(EGray16);
1.1531 + iBlankWin->SetColor(TRgb::Gray16(1));
1.1532 + TSize size(iTestWinSize.iHeight/4,iTestWinSize.iWidth/4);
1.1533 + CTBlankWindow* blankWinTemp=new(ELeave) CTBlankWindow();
1.1534 + CleanupStack::PushL(blankWinTemp);
1.1535 + blankWinTemp->SetUpL(TPoint(5,5),size,iBlankWin,*TheClient->iGc);
1.1536 + blankWinTemp->BaseWin()->SetRequiredDisplayMode(EGray16);
1.1537 + blankWinTemp->SetColor(TRgb::Gray16(15));
1.1538 + blankWinTemp->BaseWin()->FadeBehind(ETrue);
1.1539 + TheClient->Flush();
1.1540 + blankWinTemp->SetPos(TPoint(5,120));
1.1541 + //Check whether the back window is faded or not
1.1542 + TBool retBool = iBlankWin->BaseWin()->IsFaded();
1.1543 + TEST(retBool);
1.1544 + if (!retBool)
1.1545 + INFO_PRINTF3(_L("iBlankWin->BaseWin()->IsFaded() return value - Expected: %d, Actual: %d"), ETrue, retBool);
1.1546 +
1.1547 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.1548 + CheckRect(iWindowRect.iTl+TPoint(5,5),iWindowRect.iTl+TPoint(75,5),size,_L("CTFade::FadeBehindWhenMovedL()"));
1.1549 +#else
1.1550 + TInt res = LossyCompareWindow(*TheClient->iScreen, *iTestWinCopy, *iCheckWinCopy, TRect(iWindowRect.iTl+TPoint(75,5),size));
1.1551 + TEST(res);
1.1552 +#endif
1.1553 +
1.1554 + //Check whether the area behind the moved window and any other area on same window are identical
1.1555 + blankWinTemp->BaseWin()->FadeBehind(EFalse);
1.1556 + iBlankWin->BaseWin()->SetRequiredDisplayMode(displayMode);
1.1557 + CleanupStack::PopAndDestroy(blankWinTemp);
1.1558 + }
1.1559 +
1.1560 +void CTFade::FadeBehindTransparentWindowL()
1.1561 + {
1.1562 + const TInt KNumberOfWindows = 3;
1.1563 + CRedrawWin* win[KNumberOfWindows];
1.1564 + TRect rect(iWindowRect);
1.1565 + rect.Resize(-iWindowRect.Width()/3,-iWindowRect.Height()/3);
1.1566 + rect.Move(iWindowRect.Width()/10,iWindowRect.Height()/5);
1.1567 + TRect rectWin[KNumberOfWindows];
1.1568 +
1.1569 + for (TInt ii=0; ii<KNumberOfWindows; ++ii) //Causes memory leakage under OOM
1.1570 + {
1.1571 + rectWin[ii] = rect;
1.1572 + win[ii]=new(ELeave) CRedrawWin(this);
1.1573 + win[ii]->ConstructExtLD(*TheClient->iGroup,rectWin[ii].iTl,rectWin[ii].Size());
1.1574 + win[ii]->AssignGC(*TheClient->iGc);
1.1575 + win[ii]->Win()->EnableRedrawStore(EFalse);
1.1576 + win[ii]->BaseWin()->SetRequiredDisplayMode(EColor16MA);
1.1577 + if (ii==0)
1.1578 + {
1.1579 + win[ii]->Win()->SetBackgroundColor(TRgb(200,0,0,255));
1.1580 + }
1.1581 + else
1.1582 + {
1.1583 + TEST(KErrNone == win[ii]->Win()->SetTransparencyAlphaChannel());
1.1584 + if (iStep->TestStepResult() != EPass)
1.1585 + {
1.1586 + INFO_PRINTF1(_L("Transparency Alpha channel failed to be enabled"));
1.1587 + }
1.1588 + win[ii]->Win()->SetBackgroundColor(TRgb(40,100,0,0)); //RGB colour is of minor importance, as the window is fully transparent (Alpha=0)
1.1589 + }
1.1590 + win[ii]->Activate();
1.1591 +
1.1592 + //Make sure each window is drawn to the screen now when the new background
1.1593 + //colour have been set but before the call to SetFaded
1.1594 + win[ii]->Win()->BeginRedraw();
1.1595 + win[ii]->Win()->EndRedraw();
1.1596 +
1.1597 + rect.Resize(0,-iWindowRect.Height()/10);
1.1598 + rect.Move(iWindowRect.Width()/10,iWindowRect.Height()/20);
1.1599 + }
1.1600 + TheClient->iWs.Flush();
1.1601 + TheClient->iWs.Finish();
1.1602 +
1.1603 + win[0]->Win()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly);
1.1604 + win[1]->Win()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly);
1.1605 + win[2]->Win()->SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly);
1.1606 +
1.1607 + TheClient->iWs.Flush();
1.1608 + TheClient->iWs.Finish();
1.1609 +
1.1610 + // As the windows ovelap on their left side, compare the top left corners of the faded windows in order to verify that
1.1611 + // for the opaque window the directly on top faded area and the faded area under the transparent window (the area that
1.1612 + // overlaps with the transparent windows) have the same colour.
1.1613 + TRgb rgbWin[KNumberOfWindows];
1.1614 + TheClient->iScreen->GetPixel(rgbWin[0], rectWin[0].iTl);
1.1615 + TheClient->iScreen->GetPixel(rgbWin[1], rectWin[1].iTl);
1.1616 + TheClient->iScreen->GetPixel(rgbWin[2], rectWin[2].iTl);
1.1617 +
1.1618 + TEST( ETrue == (rgbWin[0].Red()==rgbWin[1].Red())&&(rgbWin[0].Green()==rgbWin[1].Green())&&(rgbWin[0].Blue()==rgbWin[1].Blue()) );
1.1619 + TEST( ETrue == (rgbWin[0].Red()==rgbWin[2].Red())&&(rgbWin[0].Green()==rgbWin[2].Green())&&(rgbWin[0].Blue()==rgbWin[2].Blue()) );
1.1620 +
1.1621 + for (TInt ii=0; ii<KNumberOfWindows; ++ii)
1.1622 + {
1.1623 + delete win[ii];
1.1624 + }
1.1625 + }
1.1626 +
1.1627 +#define BACKUPWIN 11
1.1628 +#define REDRAWWIN 20
1.1629 +void CTFade::RunTestCaseL(TInt /*aCurTestCase*/)
1.1630 + {
1.1631 + ((CTFadeStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
1.1632 + switch(++iTest->iState)
1.1633 + {
1.1634 +/**
1.1635 +@SYMTestCaseID GRAPHICS-WSERV-0218
1.1636 +
1.1637 +@SYMDEF DEF081259
1.1638 +
1.1639 +@SYMTestCaseDesc Test fading colours in windows
1.1640 +
1.1641 +@SYMTestPriority High
1.1642 +
1.1643 +@SYMTestStatus Implemented
1.1644 +
1.1645 +@SYMTestActions Fade the colours in windows and check they fade correctly
1.1646 +
1.1647 +@SYMTestExpectedResults Colour fade correctly
1.1648 +*/
1.1649 + case 1:
1.1650 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0218"));
1.1651 + iTest->LogSubTest(_L("Color Check"));
1.1652 + CreateBlankWindowL();
1.1653 + ColorTest();
1.1654 + //iTest->iState=5;
1.1655 + break;
1.1656 +/**
1.1657 +@SYMTestCaseID GRAPHICS-WSERV-0219
1.1658 +
1.1659 +@SYMDEF DEF081259
1.1660 +
1.1661 +@SYMTestCaseDesc Test fading in a blank window
1.1662 +
1.1663 +@SYMTestPriority High
1.1664 +
1.1665 +@SYMTestStatus Implemented
1.1666 +
1.1667 +@SYMTestActions Fade in a blank window and check the fading occurs correctly
1.1668 +
1.1669 +@SYMTestExpectedResults Fading in a blank window occurs correctly
1.1670 +*/
1.1671 + case 2:
1.1672 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0219"));
1.1673 + iTest->LogSubTest(_L("Blank Window"));
1.1674 + BlankWindowL();
1.1675 + break;
1.1676 +/**
1.1677 +@SYMTestCaseID GRAPHICS-WSERV-0220
1.1678 +
1.1679 +@SYMDEF DEF081259
1.1680 +
1.1681 +@SYMTestCaseDesc Test fading in child windows
1.1682 +
1.1683 +@SYMTestPriority High
1.1684 +
1.1685 +@SYMTestStatus Implemented
1.1686 +
1.1687 +@SYMTestActions Fade in child windows and check the fading occurs correctly
1.1688 +
1.1689 +@SYMTestExpectedResults Fading in the child windows occurs correctly
1.1690 +*/
1.1691 + case 3:
1.1692 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0220"));
1.1693 + iTest->LogSubTest(_L("Fade Children"));
1.1694 + FadeChildrenL();
1.1695 + break;
1.1696 +/**
1.1697 +@SYMTestCaseID GRAPHICS-WSERV-0221
1.1698 +
1.1699 +@SYMDEF DEF081259
1.1700 +
1.1701 +@SYMTestCaseDesc Test fading in newly created child windows
1.1702 +
1.1703 +@SYMTestPriority High
1.1704 +
1.1705 +@SYMTestStatus Implemented
1.1706 +
1.1707 +@SYMTestActions Fade in newly created child windows and check the fading occurs correctly
1.1708 +
1.1709 +@SYMTestExpectedResults Fading in the newly created child windows occurs correctly
1.1710 +*/
1.1711 + case 4:
1.1712 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0221"));
1.1713 + iTest->LogSubTest(_L("Fade Children newly created"));
1.1714 + FadeChildrenAfterNewChildIsCreatedL();
1.1715 + break;
1.1716 +/**
1.1717 +@SYMTestCaseID GRAPHICS-WSERV-0222
1.1718 +
1.1719 +@SYMDEF DEF081259
1.1720 +
1.1721 +@SYMTestCaseDesc Test fading in window behind another window
1.1722 +
1.1723 +@SYMTestPriority High
1.1724 +
1.1725 +@SYMTestStatus Implemented
1.1726 +
1.1727 +@SYMTestActions Fade in window behind another window and check the fading occurs correctly
1.1728 +
1.1729 +@SYMTestExpectedResults Fading in window occurs correctly
1.1730 +*/
1.1731 + case 5:
1.1732 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0222"));
1.1733 + iTest->LogSubTest(_L("Fade Behind"));
1.1734 + FadeBehindL();
1.1735 + break;
1.1736 +/**
1.1737 +@SYMTestCaseID GRAPHICS-WSERV-0223
1.1738 +
1.1739 +@SYMDEF DEF081259
1.1740 +
1.1741 +@SYMTestCaseDesc Test differnt fading techniques in a window
1.1742 +
1.1743 +@SYMTestPriority High
1.1744 +
1.1745 +@SYMTestStatus Implemented
1.1746 +
1.1747 +@SYMTestActions Fade using different fading techniques in a window
1.1748 + and check the fading occurs correctly
1.1749 +
1.1750 +@SYMTestExpectedResults Fading in window occurs correctly
1.1751 +*/
1.1752 + case 6:
1.1753 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0223"));
1.1754 +#if(defined(__DISPLAY_MODE_64K_COLOR)) //The test case Alternative Fadings1&2 & System Fade are not executed for EColor64k
1.1755 + iTest->LogSubTest(_L("Alternative Fadings1"));
1.1756 + ColorTest2();
1.1757 +#else
1.1758 + LOG_MESSAGE(_L("Alternative Fadings1 test not run"));
1.1759 +#endif
1.1760 + break;
1.1761 +/**
1.1762 +@SYMTestCaseID GRAPHICS-WSERV-0224
1.1763 +
1.1764 +@SYMDEF DEF081259
1.1765 +
1.1766 +@SYMTestCaseDesc Test differnt fading techniques in a window
1.1767 +
1.1768 +@SYMTestPriority High
1.1769 +
1.1770 +@SYMTestStatus Implemented
1.1771 +
1.1772 +@SYMTestActions Fade using different fading techniques in a window
1.1773 + and check the fading occurs correctly
1.1774 +
1.1775 +@SYMTestExpectedResults Fading in window occurs correctly
1.1776 +*/
1.1777 + case 7:
1.1778 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0224"));
1.1779 +#if(defined(__DISPLAY_MODE_64K_COLOR)) //The test case Alternative Fadings1&2 & System Fade are not executed for EColor64k
1.1780 + iTest->LogSubTest(_L("Alternative Fadings2"));
1.1781 + FadeTest();
1.1782 +#else
1.1783 + LOG_MESSAGE(_L("Alternative Fadings2 test not run"));
1.1784 +#endif
1.1785 + break;
1.1786 +/**
1.1787 +@SYMTestCaseID GRAPHICS-WSERV-0225
1.1788 +
1.1789 +@SYMDEF DEF081259
1.1790 +
1.1791 +@SYMTestCaseDesc Test differnt system wide fading techniques in a window
1.1792 +
1.1793 +@SYMTestPriority High
1.1794 +
1.1795 +@SYMTestStatus Implemented
1.1796 +
1.1797 +@SYMTestActions Fade using different system wide fading techniques in a window
1.1798 + and check the fading occurs correctly
1.1799 +
1.1800 +@SYMTestExpectedResults Fading in system occurs correctly
1.1801 +*/
1.1802 + case 8:
1.1803 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0225"));
1.1804 + iTest->LogSubTest(_L("System Fade"));
1.1805 + SystemFadeL();
1.1806 + SystemAlternateFadeL();
1.1807 + break;
1.1808 +/**
1.1809 +@SYMTestCaseID GRAPHICS-WSERV-0226
1.1810 +
1.1811 +@SYMDEF DEF081259
1.1812 +
1.1813 +@SYMTestCaseDesc Test fading in window behind another window when the window has been moved
1.1814 +
1.1815 +@SYMTestPriority High
1.1816 +
1.1817 +@SYMTestStatus Implemented
1.1818 +
1.1819 +@SYMTestActions Fade in window behind another window and check the fading occurs correctly
1.1820 +
1.1821 +@SYMTestExpectedResults Fading in window occurs correctly
1.1822 +*/
1.1823 + case 9:
1.1824 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0226"));
1.1825 + iTest->LogSubTest(_L("Fade behind moved"));
1.1826 + FadeBehindWhenMovedL();
1.1827 + break;
1.1828 +/**
1.1829 +@SYMTestCaseID GRAPHICS-WSERV-0227
1.1830 +
1.1831 +@SYMDEF DEF081259
1.1832 +
1.1833 +@SYMTestCaseDesc Destroy the blnk window used for fading
1.1834 +
1.1835 +@SYMTestPriority High
1.1836 +
1.1837 +@SYMTestStatus Implemented
1.1838 +
1.1839 +@SYMTestActions Destroy the blnk window used for fading and check it was deleted correctly
1.1840 +
1.1841 +@SYMTestExpectedResults The window is destroyed
1.1842 +*/
1.1843 + case 10:
1.1844 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0227"));
1.1845 + DestroyBlankWindow();
1.1846 + break;
1.1847 +/**
1.1848 +@SYMTestCaseID GRAPHICS-WSERV-0228
1.1849 +
1.1850 +@SYMDEF DEF081259
1.1851 +
1.1852 +@SYMTestCaseDesc Test backup window creation and drawing
1.1853 +
1.1854 +@SYMTestPriority High
1.1855 +
1.1856 +@SYMTestStatus Implemented
1.1857 +
1.1858 +@SYMTestActions Create a backup window and draw in it
1.1859 +
1.1860 +@SYMTestExpectedResults The drawing is correct in the window
1.1861 +*/
1.1862 + case BACKUPWIN:
1.1863 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0228"));
1.1864 + iTest->LogSubTest(_L("BackupWin Draw"));
1.1865 + CreateBitmapsL();
1.1866 + CreateBackupWindowL(EFalse);
1.1867 + Draw();
1.1868 + break;
1.1869 +/**
1.1870 +@SYMTestCaseID GRAPHICS-WSERV-0229
1.1871 +
1.1872 +@SYMDEF DEF081259
1.1873 +
1.1874 +@SYMTestCaseDesc Test fading with backup window obscured
1.1875 +
1.1876 +@SYMTestPriority High
1.1877 +
1.1878 +@SYMTestStatus Implemented
1.1879 +
1.1880 +@SYMTestActions Test fading with the backup window obscured
1.1881 +
1.1882 +@SYMTestExpectedResults Fading occurs correctly with window obscured
1.1883 +*/
1.1884 + case BACKUPWIN+1:
1.1885 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0229"));
1.1886 + iTest->LogSubTest(_L("BackupWin Obscured"));
1.1887 + ObscuredL();
1.1888 + break;
1.1889 +/**
1.1890 +@SYMTestCaseID GRAPHICS-WSERV-0230
1.1891 +
1.1892 +@SYMDEF DEF081259
1.1893 +
1.1894 +@SYMTestCaseDesc Test fading with backup window being moved
1.1895 +
1.1896 +@SYMTestPriority High
1.1897 +
1.1898 +@SYMTestStatus Implemented
1.1899 +
1.1900 +@SYMTestActions Test fading with the backup window being moved
1.1901 +
1.1902 +@SYMTestExpectedResults Fading occurs correctly with window moved
1.1903 +*/
1.1904 + case BACKUPWIN+2:
1.1905 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0230"));
1.1906 + iTest->LogSubTest(_L("BackupWin Moving"));
1.1907 + MovingL();
1.1908 + DestroyDrawableWindow();
1.1909 + break;
1.1910 +/**
1.1911 +@SYMTestCaseID GRAPHICS-WSERV-0231
1.1912 +
1.1913 +@SYMDEF DEF081259
1.1914 +
1.1915 +@SYMTestCaseDesc Test backup window creation and drawing
1.1916 +
1.1917 +@SYMTestPriority High
1.1918 +
1.1919 +@SYMTestStatus Implemented
1.1920 +
1.1921 +@SYMTestActions Create a backup window and draw in it
1.1922 +
1.1923 +@SYMTestExpectedResults The drawing is correct in the window
1.1924 +*/
1.1925 + case BACKUPWIN+3:
1.1926 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0231"));
1.1927 + iTest->LogSubTest(_L("BackupWin Draw"));
1.1928 + CreateBackupWindowL(ETrue);
1.1929 + Draw();
1.1930 + break;
1.1931 +/**
1.1932 +@SYMTestCaseID GRAPHICS-WSERV-0232
1.1933 +
1.1934 +@SYMDEF DEF081259
1.1935 +
1.1936 +@SYMTestCaseDesc Test fading with backup window obscured
1.1937 +
1.1938 +@SYMTestPriority High
1.1939 +
1.1940 +@SYMTestStatus Implemented
1.1941 +
1.1942 +@SYMTestActions Test fading with the backup window obscured
1.1943 +
1.1944 +@SYMTestExpectedResults Fading occurs correctly with window obscured
1.1945 +*/
1.1946 + case BACKUPWIN+4:
1.1947 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0232"));
1.1948 + iTest->LogSubTest(_L("BackupWin Obscured"));
1.1949 + ObscuredL();
1.1950 + break;
1.1951 +/**
1.1952 +@SYMTestCaseID GRAPHICS-WSERV-0233
1.1953 +
1.1954 +@SYMDEF DEF081259
1.1955 +
1.1956 +@SYMTestCaseDesc Test fading with backup window being moved
1.1957 +
1.1958 +@SYMTestPriority High
1.1959 +
1.1960 +@SYMTestStatus Implemented
1.1961 +
1.1962 +@SYMTestActions Test fading with the backup window being moved
1.1963 +
1.1964 +@SYMTestExpectedResults Fading occurs correctly with window moved
1.1965 +*/
1.1966 + case BACKUPWIN+5:
1.1967 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0233"));
1.1968 + iTest->LogSubTest(_L("BackupWin Moving"));
1.1969 + MovingL();
1.1970 + DestroyDrawableWindow();
1.1971 + break;
1.1972 +/**
1.1973 +@SYMTestCaseID GRAPHICS-WSERV-0234
1.1974 +
1.1975 +@SYMDEF DEF081259
1.1976 +
1.1977 +@SYMTestCaseDesc Test redraw window creation and drawing
1.1978 +
1.1979 +@SYMTestPriority High
1.1980 +
1.1981 +@SYMTestStatus Implemented
1.1982 +
1.1983 +@SYMTestActions Create a redraw window and draw in it
1.1984 +
1.1985 +@SYMTestExpectedResults The drawing is correct in the window
1.1986 +*/
1.1987 + case REDRAWWIN:
1.1988 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0234"));
1.1989 + iTest->LogSubTest(_L("RedrawWin Draw"));
1.1990 + CreateRedrawWindowL();
1.1991 + Draw();
1.1992 + break;
1.1993 +/**
1.1994 +@SYMTestCaseID GRAPHICS-WSERV-0235
1.1995 +
1.1996 +@SYMDEF DEF081259
1.1997 +
1.1998 +@SYMTestCaseDesc Test fading with redraw window obscured
1.1999 +
1.2000 +@SYMTestPriority High
1.2001 +
1.2002 +@SYMTestStatus Implemented
1.2003 +
1.2004 +@SYMTestActions Test fading with the redraw window obscured
1.2005 +
1.2006 +@SYMTestExpectedResults Fading occurs correctly with window obscured
1.2007 +*/
1.2008 + case REDRAWWIN+1:
1.2009 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0235"));
1.2010 + iTest->LogSubTest(_L("RedrawWin Obscured"));
1.2011 + ObscuredL();
1.2012 + break;
1.2013 +/**
1.2014 +@SYMTestCaseID GRAPHICS-WSERV-0236
1.2015 +
1.2016 +@SYMDEF DEF081259
1.2017 +
1.2018 +@SYMTestCaseDesc Test fading with redraw window being moved
1.2019 +
1.2020 +@SYMTestPriority High
1.2021 +
1.2022 +@SYMTestStatus Implemented
1.2023 +
1.2024 +@SYMTestActions Test fading with the redraw window being moved
1.2025 +
1.2026 +@SYMTestExpectedResults Fading occurs correctly with window moved
1.2027 +*/
1.2028 + case REDRAWWIN+2:
1.2029 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0236"));
1.2030 + iTest->LogSubTest(_L("RedrawWin Moving"));
1.2031 + MovingL();
1.2032 + break;
1.2033 +/**
1.2034 +@SYMTestCaseID GRAPHICS-WSERV-0237
1.2035 +
1.2036 +@SYMDEF DEF081259
1.2037 +
1.2038 +@SYMTestCaseDesc Test different fading techniques within a redraw window
1.2039 +
1.2040 +@SYMTestPriority High
1.2041 +
1.2042 +@SYMTestStatus Implemented
1.2043 +
1.2044 +@SYMTestActions Test different fading techniques within a redraw window
1.2045 +
1.2046 +@SYMTestExpectedResults Fading occurs correctly for the different techniques
1.2047 +*/
1.2048 + case REDRAWWIN+3:
1.2049 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0237"));
1.2050 + iTest->LogSubTest(_L("AlternativeFadeDraw"));
1.2051 + Draw(ETrue);
1.2052 + break;
1.2053 +
1.2054 +/**
1.2055 +@SYMTestCaseID GRAPHICS-WSERV-0238
1.2056 +
1.2057 +@SYMDEF DEF081259
1.2058 +
1.2059 +@SYMTestCaseDesc Test fading within a redraw window using the graphic context
1.2060 +
1.2061 +@SYMTestPriority High
1.2062 +
1.2063 +@SYMTestStatus Implemented
1.2064 +
1.2065 +@SYMTestActions Test fading within a redraw window using the graphic context
1.2066 +
1.2067 +@SYMTestExpectedResults Fading occurs correctly in the window
1.2068 +*/
1.2069 + case REDRAWWIN+4:
1.2070 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0238"));
1.2071 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.2072 + iTest->LogSubTest(_L("GC Test"));
1.2073 + GCDraw();
1.2074 + DestroyDrawableWindow();
1.2075 + DestroyBitmaps();
1.2076 +#endif
1.2077 + break;
1.2078 +
1.2079 +/**
1.2080 +@SYMTestCaseID GRAPHICS-WSERV-0538
1.2081 +
1.2082 +@SYMDEF DEF120965
1.2083 +
1.2084 +@SYMTestCaseDesc Test fading under transparent window
1.2085 +
1.2086 +@SYMTestPriority High
1.2087 +
1.2088 +@SYMTestStatus Implemented
1.2089 +
1.2090 +@SYMTestActions Construct opaque window lying under two transparent windows. Fade the opaque and the transparent windows.
1.2091 +
1.2092 +@SYMTestExpectedResults Each of the overlapping areas should be faded only once.
1.2093 +*/
1.2094 + case REDRAWWIN+5:
1.2095 + {
1.2096 + ((CTFadeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0538"));
1.2097 + iTest->LogSubTest(_L("Fade behind transparent window"));
1.2098 + CRedrawWin* win = new(ELeave) CRedrawWin(this);
1.2099 + win->ConstructL(TRect(0,0,0,0));
1.2100 + TInt transparency = win->Win()->SetTransparencyAlphaChannel();
1.2101 + if (transparency!=KErrNotSupported)
1.2102 + {
1.2103 + FadeBehindTransparentWindowL();
1.2104 + }
1.2105 + else
1.2106 + {
1.2107 + WARN_PRINTF1(_L("Transparency not supported. Skipping test."));
1.2108 + }
1.2109 + delete win;
1.2110 + break;
1.2111 + }
1.2112 + case REDRAWWIN+6:
1.2113 + ((CTFadeStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
1.2114 + iTest->LogSubTest(_L("Test complete\n"));
1.2115 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
1.2116 + DestroyDrawableWindow();
1.2117 + DestroyBitmaps();
1.2118 +#endif
1.2119 + ((CTFadeStep*)iStep)->CloseTMSGraphicsStep();
1.2120 + TestComplete();
1.2121 + break;
1.2122 + default:
1.2123 + ((CTFadeStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
1.2124 + break;
1.2125 + }
1.2126 + ((CTFadeStep*)iStep)->RecordTestResultL();
1.2127 + }
1.2128 +
1.2129 +__WS_CONSTRUCT_STEP__(Fade)