1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/TDirectA.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,3950 @@
1.4 +// Copyright (c) 1996-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 Direct Screen Access
1.18 +//
1.19 +//
1.20 +
1.21 +#include "tdirecta.h"
1.22 +
1.23 +static TRect WinExt;
1.24 +static TInt WinCol=0;
1.25 +static TTimeIntervalMicroSeconds32 MoveInterval;
1.26 +static TTimeIntervalMicroSeconds32 ModeInterval;
1.27 +static TTimeIntervalMicroSeconds32 FlipInterval;
1.28 +static TBool ImmediateModeSwitch;
1.29 +#if defined(LOGGING)
1.30 + LOCAL_D TLogMessageText LogMessageText;
1.31 +#endif
1.32 +
1.33 +_LIT(SemControl,"Control");
1.34 +_LIT(SemNextOp,"TrigerWindow");
1.35 +_LIT(FontName,"DejaVu Serif Condensed");
1.36 +_LIT(QueueControl,"Queue");
1.37 +
1.38 +LOCAL_D TSize FullScreenModeSize;
1.39 +LOCAL_D TInt Copy2ndHalfOfScreen;
1.40 +
1.41 +const TBool KRegionTrackingOnly = ETrue;
1.42 +const TBool KDrawingDsa = EFalse;
1.43 +
1.44 +const TInt KPanicTestOrdinalPriority=65536;
1.45 +const TInt KMainTestOrdinalPriority=65535;
1.46 +const TInt KMainTestBaseWindow=KMainTestOrdinalPriority/3;
1.47 +const TInt KAboveMainTestBaseWindow = KMainTestBaseWindow +1;
1.48 +
1.49 +const TInt KMaxIdlingTime = 25; //used for RegionTrackingOnly DSAs, it represents the maximum number of times the Idling function can be called
1.50 +//Ids of two RegionTrackingOnly DSAs
1.51 +const TInt KRegionTrackingOnlyDsaWaitingForAbortSignal = 25;
1.52 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
1.53 +const TInt KRegionTrackingOnlyDsaNoAbortSignal = 26;
1.54 +#endif
1.55 +
1.56 +const TInt KRegionTrackingOnlyDsaExistLast = 0;
1.57 +const TInt KDrawingDsaExistLast = 1;
1.58 +const TInt KShortDelay = 5000;
1.59 +#define SHORT_DELAY TTimeIntervalMicroSeconds32(KShortDelay)
1.60 +
1.61 +_LIT(KSem_DefectFix_KAA_5J3BLW_Name, "DefectFix_KAA_5J3BLW");
1.62 +
1.63 +GLDEF_C TInt ProcDirect(TAny *aScreenNumber)
1.64 + {
1.65 + CTrapCleanup* cleanupStack = NULL;
1.66 + User::LeaveIfNull(cleanupStack = CTrapCleanup::New());
1.67 +
1.68 +#if defined(LOGGING)
1.69 + _LIT(KWindow,"Window Toggle Vis=");
1.70 + _LIT(KParams,"%d, Pos=(%d,%d,%d,%d), Col=%d");
1.71 +#endif
1.72 + RSemaphore controlSem;
1.73 + RSemaphore windowSem;
1.74 + User::LeaveIfError(controlSem.OpenGlobal(SemControl));
1.75 + User::LeaveIfError(windowSem.OpenGlobal(SemNextOp));
1.76 + RWsSession ws;
1.77 + User::LeaveIfError(ws.Connect());
1.78 +
1.79 + // assign to the correct screen
1.80 + CWsScreenDevice* screen = NULL;
1.81 + TInt err;
1.82 + TRAP(err, screen = new (ELeave) CWsScreenDevice(ws));
1.83 + if (err!=KErrNone)
1.84 + return err;
1.85 +
1.86 + if ((err=screen->Construct((TInt)aScreenNumber))!=KErrNone)
1.87 + {
1.88 + delete screen;
1.89 + return err;
1.90 + }
1.91 +
1.92 + RWindowGroup group(ws);
1.93 + User::LeaveIfError(group.Construct(898));
1.94 + group.EnableReceiptOfFocus(EFalse);
1.95 + group.SetOrdinalPosition(0,KAboveMainTestBaseWindow );
1.96 + RBlankWindow window(ws);
1.97 + User::LeaveIfError(window.Construct(group,899));
1.98 + TBool vis=EFalse;
1.99 + window.SetVisible(vis);
1.100 + window.Activate();
1.101 + ws.Flush();
1.102 + controlSem.Signal();
1.103 + windowSem.Wait();
1.104 + RMsgQueueBase queue;
1.105 + TInt open = queue.OpenGlobal(QueueControl);
1.106 + TInt data;
1.107 + while (queue.Receive(&data,sizeof(TInt)) != KErrNone)
1.108 + {
1.109 + vis=!vis;
1.110 + if (vis)
1.111 + {
1.112 + window.SetColor(TRgb::Gray4(WinCol));
1.113 + window.SetExtent(WinExt.iTl,WinExt.Size());
1.114 + #if defined(LOGGING)
1.115 + LogMessageText.Copy(KWindow);
1.116 + LogMessageText.AppendFormat(KParams,vis,WinExt.iTl.iX,WinExt.iTl.iY,WinExt.iBr.iX,WinExt.iBr.iY,WinCol);
1.117 + ws.LogMessage(LogMessageText);
1.118 + #endif
1.119 + }
1.120 + window.SetVisible(vis);
1.121 + ws.Flush();
1.122 + windowSem.Wait();
1.123 + }
1.124 + queue.Close();
1.125 +
1.126 + window.Close();
1.127 + group.Close();
1.128 +
1.129 + delete screen;
1.130 + ws.Close();
1.131 + controlSem.Close();
1.132 + windowSem.Close();
1.133 +
1.134 + delete cleanupStack;
1.135 + return(KErrNone);
1.136 + }
1.137 +
1.138 +
1.139 +/*CDirectScreenAccessOld*/
1.140 +
1.141 +CDirectScreenAccessOld* CDirectScreenAccessOld::NewL(RWsSession& aWs,MAbortDirectScreenAccess& aAborter)
1.142 + {
1.143 + CDirectScreenAccessOld* self=new(ELeave) CDirectScreenAccessOld(aWs,aAborter);
1.144 + CleanupStack::PushL(self);
1.145 + self->ConstructL();
1.146 + CleanupStack::Pop(self);
1.147 + return self;
1.148 + }
1.149 +
1.150 +CDirectScreenAccessOld::~CDirectScreenAccessOld()
1.151 + {
1.152 + __ASSERT_ALWAYS(!iAborting,AutoPanic(EAutoPanicDirect));
1.153 + Cancel();
1.154 + iDirectAccess.Close();
1.155 + }
1.156 +
1.157 +void CDirectScreenAccessOld::ConstructL()
1.158 + {
1.159 + User::LeaveIfError(iDirectAccess.Construct());
1.160 + CActiveScheduler::Add(this);
1.161 + }
1.162 +
1.163 +TInt CDirectScreenAccessOld::Request(RRegion*& aRegion, RWindowBase& aWindow)
1.164 + {
1.165 + TInt ret=iDirectAccess.Request(aRegion,iStatus,aWindow);
1.166 + if (ret==KErrNone)
1.167 + SetActive();
1.168 + return ret;
1.169 + }
1.170 +
1.171 +void CDirectScreenAccessOld::DoCancel()
1.172 + {
1.173 + iDirectAccess.Cancel();
1.174 + }
1.175 +
1.176 +void CDirectScreenAccessOld::RunL()
1.177 + {
1.178 + iAborting=ETrue;
1.179 + iAborter.AbortNow(REINTERPRET_CAST(RDirectScreenAccess::TTerminationReasons&,iStatus));
1.180 + iAborting=EFalse;
1.181 + iDirectAccess.Completed();
1.182 + }
1.183 +
1.184 +
1.185 +/*CColorAnimation*/
1.186 +
1.187 +CColorAnimation* CColorAnimation::NewL(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack,CTWinBase& aParent,TRect aExtent,TBool aStart,TBool aRegionTrackingOnly)
1.188 + {
1.189 + CColorAnimation* self=new(ELeave) CColorAnimation(aScreenNumber,aId,aCallBack);
1.190 + CleanupStack::PushL(self);
1.191 + self->ConstructL(aParent,aExtent,aRegionTrackingOnly);
1.192 + if (aStart)
1.193 + self->StartL();
1.194 + CleanupStack::Pop(self);
1.195 + return self;
1.196 + }
1.197 +
1.198 +CColorAnimation::~CColorAnimation()
1.199 + {
1.200 + delete iTimer;
1.201 + delete iDrawer;
1.202 + delete iWindow;
1.203 + delete iWindow2;
1.204 + TheClient->Flush();
1.205 + }
1.206 +
1.207 +void CColorAnimation::ConstructL(CTWinBase& aParent,TRect aExtent,TBool aRegionTrackingOnly,TInt aTypeWindow/*=0*/,TInt aSingleWinForMultipleDSA/*=0*/)
1.208 + {
1.209 + iRegionTrackingOnly = aRegionTrackingOnly;
1.210 + // Make sure that the top right corner is not 0,0
1.211 + if (aTypeWindow && aExtent.iTl==TPoint(0,0))
1.212 + {
1.213 + aExtent.iTl=TPoint(10,10);
1.214 + }
1.215 + RWindowBase* win=NULL;
1.216 + iSingleWinForMultipleDSA=aSingleWinForMultipleDSA;
1.217 + if (aSingleWinForMultipleDSA)
1.218 + {
1.219 + win=iCallBack.iCallBackWin->BaseWin();
1.220 + iWinSize=TheClient->iScreen->SizeInPixels();
1.221 + }
1.222 + else
1.223 + {
1.224 + iWindow=new(ELeave) CTBlankWindow();
1.225 + iWinSize=aExtent.Size();
1.226 + iWindow->ConstructExtLD(aParent,aExtent.iTl,iWinSize);
1.227 + ChangeModeL(iCallBack.DisplayMode(iId));
1.228 + win=iWindow->BaseWin();
1.229 + win->SetShadowDisabled(ETrue);
1.230 + win->Activate();
1.231 + }
1.232 + if (!aTypeWindow)
1.233 + {
1.234 + if(iRegionTrackingOnly)
1.235 + {
1.236 + iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,*win,*this,iRegionTrackingOnly);
1.237 + }
1.238 + else
1.239 + {
1.240 + //needed for the non NGA case: only the old API is allowed to be used
1.241 + iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,*win,*this);
1.242 + }
1.243 + }
1.244 + else
1.245 + {
1.246 + TRect childRect(0,0,100,100);
1.247 + switch(aTypeWindow)
1.248 + {
1.249 + case 1:
1.250 + {
1.251 + // Create a Blank Window smaller than it's parent and its top left corner within the parent area and withn the screen area
1.252 + childRect.Shrink(10,10);
1.253 + break;
1.254 + }
1.255 + case 2:
1.256 + {
1.257 + // Create a Blank Window with its top left corner being left side of its parent
1.258 + childRect.Move(-10,0);
1.259 + break;
1.260 + }
1.261 + }
1.262 + iWindow2=new(ELeave) CTBlankWindow();
1.263 + iWindow2->ConstructExtLD(*iWindow,childRect.iTl,childRect.Size());
1.264 + // Finish constructing the window
1.265 + RWindowBase& win=*iWindow2->BaseWin();
1.266 + win.SetShadowDisabled(ETrue);
1.267 + win.Activate();
1.268 + // Create the Direct Screen Access object
1.269 + if(iRegionTrackingOnly)
1.270 + {
1.271 + iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,win,*this,iRegionTrackingOnly);
1.272 + }
1.273 + else
1.274 + {
1.275 + //needed for the non NGA case: only the old API is allowed to be used
1.276 + iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,win,*this);
1.277 + }
1.278 + }
1.279 + TheClient->Flush();
1.280 + if (iId == 4)
1.281 + {
1.282 + // This clause is needed to prevent sub-test 9 from taking an
1.283 + // exceedingly large amount of time. The CColorAnimation with iId 4 is
1.284 + // the one which controls when the test stops. This raise in
1.285 + // priority compared to the other CColorAnimations, allows it's
1.286 + // callbacks to get through when otherwise they would take much longer
1.287 + // due to the volume of callbacks generated by the other
1.288 + // CColorAnimations
1.289 + iTimer=CPeriodic::NewL(1);
1.290 + }
1.291 + else
1.292 + {
1.293 + iTimer=CPeriodic::NewL(0);
1.294 + }
1.295 + }
1.296 +
1.297 +TPoint CColorAnimation::AbsoluteWindowPosition(TInt aWindowId/*=0*/)
1.298 + {
1.299 + if (iSingleWinForMultipleDSA)
1.300 + {
1.301 + return iCallBack.iCallBackWin->BaseWin()->AbsPosition();
1.302 + }
1.303 + if (!aWindowId)
1.304 + {
1.305 + // Return the absolute position of iWindow, if Color Animation is not for Position Relative to Screen test.
1.306 + return iWindow->BaseWin()->AbsPosition();
1.307 + }
1.308 + else
1.309 + {
1.310 + // Return the absolute position of iWindow2, if it is for Position Relative to Screen test.
1.311 + return iWindow2->BaseWin()->AbsPosition();
1.312 + }
1.313 + }
1.314 +
1.315 +TInt CColorAnimation::DrawColorL(TAny* aAnimation)
1.316 + {
1.317 + STATIC_CAST(CColorAnimation*,aAnimation)->DrawColorL();
1.318 + return(KErrNone);
1.319 + }
1.320 +
1.321 +TInt CColorAnimation::IdlingL(TAny* aAnimation)
1.322 + {
1.323 + (static_cast<CColorAnimation*>(aAnimation))->IdlingL();
1.324 + return(KErrNone);
1.325 + }
1.326 +
1.327 +void CColorAnimation::StartL(TBool aChildWindow/*=EFalse*/)
1.328 + {
1.329 + iDrawer->StartL();
1.330 + TRect bounding=iDrawer->DrawingRegion()->BoundingRect();
1.331 + TRect window;
1.332 + if (aChildWindow)
1.333 + {
1.334 + window.SetRect(AbsoluteWindowPosition(1),iWinSize);
1.335 + }
1.336 + else
1.337 + {
1.338 + window.SetRect(AbsoluteWindowPosition(),iWinSize);
1.339 + }
1.340 + // Check that the window contains the bounding area (a bounding rect of (0,0,0,0) shouldn't fail the test)
1.341 + if (!(window.Contains(bounding.iTl) && window.Contains(bounding.iBr-TPoint(1,1))) && bounding.Size()!=TSize(0,0))
1.342 + {
1.343 + iCallBack.Fail();
1.344 + // iDrawer->Cancel();
1.345 + // iDrawer->StartL();
1.346 + // bounding=iDrawer->DrawingRegion()->BoundingRect();
1.347 + }
1.348 + if(!iRegionTrackingOnly)
1.349 + {
1.350 + iTimer->Start(0,iCallBack.TimerInterval(iId),TCallBack(CColorAnimation::DrawColorL,this));
1.351 + iDrawer->Gc()->SetPenStyle(CGraphicsContext::ENullPen);
1.352 + iDrawer->Gc()->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.353 + }
1.354 + else
1.355 + {
1.356 + iTimer->Start(0,iCallBack.TimerInterval(iId),TCallBack(CColorAnimation::IdlingL,this));
1.357 + }
1.358 + }
1.359 +
1.360 +void CColorAnimation::StartOrPanic()
1.361 + {
1.362 + TRAPD(err,StartL());
1.363 + if (err!=KErrNone)
1.364 + {
1.365 + iCallBack.LogLeave(err);
1.366 + iCallBack.Fail();
1.367 + }
1.368 + }
1.369 +
1.370 +void CColorAnimation::Stop()
1.371 + {
1.372 + iTimer->Cancel();
1.373 + iDrawer->Cancel();
1.374 + }
1.375 +
1.376 +void CColorAnimation::BringWindowToFront()
1.377 + {
1.378 + iWindow->WinTreeNode()->SetOrdinalPosition(0);
1.379 + }
1.380 +
1.381 +void CColorAnimation::ChangeModeL(TDisplayMode aMode)
1.382 + {
1.383 + User::LeaveIfError(iWindow->BaseWin()->SetRequiredDisplayMode(aMode));
1.384 + TheClient->Flush();
1.385 + }
1.386 +
1.387 +void CColorAnimation::FinishTest()
1.388 + {
1.389 + iCallBack.Finished(iId);
1.390 + }
1.391 +
1.392 +inline CDirectScreenAccess* CColorAnimation::GetDrawer()
1.393 + {
1.394 + return iDrawer;
1.395 + }
1.396 +
1.397 +void CColorAnimation::DrawColorL()
1.398 + {
1.399 + TBool aFinished;
1.400 + iDrawer->Gc()->SetBrushColor(iCallBack.BrushColorL(iId,iColor,aFinished));
1.401 + if (iSingleWinForMultipleDSA==1)
1.402 + {
1.403 + iDrawer->Gc()->DrawRect(iWinSize-TSize(iWinSize.iWidth/2,iWinSize.iHeight/2));
1.404 + }
1.405 + else if (iSingleWinForMultipleDSA==2)
1.406 + {
1.407 + iDrawer->Gc()->DrawRect(TRect(TPoint(iWinSize.iWidth/2,iWinSize.iHeight/2),TSize(iWinSize.iWidth/2,iWinSize.iHeight/2)));
1.408 + }
1.409 + else
1.410 + {
1.411 + iDrawer->Gc()->DrawRect(iWinSize);
1.412 + }
1.413 + iDrawer->ScreenDevice()->Update();
1.414 + if (aFinished)
1.415 + {
1.416 + if (iId==1)
1.417 + {
1.418 + iWindow->SetSize(TSize(48,52));
1.419 + TheClient->Flush();
1.420 + }
1.421 + if (aFinished==1)
1.422 + Stop();
1.423 + iCallBack.Finished(iId);
1.424 + }
1.425 + }
1.426 +
1.427 +void CColorAnimation::IdlingL()
1.428 + {
1.429 + iIdling++;
1.430 + if(iIdling == KMaxIdlingTime)
1.431 + {
1.432 + Stop();
1.433 + iIdling = 0;
1.434 + if (iId == KRegionTrackingOnlyDsaWaitingForAbortSignal)
1.435 + {
1.436 + _LIT(KErrorAbortNotReceived,"DSA didn't get an abort signal even though the window was opened in front");
1.437 + CallBack().Log((TText8*)__FILE__,__LINE__, ESevrErr,KErrorAbortNotReceived);
1.438 + CallBack().Fail();
1.439 + }
1.440 + iCallBack.Finished(iId);
1.441 + }
1.442 + }
1.443 +
1.444 +void CColorAnimation::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/)
1.445 + {
1.446 + TInt slow=iCallBack.SlowStopping(iId,iCount);
1.447 + switch (slow)
1.448 + {
1.449 + case eAbortAll:
1.450 + iCallBack.Finished(iId);
1.451 + case eAbort:
1.452 + Stop();
1.453 + return;
1.454 + case eStopDelayed:
1.455 + User::After(750000); //0.75 secs
1.456 + break;
1.457 + default:;
1.458 + }
1.459 + ++iCount;
1.460 + iTimer->Cancel();
1.461 + }
1.462 +
1.463 +void CColorAnimation::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/)
1.464 + {
1.465 + TRAPD(err,StartL());
1.466 + if (err!=KErrNone)
1.467 + iCallBack.FailedReStart(iId,err);
1.468 + }
1.469 +
1.470 +
1.471 +/*CScrollingTextDrawer*/
1.472 +
1.473 +CScrollingTextDrawer* CScrollingTextDrawer::NewL(TInt aScreenNumber,CFbsScreenDevice*& aDevice,CFbsBitGc& aGc)
1.474 + {
1.475 + CScrollingTextDrawer* self=new(ELeave) CScrollingTextDrawer(aDevice,aGc);
1.476 + CleanupStack::PushL(self);
1.477 + self->ConstructL(aScreenNumber);
1.478 + CleanupStack::Pop(self);
1.479 + return self;
1.480 + }
1.481 +
1.482 +CScrollingTextDrawer::~CScrollingTextDrawer()
1.483 + {
1.484 + if(iFontDevice)
1.485 + {
1.486 + iFontDevice->ReleaseFont(iFont);
1.487 + delete iFontDevice;
1.488 + }
1.489 + }
1.490 +
1.491 +void CScrollingTextDrawer::ConstructL(TInt aScreenNumber)
1.492 + {
1.493 + iFontDevice=CFbsScreenDevice::NewL(aScreenNumber,iDevice->DisplayMode());
1.494 + _LIT(text,"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
1.495 + iText=text;
1.496 + CreateFontL();
1.497 + //iFirstChar=0;
1.498 + iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.499 +#if defined(LOGGING)
1.500 + iWs.Connect();
1.501 + // point to correct screen
1.502 + CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(iWs);
1.503 + CleanupStack::PushL(screen);
1.504 + User::LeaveIfError(screen->Construct(aScreenNumber));
1.505 + CleanupStack::Pop(screen);
1.506 +
1.507 + _LIT(KConstTextDrawer,"Constructed Text Drawer");
1.508 + LogMessageText.Copy(KConstTextDrawer);
1.509 + iWs.LogMessage(LogMessageText);
1.510 + iWs.Flush();
1.511 +
1.512 + delete screen;
1.513 + iWs.Close();
1.514 +#endif
1.515 + }
1.516 +
1.517 +void CScrollingTextDrawer::CreateFontL()
1.518 + {
1.519 + TInt screenHeight=iDevice->SizeInPixels().iHeight;
1.520 + TFontSpec fontSpec(FontName,screenHeight);
1.521 + User::LeaveIfError(iFontDevice->GetNearestFontToDesignHeightInPixels(iFont,fontSpec));
1.522 + iGc->UseFont(iFont);
1.523 + TInt fontHeight=iFont->HeightInPixels();
1.524 + iDrawRect.iTl.iY=(screenHeight-fontHeight)/2;
1.525 + iDrawRect.iBr.iY=iDrawRect.iTl.iY+fontHeight;
1.526 + iDrawHeight=iFont->AscentInPixels();
1.527 + iCharWidth=iFont->CharWidthInPixels(iText[iFirstChar]);
1.528 + iDrawRect.iBr.iX=Max(iDevice->SizeInPixels().iWidth,iDevice->SizeInPixels().iHeight);
1.529 + iDrawRect.iTl.iX=iDrawRect.iBr.iX-iCharWidth;
1.530 + }
1.531 +
1.532 +void CScrollingTextDrawer::SetBottomOfTest(TInt aBottom)
1.533 + {
1.534 + if (iDrawRect.iBr.iY>aBottom)
1.535 + {
1.536 + iDrawRect.iTl.iY-=iDrawRect.iBr.iY-aBottom;
1.537 + iDrawRect.iBr.iY=aBottom;
1.538 + }
1.539 + }
1.540 +
1.541 +void CScrollingTextDrawer::Scroll()
1.542 + {
1.543 + iCharWidth=iFont->CharWidthInPixels(iText[iFirstChar]);
1.544 + iDrawRect.iTl.iX-=iJump;
1.545 + iGc->DrawText(iText.Mid(iFirstChar),iDrawRect,iDrawHeight);
1.546 + iDevice->Update();
1.547 + if (iDrawRect.iTl.iX<-iCharWidth)
1.548 + {
1.549 + if (++iFirstChar==iText.Length())
1.550 + {
1.551 + iFirstChar=0;
1.552 + iDrawRect.iTl.iX=iDevice->SizeInPixels().iWidth;
1.553 + }
1.554 + else
1.555 + iDrawRect.iTl.iX+=iCharWidth;
1.556 + iCharWidth=iFont->CharWidthInPixels(iText[iFirstChar]);
1.557 + }
1.558 + }
1.559 +
1.560 +
1.561 +/*CScrollText*/
1.562 +
1.563 +TInt CScrollText::DrawText(TAny* aAnimation)
1.564 + {
1.565 + STATIC_CAST(CScrollText*,aAnimation)->ScrollText();
1.566 + return(KErrNone);
1.567 + }
1.568 +
1.569 +CScrollText* CScrollText::NewL(TInt aScreenNumber,TInt aId,CTWindowGroup& aParent,TInt aScrollJump,TBool aStart/*=EFalse*/)
1.570 + {
1.571 + CScrollText* self=new(ELeave) CScrollText(aId,aScrollJump,aScreenNumber);
1.572 + CleanupStack::PushL(self);
1.573 + self->ConstructL(aParent);
1.574 + if (aStart)
1.575 + self->StartL();
1.576 + CleanupStack::Pop(self);
1.577 + return self;
1.578 + }
1.579 +
1.580 +CScrollText::~CScrollText()
1.581 + {
1.582 + delete iTimer;
1.583 + delete iTextDraw;
1.584 + iTextDraw=NULL;
1.585 + delete iDrawer;
1.586 + delete iWindow;
1.587 + TheClient->Flush();
1.588 + }
1.589 +
1.590 +void CScrollText::ConstructL(CTWindowGroup& aParent)
1.591 + {
1.592 + iWindow=new(ELeave) CTBlankWindow();
1.593 + iWindow->ConstructL(aParent);
1.594 + RWindowBase& win=*iWindow->BaseWin();
1.595 + win.Activate();
1.596 + iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,win,*this);
1.597 + TheClient->Flush();
1.598 + iTimer=CPeriodic::NewL(0);
1.599 + }
1.600 +
1.601 +void CScrollText::StartL()
1.602 + {
1.603 + DoContinueL();
1.604 + iDrawer->Gc()->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.605 + if (!iTextDraw)
1.606 + {
1.607 + iTextDraw=CScrollingTextDrawer::NewL(iScreenNumber,iDrawer->ScreenDevice(),*iDrawer->Gc());
1.608 + iTextDraw->SetScrollJump(iScrollJump);
1.609 + }
1.610 + }
1.611 +
1.612 +void CScrollText::ContinueL()
1.613 + {
1.614 + DoContinueL();
1.615 + }
1.616 +
1.617 +void CScrollText::DoContinueL()
1.618 + {
1.619 + iTimer->Start(0,10000,TCallBack(CScrollText::DrawText,this));
1.620 +
1.621 + //0.01secs
1.622 + iDrawer->StartL();
1.623 + TRect bounding=iDrawer->DrawingRegion()->BoundingRect();
1.624 +#if defined(LOGGING)
1.625 + _LIT(KBoundRect,"Continue Scroll Text Rect=(%d,%d,%d,%d)");
1.626 + LogMessageText.Zero();
1.627 + LogMessageText.AppendFormat(KBoundRect,bounding.iTl.iX,bounding.iTl.iY,bounding.iBr.iX,bounding.iBr.iY);
1.628 + TheClient->iWs.LogMessage(LogMessageText);
1.629 + TheClient->Flush();
1.630 +#endif
1.631 + TRect window=TRect(iWindow->BaseWin()->AbsPosition(),iWindow->Size());
1.632 + if (!window.Contains(bounding.iTl) || !window.Contains(bounding.iBr-TPoint(1,1)))
1.633 + AutoPanic(EAutoPanicTestFailed);
1.634 + }
1.635 +
1.636 +void CScrollText::Stop()
1.637 + {
1.638 + iTimer->Cancel();
1.639 + iDrawer->Cancel();
1.640 + }
1.641 +
1.642 +void CScrollText::ScrollText()
1.643 + {
1.644 + iTextDraw->Scroll();
1.645 + }
1.646 +
1.647 +void CScrollText::AbortNow(RDirectScreenAccess::TTerminationReasons aReason)
1.648 + {
1.649 + iTimer->Cancel();
1.650 + if (!iCounting)
1.651 + return;
1.652 + if (iAbortCountDown>0)
1.653 + --iAbortCountDown;
1.654 + else
1.655 + {
1.656 + if (aReason==RDirectScreenAccess::ETerminateRegion)
1.657 + {
1.658 + User::After(1500000); //1.5secs
1.659 + iAbortCountDown=7;
1.660 + }
1.661 + }
1.662 + }
1.663 +
1.664 +void CScrollText::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/)
1.665 +//This function is pure virtual and so cannot have an 'L' at the end of it's name
1.666 + {
1.667 + ContinueL();
1.668 + }
1.669 +
1.670 +/*CWindowWithChild*/
1.671 +
1.672 +CWindowWithChild* CWindowWithChild::NewL(TInt aScreenNumber, CTWindowGroup& aParent,TBool aStart/*=EFalse*/)
1.673 + {
1.674 + CWindowWithChild* self=new(ELeave) CWindowWithChild(aScreenNumber);
1.675 + CleanupStack::PushL(self);
1.676 + self->ConstructL(aParent);
1.677 + if (aStart)
1.678 + self->StartL();
1.679 + CleanupStack::Pop(self);
1.680 + return self;
1.681 + }
1.682 +
1.683 +CWindowWithChild::~CWindowWithChild()
1.684 + {
1.685 + delete iDrawer;
1.686 + delete iChildWindow;
1.687 + delete iWindow;
1.688 + TheClient->Flush();
1.689 + }
1.690 +
1.691 +void CWindowWithChild::ConstructL(CTWindowGroup& aParent)
1.692 + {
1.693 + iWindow=new(ELeave) CTBlankWindow();
1.694 + iWindow->ConstructL(aParent);
1.695 +
1.696 + iChildWindow = new(ELeave) CTWin();
1.697 + iChildWindow->ConstructWin(*iWindow);
1.698 +
1.699 + iChildWindow->SetExt(TPoint(0,0), TSize(4,4));
1.700 + RWindowBase& cwin=*iChildWindow->BaseWin();
1.701 + cwin.Activate();
1.702 +
1.703 + RWindowBase& win=*iWindow->BaseWin();
1.704 + win.Activate();
1.705 +
1.706 + iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,win,*this);
1.707 +
1.708 + TheClient->Flush();
1.709 + }
1.710 +
1.711 +void CWindowWithChild::StartL()
1.712 + {
1.713 + DoContinueL();
1.714 + }
1.715 +
1.716 +void CWindowWithChild::ContinueL()
1.717 + {
1.718 + DoContinueL();
1.719 + }
1.720 +
1.721 +void CWindowWithChild::DoContinueL()
1.722 + {
1.723 + iDrawer->StartL();
1.724 + iRunning = ETrue;
1.725 + }
1.726 +
1.727 +void CWindowWithChild::Stop()
1.728 + {
1.729 + iDrawer->Cancel();
1.730 + }
1.731 +
1.732 +void CWindowWithChild::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/)
1.733 + {
1.734 + iRunning = EFalse;
1.735 + }
1.736 +
1.737 +void CWindowWithChild::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/)
1.738 +//This function is pure virtual and so cannot have an 'L' at the end of it's name
1.739 + {
1.740 + ContinueL();
1.741 + }
1.742 +
1.743 +void CWindowWithChild::PerformCoverageCalls()
1.744 + {
1.745 + //add coverage to commands with no/partial coverage
1.746 + RWindow& cwin=*iChildWindow->Win();
1.747 + TInt priority = 0;
1.748 +
1.749 + cwin.SetPointerCapturePriority(priority);
1.750 + __ASSERT_ALWAYS(cwin.GetPointerCapturePriority()==priority, User::Invariant());
1.751 + cwin.ClaimPointerGrab(EFalse);
1.752 + cwin.EnableBackup(0);
1.753 + __ASSERT_ALWAYS(cwin.PrevSibling()==0, User::Invariant());
1.754 + cwin.Invalidate(TRect(0, 0, 10, 10));
1.755 + cwin.FadeBehind(ETrue);
1.756 + TheClient->Flush();
1.757 + // cover (empty) False condition in CWsWindow::SetFadeBehind
1.758 + cwin.FadeBehind(ETrue);
1.759 + TheClient->Flush();
1.760 + }
1.761 +
1.762 +/*CWsBase*/
1.763 +
1.764 +void CWsBase::ConstructL(TInt aScreenNumber, TInt aHandle)
1.765 + {
1.766 + User::LeaveIfError(iWs.Connect());
1.767 + iScrDev=new(ELeave) CWsScreenDevice(iWs);
1.768 + User::LeaveIfError(iScrDev->Construct(aScreenNumber));
1.769 + iGroup=RWindowGroup(iWs);
1.770 + User::LeaveIfError(iGroup.Construct(aHandle,EFalse));
1.771 + iGroup.SetOrdinalPosition(0,KMainTestBaseWindow);
1.772 + }
1.773 +
1.774 +void CWsBase::CreateBlankWindowL(RBlankWindow& iWin,TInt aHandle)
1.775 + {
1.776 + iWin=RBlankWindow(iWs);
1.777 + User::LeaveIfError(iWin.Construct(iGroup,aHandle));
1.778 + }
1.779 +
1.780 +CWsBase::~CWsBase()
1.781 + {
1.782 + iGroup.Close();
1.783 + delete iScrDev;
1.784 + iWs.Close();
1.785 + }
1.786 +
1.787 +
1.788 +/*CAnimating*/
1.789 +
1.790 +TInt CAnimating::StartLC(TAny* aScreenNumber)
1.791 + {
1.792 + CAnimating* self=new(ELeave) CAnimating();
1.793 + CleanupStack::PushL(self);
1.794 + self->ConstructL((TInt)aScreenNumber);
1.795 + return KErrNone;
1.796 + }
1.797 +
1.798 +void CAnimating::ConstructL(TInt aScreenNumber)
1.799 + {
1.800 + CWsBase::ConstructL(aScreenNumber,798);
1.801 +#if defined(LOGGING)
1.802 + _LIT(KAnimate1,"Constructed CWsBase");
1.803 + LogMessageText.Copy(KAnimate1);
1.804 + iWs.LogMessage(LogMessageText);
1.805 + iWs.Flush();
1.806 +#endif
1.807 + iGroup.EnableReceiptOfFocus(EFalse);
1.808 + CreateBlankWindowL(iWindow,799);
1.809 + User::LeaveIfError(iWindow.SetRequiredDisplayMode(EGray16));
1.810 + iWindow.Activate();
1.811 +#if defined(LOGGING)
1.812 + _LIT(KAnimate2,"Set up Windows");
1.813 + LogMessageText.Copy(KAnimate2);
1.814 + iWs.LogMessage(LogMessageText);
1.815 +#endif
1.816 + iWs.Flush();
1.817 + TDisplayMode displayMode=CWsBase::iScrDev->DisplayMode();
1.818 + if (displayMode<EGray16)
1.819 + displayMode=EGray16;
1.820 + iScrDev=CFbsScreenDevice::NewL(aScreenNumber,displayMode);
1.821 + User::LeaveIfError(iScrDev->CreateContext(iGc));
1.822 +#if defined(LOGGING)
1.823 + _LIT(KAnimate3,"Created Screen Device");
1.824 + LogMessageText.Copy(KAnimate3);
1.825 + iWs.LogMessage(LogMessageText);
1.826 + iWs.Flush();
1.827 +#endif
1.828 + iDirect=CDirectScreenAccessOld::NewL(iWs,*this);
1.829 + iTimer=CPeriodic::NewL(0);
1.830 + User::LeaveIfError(iControlSem.OpenGlobal(SemControl,EOwnerThread)); //Must be thread relative, since it won't get cleaned up when the thread is killed otherwise
1.831 + User::LeaveIfError(iControlQueue.OpenGlobal(QueueControl,EOwnerThread)); //Must be thread relative, since it won't get cleaned up when the thread is killed otherwise
1.832 + iSemCreated=ETrue;
1.833 +#if defined(LOGGING)
1.834 + _LIT(KAnimate5,"Created Direct, Timer and Semaphore");
1.835 + LogMessageText.Copy(KAnimate5);
1.836 + iWs.LogMessage(LogMessageText);
1.837 + iWs.Flush();
1.838 +#endif
1.839 + iScrSize=iScrDev->SizeInPixels();
1.840 + iGc->SetPenStyle(CGraphicsContext::ENullPen);
1.841 + iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.842 + StartAnimatingL();
1.843 +#if defined(LOGGING)
1.844 + _LIT(KAnimate6,"Started Animation");
1.845 + LogMessageText.Copy(KAnimate6);
1.846 + iWs.LogMessage(LogMessageText);
1.847 + iWs.Flush();
1.848 +#endif
1.849 + }
1.850 +
1.851 +CAnimating::~CAnimating()
1.852 + //This function should never actually get run in practice
1.853 + {
1.854 + if (iSemCreated)
1.855 + {
1.856 + iControlSem.Close();
1.857 + iControlQueue.Close();
1.858 + }
1.859 + if (iDrawingRegion)
1.860 + iDrawingRegion->Destroy();
1.861 + delete iTimer;
1.862 + delete iDirect;
1.863 + delete iGc;
1.864 + delete iScrDev;
1.865 + iWindow.Close();
1.866 + }
1.867 +
1.868 +void CAnimating::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/)
1.869 + {
1.870 + iTimer->Cancel();
1.871 + iControlSem.Signal();
1.872 + TInt data = 2;
1.873 + iControlQueue.Send(&data,sizeof(TInt));
1.874 + User::After(10000000); //10 secs
1.875 + }
1.876 +
1.877 +TInt NextColor(TAny* aAnimation)
1.878 + {
1.879 + STATIC_CAST(CAnimating*,aAnimation)->DrawFrame();
1.880 + return(KErrNone);
1.881 + }
1.882 +
1.883 +void CAnimating::DrawFrame()
1.884 + {
1.885 + iColor=(iColor+3)%16;
1.886 + iGc->SetBrushColor(TRgb::Gray16(iColor));
1.887 + iGc->DrawRect(iScrSize);
1.888 + iScrDev->Update();
1.889 + if (iColor==2)
1.890 + {
1.891 + iControlSem.Signal();
1.892 + TInt data = 1;
1.893 + iControlQueue.Send(&data,sizeof(TInt));
1.894 + }
1.895 + }
1.896 +
1.897 +void CAnimating::StartAnimatingL()
1.898 + {
1.899 + iTimer->Start(0,150000,TCallBack(NextColor,this)); //0.15 secs
1.900 +
1.901 + User::LeaveIfError(iDirect->Request(iDrawingRegion,iWindow));
1.902 + iGc->SetClippingRegion(iDrawingRegion);
1.903 + }
1.904 +
1.905 +
1.906 +/*CMoveWindow*/
1.907 +
1.908 +TInt CMoveWindow::StartLC(TAny* aScreenNumber)
1.909 + {
1.910 + CMoveWindow* self=new(ELeave) CMoveWindow();
1.911 + CleanupStack::PushL(self);
1.912 + self->ConstructL((TInt)aScreenNumber);
1.913 + return KErrNone;
1.914 + }
1.915 +
1.916 +TInt CMoveWindow::FlipChange(TAny* aMoveWin)
1.917 + {
1.918 + Cast(aMoveWin)->FlipChange();
1.919 + return(KErrNone);
1.920 + }
1.921 +
1.922 +TInt CMoveWindow::StateChange(TAny* aMoveWin)
1.923 + {
1.924 + Cast(aMoveWin)->StateChange();
1.925 + return(KErrNone);
1.926 + }
1.927 +
1.928 +CMoveWindow::~CMoveWindow()
1.929 + {
1.930 + delete iStateTimer;
1.931 + delete iTimer;
1.932 + iWindow.Close();
1.933 + iBackUpWin.Close();
1.934 + delete iGc;
1.935 + }
1.936 +
1.937 +TInt MoveWin(TAny* aMoveWin)
1.938 + {
1.939 + STATIC_CAST(CMoveWindow*,aMoveWin)->MoveWindow();
1.940 + return(KErrNone);
1.941 + }
1.942 +
1.943 +void CMoveWindow::ConstructL(TInt aScreenNumber)
1.944 + {
1.945 + CWsBase::ConstructL(aScreenNumber,898);
1.946 + iBounceArea=TRect(iScrDev->SizeInPixels());
1.947 + iSize.iHeight=iBounceArea.iBr.iY/5;
1.948 + iSize.iWidth=iBounceArea.iBr.iX/5;
1.949 + iBounceArea.iTl.iX=iBounceArea.iBr.iX/6;
1.950 + iBounceArea.iBr.iX=5*iBounceArea.iBr.iX/6;
1.951 + iBounceArea.iTl.iY=iBounceArea.iBr.iY/4;
1.952 + iBounceArea.iBr.iY=3*iBounceArea.iBr.iY/4;
1.953 + iDelta=TSize(3,3);
1.954 + iTl=iBounceArea.iTl;
1.955 + CreateBlankWindowL(iWindow,899);
1.956 + iWindow.SetExtent(iTl,iSize);
1.957 + iWindow.SetShadowDisabled(ETrue);
1.958 + iWindow.SetColor(TRgb::Gray4(2));
1.959 + iWindow.Activate();
1.960 + iBackUpWin=RBackedUpWindow(iWs);
1.961 + User::LeaveIfError(iBackUpWin.Construct(iGroup,EGray4,698));
1.962 + User::LeaveIfError(iBackUpWin.SetSizeErr(TSize(2,2)));
1.963 + iGc=new(ELeave) CWindowGc(iScrDev);
1.964 + User::LeaveIfError(iGc->Construct());
1.965 + iDisplayMode=EGray4;
1.966 + if (MoveInterval>TTimeIntervalMicroSeconds32(0))
1.967 + CreateTimerL();
1.968 + if (ModeInterval>TTimeIntervalMicroSeconds32(0))
1.969 + {
1.970 + iStateTimer=CPeriodic::NewL(0);
1.971 + iStateTimer->Start(ModeInterval,ModeInterval,TCallBack(CMoveWindow::StateChange,this));
1.972 + }
1.973 + if (FlipInterval>TTimeIntervalMicroSeconds32(0))
1.974 + {
1.975 + iDevice=new(ELeave) CWsScreenDevice(iWs);
1.976 + User::LeaveIfError(iDevice->Construct(aScreenNumber));
1.977 + iNumOfModes=iDevice->NumScreenModes();
1.978 + if (iNumOfModes>1)
1.979 + {
1.980 + iFlipTimer=CPeriodic::NewL(0);
1.981 + iFlipTimer->Start(FlipInterval,FlipInterval,TCallBack(CMoveWindow::FlipChange,this));
1.982 + }
1.983 + }
1.984 + iStateCountDown=0;
1.985 + }
1.986 +
1.987 +void CMoveWindow::CreateTimerL()
1.988 + {
1.989 + iTimer=CPeriodic::NewL(0);
1.990 + iTimer->Start(0,MoveInterval,TCallBack(MoveWin,this));
1.991 +
1.992 + }
1.993 +
1.994 +void CMoveWindow::MoveWindow()
1.995 + {
1.996 + if (--iStateCountDown>=0)
1.997 + {
1.998 + if (iStateCountDown==2)
1.999 + ToggleDisplayMode();
1.1000 + return;
1.1001 + }
1.1002 + TPoint iBr=iTl+iSize;
1.1003 + TSize iDeltaSize;
1.1004 + if ((iDelta.iHeight<0 && iTl.iY<=iBounceArea.iTl.iY) || (iDelta.iHeight>0 && iBr.iY>=iBounceArea.iBr.iY))
1.1005 + {
1.1006 + iDelta.iHeight=-iDelta.iHeight;
1.1007 + iDeltaSize.iWidth=2;
1.1008 + }
1.1009 + if ((iDelta.iWidth<0 && iTl.iX<=iBounceArea.iTl.iX) || (iDelta.iWidth>0 && iBr.iX>=iBounceArea.iBr.iX))
1.1010 + {
1.1011 + iDelta.iWidth=-iDelta.iWidth;
1.1012 + if (iDeltaSize.iWidth==0)
1.1013 + iDeltaSize.iHeight=2;
1.1014 + else
1.1015 + iDeltaSize.iWidth=0;
1.1016 + }
1.1017 + iTl+=iDelta;
1.1018 + iSize+=iDeltaSize;
1.1019 + iWindow.SetExtent(iTl,iSize);
1.1020 + iWs.Flush();
1.1021 + }
1.1022 +
1.1023 +void CMoveWindow::StateChange()
1.1024 + {
1.1025 + if (ImmediateModeSwitch>1)
1.1026 + {
1.1027 + if (MoveInterval>TTimeIntervalMicroSeconds32(0) && iTimer==NULL)
1.1028 + {
1.1029 + TRAPD(err,CreateTimerL());
1.1030 + if (err==KErrNone)
1.1031 + ImmediateModeSwitch=ETrue;
1.1032 + }
1.1033 + }
1.1034 + if (ImmediateModeSwitch || MoveInterval==TTimeIntervalMicroSeconds32(0))
1.1035 + ToggleDisplayMode();
1.1036 + else
1.1037 + {
1.1038 + if (iStateCountDown<-8)
1.1039 + iStateCountDown=6;
1.1040 + }
1.1041 + }
1.1042 +
1.1043 +void CMoveWindow::ToggleDisplayMode()
1.1044 + {
1.1045 + if(iDisplayMode==EColor16MU)
1.1046 + {
1.1047 + return; //Test probably doesn't work with mode EColor16MU
1.1048 + }
1.1049 + iDisplayMode=(iDisplayMode==EColor16M ? EGray4:EColor16M);
1.1050 +#if defined(LOGGING)
1.1051 + TInt newMode=
1.1052 +#endif
1.1053 + iWindow.SetRequiredDisplayMode(iDisplayMode);
1.1054 + iGc->Activate(iBackUpWin);
1.1055 + iBackUpWin.SetPosition(iDisplayMode==EColor16M ? TPoint(1,0):TPoint(0,1));
1.1056 +#if defined(LOGGING)
1.1057 + TDisplayMode curentMode=iScrDev->DisplayMode();
1.1058 + _LIT(KToggleMode,"Toggle Display Mode Mode=%d Window=%d Actual=%d");
1.1059 + LogMessageText.Zero();
1.1060 + LogMessageText.AppendFormat(KToggleMode,(TInt&)iDisplayMode,newMode,(TInt&)curentMode);
1.1061 + iWs.LogMessage(LogMessageText);
1.1062 + //iWs.LogCommand(RWsSession::ELoggingStatusDump);
1.1063 +#endif
1.1064 + iWs.Flush();
1.1065 + iGc->Deactivate();
1.1066 + }
1.1067 +
1.1068 +void CMoveWindow::FlipChange()
1.1069 + {
1.1070 + if (++iCurrentMode==2) //flip between modes 0 and 1
1.1071 + iCurrentMode=0;
1.1072 + iDevice->SetScreenMode(iCurrentMode);
1.1073 + iWs.Flush();
1.1074 + }
1.1075 +
1.1076 +//
1.1077 +// CBugFixColorAnimation
1.1078 +//
1.1079 +// This class is used for reproducing a defect found on 6.1: KAA-5J3BLW "Unnecessary Wserv's DSA abort".
1.1080 +// The problem was that a direct screen access client was getting an unnecessary abort notification
1.1081 +// when a new window (or window group) was created but not visible.
1.1082 +// This class will simulate the direct screen access client and it will check whether the first DSA abort
1.1083 +// is not caused by just creating a window.
1.1084 +
1.1085 +CBugFixColorAnimation* CBugFixColorAnimation::NewL(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack,CTWindowGroup& aParent,TRect aExtent,TBool aStart)
1.1086 + {
1.1087 + CBugFixColorAnimation* self=new(ELeave) CBugFixColorAnimation(aScreenNumber, aId,aCallBack);
1.1088 + CleanupStack::PushL(self);
1.1089 + self->ConstructL(aParent,aExtent);
1.1090 + if (aStart)
1.1091 + {
1.1092 + self->StartL();
1.1093 + self->Started();
1.1094 + }
1.1095 + CleanupStack::Pop(self);
1.1096 + return self;
1.1097 + }
1.1098 +
1.1099 +CBugFixColorAnimation::CBugFixColorAnimation(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack)
1.1100 + : CColorAnimation(aScreenNumber, aId, aCallBack)
1.1101 + {
1.1102 + iThreadParam.iScreenNumber = aScreenNumber;
1.1103 + }
1.1104 +
1.1105 +CBugFixColorAnimation::~CBugFixColorAnimation()
1.1106 + {
1.1107 + iSem.Close();
1.1108 + if(iThread)
1.1109 + {
1.1110 + TRequestStatus status;
1.1111 + iThread->Logon(status);
1.1112 + if (iThread->StillAlive())
1.1113 + {
1.1114 + iThread->Terminate(KErrNone);
1.1115 + User::WaitForRequest(status);
1.1116 + }
1.1117 + delete iThread;
1.1118 + }
1.1119 + iTestFailed->Cancel();
1.1120 + delete iTestFailed;
1.1121 + }
1.1122 +
1.1123 +
1.1124 +LOCAL_D TInt TestFailed(TAny* aAnimation)
1.1125 + {
1.1126 + CBugFixColorAnimation* anim=reinterpret_cast<CBugFixColorAnimation*>(aAnimation);
1.1127 + TRAP_IGNORE(
1.1128 + anim->Stop();
1.1129 + anim->CallBack().Fail();
1.1130 + anim->FinishTest();
1.1131 + );
1.1132 + return KErrNone;
1.1133 + }
1.1134 +
1.1135 +LOCAL_D TInt CreateNewWindowGroup(TAny* aParam)
1.1136 + {
1.1137 + TDirectThreadParam* param = (TDirectThreadParam*)aParam;
1.1138 + TRect rect = param->iRect;
1.1139 + TBool isInFront = param->iIsInFront;
1.1140 + RWsSession ws;
1.1141 + TInt error=ws.Connect();
1.1142 +
1.1143 + CWsScreenDevice* screen = NULL;
1.1144 + TRAP(error, screen = new (ELeave) CWsScreenDevice(ws));
1.1145 + if (error!=KErrNone)
1.1146 + {
1.1147 + ws.Close();
1.1148 + RThread::Rendezvous(error);
1.1149 + return error;
1.1150 + }
1.1151 +
1.1152 + if ((error=screen->Construct(param->iScreenNumber))!=KErrNone)
1.1153 + {
1.1154 + delete screen;
1.1155 + ws.Close();
1.1156 + RThread::Rendezvous(error);
1.1157 + return error;
1.1158 + }
1.1159 + RSemaphore sem;
1.1160 + error = sem.OpenGlobal(KSem_DefectFix_KAA_5J3BLW_Name, EOwnerThread);
1.1161 + if (error!=KErrNone)
1.1162 + {
1.1163 + ws.Close();
1.1164 + RThread::Rendezvous(error);
1.1165 + return error;
1.1166 + }
1.1167 +
1.1168 + RThread::Rendezvous(KErrNone);
1.1169 +
1.1170 + // wait for the dsa to start before creating the new window group
1.1171 + sem.Wait();
1.1172 + sem.Close();
1.1173 +
1.1174 +
1.1175 + RWindowGroup group(ws);
1.1176 + group.Construct(431,EFalse);
1.1177 + if(isInFront)
1.1178 + {
1.1179 + group.SetOrdinalPosition(0,KAboveMainTestBaseWindow);
1.1180 + }
1.1181 + else
1.1182 + {
1.1183 + group.SetOrdinalPosition(2);
1.1184 + }
1.1185 + RWindow window(ws);
1.1186 + error=window.Construct(group, 432);
1.1187 + if (error==KErrNone)
1.1188 + {
1.1189 + window.SetExtentErr(rect.iTl, rect.Size());
1.1190 + window.SetOrdinalPosition(0,0);
1.1191 + ws.Flush();
1.1192 + window.Activate();
1.1193 + ws.Flush();
1.1194 + if(!isInFront)
1.1195 + {
1.1196 + group.SetOrdinalPosition(-1);
1.1197 + }
1.1198 + ws.Flush();
1.1199 + //Wait for wserv to render new window on top of the existing DSA region.
1.1200 + ws.Finish();
1.1201 + //Now the window has been rendered (and DSA should have been aborted).
1.1202 + window.Close();
1.1203 + }
1.1204 +
1.1205 + group.Close();
1.1206 + delete screen;
1.1207 + ws.Close();
1.1208 + return error;
1.1209 + }
1.1210 +
1.1211 +void CBugFixColorAnimation::ConstructL(CTWindowGroup& aParent,TRect aExtent)
1.1212 + {
1.1213 + CColorAnimation::ConstructL(aParent, aExtent,KDrawingDsa);
1.1214 + _LIT(ThreadName,"Create new Window");
1.1215 + iAnimRect=aExtent;
1.1216 + TInt error=iSem.CreateGlobal(KSem_DefectFix_KAA_5J3BLW_Name, 0);
1.1217 + if (error==KErrNone)
1.1218 + {
1.1219 + iThreadParam.iRect = iAnimRect;
1.1220 + iThreadParam.iIsInFront = EFalse;
1.1221 + TThreadStartUp function=TThreadStartUp(CreateNewWindowGroup, &iThreadParam);
1.1222 + TRequestStatus status;
1.1223 + iThread=CProcess::NewThreadRendezvousL(ThreadName,&function, status);
1.1224 + User::WaitForRequest(status);
1.1225 + if (status != KErrNone)
1.1226 + {
1.1227 + RDebug::Printf("the request status is returned to be non KErrNone: %d", status.Int());
1.1228 + TestFailed(this);
1.1229 + }
1.1230 + iTestFailed = CIdle::NewL(0);
1.1231 + }
1.1232 + else
1.1233 + {
1.1234 + TestFailed(this);
1.1235 + }
1.1236 + }
1.1237 +
1.1238 +void CBugFixColorAnimation::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/)
1.1239 + {
1.1240 + Stop();
1.1241 + if (!iTestFailed->IsActive())
1.1242 + {
1.1243 + iTestFailed->Start(TCallBack(TestFailed,this));
1.1244 + }
1.1245 + }
1.1246 +
1.1247 +void CBugFixColorAnimation::Restart(RDirectScreenAccess::TTerminationReasons aReason)
1.1248 + {
1.1249 + AbortNow(aReason);
1.1250 + }
1.1251 +
1.1252 +TInt CPanicDirect::DoTestOnNewSchedulerL(TInt aInt, TAny* aPtr)
1.1253 + {
1.1254 + CActiveScheduler* activeScheduler=new(ELeave) CActiveScheduler;
1.1255 + CActiveScheduler::Install(activeScheduler);
1.1256 + CleanupStack::PushL(activeScheduler);
1.1257 + DoTestNowL(aInt,aPtr);
1.1258 + CleanupStack::PopAndDestroy(activeScheduler);
1.1259 + return(EWsExitReasonBad); //calls to this method currently all ignore the return code anyway.
1.1260 + }
1.1261 +
1.1262 +TInt CPanicDirect::DoTestOnNewScheduler(TInt aInt, TAny* aPtr)
1.1263 + {
1.1264 + TInt rv=EWsExitReasonBad;
1.1265 + TRAP_IGNORE(rv=DoTestOnNewSchedulerL(aInt,aPtr));
1.1266 + return(rv); //calls to this method currently all ignore the return code anyway.
1.1267 + }
1.1268 +
1.1269 +void CPanicDirect::DoTestNowL(TInt aInt, TAny* aPtr)
1.1270 + {
1.1271 + CPanicDirect* self=new(ELeave) CPanicDirect();
1.1272 + CleanupStack::PushL(self);
1.1273 + self->ConstructL((TInt)aPtr, aInt);
1.1274 + self->TestL();
1.1275 + CleanupStack::PopAndDestroy(self);
1.1276 + }
1.1277 +
1.1278 +void CPanicDirect::ConstructL(TInt aScreenNumber, TInt aInt)
1.1279 + {
1.1280 + iScreenNumber = aScreenNumber;
1.1281 +
1.1282 + User::LeaveIfError(iTimer.CreateLocal());
1.1283 + User::LeaveIfError(iWs.Connect());
1.1284 + iWsScrDev=new(ELeave) CWsScreenDevice(iWs);
1.1285 + User::LeaveIfError(iWsScrDev->Construct(iScreenNumber));
1.1286 +
1.1287 +#if defined(LOGGING)
1.1288 + _LIT(KPanicThead1,"PanicThread: Into ConstructL");
1.1289 + LogMessageText.Copy(KPanicThead1);
1.1290 + iWs.LogMessage(LogMessageText);
1.1291 + iWs.Flush();
1.1292 +#endif
1.1293 + iGroup=RWindowGroup(iWs);
1.1294 + User::LeaveIfError(iGroup.Construct(2200+aInt,EFalse));
1.1295 + iGroup.SetOrdinalPosition(0,KPanicTestOrdinalPriority);
1.1296 + iBlankWin=RBlankWindow(iWs);
1.1297 + User::LeaveIfError(iBlankWin.Construct(iGroup,2300+aInt));
1.1298 + iBlankWin.Activate();
1.1299 + iDirect=RDirectScreenAccess(iWs);
1.1300 + User::LeaveIfError(iDirect.Construct());
1.1301 + iDisplayMode=iWsScrDev->DisplayMode();
1.1302 +#if defined(LOGGING)
1.1303 + _LIT(KPanicThead2,"PanicThread: Creating Screen Device, Mode=%d");
1.1304 + LogMessageText.Format(KPanicThead2,iDisplayMode);
1.1305 + iWs.LogMessage(LogMessageText);
1.1306 + iWs.Flush();
1.1307 +#endif
1.1308 + iScreenDevice=CFbsScreenDevice::NewL(aScreenNumber,iDisplayMode);
1.1309 +#if defined(LOGGING)
1.1310 + _LIT(KPanicThead3,"PanicThread: Created Device");
1.1311 + LogMessageText.Copy(KPanicThead3);
1.1312 + iWs.LogMessage(LogMessageText);
1.1313 + iWs.Flush();
1.1314 +#endif
1.1315 + User::LeaveIfError(iScreenDevice->CreateContext(iGc));
1.1316 +#if defined(LOGGING)
1.1317 + _LIT(KPanicThead4,"PanicThread: Created Context");
1.1318 + LogMessageText.Copy(KPanicThead4);
1.1319 + iWs.LogMessage(LogMessageText);
1.1320 + iWs.Flush();
1.1321 +#endif
1.1322 + iTextDraw=CScrollingTextDrawer::NewL(iScreenNumber,iScreenDevice,*iGc);
1.1323 +#if defined(LOGGING)
1.1324 + _LIT(KPanicThead5,"PanicThread: Created ScrollDrawer");
1.1325 + LogMessageText.Copy(KPanicThead5);
1.1326 + iWs.LogMessage(LogMessageText);
1.1327 + iWs.Flush();
1.1328 +#endif
1.1329 + iTextDraw->SetScrollJump(4);
1.1330 +#if defined(LOGGING)
1.1331 + _LIT(KCreatedDrawer,"PanicThread: CreatedDrawer");
1.1332 + LogMessageText.Copy(KCreatedDrawer);
1.1333 + iWs.LogMessage(LogMessageText);
1.1334 + iWs.Flush();
1.1335 +#endif
1.1336 + iTestNo=aInt;
1.1337 + }
1.1338 +
1.1339 +CPanicDirect::~CPanicDirect()
1.1340 + {
1.1341 + iDirect.Close();
1.1342 + delete iGc;
1.1343 + delete iScreenDevice;
1.1344 + delete iTextDraw;
1.1345 + iBlankWin.Close();
1.1346 + iGroup.Close();
1.1347 + delete iWsScrDev;
1.1348 + iWs.Close();
1.1349 + if (iRegion)
1.1350 + iRegion->Close();
1.1351 + iTimer.Close();
1.1352 + }
1.1353 +
1.1354 +void CPanicDirect::TestL()
1.1355 + {
1.1356 + if (iTestNo==2)
1.1357 + {
1.1358 + iDirect.Completed();
1.1359 + return;
1.1360 + }
1.1361 + TInt err=iDirect.Request(iRegion,iDirectStatus,iBlankWin);
1.1362 + if (err!=KErrNone || !iRegion)
1.1363 + return;
1.1364 + TRect screen(iScreenDevice->SizeInPixels());
1.1365 + TRect bounding=iRegion->BoundingRect();
1.1366 + if (!screen.Contains(bounding.iTl) || !screen.Contains(bounding.iBr-TPoint(1,1)))
1.1367 + goto Cancel;
1.1368 + iGc->SetClippingRegion(iRegion);
1.1369 + iDrawingAllowed=ETrue;
1.1370 + iTimer.After(iTimerStatus,50000); //0.05secs
1.1371 + FOREVER
1.1372 + {
1.1373 + User::WaitForRequest(iDirectStatus,iTimerStatus);
1.1374 + if (iDirectStatus!=KRequestPending)
1.1375 + iDrawingAllowed=EFalse;
1.1376 + else if (iTimerStatus!=KRequestPending)
1.1377 + {
1.1378 + if (iDrawingAllowed)
1.1379 + DoDrawingL();
1.1380 + iTimer.After(iTimerStatus,50000); //0.05secs
1.1381 + }
1.1382 + else
1.1383 + {
1.1384 + Cancel:
1.1385 + iDirect.Cancel();
1.1386 + return;
1.1387 + }
1.1388 + }
1.1389 + }
1.1390 +
1.1391 +void CPanicDirect::DoDrawingL()
1.1392 + {
1.1393 + ++iCount;
1.1394 + iTextDraw->Scroll();
1.1395 + if (iTestNo==1 && iCount==8)
1.1396 + {
1.1397 + iDirect.Request(iRegion,iDirectStatus,iBlankWin);
1.1398 + return;
1.1399 + }
1.1400 + if (iTestNo==3 && iCount==12)
1.1401 + {
1.1402 + iDirect.Completed();
1.1403 + iDirect.Completed();
1.1404 + return;
1.1405 + }
1.1406 + if (iTestNo==4 && iCount==16)
1.1407 + {
1.1408 + iBlankWin.SetSize(TSize(20,25));
1.1409 + delete iRegion;
1.1410 + User::LeaveIfError(iDirect.Request(iRegion,iDirectStatus,iBlankWin));
1.1411 + return;
1.1412 + }
1.1413 + if (iTestNo==5 && iCount==19)
1.1414 + {
1.1415 + iWs.Close();
1.1416 + return;
1.1417 + }
1.1418 + }
1.1419 +
1.1420 +
1.1421 +/*CTDirect*/
1.1422 +
1.1423 +CTDirect::CTDirect(CTestStep* aStep):
1.1424 + CTWsGraphicsBase(aStep)
1.1425 + {
1.1426 + iState = 0;
1.1427 + iNextFrameFinished = ETrue;
1.1428 + iPackagingFinished = EFalse;
1.1429 + iTimerRunning = EFalse;
1.1430 + }
1.1431 +
1.1432 +CTDirect::~CTDirect()
1.1433 + {
1.1434 + DeleteMoveWindow();
1.1435 + DeleteScroll();
1.1436 +
1.1437 + delete iAnim;
1.1438 + TheClient->WaitForRedrawsToFinish();
1.1439 + delete iCallBackWin;
1.1440 + // put focus back to current screen as this test changed the focus screen to primary screen
1.1441 + TheClient->iWs.SetFocusScreen(iTest->iScreenNumber);
1.1442 + }
1.1443 +
1.1444 +void CTDirect::ConstructL()
1.1445 + {
1.1446 + _LIT(KCTDirectConstructL,"AUTO Construct Direct Test");
1.1447 + LOG_MESSAGE(KCTDirectConstructL);
1.1448 + FullScreenModeSize=TheClient->iScreen->SizeInPixels();
1.1449 + iIsScalingSupported=CheckScalingSupportedOrNot();
1.1450 + iNumOfCallBack=0;
1.1451 + iCallBackWin=new(ELeave) CTBlankWindow;
1.1452 + iCallBackWin->ConstructL(*TheClient->iGroup);
1.1453 + User::LeaveIfError(iCallBackWin->BaseWin()->SetRequiredDisplayMode(EColor256));
1.1454 + iCallBackWin->SetExt(TPoint(),TheClient->iScreen->SizeInPixels());
1.1455 + iCallBackWin->SetVisible(EFalse);
1.1456 + iCallBackWin->Activate();
1.1457 + // the following line makes sure that a console object hidden outside of
1.1458 + // screens range doesn't affect test results being on top of tested objects
1.1459 + TheClient->iGroup->GroupWin()->SetOrdinalPosition(0, KMainTestBaseWindow);
1.1460 + }
1.1461 +
1.1462 +void CTDirect::ConstrucBlankWindowL()
1.1463 + {
1.1464 + delete iWin;
1.1465 + iWin=new(ELeave) CTBlankWindow;
1.1466 + iWin->ConstructL(*TheClient->iGroup);
1.1467 + iWin->BaseWin()->SetShadowDisabled(ETrue);
1.1468 + iWin->BaseWin()->Activate();
1.1469 + TheClient->Flush();
1.1470 + }
1.1471 +
1.1472 +void CTDirect::InitialiseAnimationL()
1.1473 + {
1.1474 + ConstrucBlankWindowL();
1.1475 + TInt colors,greys;
1.1476 + TDisplayMode dispMode=TheClient->iWs.GetDefModeMaxNumColors(colors,greys);
1.1477 + iScrDev=CFbsScreenDevice::NewL(iTest->iScreenNumber,dispMode);
1.1478 + User::LeaveIfError(iScrDev->CreateContext(iGc));
1.1479 + INFO_PRINTF1(_L(" Constructed Screen Device"));
1.1480 + iScrSize=iScrDev->SizeInPixels();
1.1481 + TFontSpec fontSpec(FontName,iScrSize.iHeight);
1.1482 + fontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
1.1483 + User::LeaveIfError(iScrDev->GetNearestFontToDesignHeightInPixels(iFont,fontSpec));
1.1484 + iGc->UseFont(iFont);
1.1485 + iFlags|=eFontSet;
1.1486 + iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.1487 + TInt fontHeight=iFont->HeightInPixels();
1.1488 + iDrawRect.iTl.iY=(iScrSize.iHeight-fontHeight)/2;
1.1489 + iDrawRect.SetHeight(fontHeight);
1.1490 + iDrawHeight=iFont->AscentInPixels();
1.1491 + TSize winSize(25,20);
1.1492 + iWin2=new(ELeave) CTBlankWindow;
1.1493 + iWin2->ConstructL(*TheClient->iGroup);
1.1494 + iWin2->SetExt(TPoint((iScrSize.iWidth-winSize.iWidth)/2,(iScrSize.iHeight-winSize.iHeight)/2),winSize);
1.1495 + iWin2->SetColor(TRgb::Gray4(2));
1.1496 + iWin2->BaseWin()->Activate();
1.1497 + INFO_PRINTF1(_L(" Setup Window"));
1.1498 + iScrDev->Update();
1.1499 + TheClient->iWs.Finish();
1.1500 +
1.1501 + User::LeaveIfError(iControlSem.CreateGlobal(SemControl,0,KOwnerType));
1.1502 + User::LeaveIfError(iControlQueue.CreateGlobal(QueueControl,1,sizeof(TInt),KOwnerType));
1.1503 +
1.1504 + iFlags|=eDirectControlSem;
1.1505 + User::LeaveIfError(iWinSem.CreateGlobal(SemNextOp,0,KOwnerType));
1.1506 + iFlags|=eDirectWindowSem;
1.1507 + iProcess=CProcess::NewTL(CProcess::eProcessDirectTest,iTest->iScreenNumber,&iThreadStatus);
1.1508 + INFO_PRINTF1(_L(" Constructed Semaphores & Thread"));
1.1509 + iControlSem.Wait();
1.1510 +
1.1511 + iTimer=CPeriodic::NewL(iTest->EAutoTestPriority);
1.1512 + iRestart=CIdle::NewL(iTest->EAutoTestPriority+5);
1.1513 + iDirect=CDirectScreenAccessOld::NewL(TheClient->iWs,*this);
1.1514 + }
1.1515 +
1.1516 +void CTDirect::DestroyAnimation()
1.1517 + {
1.1518 + ResetScreenSizeMode();
1.1519 + if(iProcess && iProcess->StillAlive())
1.1520 + {
1.1521 + if (iFlags&eDirectControlSem)
1.1522 + {
1.1523 + iControlSem.Signal();
1.1524 + TInt data = 3;
1.1525 + iControlQueue.Send(&data,sizeof(TInt));
1.1526 + }
1.1527 + if (iFlags&eDirectWindowSem)
1.1528 + iWinSem.Signal();
1.1529 + }
1.1530 +
1.1531 + delete iTimer;
1.1532 + iTimer=NULL;
1.1533 + delete iRestart;
1.1534 + iRestart=NULL;
1.1535 + delete iDirect;
1.1536 + iDirect=NULL;
1.1537 + delete iChangeScreenModeTimer;
1.1538 + iChangeScreenModeTimer=NULL;
1.1539 + delete iScreenModeTimer;
1.1540 + iScreenModeTimer=NULL;
1.1541 +
1.1542 + if (iFlags&eFontSet)
1.1543 + {
1.1544 + iGc->DiscardFont();
1.1545 + iScrDev->ReleaseFont(iFont);
1.1546 + }
1.1547 + delete iGc;
1.1548 + if (iDrawingRegion)
1.1549 + iDrawingRegion->Destroy();
1.1550 + delete iScrDev;
1.1551 + delete iWin;
1.1552 + delete iWin2;
1.1553 + if (iProcess)
1.1554 + {
1.1555 + User::WaitForRequest(iThreadStatus);
1.1556 + delete iProcess;
1.1557 + iProcess = NULL;
1.1558 + }
1.1559 + if (iFlags&eDirectControlSem)
1.1560 + {
1.1561 + iControlSem.Close();
1.1562 + iControlQueue.Close();
1.1563 + }
1.1564 + if (iFlags&eDirectWindowSem)
1.1565 + iWinSem.Close();
1.1566 + }
1.1567 +
1.1568 +void CTDirect::ResetScreenSizeMode()
1.1569 + {
1.1570 + if (iModeBackup!=ESizeEnforcementNone)
1.1571 + {
1.1572 + TheClient->iScreen->SetScreenModeEnforcement(ESizeEnforcementNone);
1.1573 + iModeBackup=ESizeEnforcementNone;
1.1574 + }
1.1575 + TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationNormal);
1.1576 + TheClient->iScreen->SetScreenMode(0);
1.1577 + TPixelsAndRotation pixelsAndRotation;
1.1578 + TheClient->iScreen->GetDefaultScreenSizeAndRotation(pixelsAndRotation);
1.1579 + TheClient->iScreen->SetScreenSizeAndRotation(pixelsAndRotation);
1.1580 + User::After(350000); //0.35secs
1.1581 + }
1.1582 +
1.1583 +void CTDirect::ScanTypeFacesL()
1.1584 + {
1.1585 + CFbsScreenDevice* scrdev=CFbsScreenDevice::NewL(iTest->iScreenNumber,EGray4);
1.1586 + TTypefaceSupport typeFace;
1.1587 + TInt numFaces=scrdev->NumTypefaces();
1.1588 + TInt ii;
1.1589 + for (ii=0;ii<numFaces;++ii)
1.1590 + {
1.1591 + scrdev->TypefaceSupport(typeFace,ii);
1.1592 + }
1.1593 + delete scrdev;
1.1594 + }
1.1595 +
1.1596 +TInt RestartAnimation(TAny* aTest)
1.1597 + {
1.1598 + STATIC_CAST(CTDirect*,aTest)->Restart();
1.1599 + return(KErrNone);
1.1600 + }
1.1601 +
1.1602 +TInt NextFrame(TAny* aTest)
1.1603 + {
1.1604 + STATIC_CAST(CTDirect*,aTest)->DrawFrame();
1.1605 + return(KErrNone);
1.1606 + }
1.1607 +
1.1608 +void CTDirect::AbortNow(RDirectScreenAccess::TTerminationReasons aReason)
1.1609 + {
1.1610 + TEST(aReason==RDirectScreenAccess::ETerminateRegion);
1.1611 +
1.1612 + if (iDelay)
1.1613 + User::After(2000000); //2 secs
1.1614 + if (iCancelNext)
1.1615 + {
1.1616 + iFrameNo=eDirectNumFrames;
1.1617 + iTimer->Cancel();
1.1618 + iDirect->Cancel();
1.1619 + TheClient->Flush();
1.1620 + iNextFrameFinished = ETrue;
1.1621 + iState++;
1.1622 + return;
1.1623 + }
1.1624 + iRestart->Start(TCallBack(RestartAnimation,this));
1.1625 + }
1.1626 +
1.1627 +TBool CTDirect::Restart()
1.1628 + {
1.1629 + StartDirect();
1.1630 + return ETrue;
1.1631 + }
1.1632 +
1.1633 +#pragma warning( disable : 4244 ) //conversion from 'int' to 'unsigned short', possible loss of data
1.1634 +TBool CTDirect::DrawFrame()
1.1635 + {
1.1636 + if (iFrameNo==eDirectNumFrames)
1.1637 + {
1.1638 + iState++;
1.1639 + iTimer->Cancel();
1.1640 + if (iFrameNo==eDirectNumFrames)
1.1641 + iDirect->Cancel();
1.1642 + iNextFrameFinished = ETrue;
1.1643 + return EFalse;
1.1644 + }
1.1645 + _LIT(Text,"A0");
1.1646 + TBuf<2> iString(Text); //_LIT(Text,"ABCabc123");
1.1647 + iString[0]+=iFrameNo;
1.1648 + iString[1]+=iFrameNo;
1.1649 + TInt textWidth=iFont->TextWidthInPixels(iString);
1.1650 + TInt maxTextWidth=Max(textWidth,iLastTextWidth);
1.1651 + iLastTextWidth=textWidth;
1.1652 + if (iLastMaxTextWidth!=maxTextWidth)
1.1653 + {
1.1654 + iLastMaxTextWidth=maxTextWidth;
1.1655 + iDrawRect.iTl.iX=(iScrSize.iWidth-iLastMaxTextWidth)/2;
1.1656 + iDrawRect.SetWidth(iLastMaxTextWidth);
1.1657 + }
1.1658 + TInt colorOffset=iFrameNo%2;
1.1659 + iGc->SetPenColor(TRgb::Gray4(colorOffset));
1.1660 + iGc->DrawText(iString,iDrawRect,iDrawHeight,CGraphicsContext::ECenter);
1.1661 + iGc->SetPenColor(TRgb::Gray4(1+colorOffset));
1.1662 + iGc->DrawLine(TPoint(),iScrSize.AsPoint());
1.1663 + iGc->DrawLine(TPoint(iScrSize.iWidth,0),TPoint(0,iScrSize.iHeight));
1.1664 + iGc->DrawLine(TPoint(iScrSize.iWidth/2,0),TPoint(iScrSize.iWidth/2,iScrSize.iHeight));
1.1665 + iGc->DrawLine(TPoint(0,iScrSize.iHeight/2),TPoint(iScrSize.iWidth,iScrSize.iHeight/2));
1.1666 + iScrDev->Update();
1.1667 + ++iFrameNo;
1.1668 + if (iFrameNo==iFrameToSignalAfter)
1.1669 + SignalWindow();
1.1670 + return ETrue;
1.1671 + }
1.1672 +#pragma warning( default : 4244 )
1.1673 +
1.1674 +void CTDirect::SignalWindow()
1.1675 + {
1.1676 + switch(iState)
1.1677 + {
1.1678 + case 0:
1.1679 + switch(iFrameNo)
1.1680 + {
1.1681 + case 0:
1.1682 + iFrameToSignalAfter=0;
1.1683 + }
1.1684 + return;
1.1685 + case 1:
1.1686 + case 3:
1.1687 + switch(iFrameNo)
1.1688 + {
1.1689 + case 0:
1.1690 + iFrameToSignalAfter=3;
1.1691 + iDelay=(iState==3);
1.1692 + return;
1.1693 + case 3:
1.1694 + WinExt.SetSize(TSize(iScrSize.iWidth/2-5,iScrSize.iHeight/2+30));
1.1695 + iFrameToSignalAfter=5;
1.1696 + break;
1.1697 + case 5:
1.1698 + iFrameToSignalAfter=7;
1.1699 + break;
1.1700 + case 7:
1.1701 + WinExt.SetSize(TSize(iScrSize.iWidth/2+30,iScrSize.iHeight/2-5));
1.1702 + WinCol=1;
1.1703 + iFrameToSignalAfter=8;
1.1704 + break;
1.1705 + case 8:
1.1706 + iFrameToSignalAfter=0;
1.1707 + iDelay=EFalse;
1.1708 + break;
1.1709 + }
1.1710 + break;
1.1711 + case 2:
1.1712 + switch(iFrameNo)
1.1713 + {
1.1714 + case 0:
1.1715 + iFrameToSignalAfter=2;
1.1716 + return;
1.1717 + case 2:
1.1718 + WinExt.SetRect(TPoint(iScrSize.iWidth/2-15,iScrSize.iHeight/2-20),TSize(iScrSize.iWidth/3,iScrSize.iHeight/3));
1.1719 + WinCol=2;
1.1720 + iFrameToSignalAfter=5;
1.1721 + break;
1.1722 + case 5:
1.1723 + iFrameToSignalAfter=6;
1.1724 + break;
1.1725 + case 6:
1.1726 + WinExt.SetRect(TPoint(iScrSize.iWidth/2-50,iScrSize.iHeight/3),TSize(iScrSize.iWidth/4,iScrSize.iHeight/3));
1.1727 + WinCol=3;
1.1728 + iFrameToSignalAfter=8;
1.1729 + break;
1.1730 + case 8:
1.1731 + iFrameToSignalAfter=0;
1.1732 + break;
1.1733 + }
1.1734 + break;
1.1735 + case 4:
1.1736 + switch(iFrameNo)
1.1737 + {
1.1738 + case 0:
1.1739 + iFrameToSignalAfter=3;
1.1740 + return;
1.1741 + case 3:
1.1742 + iFrameToSignalAfter=6;
1.1743 + iWin2->SetVisible(EFalse);
1.1744 + TheClient->Flush();
1.1745 + return;
1.1746 + case 6:
1.1747 + iFrameToSignalAfter=0;
1.1748 + iWin2->SetVisible(ETrue);
1.1749 + TheClient->Flush();
1.1750 + return;
1.1751 + }
1.1752 + break;
1.1753 + case 5:
1.1754 + switch(iFrameNo)
1.1755 + {
1.1756 + case 0:
1.1757 + iFrameToSignalAfter=6;
1.1758 + return;
1.1759 + case 6:
1.1760 + iFrameToSignalAfter=0;
1.1761 + WinExt.SetRect(10,10,20,20);
1.1762 + iCancelNext=ETrue;
1.1763 + break;
1.1764 + }
1.1765 + break;
1.1766 + case 6:
1.1767 + switch(iFrameNo)
1.1768 + {
1.1769 + case 0:
1.1770 + iFrameToSignalAfter=7;
1.1771 + iCancelNext=EFalse;
1.1772 + return;
1.1773 + case 7:
1.1774 + iFrameToSignalAfter=0;
1.1775 + delete iWin;
1.1776 + TheClient->Flush();
1.1777 + iWin=NULL;
1.1778 + iWindowDead=ETrue;
1.1779 + return;
1.1780 + }
1.1781 + break;
1.1782 + }
1.1783 +#if defined(LOGGING)
1.1784 + _LIT(KSignal,"Signaling Move Window");
1.1785 + LogMessageText.Copy(KSignal);
1.1786 + TheClient->iWs.LogMessage(LogMessageText);
1.1787 + TheClient->Flush();
1.1788 +#endif
1.1789 + iWinSem.Signal();
1.1790 + }
1.1791 +
1.1792 +void CTDirect::StartDirect()
1.1793 + {
1.1794 + if (iWin==NULL)
1.1795 + {
1.1796 + TEST(iWindowDead);
1.1797 + if (!iWindowDead)
1.1798 + INFO_PRINTF3(_L("iWindowDead - Expected: %d, Actual: %d"), ETrue, iWindowDead);
1.1799 +
1.1800 + iFrameNo=eDirectNumFrames;
1.1801 + return;
1.1802 + }
1.1803 + TEST(!iWindowDead);
1.1804 + if (iWindowDead)
1.1805 + INFO_PRINTF3(_L("iWindowDead - Expected: %d, Actual: %d"), EFalse, iWindowDead);
1.1806 +
1.1807 + if (iDrawingRegion)
1.1808 + iDrawingRegion->Destroy();
1.1809 + TInt retVal = iDirect->Request(iDrawingRegion,*iWin->BaseWin());
1.1810 + TEST(retVal==KErrNone);
1.1811 + if (retVal!=KErrNone)
1.1812 + INFO_PRINTF3(_L("iDirect->Request(iDrawingRegion,*iWin->BaseWin()) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.1813 +
1.1814 + iGc->SetClippingRegion(iDrawingRegion);
1.1815 + }
1.1816 +
1.1817 +void CTDirect::LogLeave(TInt aErr)
1.1818 + {
1.1819 + iTest->LogLeave(aErr);
1.1820 + }
1.1821 +
1.1822 +void CTDirect::Fail()
1.1823 + {
1.1824 + TEST(EFalse);
1.1825 + }
1.1826 +
1.1827 +void CTDirect::Finished(TInt aId)
1.1828 + {
1.1829 + //aId refers to the animation, it is not the test number
1.1830 + _LIT(KCTDirectFinished,"Destroying animation number %d");
1.1831 + LOG_MESSAGE2(KCTDirectFinished,aId);
1.1832 + switch (aId)
1.1833 + {
1.1834 + case 10:
1.1835 + case 11:
1.1836 + ResetScreenSizeMode();
1.1837 + case 9:
1.1838 + iPackagingFinished = ETrue;
1.1839 + case 8:
1.1840 + DeleteMoveWindow();
1.1841 + //iPackagingFinished = ETrue;
1.1842 + if (iScroll)
1.1843 + {
1.1844 + DeleteScroll();
1.1845 + #if defined(LOGGING)
1.1846 + _LIT(KDeleteScroll,"Deleting Scroll Text Id=%d TimerActive=%d");
1.1847 + LogMessageText.Zero();
1.1848 + LogMessageText.AppendFormat(KDeleteScroll,aId,iAnim->IsTimerActive());
1.1849 + TheClient->iWs.LogMessage(LogMessageText);
1.1850 + TheClient->Flush();
1.1851 + #endif
1.1852 + }
1.1853 + if (aId==8 && iAnim->IsTimerActive())
1.1854 + return;
1.1855 + case 1:
1.1856 + case 12:
1.1857 + case 25: //case DSA using Region tracking Only (abort signal expceted)
1.1858 + case 26: //case DSA using Region tracking Only (abort signal not expceted)
1.1859 + {
1.1860 + iPackagingFinished = ETrue;
1.1861 + delete iAnim;
1.1862 + iAnim=NULL;
1.1863 +CHECKHANDLES:
1.1864 + TInt numProcessHandles;
1.1865 + TInt numThreadHandles;
1.1866 + RThread().HandleCount(numProcessHandles,numThreadHandles);
1.1867 + TEST(Abs(numThreadHandles-iNumThreadHandles)<2);
1.1868 + if (Abs(numThreadHandles-iNumThreadHandles)>=2)
1.1869 + INFO_PRINTF3(_L("Abs(numThreadHandles-iNumThreadHandles)<2 - Expected: %d or less, Actual: %d"), 2, Abs(numThreadHandles-iNumThreadHandles));
1.1870 + }
1.1871 + break;
1.1872 + case 16:
1.1873 + case 15:
1.1874 + {
1.1875 + // Stop the animation and delete it, but make sure that you don't increment iState and call Rquest()
1.1876 + // until this is the second call i.e. one of aId = 15 or aId = 16 has already been finished.
1.1877 + TInt index = aId-15;
1.1878 + iAnims[index]->Stop();
1.1879 + delete iAnims[index];
1.1880 + iAnims[index]=NULL;
1.1881 + // This test creates two animations iAnims[0] and iAnims[1].
1.1882 + // Use (index ^ 1 ) = Toggle the Index, to get the index of other animation.
1.1883 + // If iAnims [ index ^ 1] is NULL then this is the second Call and test is finished.
1.1884 + if (iAnims[index ^ 1] != NULL)
1.1885 + {
1.1886 + return;
1.1887 + }
1.1888 + iPackagingFinished = ETrue;
1.1889 + goto CHECKHANDLES;
1.1890 + }
1.1891 + case 13:
1.1892 + {
1.1893 + iPackagingFinished = ETrue;
1.1894 + delete iBlankTopClientWin1;
1.1895 + // delete iBlankTopClientWin2;
1.1896 + TInt jj;
1.1897 + for (jj=0;jj<4;++jj)
1.1898 + iAnims[jj]->Stop();
1.1899 + for (jj=0;jj<4;++jj)
1.1900 + delete iAnims[jj];
1.1901 + break;
1.1902 + }
1.1903 + case 14:
1.1904 + {
1.1905 + iPackagingFinished = ETrue;
1.1906 + iAnims[0]->Stop();
1.1907 + delete iAnims[0];
1.1908 + if (iNumOfModes==iCurrentMode)
1.1909 + {
1.1910 + ResetScreenSizeMode();
1.1911 + iCallBackWin->SetVisible(EFalse);
1.1912 + break;
1.1913 + }
1.1914 + break;
1.1915 + }
1.1916 + case 18:
1.1917 + case 17:
1.1918 + {
1.1919 + // Stop the animation and delete it, but make sure that you don't increment iState and call Rquest()
1.1920 + // until this is the second call i.e. one of aId = 17 or aId = 18 has already been finished.
1.1921 + TInt ii = 0;
1.1922 + TBool finished = ETrue;
1.1923 + if (aId == 17)
1.1924 + {
1.1925 + iAnims[0]->Stop();
1.1926 + delete iAnims[0];
1.1927 + iAnims[0] = NULL;
1.1928 + for (ii=1;ii<=iNumAnimation;++ii)
1.1929 + {
1.1930 + if (iAnims[ii])
1.1931 + {
1.1932 + finished = EFalse;
1.1933 + break;
1.1934 + }
1.1935 + }
1.1936 + }
1.1937 + else // aId == 18
1.1938 + {
1.1939 + for (ii=1;ii<=iNumAnimation;++ii)
1.1940 + {
1.1941 + iAnims[ii]->Stop();
1.1942 + delete iAnims[ii];
1.1943 + iAnims[ii] = NULL;
1.1944 + }
1.1945 + if (iAnims[0])
1.1946 + {
1.1947 + finished = EFalse;
1.1948 + }
1.1949 + }
1.1950 + if (!finished)
1.1951 + {
1.1952 + return;
1.1953 + }
1.1954 + iPackagingFinished = ETrue;
1.1955 + break;
1.1956 + }
1.1957 + case 19:
1.1958 + {
1.1959 + iPackagingFinished = ETrue;
1.1960 + iAnims[0]->Stop();
1.1961 + delete iAnims[0];
1.1962 + break;
1.1963 + }
1.1964 + case 21:
1.1965 + case 20:
1.1966 + {
1.1967 + // Stop the animation and delete it, but make sure that you don't increment iState and call Rquest()
1.1968 + // until this is the second call i.e. one of aId = 20 or aId = 21 has already been finished.
1.1969 + TInt index = aId-20;
1.1970 + iAnims[index]->Stop();
1.1971 + delete iAnims[index];
1.1972 + iAnims[index]=NULL;
1.1973 + // This test creates two animations iAnims[0] and iAnims[1].
1.1974 + // Use (index ^ 1 ) = Toggle the Index, to get the index of other animation.
1.1975 + // If iAnims [ index ^ 1] is NULL then this is the second Call and test is finished.
1.1976 + if (iAnims[index ^ 1] != NULL)
1.1977 + {
1.1978 + return;
1.1979 + }
1.1980 + DeleteMoveWindow();
1.1981 + iPackagingFinished = ETrue;
1.1982 + goto CHECKHANDLES;
1.1983 + } //unreachable line, no need for break
1.1984 + case 24:
1.1985 + iPackagingFinished = ETrue;
1.1986 + iAnim->Stop();
1.1987 + delete iAnim;
1.1988 + iAnim=NULL;
1.1989 + //don't want to increase state, so decrement, since it is incremented below
1.1990 + //as part of processing normal completions. This is to reenter the test
1.1991 + //to call Fail() if required
1.1992 + iState--;
1.1993 + break;
1.1994 +
1.1995 + case 27:
1.1996 + case 28:
1.1997 + case 29:
1.1998 + case 30:
1.1999 + case 31:
1.2000 + case 32:
1.2001 + iAnims[aId-27]->Stop();
1.2002 + delete iAnims[aId-27];
1.2003 + iAnims[aId-27] = NULL;
1.2004 + if(aId != 32)
1.2005 + {
1.2006 + return;
1.2007 + }
1.2008 + DeleteMoveWindow();
1.2009 + iPackagingFinished = ETrue;
1.2010 + break;
1.2011 + default:
1.2012 + iPackagingFinished = ETrue;
1.2013 + TInt ii;
1.2014 + for (ii=0;ii<6;++ii)
1.2015 + iAnims[ii]->Stop();
1.2016 + for (ii=0;ii<6;++ii)
1.2017 + delete iAnims[ii];
1.2018 + DeleteMoveWindow();
1.2019 + break;
1.2020 + }
1.2021 +#if defined(LOGGING)
1.2022 + _LIT(KRequest,"Signal Start NextTest Id=%d, State=%d(+1)");
1.2023 + LogMessageText.Zero();
1.2024 + LogMessageText.AppendFormat(KRequest,aId,iState);
1.2025 + TheClient->iWs.LogMessage(LogMessageText);
1.2026 + TheClient->Flush();
1.2027 +#endif
1.2028 + iState++;
1.2029 + }
1.2030 +
1.2031 +void CTDirect::DeleteMoveWindow()
1.2032 + {
1.2033 + if (iMoveWin)
1.2034 + {
1.2035 + TRequestStatus status;
1.2036 + iMoveWin->Logon(status);
1.2037 + if (iMoveWin->StillAlive())
1.2038 + {
1.2039 + iMoveWin->Terminate(KErrNone);
1.2040 + User::WaitForRequest(status);
1.2041 + }
1.2042 + delete iMoveWin;
1.2043 + iMoveWin=NULL;
1.2044 + }
1.2045 + }
1.2046 +
1.2047 +void CTDirect::DeleteScroll()
1.2048 + {
1.2049 + if (iScroll)
1.2050 + {
1.2051 + TheClient->iScreen->SetScreenMode(0);
1.2052 + iScroll->Stop();
1.2053 + delete iScroll;
1.2054 + iScroll=NULL;
1.2055 + }
1.2056 + }
1.2057 +
1.2058 +TDisplayMode CTDirect::DisplayMode(TInt aId)
1.2059 + {
1.2060 + switch (aId)
1.2061 + {
1.2062 + case 1:
1.2063 + case 13:
1.2064 + case 15:
1.2065 + case 16:
1.2066 + return EColor16;
1.2067 + case 2:
1.2068 + return EGray16;
1.2069 + case 3:
1.2070 + return EColor16;
1.2071 + case 4:
1.2072 + case 14:
1.2073 + case 17:
1.2074 + case 18:
1.2075 + case 19:
1.2076 + case 24:
1.2077 + return EColor256;
1.2078 + case 5:
1.2079 + return EGray256;
1.2080 + case 6:
1.2081 + return EColor4K;
1.2082 + case 7:
1.2083 + return EColor64K;
1.2084 + case 8:
1.2085 + case 9:
1.2086 + case 10:
1.2087 + case 11:
1.2088 + case 12:
1.2089 + {
1.2090 + TInt colors,grays;
1.2091 + /*TDisplayMode mode=*/TheClient->iWs.GetDefModeMaxNumColors(colors,grays);
1.2092 + if (colors==0)
1.2093 + return EGray4;
1.2094 + return (aId==8? EGray16:EColor16);
1.2095 + }
1.2096 + default:;
1.2097 + return TheClient->iScreen->DisplayMode();
1.2098 + }
1.2099 + }
1.2100 +
1.2101 +void CTDirect::Log(const TText8* aFile, TInt aLine, TInt aSeverity,const TDesC& aString)
1.2102 + {
1.2103 + Logger().LogExtra(((TText8*)aFile), aLine, aSeverity, aString) ;
1.2104 + }
1.2105 +
1.2106 +TRgb CTDirect::BrushColorL(TInt aId,TInt& aColor,TBool& aFinished)
1.2107 + {
1.2108 + aFinished=EFalse;
1.2109 + switch (aId)
1.2110 + {
1.2111 + case 1:
1.2112 + case 13:
1.2113 + case 14:
1.2114 + case 15:
1.2115 + case 16:
1.2116 + case 17:
1.2117 + case 18:
1.2118 + case 19:
1.2119 + case 20:
1.2120 + case 21:
1.2121 + case 27:
1.2122 + aFinished=(aColor==20);
1.2123 + return TRgb::Color16(27 + aColor++);
1.2124 + case 28:
1.2125 + aFinished=(aColor==17);
1.2126 + return TRgb::Color16(28 + aColor++);
1.2127 + case 29:
1.2128 + aFinished=(aColor==15);
1.2129 + return TRgb::Color16(29 + aColor++);
1.2130 + case 8:
1.2131 + if (aColor==15)
1.2132 + {
1.2133 + ++iCycles;
1.2134 + aFinished=(iCycles==5);
1.2135 + }
1.2136 + else if (!iScroll)
1.2137 + aFinished=ETrue;
1.2138 + else if (!iScroll->IsRunning())
1.2139 + iScroll->ContinueL();
1.2140 + {
1.2141 + #if defined(LOGGING)
1.2142 + if (aFinished || iScroll==NULL)
1.2143 + {
1.2144 + _LIT(KColor,"Col=%d Cycles=%d Fin=%d iScroll=%d");
1.2145 + LogMessageText.Zero();
1.2146 + LogMessageText.AppendFormat(KColor,aColor,iCycles,aFinished,(TInt&)iScroll);
1.2147 + TheClient->iWs.LogMessage(LogMessageText);
1.2148 + TheClient->Flush();
1.2149 + }
1.2150 + #endif
1.2151 + }
1.2152 + case 2:
1.2153 + if (aColor==16)
1.2154 + aColor=0;
1.2155 + return TRgb::Gray16(aColor++);
1.2156 + case 9:
1.2157 + case 10:
1.2158 + aFinished=iCycles>3;
1.2159 + case 11:
1.2160 + case 3:
1.2161 + if (aColor==16)
1.2162 + {
1.2163 + ++iCycles;
1.2164 + aColor=0;
1.2165 + }
1.2166 + return TRgb::Color16(aColor++);
1.2167 + case 4:
1.2168 + aFinished=(aColor==256);
1.2169 + return TRgb::Color256(aColor++);
1.2170 + case 5:
1.2171 + if (aColor==256)
1.2172 + aColor=0;
1.2173 + return TRgb::Gray256(aColor++);
1.2174 + case 6:
1.2175 + aColor+=127;
1.2176 + if (aColor>4095)
1.2177 + aColor-=4096;
1.2178 + return TRgb::Color4K(aColor);
1.2179 + case 7:
1.2180 + aColor+=211;
1.2181 + if (aColor>65535)
1.2182 + aColor-=65536;
1.2183 + return TRgb::Color64K(aColor++);
1.2184 + case 12:
1.2185 + aFinished=2*(aColor>5);
1.2186 + return TRgb::Color16(aColor++);
1.2187 + case 24:
1.2188 + iCycles++;
1.2189 + if (iCycles==5)
1.2190 + {
1.2191 + aFinished=ETrue;
1.2192 + CheckForTemporaryDeadlock();
1.2193 + }
1.2194 + return TRgb::Color16(aColor++);
1.2195 + case 30:
1.2196 + aFinished=(aColor==256);
1.2197 + return TRgb::Color16(aColor++);
1.2198 + case 31:
1.2199 + aFinished=(aColor==100);
1.2200 + return TRgb::Color16(aColor++);
1.2201 + case 32:
1.2202 + aFinished=(aColor==300);
1.2203 + return TRgb::Color16(aColor++);
1.2204 + default:;
1.2205 + aFinished=ETrue;
1.2206 + return TRgb::Gray2(1); //White
1.2207 + }
1.2208 + }
1.2209 +
1.2210 +TInt CTDirect::TimerInterval(TInt aId)
1.2211 + {
1.2212 + switch (aId)
1.2213 + {
1.2214 + case 1:
1.2215 + case 15:
1.2216 + case 16:
1.2217 + case 17:
1.2218 + case 18:
1.2219 + case 20:
1.2220 + case 21:
1.2221 + return 143200;
1.2222 + case 27:
1.2223 + return 200000;
1.2224 + case 28:
1.2225 + return 180000;
1.2226 + case 29:
1.2227 + return 170000;
1.2228 + case 30:
1.2229 + return 200000;
1.2230 + case 31:
1.2231 + return 205000;
1.2232 + case 32:
1.2233 + return 300000;
1.2234 + case 2:
1.2235 + case 25:
1.2236 + case 26:
1.2237 + return 234567;
1.2238 + case 3:
1.2239 + return 200000;
1.2240 + case 4:
1.2241 + return 11718;
1.2242 + case 5:
1.2243 + return 13719;
1.2244 + case 6:
1.2245 + return 14719;
1.2246 + case 7:
1.2247 + return 15719;
1.2248 + case 8:
1.2249 + return 275000;
1.2250 + case 9:
1.2251 + return 210000;
1.2252 + case 10:
1.2253 + return 110000;
1.2254 + case 11:
1.2255 + return 123456;
1.2256 + case 12:
1.2257 + return 10627;
1.2258 + case 19:
1.2259 + return 1000000;
1.2260 + default:;
1.2261 + return 1;
1.2262 + }
1.2263 + }
1.2264 +
1.2265 +void CTDirect::FailedReStart(TInt /*aId*/,TInt /*aReason*/)
1.2266 + {
1.2267 + Fail();
1.2268 + }
1.2269 +
1.2270 +TInt CTDirect::SlowStopping(TInt aId,TInt aCount)
1.2271 + {
1.2272 + if (aId==8)
1.2273 + return (aCount>1 ? CColorAnimation::eAbortAll : CColorAnimation::eStopNow);
1.2274 + if (aId==9 || aId==10)
1.2275 + return CColorAnimation::eStopNow;
1.2276 + TInt ret=(2*aId-3==aCount%12);
1.2277 + if (ret && aId==5)
1.2278 + {
1.2279 + ++iCount;
1.2280 + if (iCount==5)
1.2281 + return CColorAnimation::eAbort;
1.2282 + }
1.2283 + return ret;
1.2284 + }
1.2285 +
1.2286 +void CTDirect::ModeSwitch()
1.2287 + {
1.2288 + TRAPD(err,iAnim->ChangeModeL(EGray4));
1.2289 + iWin2->SetSize(TSize(20,25));
1.2290 + TheClient->Flush();
1.2291 + if (err!=KErrNone)
1.2292 + Fail();
1.2293 + }
1.2294 +
1.2295 +TestState CTDirect::AnimateWindowL()
1.2296 + {
1.2297 +// if (!iTimer->IsActive())
1.2298 + {
1.2299 +
1.2300 +
1.2301 + iFrameNo=0;
1.2302 + SignalWindow();
1.2303 +
1.2304 +
1.2305 + iTimer->Start(0,200000,TCallBack(NextFrame,this)); //0.2 secs
1.2306 +
1.2307 + StartDirect();
1.2308 + TEST(iDrawingRegion->BoundingRect()==iScrSize);
1.2309 + }
1.2310 +// else
1.2311 +// {
1.2312 +// int i=0;
1.2313 +// }
1.2314 + return EWait;
1.2315 + }
1.2316 +
1.2317 +TestState CTDirect::AnimationDiesL()
1.2318 + {
1.2319 + INFO_PRINTF1(_L("AUTO Animation Dies "));
1.2320 + _LIT(ThreadName,"AnimationDie");
1.2321 + iFirstFunction=TThreadStartUp(CAnimating::StartLC,(TAny*)iTest->iScreenNumber);
1.2322 + CProcess* thread=CProcess::NewThreadL(ThreadName,&iFirstFunction);
1.2323 + CleanupStack::PushL(thread);
1.2324 + thread->LeaveIfDied();
1.2325 + INFO_PRINTF1(_L(" Constructed Thread"));
1.2326 + iControlSem.Wait();
1.2327 + RWindowGroup group(TheClient->iWs);
1.2328 + group.Construct(431,EFalse);
1.2329 + RBlankWindow win(TheClient->iWs);
1.2330 + win.Construct(group,432);
1.2331 + win.SetExtent(TPoint(12,34),TSize(56,78));
1.2332 + win.Activate();
1.2333 + INFO_PRINTF1(_L(" Constructed Windows"));
1.2334 + iControlSem.Wait();
1.2335 + User::After(1000000); //1 sec
1.2336 + TRequestStatus threadDied;
1.2337 + thread->Logon(threadDied);
1.2338 + thread->Terminate(KErrGeneral);
1.2339 + INFO_PRINTF1(_L(" Waiting for Thread"));
1.2340 + User::WaitForRequest(threadDied);
1.2341 + CleanupStack::PopAndDestroy(thread);
1.2342 + win.Close();
1.2343 + group.Close();
1.2344 + INFO_PRINTF1(_L(" Finished"));
1.2345 + return ENext;
1.2346 + }
1.2347 +
1.2348 +TestState CTDirect::PackagingClassL()
1.2349 + {
1.2350 + ConstrucBlankWindowL();
1.2351 + TInt numProcessHandles;
1.2352 + RThread().HandleCount(numProcessHandles,iNumThreadHandles);
1.2353 + iAnim=CColorAnimation::NewL(iTest->iScreenNumber,1,*this,*TheClient->iGroup,TRect(10,10,630,230),ETrue);
1.2354 + return EWait;
1.2355 + }
1.2356 +
1.2357 +TestState CTDirect::MultipleL()
1.2358 + {
1.2359 + TSize scrSize=TheClient->iScreen->SizeInPixels();
1.2360 +
1.2361 + iFlags|=eMultiAnim;
1.2362 + iAnims[0]=CColorAnimation::NewL(iTest->iScreenNumber,2,*this,*TheClient->iGroup,
1.2363 + TRect(0,10,scrSize.iWidth/3+20,scrSize.iHeight/2-5),EFalse);
1.2364 + iAnims[1]=CColorAnimation::NewL(iTest->iScreenNumber,3,*this,*TheClient->iGroup,
1.2365 + TRect(10,scrSize.iHeight/2-20,scrSize.iWidth/3-5,scrSize.iHeight),EFalse);
1.2366 + iAnims[3]=CColorAnimation::NewL(iTest->iScreenNumber,5,*this,*TheClient->iGroup,
1.2367 + TRect(scrSize.iWidth/3-20,scrSize.iHeight/2+5,2*scrSize.iWidth/3+20,scrSize.iHeight-10),EFalse);
1.2368 + iAnims[2]=CColorAnimation::NewL(iTest->iScreenNumber,4,*this,*TheClient->iGroup,
1.2369 + TRect(scrSize.iWidth/3+5,0,2*scrSize.iWidth/3-5,scrSize.iHeight/2+20),EFalse);
1.2370 + iAnims[4]=CColorAnimation::NewL(iTest->iScreenNumber,6,*this,*TheClient->iGroup,
1.2371 + TRect(2*scrSize.iWidth/3-20,15,scrSize.iWidth,scrSize.iHeight/2+50),EFalse);
1.2372 + iAnims[5]=CColorAnimation::NewL(iTest->iScreenNumber,7,*this,*TheClient->iGroup,
1.2373 + TRect(2*scrSize.iWidth/3+5,-20,scrSize.iWidth-15,scrSize.iHeight+10),ETrue);
1.2374 + TInt ii;
1.2375 + for (ii=0;ii<5;++ii)
1.2376 + iAnims[ii]->StartL();
1.2377 + _LIT(ThreadName,"MoveWin");
1.2378 +
1.2379 + MoveInterval=100000; //0.1 secs
1.2380 + ModeInterval=1200000; //1.2 sec
1.2381 + ImmediateModeSwitch=EFalse;
1.2382 + iFirstFunction=TThreadStartUp(CMoveWindow::StartLC,(TAny*)iTest->iScreenNumber);
1.2383 + iMoveWin=CProcess::NewThreadL(ThreadName,&iFirstFunction);
1.2384 + return EWait;
1.2385 + }
1.2386 +
1.2387 +TestState CTDirect::MixDsaAndRegionTrackingOnlyL(TBool aWhoExitsLast)
1.2388 + {
1.2389 + TSize scrSize=TheClient->iScreen->SizeInPixels();
1.2390 +
1.2391 + iFlags|=eMultiAnim;
1.2392 + TUint firstRegionTrackinOnlyDsa = (aWhoExitsLast == KRegionTrackingOnlyDsaExistLast ? 0 : 3);
1.2393 + TUint firstDrawingDsa = (aWhoExitsLast == KDrawingDsaExistLast ? 0 : 3);
1.2394 +
1.2395 + //DSAs who use region tracking only
1.2396 + iAnims[firstRegionTrackinOnlyDsa]=CColorAnimation::NewL(iTest->iScreenNumber,firstRegionTrackinOnlyDsa+27,*this,*TheClient->iGroup,
1.2397 + TRect(10,scrSize.iHeight/2-20,scrSize.iWidth/3-5,scrSize.iHeight),EFalse,KRegionTrackingOnly);
1.2398 + iAnims[firstRegionTrackinOnlyDsa+1]=CColorAnimation::NewL(iTest->iScreenNumber,firstRegionTrackinOnlyDsa+28,*this,*TheClient->iGroup,
1.2399 + TRect(2*scrSize.iWidth/3-20,15,scrSize.iWidth,scrSize.iHeight/2+50),EFalse,KRegionTrackingOnly);
1.2400 + iAnims[firstRegionTrackinOnlyDsa+2]=CColorAnimation::NewL(iTest->iScreenNumber,firstRegionTrackinOnlyDsa+29,*this,*TheClient->iGroup,
1.2401 + TRect(2*scrSize.iWidth/3+5,-20,scrSize.iWidth-15,scrSize.iHeight+10),EFalse,KRegionTrackingOnly);
1.2402 +
1.2403 + //DSAs who actually draw
1.2404 + iAnims[firstDrawingDsa]=CColorAnimation::NewL(iTest->iScreenNumber,firstDrawingDsa+27,*this,*TheClient->iGroup,
1.2405 + TRect(0,10,scrSize.iWidth/3+20,scrSize.iHeight/2-5),EFalse,KDrawingDsa);
1.2406 + iAnims[firstDrawingDsa+1]=CColorAnimation::NewL(iTest->iScreenNumber,firstDrawingDsa+28,*this,*TheClient->iGroup,
1.2407 + TRect(scrSize.iWidth/3+5,0,2*scrSize.iWidth/3-5,scrSize.iHeight/2+20),EFalse,KDrawingDsa);
1.2408 + iAnims[firstDrawingDsa+2]=CColorAnimation::NewL(iTest->iScreenNumber,firstDrawingDsa+29,*this,*TheClient->iGroup,
1.2409 + TRect(scrSize.iWidth/3-20,scrSize.iHeight/2+5,2*scrSize.iWidth/3+20,scrSize.iHeight-10),EFalse,KDrawingDsa);
1.2410 +
1.2411 + TInt ii;
1.2412 + for (ii=0;ii<6;++ii)
1.2413 + {
1.2414 + if(iAnims[ii])
1.2415 + iAnims[ii]->StartL();
1.2416 + }
1.2417 +
1.2418 + _LIT(ThreadName,"MoveWin");
1.2419 +
1.2420 + MoveInterval=100000; //0.1 secs
1.2421 + ModeInterval=1200000; //1.2 secs
1.2422 + ImmediateModeSwitch=EFalse;
1.2423 + iFirstFunction=TThreadStartUp(CMoveWindow::StartLC,(TAny*)iTest->iScreenNumber);
1.2424 + iMoveWin=CProcess::NewThreadL(ThreadName,&iFirstFunction);
1.2425 + return EWait;
1.2426 + }
1.2427 +
1.2428 +TestState CTDirect::TryDifferentSupportedModesL()
1.2429 + {
1.2430 +
1.2431 + RWsSession session;
1.2432 + User::LeaveIfError(session.Connect());
1.2433 + CWsScreenDevice* device = new(ELeave) CWsScreenDevice(session);
1.2434 + CleanupStack::PushL(device);
1.2435 + User::LeaveIfError(device->Construct(iTest->iScreenNumber));
1.2436 + TUint numOfModes=device->NumScreenModes();
1.2437 + _LIT(KTryingCurrentMode,"Trying Mode = %d");
1.2438 + for(TUint currentMode =0; currentMode < numOfModes; currentMode++)
1.2439 + {
1.2440 + LOG_MESSAGE2(KTryingCurrentMode,currentMode);
1.2441 + device->SetScreenMode(currentMode);
1.2442 + TRAPD(err,iAnims[0]=CColorAnimation::NewL(iTest->iScreenNumber,4,*this,*TheClient->iGroup,
1.2443 + TRect(0,0,50,50),ETrue));
1.2444 + if(err!=KErrNone)
1.2445 + {
1.2446 + TEST(EFalse);
1.2447 + }
1.2448 + else
1.2449 + {
1.2450 + User::After(2000000);
1.2451 + iAnims[0]->Stop();
1.2452 + delete iAnims[0];
1.2453 + }
1.2454 + }
1.2455 + CleanupStack::PopAndDestroy(device);
1.2456 + session.Close();
1.2457 + iState++;
1.2458 + return EWait;
1.2459 + }
1.2460 +
1.2461 +
1.2462 +TestState CTDirect::FailCodesL()
1.2463 + {
1.2464 + __UHEAP_MARK;
1.2465 + TRequestStatus status;
1.2466 + RRegion region(TRect(0,0,10,10),1);
1.2467 + RRegion* pRegion=®ion;
1.2468 + RDirectScreenAccess direct(TheClient->iWs);
1.2469 + User::LeaveIfError(direct.Construct());
1.2470 + RBlankWindow window(TheClient->iWs);
1.2471 + User::LeaveIfError(window.Construct(*TheClient->iGroup->WinTreeNode(),1234));
1.2472 + TInt err=direct.Request(pRegion,status,window);
1.2473 + TEST(err==KErrNone);
1.2474 + if (err!=KErrNone)
1.2475 + INFO_PRINTF3(_L("direct.Request(pRegion,status,window) return value - Expected: %d, Actual: %d"), KErrNone, err);
1.2476 + TEST(pRegion!=NULL);
1.2477 + if (pRegion==NULL)
1.2478 + INFO_PRINTF3(_L("pRegion!=NULL - Expected: %d, Actual: %d"), 0, 0);
1.2479 + pRegion->Destroy();
1.2480 + direct.Cancel();
1.2481 + User::WaitForRequest(status);
1.2482 + window.Activate();
1.2483 + window.SetOrdinalPosition(-2);
1.2484 + pRegion=®ion;
1.2485 + err=direct.Request(pRegion,status,window);
1.2486 + TEST(err==KErrNone);
1.2487 + if (err!=KErrNone)
1.2488 + INFO_PRINTF3(_L("direct.Request(pRegion,status,window) return value - Expected: %d, Actual: %d"), KErrNone, err);
1.2489 + TEST(pRegion!=NULL);
1.2490 + if (pRegion==NULL)
1.2491 + INFO_PRINTF3(_L("pRegion!=NULL - Expected: %d, Actual: %d"), 0, 0);
1.2492 + pRegion->Destroy();
1.2493 + direct.Cancel();
1.2494 + User::WaitForRequest(status);
1.2495 +#if defined(__WINS__)
1.2496 + // Loop over the allocations done.
1.2497 + // There is one allocating of the rectangle list and
1.2498 + // one of the region holding the list
1.2499 + for (TInt rate = 1; rate <= 2; rate++)
1.2500 + {
1.2501 + window.SetOrdinalPosition(0);
1.2502 + pRegion=®ion;
1.2503 + TheClient->Flush();
1.2504 + __UHEAP_FAILNEXT(rate);
1.2505 + err=direct.Request(pRegion,status,window);
1.2506 + TEST(err==KErrNoMemory);
1.2507 + if (err!=KErrNoMemory)
1.2508 + INFO_PRINTF3(_L("direct.Request(pRegion,status,window) return value - Expected: %d, Actual: %d"), KErrNoMemory, err);
1.2509 +
1.2510 + TEST(pRegion==NULL);
1.2511 + if (pRegion!=NULL)
1.2512 + INFO_PRINTF3(_L("pRegion!=NULL - Expected: %d, Actual: %d"), 0, 0);
1.2513 + }
1.2514 +#endif
1.2515 + window.Close();
1.2516 + direct.Close();
1.2517 + region.Close();
1.2518 + __UHEAP_MARKEND;
1.2519 + return ENext;
1.2520 + }
1.2521 +
1.2522 +void CTDirect::ScrolingTextL(TInt aId,TRect aWinRect,TBool aStartThread,TInt aScreenMode/*=0*/)
1.2523 + {
1.2524 + INFO_PRINTF1(_L("AUTO Construct ScrolingText "));
1.2525 + INFO_PRINTF1(_L(" Constructed Window"));
1.2526 + iCycles=0;
1.2527 + TInt numProcessHandles;
1.2528 + RThread().HandleCount(numProcessHandles,iNumThreadHandles);
1.2529 + iAnim=CColorAnimation::NewL(iTest->iScreenNumber,aId,*this,*TheClient->iGroup,aWinRect,EFalse);
1.2530 + iScroll=CScrollText::NewL(iTest->iScreenNumber,1,*TheClient->iGroup,5,EFalse);
1.2531 + INFO_PRINTF1(_L(" Constructed Text Scroller & Animation"));
1.2532 + iAnim->BringWindowToFront();
1.2533 + if (aStartThread)
1.2534 + {
1.2535 + _LIT(ThreadName,"MoveWin");
1.2536 + INFO_PRINTF1(_L(" About to constructed Thread"));
1.2537 + iFirstFunction=TThreadStartUp(CMoveWindow::StartLC,(TAny*)iTest->iScreenNumber);
1.2538 + __ASSERT_DEBUG(!iMoveWin,AutoPanic(EAutoPanicDirect));
1.2539 + iMoveWin=CProcess::NewThreadL(ThreadName,&iFirstFunction);
1.2540 + INFO_PRINTF1(_L(" Constructed Thread"));
1.2541 + }
1.2542 + if (aScreenMode>0)
1.2543 + {
1.2544 + TInt numScreenModes = TheClient->iScreen->NumScreenModes();
1.2545 + if (aScreenMode < numScreenModes)
1.2546 + TheClient->iScreen->SetScreenMode(aScreenMode);
1.2547 + else
1.2548 + LOG_MESSAGE(_L("WARNING: Failed to change screen mode"));
1.2549 + // We have to run the test anyway to avoid things going wrong later
1.2550 + }
1.2551 + iAnim->StartOrPanic();
1.2552 + iScroll->StartL();
1.2553 + INFO_PRINTF1(_L(" Constructed/Started"));
1.2554 +#if defined(LOGGING)
1.2555 + _LIT(KStarted,"Finished StartUp ScrollText");
1.2556 + LogMessageText.Copy(KStarted);
1.2557 + TheClient->iWs.LogMessage(LogMessageText);
1.2558 + TheClient->Flush();
1.2559 +#endif
1.2560 + }
1.2561 +
1.2562 +TestState CTDirect::ScrolingText1L()
1.2563 + {
1.2564 + MoveInterval=0;
1.2565 + ModeInterval=1200000; //1.2 sec
1.2566 + ScrolingTextL(8,TRect(20,20,40,40),ETrue);
1.2567 + return EWait;
1.2568 + }
1.2569 +
1.2570 +TestState CTDirect::RClassL()
1.2571 + {
1.2572 +#if defined(LOGGING)
1.2573 + _LIT(KRClass,"Starting Panic test on RClass");
1.2574 + LogMessageText.Zero();
1.2575 + LogMessageText.AppendFormat(KRClass);
1.2576 + TheClient->iWs.LogMessage(LogMessageText);
1.2577 + TheClient->Flush();
1.2578 +#endif
1.2579 + TEST(iTest->TestWsPanicL(CPanicDirect::DoTestOnNewScheduler,EWservPanicDirectMisuse,1,(TAny*)iTest->iScreenNumber));
1.2580 +#if defined(LOGGING)
1.2581 + _LIT(KPanic1,"Done First Panic");
1.2582 + LogMessageText.Zero();
1.2583 + LogMessageText.AppendFormat(KPanic1);
1.2584 + TheClient->iWs.LogMessage(LogMessageText);
1.2585 + TheClient->Flush();
1.2586 +#endif
1.2587 +#if defined(__WINS__)
1.2588 +#if defined(LOGGING)
1.2589 + _LIT(KPanic2,"Doing 2 debug panics");
1.2590 + LogMessageText.Zero();
1.2591 + LogMessageText.AppendFormat(KPanic2);
1.2592 + TheClient->iWs.LogMessage(LogMessageText);
1.2593 + TheClient->Flush();
1.2594 +#endif
1.2595 + TEST(iTest->TestW32PanicL(CPanicDirect::DoTestOnNewScheduler,EW32PanicDirectMisuse,2,(TAny*)iTest->iScreenNumber));
1.2596 + TEST(iTest->TestW32PanicL(CPanicDirect::DoTestOnNewScheduler,EW32PanicDirectMisuse,3,(TAny*)iTest->iScreenNumber));
1.2597 +#endif
1.2598 +#if defined(LOGGING)
1.2599 + _LIT(KPanicTest,"Trying Panic %d");
1.2600 + LogMessageText.Zero();
1.2601 + LogMessageText.AppendFormat(KPanicTest,4);
1.2602 + TheClient->iWs.LogMessage(LogMessageText);
1.2603 + TheClient->Flush();
1.2604 +#endif
1.2605 + TEST(iTest->TestWsPanicL(CPanicDirect::DoTestOnNewScheduler,EWservPanicDirectMisuse,4,(TAny*)iTest->iScreenNumber));
1.2606 + TEST(iTest->TestW32PanicL(CPanicDirect::DoTestOnNewScheduler,EW32PanicDirectMisuse,5,(TAny*)iTest->iScreenNumber));
1.2607 + return ENext;
1.2608 + }
1.2609 +
1.2610 +TestState CTDirect::ScrolingText2L()
1.2611 + {
1.2612 + MoveInterval=81234; //0.08 sec
1.2613 + ModeInterval=140123; //0.14 sec
1.2614 + ImmediateModeSwitch=2;
1.2615 + ScrolingTextL(9,TRect(15,25,45,35),ETrue);
1.2616 + iScroll->SetCountDown(5);
1.2617 + return EWait;
1.2618 + }
1.2619 +
1.2620 +TestState CTDirect::ScrolingText3L()
1.2621 + {
1.2622 + iModeBackup=TheClient->iScreen->ScreenModeEnforcement();
1.2623 + if (iModeBackup!=ESizeEnforcementNone)
1.2624 + TheClient->iScreen->SetScreenModeEnforcement(ESizeEnforcementNone);
1.2625 + MoveInterval=0;
1.2626 + ModeInterval=0;
1.2627 + FlipInterval=1200000; //1.2 secs
1.2628 + ScrolingTextL(10,TRect(25,30,35,45),ETrue,1);
1.2629 + iScroll->SetBottomOfTest(80); //So it can be seen in both screen modes
1.2630 + return EWait;
1.2631 + }
1.2632 +
1.2633 +TestState CTDirect::ScrolingText4L()
1.2634 + {
1.2635 + iModeBackup=TheClient->iScreen->ScreenModeEnforcement();
1.2636 + if (iModeBackup!=ESizeEnforcementNone)
1.2637 + TheClient->iScreen->SetScreenModeEnforcement(ESizeEnforcementNone);
1.2638 + MoveInterval=876543; //0.88 secs
1.2639 + ModeInterval=2178900; //2.18 secs
1.2640 + FlipInterval=5000000; //5 secs
1.2641 + ScrolingTextL(11,TRect(30,40,55,65),ETrue);
1.2642 + iScroll->SetBottomOfTest(80); //So it can be seen in both screen modes
1.2643 + return EWait;
1.2644 + }
1.2645 +
1.2646 +void CTDirect::CreateAnimForScreenModeL(TInt aAnimIndex,CTWinBase& aParent,TRect aRect,TInt aId)
1.2647 + {
1.2648 + iAnims[aAnimIndex]=CColorAnimation::NewL(iTest->iScreenNumber,aId,*this,aParent,aRect,EFalse);
1.2649 + iAnims[aAnimIndex]->StartL();
1.2650 + iAnims[aAnimIndex]->BringWindowToFront();
1.2651 + }
1.2652 +
1.2653 +void CTDirect::BlankTopClientWindowL(CTBlankWindow& aBlankWindow,TRect aRect)
1.2654 + {
1.2655 + aBlankWindow.ConstructExtLD(*TheClient->iGroup,aRect.iTl,aRect.Size());
1.2656 + User::LeaveIfError(aBlankWindow.BaseWin()->SetRequiredDisplayMode(EColor256));
1.2657 + aBlankWindow.BaseWin()->SetShadowDisabled(ETrue);
1.2658 + aBlankWindow.Activate();
1.2659 + }
1.2660 +
1.2661 +static TInt ChangeScreenModeL(TAny* aTest)
1.2662 + {
1.2663 + STATIC_CAST(CTDirect*,aTest)->ChangeToNextScreenModeL();
1.2664 + return KErrNone;
1.2665 + }
1.2666 +
1.2667 +void CTDirect::ChangeToNextScreenModeL()
1.2668 + {
1.2669 +#if defined(LOGGING)
1.2670 + _LIT(KChangeMode,"AUTO Screen Mode Pos Test2 CallBack");
1.2671 + LogMessageText.Copy(KChangeMode);
1.2672 + TheClient->LogMessage(LogMessageText);
1.2673 + TheClient->iWs.LogCommand(RWsSession::ELoggingStatusDump);
1.2674 +#endif
1.2675 + iNumOfModes=TheClient->iScreen->NumScreenModes();
1.2676 + if (iCurrentMode<iNumOfModes)
1.2677 + {
1.2678 + TPixelsAndRotation pixelsAndRotation;
1.2679 + SetScreenMode(iCurrentMode,pixelsAndRotation);
1.2680 + TInt oldCurrentMode=iCurrentMode;
1.2681 + CArrayFixFlat<TInt>* rotations=new(ELeave) CArrayFixFlat<TInt>(1);
1.2682 + CleanupStack::PushL(rotations);
1.2683 + User::LeaveIfError(TheClient->iScreen->GetRotationsList(iCurrentMode,rotations));
1.2684 + TInt count=rotations->Count();
1.2685 + TInt jj=0;
1.2686 + if (count>1)
1.2687 + {
1.2688 + for (jj=0;jj<count;)
1.2689 + {
1.2690 + if ((*rotations)[jj++]==pixelsAndRotation.iRotation)
1.2691 + {
1.2692 + break;
1.2693 + }
1.2694 + }
1.2695 + if (jj==count)
1.2696 + {
1.2697 + jj=0;
1.2698 + }
1.2699 + }
1.2700 + if (jj==0)
1.2701 + {
1.2702 + iCurrentMode++;
1.2703 + }
1.2704 + TInt currentRotation=(*rotations)[jj];
1.2705 + TheClient->iScreen->SetCurrentRotations(oldCurrentMode,REINTERPRET_CAST(CFbsBitGc::TGraphicsOrientation&,currentRotation));
1.2706 + CleanupStack::PopAndDestroy(rotations);
1.2707 + TheClient->iScreen->GetScreenModeSizeAndRotation(oldCurrentMode,pixelsAndRotation);
1.2708 + TInt screenWidth=pixelsAndRotation.iPixelSize.iWidth;
1.2709 + TInt screenHeight=pixelsAndRotation.iPixelSize.iHeight;
1.2710 + TPoint screenModeOrigin=TheClient->iScreen->GetScreenModeScaledOrigin(oldCurrentMode);
1.2711 + TPoint point1(screenModeOrigin.iX,screenModeOrigin.iY+(screenModeOrigin.iY+screenHeight)/2);
1.2712 + TPoint point2(screenModeOrigin.iX+(screenModeOrigin.iX+screenWidth)/2,screenHeight+screenModeOrigin.iY);
1.2713 + TRect rect0(point1,point2);
1.2714 + TRect rect1(TPoint(0,0),rect0.Size());
1.2715 + CreateAnimForScreenModeL(0,*TheClient->iGroup,rect1,14);
1.2716 + TPoint pos=iAnims[0]->AbsoluteWindowPosition();
1.2717 + TEST(pos==TPoint(0,0));
1.2718 + }
1.2719 + }
1.2720 +
1.2721 +TInt ChangeScreenScaleCallBack(TAny* aTest)
1.2722 + {
1.2723 + static_cast<CTDirect*>(aTest)->ChangeScreenScale();
1.2724 + return KErrNone;
1.2725 + }
1.2726 +
1.2727 +void CTDirect::ChangeScreenScale()
1.2728 + {
1.2729 + if (!iNumOfCallBack)
1.2730 + {
1.2731 + iCurrentMode=TheClient->iScreen->CurrentScreenMode();
1.2732 + iModeData=TheClient->iScreen->GetCurrentScreenModeAttributes();
1.2733 + iModeData.iScreenScale.SetSize(1,1);
1.2734 + }
1.2735 + TSizeMode testMode=iModeData;
1.2736 + if (!iNumOfCallBack)
1.2737 + {
1.2738 + testMode.iScreenScale.SetSize(2,2);
1.2739 + }
1.2740 + else if (iNumOfCallBack==1)
1.2741 + {
1.2742 + testMode.iScreenScale.SetSize(3,2);
1.2743 + }
1.2744 + else if (iNumOfCallBack==2)
1.2745 + {
1.2746 + testMode.iScreenScale.SetSize(2,3);
1.2747 + }
1.2748 + TheClient->iScreen->SetCurrentScreenModeAttributes(testMode);
1.2749 + TheClient->iScreen->SetAppScreenMode(iCurrentMode);
1.2750 + TheClient->iScreen->SetScreenMode(iCurrentMode);
1.2751 + if (iNumOfCallBack==2)
1.2752 + {
1.2753 + iScreenModeTimer->Cancel();
1.2754 + delete iScreenModeTimer;
1.2755 + iScreenModeTimer=NULL;
1.2756 + }
1.2757 + iNumOfCallBack++;
1.2758 + }
1.2759 +
1.2760 +/*
1.2761 + * Creates a DSA for screen mode 0. After DSA has displayd 2 or 3 frames screen mode
1.2762 + * scale is changed with a timer. The DSA aborts and restarts once again
1.2763 + * and completes itself in different screen mode.
1.2764 + */
1.2765 +TestState CTDirect::ScreenModeTestForScalingL()
1.2766 + {
1.2767 + CreateAnimForScreenModeL(0,*TheClient->iGroup,TRect(TSize(10,10)),19);
1.2768 + iScreenModeTimer=CPeriodic::NewL(0);
1.2769 + MoveInterval=2000000;
1.2770 + iScreenModeTimer->Start(1000,MoveInterval,TCallBack(ChangeScreenScaleCallBack,this));
1.2771 + return EWait;
1.2772 + }
1.2773 +
1.2774 +/*
1.2775 + * Creates a DSA for screen mode 0, tests API AbsoluteWindowPosition()
1.2776 + * Then sets screen mode to last(test) screen mode, here it does the same thing as
1.2777 + * done for screenmode 0, but with diffrerent scale (2,2) (2,3) (3,2) (3,3) and
1.2778 + * with different origin (20,30) (30,20) (20,20).
1.2779 + * Lastly copy back the test screen mode values.
1.2780 + */
1.2781 +TestState CTDirect::ScreenModeScalingTestL()
1.2782 + {
1.2783 +#if defined(LOGGING)
1.2784 +INFO_PRINTF1("AUTO ScreenModeScalingTest ");
1.2785 +#else
1.2786 +// DisabledStartLogText();
1.2787 +#endif
1.2788 +INFO_PRINTF1(_L(" Switch to mode 0"));
1.2789 + iModeData.iScreenScale.iWidth=1;
1.2790 + iModeData.iScreenScale.iHeight=1;
1.2791 + TheClient->iScreen->SetCurrentScreenModeAttributes(iModeData);
1.2792 + TheClient->iScreen->SetAppScreenMode(0);
1.2793 + TheClient->iScreen->SetScreenMode(0);
1.2794 + iCurrentMode=0;
1.2795 +INFO_PRINTF1(_L(" Get Parameters"));
1.2796 + iCurrentScreenModeOrigin=TheClient->iScreen->GetDefaultScreenModeOrigin();
1.2797 + iCurrentScreenModeScale=TheClient->iScreen->GetCurrentScreenModeScale();
1.2798 + Copy2ndHalfOfScreen=(iCurrentScreenModeOrigin.iX>FullScreenModeSize.iWidth/2? 1 : 0);
1.2799 + TRect testWinRect(PhysicalToLogical(TPoint(),iCurrentScreenModeScale),
1.2800 + PhysicalToLogical(TPoint((Copy2ndHalfOfScreen ? FullScreenModeSize.iWidth :
1.2801 + FullScreenModeSize.iWidth/2),
1.2802 + FullScreenModeSize.iHeight)-
1.2803 + iCurrentScreenModeOrigin,iCurrentScreenModeScale)
1.2804 + );
1.2805 + testWinRect.Shrink(10,10);
1.2806 +INFO_PRINTF1(_L(" Create Animation"));
1.2807 + CreateAnimForScreenModeL(0,*TheClient->iGroup,testWinRect,17);
1.2808 + TPoint pos0=iAnims[0]->AbsoluteWindowPosition();
1.2809 + TEST(pos0==TPoint(10,10));
1.2810 +
1.2811 + TInt numOfModes=TheClient->iScreen->NumScreenModes();
1.2812 + iCurrentMode=numOfModes-1;
1.2813 +INFO_PRINTF1(_L(" Switch to Last Mode"));
1.2814 + TheClient->iScreen->SetAppScreenMode(iCurrentMode);
1.2815 + TheClient->iScreen->SetScreenMode(iCurrentMode);
1.2816 + TSizeMode storeModeData=TheClient->iScreen->GetCurrentScreenModeAttributes();
1.2817 + TSizeMode testMode=storeModeData;
1.2818 + iNumAnimation=0;
1.2819 + for (TInt xScale=2;xScale<4;xScale++)
1.2820 + {
1.2821 +INFO_PRINTF1(_L(" New X-Scale"));
1.2822 + for (TInt yScale=2;yScale<4;yScale++)
1.2823 + {
1.2824 +INFO_PRINTF1(_L(" New Y-Scale"));
1.2825 + testMode.iScreenScale=TSize(xScale,yScale);
1.2826 + TestDifferentOriginAndScaleL(testMode,TPoint(20,20));
1.2827 + TestDifferentOriginAndScaleL(testMode,TPoint(20,30));
1.2828 + TestDifferentOriginAndScaleL(testMode,TPoint(30,20));
1.2829 + }
1.2830 + }
1.2831 + TheClient->iScreen->SetScreenMode(iCurrentMode);
1.2832 + TheClient->iScreen->SetCurrentScreenModeAttributes(storeModeData);
1.2833 +INFO_PRINTF1(_L(" Set To Mode 0"));
1.2834 + TheClient->iScreen->SetAppScreenMode(0);
1.2835 + TheClient->iScreen->SetScreenMode(0);
1.2836 + return EWait;
1.2837 + }
1.2838 +
1.2839 +void CTDirect::TestDifferentOriginAndScaleL(TSizeMode &aMode,TPoint aOrigin)
1.2840 + {
1.2841 + aMode.iOrigin=aOrigin;
1.2842 + TheClient->iScreen->SetCurrentScreenModeAttributes(aMode);
1.2843 + TheClient->iScreen->SetAppScreenMode(iCurrentMode);
1.2844 + TheClient->iScreen->SetScreenMode(iCurrentMode);
1.2845 + iCurrentScreenModeOrigin=TheClient->iScreen->GetScreenModeOrigin(iCurrentMode);
1.2846 + iCurrentScreenModeScale=TheClient->iScreen->GetScreenModeScale(iCurrentMode);
1.2847 + Copy2ndHalfOfScreen=(iCurrentScreenModeOrigin.iX>FullScreenModeSize.iWidth/2? 1 : 0);
1.2848 + TRect testWinRect(PhysicalToLogical(TPoint(),iCurrentScreenModeScale),
1.2849 + PhysicalToLogical(TPoint((Copy2ndHalfOfScreen ? FullScreenModeSize.iWidth
1.2850 + : FullScreenModeSize.iWidth/2),
1.2851 + FullScreenModeSize.iHeight)
1.2852 + -iCurrentScreenModeOrigin,iCurrentScreenModeScale)
1.2853 + );
1.2854 + testWinRect.Shrink(10,10);
1.2855 + ++iNumAnimation;
1.2856 + CreateAnimForScreenModeL(iNumAnimation,*TheClient->iGroup,testWinRect,18);
1.2857 + TPoint pos0=iAnims[iNumAnimation]->AbsoluteWindowPosition();
1.2858 + TEST(pos0==TPoint(10,10));
1.2859 + }
1.2860 +
1.2861 +//REQUIREMENT: CR PHAR-5SJGAM, PREQ673
1.2862 +//Tests that DSA works correctly in screen modes with non-zero screen mode origin.
1.2863 +TestState CTDirect::DSAWithScreenModeOffset1L()
1.2864 + {
1.2865 + TPoint screenModeTwoOrigin=TheClient->iScreen->GetScreenModeScaledOrigin(2);
1.2866 + TPixelsAndRotation pixelsAndRotation;
1.2867 + TheClient->iScreen->GetScreenModeSizeAndRotation(2,pixelsAndRotation);
1.2868 + if(pixelsAndRotation.iRotation != CFbsBitGc::EGraphicsOrientationNormal)
1.2869 + {
1.2870 + TheClient->iScreen->SetCurrentRotations(2, CFbsBitGc::EGraphicsOrientationNormal);
1.2871 + }
1.2872 + TheClient->iScreen->GetScreenModeSizeAndRotation(2,pixelsAndRotation);
1.2873 + //check that the current rotation is normal
1.2874 + __ASSERT_DEBUG(pixelsAndRotation.iRotation==CFbsBitGc::EGraphicsOrientationNormal,AutoPanic(EAutoPanicDirect));
1.2875 + TInt screenWidthMode2=pixelsAndRotation.iPixelSize.iWidth;
1.2876 + TInt screenHeightMode2=pixelsAndRotation.iPixelSize.iHeight;
1.2877 + TPoint point1(screenModeTwoOrigin.iX,screenModeTwoOrigin.iY+(screenModeTwoOrigin.iY+screenHeightMode2)/2);
1.2878 + TPoint point2(screenModeTwoOrigin.iX+(screenModeTwoOrigin.iX+screenWidthMode2)/2,screenHeightMode2+screenModeTwoOrigin.iY);
1.2879 + TPoint point3(screenModeTwoOrigin.iX+screenWidthMode2,screenModeTwoOrigin.iY+screenHeightMode2);
1.2880 +
1.2881 + SetScreenMode(0,pixelsAndRotation);
1.2882 + TRect rect0(point1,point2);
1.2883 + CreateAnimForScreenModeL(0,*TheClient->iGroup,rect0,13);
1.2884 + TPoint pos0=iAnims[0]->AbsoluteWindowPosition();
1.2885 + TEST(pos0==point1);
1.2886 +
1.2887 + SetScreenMode(2,pixelsAndRotation);
1.2888 + TRect rect1(TPoint(0,0),rect0.Size());
1.2889 + CreateAnimForScreenModeL(1,*TheClient->iGroup,rect1,13);
1.2890 + TPoint pos1=iAnims[1]->AbsoluteWindowPosition();
1.2891 + TEST(pos1==rect1.iTl);
1.2892 +
1.2893 + SetScreenMode(0,pixelsAndRotation);
1.2894 + iBlankTopClientWin1=new(ELeave) CTBlankWindow();
1.2895 +// TInt ordpos = iBlankTopClientWin1->BaseWin()->OrdinalPosition();
1.2896 + TRect rect2(TPoint(point2.iX,point1.iY),point3);
1.2897 + BlankTopClientWindowL(*iBlankTopClientWin1,rect2);
1.2898 + TInt x=rect2.Size().iWidth/4;
1.2899 + TPoint animWinPt(x,0);
1.2900 + rect2.Shrink(x,0);
1.2901 + CreateAnimForScreenModeL(2,*iBlankTopClientWin1,TRect(animWinPt,rect2.Size()),13);
1.2902 + TPoint pos2=iAnims[2]->AbsoluteWindowPosition();
1.2903 + TEST(pos2==rect2.iTl);
1.2904 +
1.2905 + SetScreenMode(2,pixelsAndRotation);
1.2906 + iBlankTopClientWin2=new(ELeave) CTBlankWindow();
1.2907 +// ordpos = iBlankTopClientWin2->BaseWin()->OrdinalPosition();
1.2908 + TPoint tl(rect1.iBr.iX,0);
1.2909 + TRect rect3(tl,TPoint(screenWidthMode2,rect1.iBr.iY));
1.2910 + BlankTopClientWindowL(*iBlankTopClientWin2,rect3);
1.2911 + x=rect3.Size().iWidth/4;
1.2912 + animWinPt=TPoint(x,0);
1.2913 + rect3.Shrink(x,0);
1.2914 + CreateAnimForScreenModeL(3,*iBlankTopClientWin2,TRect(animWinPt,rect3.Size()),13);
1.2915 + TPoint pos3=iAnims[3]->AbsoluteWindowPosition();
1.2916 + TEST(pos3==(animWinPt+tl));
1.2917 +
1.2918 + SetScreenMode(0,pixelsAndRotation);
1.2919 + return EWait;
1.2920 + }
1.2921 +
1.2922 +//REQUIREMENT: CR PHAR-5SJGAM, PREQ673
1.2923 +//Tests that DSA works correctly in screen modes with non-zero screen mode origin and different rotations
1.2924 +TestState CTDirect::DSAWithScreenModeOffset2L()
1.2925 + {
1.2926 + iCurrentMode=0;
1.2927 + TTimeIntervalMicroSeconds32 timeBetweenScreenModeChange=3200000;
1.2928 + iCallBackWin->WinTreeNode()->SetOrdinalPosition(0);
1.2929 + iCallBackWin->SetVisible(ETrue); //Used to forsce screen into Color256 so that it will rotate
1.2930 + iChangeScreenModeTimer=CPeriodic::NewL(0);
1.2931 + iChangeScreenModeTimer->Start(0,timeBetweenScreenModeChange,TCallBack(ChangeScreenModeL,this));
1.2932 + return EWait;
1.2933 + }
1.2934 +
1.2935 +void CTDirect::SetScreenMode(TInt aMode,TPixelsAndRotation& aPixelsAndRotation)
1.2936 + {
1.2937 + TheClient->iScreen->SetScreenMode(aMode);
1.2938 + TheClient->iScreen->SetScreenModeEnforcement(ESizeEnforcementNone);
1.2939 + TheClient->iScreen->GetDefaultScreenSizeAndRotation(aPixelsAndRotation);
1.2940 + TheClient->iScreen->SetScreenSizeAndRotation(aPixelsAndRotation);
1.2941 + TheClient->Flush();
1.2942 + }
1.2943 +
1.2944 +TestState CTDirect::DefectFix_KAA_5J3BLW_L()
1.2945 + {
1.2946 + TInt numProcessHandles;
1.2947 + RThread().HandleCount(numProcessHandles,iNumThreadHandles);
1.2948 + const TSize screenSize(TheClient->iScreen->SizeInPixels());
1.2949 + const TRect dsaRect(0,0,screenSize.iWidth>>2,screenSize.iHeight>>2);
1.2950 + iAnim=CBugFixColorAnimation::NewL(iTest->iScreenNumber, 1, *this, *TheClient->iGroup, dsaRect,ETrue);
1.2951 + return EWait;
1.2952 + }
1.2953 +
1.2954 +TestState CTDirect::RegionTrackingOnlyNotificationsL(TUint aId)
1.2955 + {
1.2956 + TInt numProcessHandles;
1.2957 + RThread().HandleCount(numProcessHandles,iNumThreadHandles);
1.2958 + const TSize screenSize(TheClient->iScreen->SizeInPixels());
1.2959 + const TRect dsaRect(0,0,screenSize.iWidth>>2,screenSize.iHeight>>2);
1.2960 + TBool isWindowOpenedInFrontOfDsa = (aId == KRegionTrackingOnlyDsaWaitingForAbortSignal);
1.2961 + iAnim=CRegionTrackingOnly::NewL(iTest->iScreenNumber, aId, *this, *TheClient->iGroup, dsaRect,ETrue,isWindowOpenedInFrontOfDsa);
1.2962 + return EWait;
1.2963 + }
1.2964 +
1.2965 +// Tests the new function of getting the window's absolute position
1.2966 +TestState CTDirect::WindowPoistionRelativeToScreenL()
1.2967 + {
1.2968 + //.. delete screen mode timer
1.2969 + delete iChangeScreenModeTimer;
1.2970 + iChangeScreenModeTimer=NULL;
1.2971 +
1.2972 + TInt numProcessHandles;
1.2973 + RThread().HandleCount(numProcessHandles,iNumThreadHandles);
1.2974 + TSize screenSize(TheClient->iScreen->SizeInPixels());
1.2975 + TRect rect(0,0,screenSize.iWidth>>1,screenSize.iHeight);
1.2976 + rect.Shrink(10,10);
1.2977 + // First animation is for showing that child window is within the visible part of the parent window and within the visible screen area
1.2978 + iAnims[0]=new(ELeave) CColorAnimation(iTest->iScreenNumber,15,*this);
1.2979 + iAnims[0]->ConstructL(*TheClient->iGroup,rect,KDrawingDsa,1);
1.2980 + iAnims[0]->StartL(ETrue);
1.2981 + // First animation is for showing that child window is to the side of visible part of parent window
1.2982 + rect.Move(screenSize.iWidth>>1,0);
1.2983 + iAnims[1]=new(ELeave) CColorAnimation(iTest->iScreenNumber,16,*this);
1.2984 + iAnims[1]->ConstructL(*TheClient->iGroup,rect,KDrawingDsa,2);
1.2985 + iAnims[1]->StartL(ETrue);
1.2986 + return EWait;
1.2987 + }
1.2988 +
1.2989 +TestState CTDirect::MultipleDSAsOnSameWindowL()
1.2990 + {
1.2991 + TInt numProcessHandles;
1.2992 + RThread().HandleCount(numProcessHandles,iNumThreadHandles);
1.2993 + iCallBackWin->SetVisible(ETrue);
1.2994 + iCallBackWin->WinTreeNode()->SetOrdinalPosition(0);
1.2995 + iAnims[0]=new(ELeave) CColorAnimation(iTest->iScreenNumber,20,*this);
1.2996 + iAnims[0]->ConstructL(*TheClient->iGroup,TRect(),KDrawingDsa,0,1);
1.2997 + iAnims[0]->StartL();
1.2998 + iAnims[1]=new(ELeave) CColorAnimation(iTest->iScreenNumber,21,*this);
1.2999 + iAnims[1]->ConstructL(*TheClient->iGroup,TRect(),KDrawingDsa,0,2);
1.3000 + iAnims[1]->StartL();
1.3001 + _LIT(ThreadName,"MoveWin");
1.3002 + MoveInterval=100000;
1.3003 + ModeInterval=0;
1.3004 + FlipInterval=0;
1.3005 + ImmediateModeSwitch=EFalse;
1.3006 + iFirstFunction=TThreadStartUp(CMoveWindow::StartLC,(TAny*)iTest->iScreenNumber);
1.3007 + iMoveWin=CProcess::NewThreadL(ThreadName,&iFirstFunction);
1.3008 + return EWait;
1.3009 + }
1.3010 +
1.3011 +TestState CTDirect::KillAnimationL()
1.3012 + {
1.3013 + TInt numProcessHandles;
1.3014 + RThread().HandleCount(numProcessHandles,iNumThreadHandles);
1.3015 + iAnim=CColorAnimation::NewL(iTest->iScreenNumber,12,*this,*TheClient->iGroup,TRect(15,15,625,225),ETrue);
1.3016 + return EWait;
1.3017 + }
1.3018 +
1.3019 +TestState CTDirect::TemporaryDeadlockL()
1.3020 + {
1.3021 +
1.3022 + if (iTestJustCompleted)
1.3023 + {
1.3024 + if (iTestJustFailed)
1.3025 + {
1.3026 + Fail();
1.3027 + }
1.3028 + iState++;
1.3029 + return ENext;
1.3030 + }
1.3031 +
1.3032 + //make sure this code isn't called a second time
1.3033 + __ASSERT_ALWAYS(iAnim==NULL,AutoPanic(EAutoPanicDirect));
1.3034 +
1.3035 + TSize screenSize(TheClient->iScreen->SizeInPixels());
1.3036 + TRect rect(0,0,screenSize.iWidth>>1,screenSize.iHeight);
1.3037 + rect.Shrink(10,10);
1.3038 + iAnim=new(ELeave) CColorAnimation(iTest->iScreenNumber,24,*this);
1.3039 + iAnim->ConstructL(*TheClient->iGroup,rect,KDrawingDsa,1);
1.3040 + iAnim->StartL(ETrue);
1.3041 + return EWait;
1.3042 + }
1.3043 +
1.3044 +void CTDirect::CheckForTemporaryDeadlock()
1.3045 + {
1.3046 +
1.3047 + TBool result=ETrue;
1.3048 + TInt error;
1.3049 +
1.3050 +
1.3051 + //Create a window for placing on top
1.3052 + TTime beforeTime;
1.3053 + beforeTime.HomeTime();
1.3054 +
1.3055 + RWindow window(TheClient->iWs);
1.3056 +
1.3057 + error=window.Construct(*TheClient->iGroup->GroupWin(), reinterpret_cast<TInt>(&window));
1.3058 + if (error==KErrNone)
1.3059 + {
1.3060 + window.SetOrdinalPosition(0);
1.3061 + window.SetExtent(TPoint(30,30),TSize(10,10));
1.3062 + window.SetBackgroundColor(TRgb(255,0,255));
1.3063 +
1.3064 + //make sure the basewin is towards the back
1.3065 + iCallBackWin->BaseWin()->SetOrdinalPosition(5);
1.3066 +
1.3067 + window.SetRequiredDisplayMode(EColor256);
1.3068 + window.Activate();
1.3069 + TheClient->iWs.Flush();
1.3070 + //need code similar to below, but the status of the active object we
1.3071 + //really want is too private
1.3072 + //if (!iAnim->IsReadyToAbort())
1.3073 + // {
1.3074 + // result=EFalse;
1.3075 + // }
1.3076 + window.Close();
1.3077 + }
1.3078 + else
1.3079 + {
1.3080 + result = EFalse;
1.3081 + }
1.3082 +
1.3083 + TTime afterTime;
1.3084 + afterTime.HomeTime();
1.3085 + TTimeIntervalMicroSeconds difference = afterTime.MicroSecondsFrom(beforeTime);
1.3086 +
1.3087 + //make time difference 350ms, since the two timers to be checked are 400ms and 500ms
1.3088 + if (difference>TTimeIntervalMicroSeconds(1000*350))
1.3089 + {
1.3090 + result=EFalse;
1.3091 + }
1.3092 +
1.3093 + iTestJustCompleted = ETrue;
1.3094 + if (result==EFalse)
1.3095 + {
1.3096 + iTestJustFailed=ETrue;
1.3097 + }
1.3098 + }
1.3099 +
1.3100 +void CTDirect::RunTestCaseL(TInt /*aCurTestCase*/)
1.3101 + {
1.3102 + _LIT(Animation1,"Animating");
1.3103 + _LIT(Animation2,"Animating Dies");
1.3104 + _LIT(Animation3,"Packaging Class");
1.3105 + _LIT(Animation4,"Many Animations");
1.3106 + _LIT(Animation5,"Fail Codes");
1.3107 + _LIT(Animation6,"Cancel The Other");
1.3108 + _LIT(Animation7,"'R' Class API");
1.3109 + _LIT(Animation8,"Switch Clear Type");
1.3110 + _LIT(Animation9,"SizeMode Change");
1.3111 + _LIT(Animation10,"Soak Testing");
1.3112 + _LIT(Animation11,"Kill Animation");
1.3113 + _LIT(Animation12,"Defect-Fix: KAA-5J3BLW");
1.3114 + _LIT(Animation13,"Screen Mode Positioning DSA Test 1");
1.3115 + _LIT(Animation14,"Screen Mode Positioning DSA Test 2");
1.3116 + _LIT(Animation15,"Position Relative to Screen");
1.3117 + _LIT(Animation16,"Screen mode Scaling DSA Test 1");
1.3118 + _LIT(Animation17,"Screen mode Scaling DSA Test 2");
1.3119 + _LIT(Animation18,"Multiple DSAs on same window");
1.3120 + _LIT(Animation19,"DSA and windows temporary deadlock");
1.3121 + _LIT(Animation25,"RegionTrackingOnly DSA, window opened in front");
1.3122 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
1.3123 + _LIT(Animation26,"RegionTrackingOnly DSA, window opened behind");
1.3124 + _LIT(Animation27,"Mixed DSAs, RegionTrackingOnly DSA last to exit");
1.3125 + _LIT(Animation28,"Mixed DSAs, drawing DSA last to exit");
1.3126 + _LIT(Animation29,"Trying all the screen supported modes");
1.3127 +#endif
1.3128 + TestState ret=ENext;
1.3129 +
1.3130 + if (iTimerRunning && !iPackagingFinished)
1.3131 + {
1.3132 + // Prevent test harness from repeatedly running the test case too quickly.
1.3133 + User::After(SHORT_DELAY);
1.3134 + }
1.3135 +
1.3136 + //if (iState==0) iState=18;
1.3137 + iTest->iState=iState;
1.3138 + ((CTDirectStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
1.3139 + switch(iState)
1.3140 + {
1.3141 +/**
1.3142 +@SYMTestCaseID GRAPHICS-WSERV-0158
1.3143 +
1.3144 +@SYMDEF DEF081259
1.3145 +
1.3146 +@SYMTestCaseDesc Create seven seperate animations and run them to completion
1.3147 +
1.3148 +@SYMTestPriority High
1.3149 +
1.3150 +@SYMTestStatus Implemented
1.3151 +
1.3152 +@SYMTestActions Create animations and start them running. Run until the animations finish.
1.3153 +
1.3154 +@SYMTestExpectedResults The animation run to completion without error
1.3155 +*/
1.3156 + case 0:
1.3157 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158"));
1.3158 + if (iNextFrameFinished)
1.3159 + InitialiseAnimationL();
1.3160 + case 1:
1.3161 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158"));
1.3162 + case 2:
1.3163 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158"));
1.3164 + case 3:
1.3165 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158"));
1.3166 + case 4:
1.3167 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158"));
1.3168 + case 5:
1.3169 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158"));
1.3170 + case 6:
1.3171 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158"));
1.3172 + if (iNextFrameFinished)
1.3173 + {
1.3174 + iTest->LogSubTest(Animation1);
1.3175 + ret=AnimateWindowL();
1.3176 + iNextFrameFinished=EFalse;
1.3177 + }
1.3178 + else
1.3179 + {
1.3180 + // Prevent test harness from repeatedly running the test case too quickly.
1.3181 + User::After(SHORT_DELAY);
1.3182 + }
1.3183 + break;
1.3184 +/**
1.3185 +@SYMTestCaseID GRAPHICS-WSERV-0159
1.3186 +
1.3187 +@SYMDEF DEF081259
1.3188 +
1.3189 +@SYMTestCaseDesc Check animation dies correctly when run in a thread
1.3190 +
1.3191 +@SYMTestPriority High
1.3192 +
1.3193 +@SYMTestStatus Implemented
1.3194 +
1.3195 +@SYMTestActions Create animation and run in from a thread that dies. Once the thread
1.3196 + has died check the animation has been dealt with correctly.
1.3197 +
1.3198 +@SYMTestExpectedResults The animation dies correctly
1.3199 +*/
1.3200 + case 7:
1.3201 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0159"));
1.3202 + iTest->LogSubTest(Animation2);
1.3203 + ret=AnimationDiesL();
1.3204 + ++iState;
1.3205 + DestroyAnimation();
1.3206 + break;
1.3207 +/**
1.3208 +@SYMTestCaseID GRAPHICS-WSERV-0160
1.3209 +
1.3210 +@SYMDEF DEF081259
1.3211 +
1.3212 +@SYMTestCaseDesc Check animation runs correctly in blank window
1.3213 +
1.3214 +@SYMTestPriority High
1.3215 +
1.3216 +@SYMTestStatus Implemented
1.3217 +
1.3218 +@SYMTestActions Create an animation and run it in a blank window
1.3219 +
1.3220 +@SYMTestExpectedResults The animation runs to completion without error
1.3221 +*/
1.3222 + case 8:
1.3223 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0160"));
1.3224 + if (!iTimerRunning)
1.3225 + {
1.3226 + iTest->LogSubTest(Animation3);
1.3227 + ret=PackagingClassL();
1.3228 + iTimerRunning = ETrue;
1.3229 + }
1.3230 + if (iPackagingFinished)
1.3231 + {
1.3232 + iPackagingFinished = EFalse;
1.3233 + iTimerRunning = EFalse;
1.3234 + }
1.3235 + break;
1.3236 +/**
1.3237 +@SYMTestCaseID GRAPHICS-WSERV-0161
1.3238 +
1.3239 +@SYMDEF DEF081259
1.3240 +
1.3241 +@SYMTestCaseDesc Check many animations can be run in the same window
1.3242 +
1.3243 +@SYMTestPriority High
1.3244 +
1.3245 +@SYMTestStatus Implemented
1.3246 +
1.3247 +@SYMTestActions Create multiple animations in a window and run them all
1.3248 + until completion
1.3249 +
1.3250 +@SYMTestExpectedResults The animations run without error
1.3251 +*/
1.3252 + case 9:
1.3253 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0161"));
1.3254 + if (!iTimerRunning)
1.3255 + {
1.3256 + iTest->LogSubTest(Animation4);
1.3257 + ret=MultipleL();
1.3258 + iTimerRunning = ETrue;
1.3259 + }
1.3260 + if (iPackagingFinished)
1.3261 + {
1.3262 + iPackagingFinished = EFalse;
1.3263 + iTimerRunning = EFalse;
1.3264 + }
1.3265 + break;
1.3266 +/**
1.3267 +@SYMTestCaseID GRAPHICS-WSERV-0162
1.3268 +
1.3269 +@SYMDEF DEF081259
1.3270 +
1.3271 +@SYMTestCaseDesc Direct screen access out of memory test
1.3272 +
1.3273 +@SYMTestPriority High
1.3274 +
1.3275 +@SYMTestStatus Implemented
1.3276 +
1.3277 +@SYMTestActions Direct screen access out of memory test
1.3278 +
1.3279 +@SYMTestExpectedResults The out of memory error is handled correctly
1.3280 +*/
1.3281 + case 10:
1.3282 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0162"));
1.3283 + iTest->LogSubTest(Animation5);
1.3284 + ret=FailCodesL();
1.3285 + iState++;
1.3286 + break;
1.3287 +/**
1.3288 +@SYMTestCaseID GRAPHICS-WSERV-0163
1.3289 +
1.3290 +@SYMDEF DEF081259
1.3291 +
1.3292 +@SYMTestCaseDesc Two animations, one scrolling text
1.3293 +
1.3294 +@SYMTestPriority High
1.3295 +
1.3296 +@SYMTestStatus Implemented
1.3297 +
1.3298 +@SYMTestActions Create two animations, one which scrolls text across the screen and
1.3299 + run them to completion
1.3300 +
1.3301 +@SYMTestExpectedResults The animations run without error
1.3302 +*/
1.3303 + case 11:
1.3304 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0163"));
1.3305 + if (!iTimerRunning)
1.3306 + {
1.3307 + iTest->LogSubTest(Animation6);
1.3308 + ret=ScrolingText1L();
1.3309 + iTimerRunning = ETrue;
1.3310 + }
1.3311 + if (iPackagingFinished)
1.3312 + {
1.3313 + iPackagingFinished = EFalse;
1.3314 + iTimerRunning = EFalse;
1.3315 + }
1.3316 + break;
1.3317 +/**
1.3318 +@SYMTestCaseID GRAPHICS-WSERV-0164
1.3319 +
1.3320 +@SYMDEF DEF081259
1.3321 +
1.3322 +@SYMTestCaseDesc Test direct screen access panic messages
1.3323 +
1.3324 +@SYMTestPriority High
1.3325 +
1.3326 +@SYMTestStatus Implemented
1.3327 +
1.3328 +@SYMTestActions Call the direct screen access panic's and check they are handled
1.3329 + correctly
1.3330 +
1.3331 +@SYMTestExpectedResults The panic's are handled correctly
1.3332 +*/
1.3333 + case 12:
1.3334 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0164"));
1.3335 + iTest->LogSubTest(Animation7);
1.3336 + ret=RClassL();
1.3337 + iTest->CloseAllPanicWindows();
1.3338 + iState++;
1.3339 + break;
1.3340 +/**
1.3341 +@SYMTestCaseID GRAPHICS-WSERV-0165
1.3342 +
1.3343 +@SYMDEF DEF081259
1.3344 +
1.3345 +@SYMTestCaseDesc Two animations, one scrolling text
1.3346 +
1.3347 +@SYMTestPriority High
1.3348 +
1.3349 +@SYMTestStatus Implemented
1.3350 +
1.3351 +@SYMTestActions Create two animations, one which scrolls text across the screen and
1.3352 + run them to completion
1.3353 +
1.3354 +@SYMTestExpectedResults The animations run without error
1.3355 +*/
1.3356 + case 13:
1.3357 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0165"));
1.3358 + if (!iTimerRunning)
1.3359 + {
1.3360 + iTest->LogSubTest(Animation8);
1.3361 + ret=ScrolingText2L();
1.3362 + iTimerRunning = ETrue;
1.3363 + }
1.3364 + if (iPackagingFinished)
1.3365 + {
1.3366 + iPackagingFinished = EFalse;
1.3367 + iTimerRunning = EFalse;
1.3368 + }
1.3369 + break;
1.3370 +/**
1.3371 +@SYMTestCaseID GRAPHICS-WSERV-0166
1.3372 +
1.3373 +@SYMDEF DEF081259
1.3374 +
1.3375 +@SYMTestCaseDesc Two animations, one scrolling text. Change the screen mode an run.
1.3376 +
1.3377 +@SYMTestPriority High
1.3378 +
1.3379 +@SYMTestStatus Implemented
1.3380 +
1.3381 +@SYMTestActions Create two animations, one which scrolls text across the screen and
1.3382 + run them to completion while changing the screen mode
1.3383 +
1.3384 +@SYMTestExpectedResults The animations run without error
1.3385 +*/
1.3386 +
1.3387 + case 14:
1.3388 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0166"));
1.3389 + if (!iTimerRunning)
1.3390 + {
1.3391 + iTest->LogSubTest(Animation9);
1.3392 + ret=ScrolingText3L();
1.3393 + if (ret == ENext)
1.3394 + iPackagingFinished = ETrue;
1.3395 + else
1.3396 + iTimerRunning = ETrue;
1.3397 + }
1.3398 + if (iPackagingFinished)
1.3399 + {
1.3400 + iPackagingFinished = EFalse;
1.3401 + iTimerRunning = EFalse;
1.3402 + FlipInterval = 0; // Stops the tests (erroneously) flipping for the rest of the run
1.3403 + }
1.3404 + break;
1.3405 +/**
1.3406 +@SYMTestCaseID GRAPHICS-WSERV-0167
1.3407 +
1.3408 +@SYMDEF DEF081259
1.3409 +
1.3410 +@SYMTestCaseDesc Start an animation then kill it
1.3411 +
1.3412 +@SYMTestPriority High
1.3413 +
1.3414 +@SYMTestStatus Implemented
1.3415 +
1.3416 +@SYMTestActions Start an animation running then kill it. Check the animation dies correctly
1.3417 +
1.3418 +@SYMTestExpectedResults The animations dies correctly
1.3419 +*/
1.3420 + case 15:
1.3421 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0167"));
1.3422 + if (!iTimerRunning)
1.3423 + {
1.3424 + iTest->LogSubTest(Animation11);
1.3425 + ret=KillAnimationL();
1.3426 + iTimerRunning = ETrue;
1.3427 + }
1.3428 + if (iPackagingFinished)
1.3429 + {
1.3430 + iPackagingFinished = EFalse;
1.3431 + iTimerRunning = EFalse;
1.3432 + }
1.3433 + break;
1.3434 + case 16:
1.3435 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0167"));
1.3436 + iTest->LogSubTest(Animation10); //This test is designed to be left running for at least several hours
1.3437 + //ret=ScrolingText4L();
1.3438 + iState++;
1.3439 + break;
1.3440 +/**
1.3441 +@SYMTestCaseID GRAPHICS-WSERV-0168
1.3442 +
1.3443 +@SYMDEF DEF081259
1.3444 +
1.3445 +@SYMTestCaseDesc CBugFixColorAnimation
1.3446 +
1.3447 +@SYMTestPriority High
1.3448 +
1.3449 +@SYMTestStatus Implemented
1.3450 +
1.3451 +@SYMTestActions This class is used for reproducing a defect found on 6.1: KAA-5J3BLW "Unnecessary Wserv's DSA abort".
1.3452 + The problem was that a direct screen access client was getting an unnecessary abort notification
1.3453 + when a new window (or window group) was created but not visible.
1.3454 + This class will simulate the direct screen access client and it will check whether the first DSA abort
1.3455 + is not caused by just creating a window.
1.3456 +
1.3457 +@SYMTestExpectedResults Abort is not caused when creatung a window
1.3458 +*/
1.3459 + case 17:
1.3460 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0168"));
1.3461 + if (!iTimerRunning)
1.3462 + {
1.3463 + iTest->LogSubTest(Animation12);
1.3464 + ret=DefectFix_KAA_5J3BLW_L();
1.3465 + iTimerRunning = ETrue;
1.3466 + }
1.3467 + if (iPackagingFinished)
1.3468 + {
1.3469 + iPackagingFinished = EFalse;
1.3470 + iTimerRunning = EFalse;
1.3471 + }
1.3472 + break;
1.3473 +/**
1.3474 +@SYMTestCaseID GRAPHICS-WSERV-0169
1.3475 +
1.3476 +@SYMDEF DEF081259
1.3477 +
1.3478 +@SYMTestCaseDesc Direct screen access in screen modes with non-zero screen mode origin
1.3479 +
1.3480 +@SYMTestPriority High
1.3481 +
1.3482 +@SYMTestStatus Implemented
1.3483 +
1.3484 +@SYMTestActions Tests that DSA works correctly in screen modes with non-zero screen mode origin
1.3485 +
1.3486 +@SYMTestExpectedResults The DSA works correctly
1.3487 +*/
1.3488 + case 18:
1.3489 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0169"));
1.3490 + if (!CheckNonZeroOriginsSupportedOrNot())
1.3491 + {
1.3492 + INFO_PRINTF1(_L("Non Zero Origins not supported\n"));
1.3493 + iState++;
1.3494 + }
1.3495 + else
1.3496 + {
1.3497 + if (!iTimerRunning)
1.3498 + {
1.3499 + iTest->LogSubTest(Animation13);
1.3500 + ret=DSAWithScreenModeOffset1L();
1.3501 + iTimerRunning = ETrue;
1.3502 + }
1.3503 + if (iPackagingFinished)
1.3504 + {
1.3505 + iPackagingFinished = EFalse;
1.3506 + iTimerRunning = EFalse;
1.3507 + }
1.3508 + }
1.3509 + break;
1.3510 +/**
1.3511 +@SYMTestCaseID GRAPHICS-WSERV-0170
1.3512 +
1.3513 +@SYMDEF DEF081259
1.3514 +
1.3515 +@SYMTestCaseDesc Direct screen access in screen modes with non-zero screen mode origin
1.3516 +
1.3517 +@SYMTestPriority High
1.3518 +
1.3519 +@SYMTestStatus Implemented
1.3520 +
1.3521 +@SYMTestActions Tests that DSA works correctly in screen modes with non-zero screen mode origin and different rotations
1.3522 +
1.3523 +@SYMTestExpectedResults The DSA works correctly
1.3524 +*/
1.3525 + case 19:
1.3526 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0170"));
1.3527 + if (!CheckNonZeroOriginsSupportedOrNot())
1.3528 + {
1.3529 + INFO_PRINTF1(_L("Non Zero Origins not supported\n"));
1.3530 + iState++;
1.3531 + }
1.3532 + else
1.3533 + {
1.3534 + if (!iTimerRunning)
1.3535 + {
1.3536 + iTest->LogSubTest(Animation14);
1.3537 + ret=DSAWithScreenModeOffset2L();
1.3538 + iTimerRunning = ETrue;
1.3539 + }
1.3540 + if (iPackagingFinished)
1.3541 + {
1.3542 + iPackagingFinished = EFalse;
1.3543 + iTimerRunning = EFalse;
1.3544 + }
1.3545 + }
1.3546 + break;
1.3547 +/**
1.3548 +@SYMTestCaseID GRAPHICS-WSERV-0171
1.3549 +
1.3550 +@SYMDEF DEF081259
1.3551 +
1.3552 +@SYMTestCaseDesc Window absolute position
1.3553 +
1.3554 +@SYMTestPriority High
1.3555 +
1.3556 +@SYMTestStatus Implemented
1.3557 +
1.3558 +@SYMTestActions Tests the new function of getting the window's absolute position
1.3559 +
1.3560 +@SYMTestExpectedResults Function works correctly
1.3561 +*/
1.3562 + case 20:
1.3563 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0171"));
1.3564 + if (!iTimerRunning)
1.3565 + {
1.3566 + iTest->LogSubTest(Animation15);
1.3567 + ret=WindowPoistionRelativeToScreenL();
1.3568 + iTimerRunning = ETrue;
1.3569 + }
1.3570 + if (iPackagingFinished)
1.3571 + {
1.3572 + iPackagingFinished = EFalse;
1.3573 + iTimerRunning = EFalse;
1.3574 + }
1.3575 + break;
1.3576 +/**
1.3577 +@SYMTestCaseID GRAPHICS-WSERV-0172
1.3578 +
1.3579 +@SYMDEF DEF081259
1.3580 +
1.3581 +@SYMTestCaseDesc Test direct screen access restart
1.3582 +
1.3583 +@SYMTestPriority High
1.3584 +
1.3585 +@SYMTestStatus Implemented
1.3586 +
1.3587 +@SYMTestActions Creates a DSA for screen mode 0. After DSA has displayed 2 or 3 frames screen mode
1.3588 + scale is changed with a timer. The DSA aborts and restarts once again
1.3589 + and completes itself in different screen mode.
1.3590 +
1.3591 +@SYMTestExpectedResults DSA restarts and completes correctly
1.3592 +*/
1.3593 + case 21:
1.3594 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0172"));
1.3595 + if (iIsScalingSupported)
1.3596 + {
1.3597 + if (!iTimerRunning)
1.3598 + {
1.3599 + iTest->LogSubTest(Animation16);
1.3600 + ret=ScreenModeTestForScalingL();
1.3601 + iTimerRunning = ETrue;
1.3602 + }
1.3603 + if (iPackagingFinished)
1.3604 + {
1.3605 + iPackagingFinished = EFalse;
1.3606 + iTimerRunning = EFalse;
1.3607 + }
1.3608 + break;
1.3609 + }
1.3610 + iState++;
1.3611 + break;
1.3612 +/**
1.3613 +@SYMTestCaseID GRAPHICS-WSERV-0173
1.3614 +
1.3615 +@SYMDEF DEF081259
1.3616 +
1.3617 +@SYMTestCaseDesc Test direct screen access scaling
1.3618 +
1.3619 +@SYMTestPriority High
1.3620 +
1.3621 +@SYMTestStatus Implemented
1.3622 +
1.3623 +@SYMTestActions Creates a DSA for screen mode 0, tests API AbsoluteWindowPosition()
1.3624 + Then sets screen mode to last(test) screen mode, here it does the same thing as
1.3625 + done for screenmode 0, but with diffrerent scale (2,2) (2,3) (3,2) (3,3) and
1.3626 + with different origin (20,30) (30,20) (20,20).
1.3627 + Lastly copy back the test screen mode values.
1.3628 +
1.3629 +@SYMTestExpectedResults DSA scales correctly
1.3630 +*/
1.3631 + case 22:
1.3632 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0173"));
1.3633 + if (iIsScalingSupported)
1.3634 + {
1.3635 + if (!iTimerRunning)
1.3636 + {
1.3637 + iTest->LogSubTest(Animation17);
1.3638 + ret=ScreenModeScalingTestL();
1.3639 + iTimerRunning = ETrue;
1.3640 + }
1.3641 + if (iPackagingFinished)
1.3642 + {
1.3643 + iPackagingFinished = EFalse;
1.3644 + iTimerRunning = EFalse;
1.3645 + }
1.3646 + break;
1.3647 + }
1.3648 + iState++;
1.3649 + break;
1.3650 +/**
1.3651 +@SYMTestCaseID GRAPHICS-WSERV-0174
1.3652 +
1.3653 +@SYMDEF DEF081259
1.3654 +
1.3655 +@SYMTestCaseDesc Test multiple direct screen access elements on the same window
1.3656 +
1.3657 +@SYMTestPriority High
1.3658 +
1.3659 +@SYMTestStatus Implemented
1.3660 +
1.3661 +@SYMTestActions Create a number of direct screen access elements on the same window and
1.3662 + check that they work correctly
1.3663 +
1.3664 +@SYMTestExpectedResults DSAs work correctly
1.3665 +*/
1.3666 + case 23:
1.3667 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0174"));
1.3668 + if (iIsScalingSupported)
1.3669 + {
1.3670 + if (!iTimerRunning)
1.3671 + {
1.3672 + iTest->LogSubTest(Animation18);
1.3673 + ret=MultipleDSAsOnSameWindowL();
1.3674 + iTimerRunning = ETrue;
1.3675 + }
1.3676 + if (iPackagingFinished)
1.3677 + {
1.3678 + iPackagingFinished = EFalse;
1.3679 + iTimerRunning = EFalse;
1.3680 + }
1.3681 + break;
1.3682 + }
1.3683 + iState++;
1.3684 + break;
1.3685 +/**
1.3686 +@SYMTestCaseID GRAPHICS-WSERV-0175
1.3687 +
1.3688 +@SYMDEF DEF081259
1.3689 +
1.3690 +@SYMTestCaseDesc Create a temporary deadlock on a DSA and resolve it
1.3691 +
1.3692 +@SYMTestPriority High
1.3693 +
1.3694 +@SYMTestStatus Implemented
1.3695 +
1.3696 +@SYMTestActions Resolve a temporary deadlock on a DSA
1.3697 +
1.3698 +@SYMTestExpectedResults DSA resolves the deadlock
1.3699 +*/
1.3700 + case 24:
1.3701 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0175"));
1.3702 + if (!iTimerRunning)
1.3703 + {
1.3704 + iTest->LogSubTest(Animation19);
1.3705 + ret=TemporaryDeadlockL();//for INC072887 - removing a 0.5s delay in wserv.
1.3706 + iTimerRunning = ETrue;
1.3707 + }
1.3708 + if (iPackagingFinished)
1.3709 + {
1.3710 + iPackagingFinished = EFalse;
1.3711 + iTimerRunning = EFalse;
1.3712 + iState++;
1.3713 + }
1.3714 + break;
1.3715 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
1.3716 + case 25:
1.3717 +/**
1.3718 +@SYMTestCaseID GRAPHICS-WSERV-0533
1.3719 +*/
1.3720 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0533"));
1.3721 + if (!iTimerRunning)
1.3722 + {
1.3723 + FlipInterval=0;
1.3724 + iTest->LogSubTest(Animation25);
1.3725 + //Opens a window in front of a region tracking only DSA
1.3726 + ret=RegionTrackingOnlyNotificationsL(KRegionTrackingOnlyDsaWaitingForAbortSignal);
1.3727 + iTimerRunning = ETrue;
1.3728 + }
1.3729 + if (iPackagingFinished)
1.3730 + {
1.3731 + iPackagingFinished = EFalse;
1.3732 + iTimerRunning = EFalse;
1.3733 + }
1.3734 + break;
1.3735 + case 26:
1.3736 +/**
1.3737 +@SYMTestCaseID GRAPHICS-WSERV-0534
1.3738 +*/
1.3739 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0534"));
1.3740 + if (!iTimerRunning)
1.3741 + {
1.3742 + iTest->LogSubTest(Animation26);
1.3743 + //Opens a window behind a region tracking only DSA
1.3744 + ret=RegionTrackingOnlyNotificationsL(KRegionTrackingOnlyDsaNoAbortSignal);
1.3745 + iTimerRunning = ETrue;
1.3746 + }
1.3747 + if (iPackagingFinished)
1.3748 + {
1.3749 + iPackagingFinished = EFalse;
1.3750 + iTimerRunning = EFalse;
1.3751 + }
1.3752 + break;
1.3753 + case 27:
1.3754 +/**
1.3755 +@SYMTestCaseID GRAPHICS-WSERV-0535
1.3756 +*/
1.3757 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0535"));
1.3758 + if (!iTimerRunning)
1.3759 + {
1.3760 + iTest->LogSubTest(Animation27);
1.3761 + ret=MixDsaAndRegionTrackingOnlyL(KRegionTrackingOnlyDsaExistLast);
1.3762 + iTimerRunning = ETrue;
1.3763 + }
1.3764 + if (iPackagingFinished)
1.3765 + {
1.3766 + iPackagingFinished = EFalse;
1.3767 + iTimerRunning = EFalse;
1.3768 + }
1.3769 + break;
1.3770 + case 28:
1.3771 +/**
1.3772 +@SYMTestCaseID GRAPHICS-WSERV-0536
1.3773 +*/
1.3774 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0536"));
1.3775 + if (!iTimerRunning)
1.3776 + {
1.3777 + iTest->LogSubTest(Animation28);
1.3778 + ret=MixDsaAndRegionTrackingOnlyL(KDrawingDsaExistLast);
1.3779 + iTimerRunning = ETrue;
1.3780 + }
1.3781 + if (iPackagingFinished)
1.3782 + {
1.3783 + iPackagingFinished = EFalse;
1.3784 + iTimerRunning = EFalse;
1.3785 + }
1.3786 + break;
1.3787 + case 29:
1.3788 +/**
1.3789 +@SYMTestCaseID GRAPHICS-WSERV-0537
1.3790 +*/
1.3791 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0537"));
1.3792 + if (!iTimerRunning)
1.3793 + {
1.3794 + iTest->LogSubTest(Animation29);
1.3795 + ret=TryDifferentSupportedModesL();
1.3796 + iTimerRunning = ETrue;
1.3797 + }
1.3798 + if (iPackagingFinished)
1.3799 + {
1.3800 + iPackagingFinished = EFalse;
1.3801 + iTimerRunning = EFalse;
1.3802 + }
1.3803 + break;
1.3804 +#else
1.3805 +//NON NGA negative test for RegionTrackingOnly DSA
1.3806 + case 25:
1.3807 +/**
1.3808 +@SYMTestCaseID GRAPHICS-WSERV-0575
1.3809 +*/
1.3810 + ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0575"));
1.3811 + if (!iTimerRunning)
1.3812 + {
1.3813 + FlipInterval=0;
1.3814 + iTest->LogSubTest(Animation25);
1.3815 + CColorAnimation* temp = NULL;
1.3816 + //Attempt to create a RegionTrackingOnly DSA in non NGA code
1.3817 + TRAPD(err,temp = CColorAnimation::NewL(iTest->iScreenNumber,1,*this,*TheClient->iGroup,TRect(10,10,630,230),ETrue,KRegionTrackingOnly));
1.3818 + if(err!=KErrNotSupported)
1.3819 + {
1.3820 + _LIT(KCTDirectNonNgaError,"Attempt to creat a RegionTrackingOnly DSA did not return KErrNotSupported on non-NGA");
1.3821 + LOG_MESSAGE(KCTDirectNonNgaError);
1.3822 + if(temp)
1.3823 + {
1.3824 + delete temp;
1.3825 + }
1.3826 + Fail();
1.3827 + }
1.3828 + else
1.3829 + {
1.3830 + _LIT(KCTDirectNonNgaSuccess,"RegionTrackingOnly DSA not supported on non-NGA as expected");
1.3831 + LOG_MESSAGE(KCTDirectNonNgaSuccess);
1.3832 + }
1.3833 + iState++;
1.3834 + }
1.3835 + break;
1.3836 +#endif
1.3837 + default:
1.3838 + ((CTDirectStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
1.3839 + ((CTDirectStep*)iStep)->CloseTMSGraphicsStep();
1.3840 + TestComplete();
1.3841 + break;
1.3842 + }
1.3843 + ((CTDirectStep*)iStep)->RecordTestResultL();
1.3844 + }
1.3845 +
1.3846 +CRegionTrackingOnly* CRegionTrackingOnly::NewL(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack,CTWindowGroup& aParent,TRect aExtent,TBool aStart,TBool aOpenWindowInFrontDsa)
1.3847 + {
1.3848 + CRegionTrackingOnly* self=new(ELeave) CRegionTrackingOnly(aScreenNumber, aId,aCallBack);
1.3849 + CleanupStack::PushL(self);
1.3850 + self->ConstructL(aParent,aExtent,aOpenWindowInFrontDsa);
1.3851 + if (aStart)
1.3852 + {
1.3853 + self->StartL();
1.3854 + self->Started();
1.3855 + }
1.3856 + CleanupStack::Pop(self);
1.3857 + return self;
1.3858 + }
1.3859 +
1.3860 +CRegionTrackingOnly::CRegionTrackingOnly(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack)
1.3861 + : CColorAnimation(aScreenNumber, aId, aCallBack)
1.3862 + {
1.3863 + iThreadParam.iScreenNumber = aScreenNumber;
1.3864 + }
1.3865 +
1.3866 +void CRegionTrackingOnly::ConstructL(CTWindowGroup& aParent,TRect aExtent,TBool aOpenWindowInFrontDsa)
1.3867 + {
1.3868 + iExpectedToAbort = aOpenWindowInFrontDsa;
1.3869 + CColorAnimation::ConstructL(aParent, aExtent, KRegionTrackingOnly);
1.3870 + _LIT(ThreadName,"Create new Window");
1.3871 +
1.3872 + TInt error=iSem.CreateGlobal(KSem_DefectFix_KAA_5J3BLW_Name, 0);
1.3873 + if (error==KErrNone)
1.3874 + {
1.3875 + iAnimRect=aExtent;
1.3876 + iThreadParam.iRect = iAnimRect;
1.3877 + iThreadParam.iIsInFront = aOpenWindowInFrontDsa;
1.3878 + TThreadStartUp function=TThreadStartUp(CreateNewWindowGroup, &iThreadParam);
1.3879 + TRequestStatus status;
1.3880 + iThread=CProcess::NewThreadRendezvousL(ThreadName,&function,status);
1.3881 + User::WaitForRequest(status);
1.3882 + if (status != KErrNone)
1.3883 + {
1.3884 + RDebug::Printf("the request status is returned to be non KErrNone: %d", status.Int());
1.3885 + TestFailed(this);
1.3886 + }
1.3887 + }
1.3888 + else
1.3889 + {
1.3890 + TestFailed(this);
1.3891 + }
1.3892 + }
1.3893 +
1.3894 +TBool CColorAnimation::TestGcAndScreenDeviceValues()
1.3895 + {
1.3896 + TBool succeeded = ETrue;
1.3897 + _LIT(KErrorLogGraphicContext,"GraphicsContext not NULL when using the region tracking feature only");
1.3898 + _LIT(KErrorLogScreenDevice,"ScreenDevice not NULL when using the region tracking feature only");
1.3899 + if(iRegionTrackingOnly && iDrawer->Gc() != NULL)
1.3900 + {
1.3901 + CallBack().Log((TText8*)__FILE__,__LINE__, ESevrErr,KErrorLogGraphicContext);
1.3902 + succeeded = EFalse;
1.3903 + }
1.3904 + if(iRegionTrackingOnly && iDrawer->ScreenDevice() != NULL)
1.3905 + {
1.3906 + CallBack().Log((TText8*)__FILE__,__LINE__, ESevrErr,KErrorLogScreenDevice);
1.3907 + succeeded = EFalse;
1.3908 + }
1.3909 + return succeeded;
1.3910 + }
1.3911 +
1.3912 +void CRegionTrackingOnly::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/)
1.3913 + {
1.3914 + Stop();
1.3915 + }
1.3916 +
1.3917 +void CRegionTrackingOnly::Restart(RDirectScreenAccess::TTerminationReasons/* aReason*/)
1.3918 + {
1.3919 + if(!TestGcAndScreenDeviceValues())
1.3920 + {
1.3921 + CallBack().Fail();
1.3922 + }
1.3923 + if (iExpectedToAbort)
1.3924 + {
1.3925 + _LIT(KExpected,"DSA got an abort signal as expected");
1.3926 + CallBack().Log((TText8*)__FILE__,__LINE__,ESevrInfo,KExpected);
1.3927 + }
1.3928 + else
1.3929 + {
1.3930 + _LIT(KError,"DSA got an abort signal even though the window was opened behind it");
1.3931 + CallBack().Log((TText8*)__FILE__,__LINE__,ESevrErr,KError);
1.3932 + CallBack().Fail();
1.3933 + }
1.3934 + FinishTest();
1.3935 + }
1.3936 +
1.3937 +CRegionTrackingOnly::~CRegionTrackingOnly()
1.3938 + {
1.3939 + iSem.Close();
1.3940 + if(iThread)
1.3941 + {
1.3942 + TRequestStatus status;
1.3943 + iThread->Logon(status);
1.3944 + if (iThread->StillAlive())
1.3945 + {
1.3946 + iThread->Terminate(KErrNone);
1.3947 + User::WaitForRequest(status);
1.3948 + }
1.3949 + delete iThread;
1.3950 + }
1.3951 + }
1.3952 +
1.3953 +__WS_CONSTRUCT_STEP__(Direct)