First public contribution.
1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Test Direct Screen Access
22 static TTimeIntervalMicroSeconds32 MoveInterval;
23 static TTimeIntervalMicroSeconds32 ModeInterval;
24 static TTimeIntervalMicroSeconds32 FlipInterval;
25 static TBool ImmediateModeSwitch;
27 LOCAL_D TLogMessageText LogMessageText;
30 _LIT(SemControl,"Control");
31 _LIT(SemNextOp,"TrigerWindow");
32 _LIT(FontName,"DejaVu Serif Condensed");
33 _LIT(QueueControl,"Queue");
35 LOCAL_D TSize FullScreenModeSize;
36 LOCAL_D TInt Copy2ndHalfOfScreen;
38 const TBool KRegionTrackingOnly = ETrue;
39 const TBool KDrawingDsa = EFalse;
41 const TInt KPanicTestOrdinalPriority=65536;
42 const TInt KMainTestOrdinalPriority=65535;
43 const TInt KMainTestBaseWindow=KMainTestOrdinalPriority/3;
44 const TInt KAboveMainTestBaseWindow = KMainTestBaseWindow +1;
46 const TInt KMaxIdlingTime = 25; //used for RegionTrackingOnly DSAs, it represents the maximum number of times the Idling function can be called
47 //Ids of two RegionTrackingOnly DSAs
48 const TInt KRegionTrackingOnlyDsaWaitingForAbortSignal = 25;
49 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
50 const TInt KRegionTrackingOnlyDsaNoAbortSignal = 26;
53 const TInt KRegionTrackingOnlyDsaExistLast = 0;
54 const TInt KDrawingDsaExistLast = 1;
55 const TInt KShortDelay = 5000;
56 #define SHORT_DELAY TTimeIntervalMicroSeconds32(KShortDelay)
58 _LIT(KSem_DefectFix_KAA_5J3BLW_Name, "DefectFix_KAA_5J3BLW");
60 GLDEF_C TInt ProcDirect(TAny *aScreenNumber)
62 CTrapCleanup* cleanupStack = NULL;
63 User::LeaveIfNull(cleanupStack = CTrapCleanup::New());
66 _LIT(KWindow,"Window Toggle Vis=");
67 _LIT(KParams,"%d, Pos=(%d,%d,%d,%d), Col=%d");
69 RSemaphore controlSem;
71 User::LeaveIfError(controlSem.OpenGlobal(SemControl));
72 User::LeaveIfError(windowSem.OpenGlobal(SemNextOp));
74 User::LeaveIfError(ws.Connect());
76 // assign to the correct screen
77 CWsScreenDevice* screen = NULL;
79 TRAP(err, screen = new (ELeave) CWsScreenDevice(ws));
83 if ((err=screen->Construct((TInt)aScreenNumber))!=KErrNone)
89 RWindowGroup group(ws);
90 User::LeaveIfError(group.Construct(898));
91 group.EnableReceiptOfFocus(EFalse);
92 group.SetOrdinalPosition(0,KAboveMainTestBaseWindow );
93 RBlankWindow window(ws);
94 User::LeaveIfError(window.Construct(group,899));
96 window.SetVisible(vis);
102 TInt open = queue.OpenGlobal(QueueControl);
104 while (queue.Receive(&data,sizeof(TInt)) != KErrNone)
109 window.SetColor(TRgb::Gray4(WinCol));
110 window.SetExtent(WinExt.iTl,WinExt.Size());
112 LogMessageText.Copy(KWindow);
113 LogMessageText.AppendFormat(KParams,vis,WinExt.iTl.iX,WinExt.iTl.iY,WinExt.iBr.iX,WinExt.iBr.iY,WinCol);
114 ws.LogMessage(LogMessageText);
117 window.SetVisible(vis);
136 /*CDirectScreenAccessOld*/
138 CDirectScreenAccessOld* CDirectScreenAccessOld::NewL(RWsSession& aWs,MAbortDirectScreenAccess& aAborter)
140 CDirectScreenAccessOld* self=new(ELeave) CDirectScreenAccessOld(aWs,aAborter);
141 CleanupStack::PushL(self);
143 CleanupStack::Pop(self);
147 CDirectScreenAccessOld::~CDirectScreenAccessOld()
149 __ASSERT_ALWAYS(!iAborting,AutoPanic(EAutoPanicDirect));
151 iDirectAccess.Close();
154 void CDirectScreenAccessOld::ConstructL()
156 User::LeaveIfError(iDirectAccess.Construct());
157 CActiveScheduler::Add(this);
160 TInt CDirectScreenAccessOld::Request(RRegion*& aRegion, RWindowBase& aWindow)
162 TInt ret=iDirectAccess.Request(aRegion,iStatus,aWindow);
168 void CDirectScreenAccessOld::DoCancel()
170 iDirectAccess.Cancel();
173 void CDirectScreenAccessOld::RunL()
176 iAborter.AbortNow(REINTERPRET_CAST(RDirectScreenAccess::TTerminationReasons&,iStatus));
178 iDirectAccess.Completed();
184 CColorAnimation* CColorAnimation::NewL(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack,CTWinBase& aParent,TRect aExtent,TBool aStart,TBool aRegionTrackingOnly)
186 CColorAnimation* self=new(ELeave) CColorAnimation(aScreenNumber,aId,aCallBack);
187 CleanupStack::PushL(self);
188 self->ConstructL(aParent,aExtent,aRegionTrackingOnly);
191 CleanupStack::Pop(self);
195 CColorAnimation::~CColorAnimation()
204 void CColorAnimation::ConstructL(CTWinBase& aParent,TRect aExtent,TBool aRegionTrackingOnly,TInt aTypeWindow/*=0*/,TInt aSingleWinForMultipleDSA/*=0*/)
206 iRegionTrackingOnly = aRegionTrackingOnly;
207 // Make sure that the top right corner is not 0,0
208 if (aTypeWindow && aExtent.iTl==TPoint(0,0))
210 aExtent.iTl=TPoint(10,10);
212 RWindowBase* win=NULL;
213 iSingleWinForMultipleDSA=aSingleWinForMultipleDSA;
214 if (aSingleWinForMultipleDSA)
216 win=iCallBack.iCallBackWin->BaseWin();
217 iWinSize=TheClient->iScreen->SizeInPixels();
221 iWindow=new(ELeave) CTBlankWindow();
222 iWinSize=aExtent.Size();
223 iWindow->ConstructExtLD(aParent,aExtent.iTl,iWinSize);
224 ChangeModeL(iCallBack.DisplayMode(iId));
225 win=iWindow->BaseWin();
226 win->SetShadowDisabled(ETrue);
231 if(iRegionTrackingOnly)
233 iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,*win,*this,iRegionTrackingOnly);
237 //needed for the non NGA case: only the old API is allowed to be used
238 iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,*win,*this);
243 TRect childRect(0,0,100,100);
248 // Create a Blank Window smaller than it's parent and its top left corner within the parent area and withn the screen area
249 childRect.Shrink(10,10);
254 // Create a Blank Window with its top left corner being left side of its parent
255 childRect.Move(-10,0);
259 iWindow2=new(ELeave) CTBlankWindow();
260 iWindow2->ConstructExtLD(*iWindow,childRect.iTl,childRect.Size());
261 // Finish constructing the window
262 RWindowBase& win=*iWindow2->BaseWin();
263 win.SetShadowDisabled(ETrue);
265 // Create the Direct Screen Access object
266 if(iRegionTrackingOnly)
268 iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,win,*this,iRegionTrackingOnly);
272 //needed for the non NGA case: only the old API is allowed to be used
273 iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,win,*this);
279 // This clause is needed to prevent sub-test 9 from taking an
280 // exceedingly large amount of time. The CColorAnimation with iId 4 is
281 // the one which controls when the test stops. This raise in
282 // priority compared to the other CColorAnimations, allows it's
283 // callbacks to get through when otherwise they would take much longer
284 // due to the volume of callbacks generated by the other
286 iTimer=CPeriodic::NewL(1);
290 iTimer=CPeriodic::NewL(0);
294 TPoint CColorAnimation::AbsoluteWindowPosition(TInt aWindowId/*=0*/)
296 if (iSingleWinForMultipleDSA)
298 return iCallBack.iCallBackWin->BaseWin()->AbsPosition();
302 // Return the absolute position of iWindow, if Color Animation is not for Position Relative to Screen test.
303 return iWindow->BaseWin()->AbsPosition();
307 // Return the absolute position of iWindow2, if it is for Position Relative to Screen test.
308 return iWindow2->BaseWin()->AbsPosition();
312 TInt CColorAnimation::DrawColorL(TAny* aAnimation)
314 STATIC_CAST(CColorAnimation*,aAnimation)->DrawColorL();
318 TInt CColorAnimation::IdlingL(TAny* aAnimation)
320 (static_cast<CColorAnimation*>(aAnimation))->IdlingL();
324 void CColorAnimation::StartL(TBool aChildWindow/*=EFalse*/)
327 TRect bounding=iDrawer->DrawingRegion()->BoundingRect();
331 window.SetRect(AbsoluteWindowPosition(1),iWinSize);
335 window.SetRect(AbsoluteWindowPosition(),iWinSize);
337 // Check that the window contains the bounding area (a bounding rect of (0,0,0,0) shouldn't fail the test)
338 if (!(window.Contains(bounding.iTl) && window.Contains(bounding.iBr-TPoint(1,1))) && bounding.Size()!=TSize(0,0))
341 // iDrawer->Cancel();
342 // iDrawer->StartL();
343 // bounding=iDrawer->DrawingRegion()->BoundingRect();
345 if(!iRegionTrackingOnly)
347 iTimer->Start(0,iCallBack.TimerInterval(iId),TCallBack(CColorAnimation::DrawColorL,this));
348 iDrawer->Gc()->SetPenStyle(CGraphicsContext::ENullPen);
349 iDrawer->Gc()->SetBrushStyle(CGraphicsContext::ESolidBrush);
353 iTimer->Start(0,iCallBack.TimerInterval(iId),TCallBack(CColorAnimation::IdlingL,this));
357 void CColorAnimation::StartOrPanic()
362 iCallBack.LogLeave(err);
367 void CColorAnimation::Stop()
373 void CColorAnimation::BringWindowToFront()
375 iWindow->WinTreeNode()->SetOrdinalPosition(0);
378 void CColorAnimation::ChangeModeL(TDisplayMode aMode)
380 User::LeaveIfError(iWindow->BaseWin()->SetRequiredDisplayMode(aMode));
384 void CColorAnimation::FinishTest()
386 iCallBack.Finished(iId);
389 inline CDirectScreenAccess* CColorAnimation::GetDrawer()
394 void CColorAnimation::DrawColorL()
397 iDrawer->Gc()->SetBrushColor(iCallBack.BrushColorL(iId,iColor,aFinished));
398 if (iSingleWinForMultipleDSA==1)
400 iDrawer->Gc()->DrawRect(iWinSize-TSize(iWinSize.iWidth/2,iWinSize.iHeight/2));
402 else if (iSingleWinForMultipleDSA==2)
404 iDrawer->Gc()->DrawRect(TRect(TPoint(iWinSize.iWidth/2,iWinSize.iHeight/2),TSize(iWinSize.iWidth/2,iWinSize.iHeight/2)));
408 iDrawer->Gc()->DrawRect(iWinSize);
410 iDrawer->ScreenDevice()->Update();
415 iWindow->SetSize(TSize(48,52));
420 iCallBack.Finished(iId);
424 void CColorAnimation::IdlingL()
427 if(iIdling == KMaxIdlingTime)
431 if (iId == KRegionTrackingOnlyDsaWaitingForAbortSignal)
433 _LIT(KErrorAbortNotReceived,"DSA didn't get an abort signal even though the window was opened in front");
434 CallBack().Log((TText8*)__FILE__,__LINE__, ESevrErr,KErrorAbortNotReceived);
437 iCallBack.Finished(iId);
441 void CColorAnimation::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/)
443 TInt slow=iCallBack.SlowStopping(iId,iCount);
447 iCallBack.Finished(iId);
452 User::After(750000); //0.75 secs
460 void CColorAnimation::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/)
464 iCallBack.FailedReStart(iId,err);
468 /*CScrollingTextDrawer*/
470 CScrollingTextDrawer* CScrollingTextDrawer::NewL(TInt aScreenNumber,CFbsScreenDevice*& aDevice,CFbsBitGc& aGc)
472 CScrollingTextDrawer* self=new(ELeave) CScrollingTextDrawer(aDevice,aGc);
473 CleanupStack::PushL(self);
474 self->ConstructL(aScreenNumber);
475 CleanupStack::Pop(self);
479 CScrollingTextDrawer::~CScrollingTextDrawer()
483 iFontDevice->ReleaseFont(iFont);
488 void CScrollingTextDrawer::ConstructL(TInt aScreenNumber)
490 iFontDevice=CFbsScreenDevice::NewL(aScreenNumber,iDevice->DisplayMode());
491 _LIT(text,"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
495 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
498 // point to correct screen
499 CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(iWs);
500 CleanupStack::PushL(screen);
501 User::LeaveIfError(screen->Construct(aScreenNumber));
502 CleanupStack::Pop(screen);
504 _LIT(KConstTextDrawer,"Constructed Text Drawer");
505 LogMessageText.Copy(KConstTextDrawer);
506 iWs.LogMessage(LogMessageText);
514 void CScrollingTextDrawer::CreateFontL()
516 TInt screenHeight=iDevice->SizeInPixels().iHeight;
517 TFontSpec fontSpec(FontName,screenHeight);
518 User::LeaveIfError(iFontDevice->GetNearestFontToDesignHeightInPixels(iFont,fontSpec));
520 TInt fontHeight=iFont->HeightInPixels();
521 iDrawRect.iTl.iY=(screenHeight-fontHeight)/2;
522 iDrawRect.iBr.iY=iDrawRect.iTl.iY+fontHeight;
523 iDrawHeight=iFont->AscentInPixels();
524 iCharWidth=iFont->CharWidthInPixels(iText[iFirstChar]);
525 iDrawRect.iBr.iX=Max(iDevice->SizeInPixels().iWidth,iDevice->SizeInPixels().iHeight);
526 iDrawRect.iTl.iX=iDrawRect.iBr.iX-iCharWidth;
529 void CScrollingTextDrawer::SetBottomOfTest(TInt aBottom)
531 if (iDrawRect.iBr.iY>aBottom)
533 iDrawRect.iTl.iY-=iDrawRect.iBr.iY-aBottom;
534 iDrawRect.iBr.iY=aBottom;
538 void CScrollingTextDrawer::Scroll()
540 iCharWidth=iFont->CharWidthInPixels(iText[iFirstChar]);
541 iDrawRect.iTl.iX-=iJump;
542 iGc->DrawText(iText.Mid(iFirstChar),iDrawRect,iDrawHeight);
544 if (iDrawRect.iTl.iX<-iCharWidth)
546 if (++iFirstChar==iText.Length())
549 iDrawRect.iTl.iX=iDevice->SizeInPixels().iWidth;
552 iDrawRect.iTl.iX+=iCharWidth;
553 iCharWidth=iFont->CharWidthInPixels(iText[iFirstChar]);
560 TInt CScrollText::DrawText(TAny* aAnimation)
562 STATIC_CAST(CScrollText*,aAnimation)->ScrollText();
566 CScrollText* CScrollText::NewL(TInt aScreenNumber,TInt aId,CTWindowGroup& aParent,TInt aScrollJump,TBool aStart/*=EFalse*/)
568 CScrollText* self=new(ELeave) CScrollText(aId,aScrollJump,aScreenNumber);
569 CleanupStack::PushL(self);
570 self->ConstructL(aParent);
573 CleanupStack::Pop(self);
577 CScrollText::~CScrollText()
587 void CScrollText::ConstructL(CTWindowGroup& aParent)
589 iWindow=new(ELeave) CTBlankWindow();
590 iWindow->ConstructL(aParent);
591 RWindowBase& win=*iWindow->BaseWin();
593 iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,win,*this);
595 iTimer=CPeriodic::NewL(0);
598 void CScrollText::StartL()
601 iDrawer->Gc()->SetBrushStyle(CGraphicsContext::ESolidBrush);
604 iTextDraw=CScrollingTextDrawer::NewL(iScreenNumber,iDrawer->ScreenDevice(),*iDrawer->Gc());
605 iTextDraw->SetScrollJump(iScrollJump);
609 void CScrollText::ContinueL()
614 void CScrollText::DoContinueL()
616 iTimer->Start(0,10000,TCallBack(CScrollText::DrawText,this));
620 TRect bounding=iDrawer->DrawingRegion()->BoundingRect();
622 _LIT(KBoundRect,"Continue Scroll Text Rect=(%d,%d,%d,%d)");
623 LogMessageText.Zero();
624 LogMessageText.AppendFormat(KBoundRect,bounding.iTl.iX,bounding.iTl.iY,bounding.iBr.iX,bounding.iBr.iY);
625 TheClient->iWs.LogMessage(LogMessageText);
628 TRect window=TRect(iWindow->BaseWin()->AbsPosition(),iWindow->Size());
629 if (!window.Contains(bounding.iTl) || !window.Contains(bounding.iBr-TPoint(1,1)))
630 AutoPanic(EAutoPanicTestFailed);
633 void CScrollText::Stop()
639 void CScrollText::ScrollText()
644 void CScrollText::AbortNow(RDirectScreenAccess::TTerminationReasons aReason)
649 if (iAbortCountDown>0)
653 if (aReason==RDirectScreenAccess::ETerminateRegion)
655 User::After(1500000); //1.5secs
661 void CScrollText::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/)
662 //This function is pure virtual and so cannot have an 'L' at the end of it's name
669 CWindowWithChild* CWindowWithChild::NewL(TInt aScreenNumber, CTWindowGroup& aParent,TBool aStart/*=EFalse*/)
671 CWindowWithChild* self=new(ELeave) CWindowWithChild(aScreenNumber);
672 CleanupStack::PushL(self);
673 self->ConstructL(aParent);
676 CleanupStack::Pop(self);
680 CWindowWithChild::~CWindowWithChild()
688 void CWindowWithChild::ConstructL(CTWindowGroup& aParent)
690 iWindow=new(ELeave) CTBlankWindow();
691 iWindow->ConstructL(aParent);
693 iChildWindow = new(ELeave) CTWin();
694 iChildWindow->ConstructWin(*iWindow);
696 iChildWindow->SetExt(TPoint(0,0), TSize(4,4));
697 RWindowBase& cwin=*iChildWindow->BaseWin();
700 RWindowBase& win=*iWindow->BaseWin();
703 iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,win,*this);
708 void CWindowWithChild::StartL()
713 void CWindowWithChild::ContinueL()
718 void CWindowWithChild::DoContinueL()
724 void CWindowWithChild::Stop()
729 void CWindowWithChild::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/)
734 void CWindowWithChild::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/)
735 //This function is pure virtual and so cannot have an 'L' at the end of it's name
740 void CWindowWithChild::PerformCoverageCalls()
742 //add coverage to commands with no/partial coverage
743 RWindow& cwin=*iChildWindow->Win();
746 cwin.SetPointerCapturePriority(priority);
747 __ASSERT_ALWAYS(cwin.GetPointerCapturePriority()==priority, User::Invariant());
748 cwin.ClaimPointerGrab(EFalse);
749 cwin.EnableBackup(0);
750 __ASSERT_ALWAYS(cwin.PrevSibling()==0, User::Invariant());
751 cwin.Invalidate(TRect(0, 0, 10, 10));
752 cwin.FadeBehind(ETrue);
754 // cover (empty) False condition in CWsWindow::SetFadeBehind
755 cwin.FadeBehind(ETrue);
761 void CWsBase::ConstructL(TInt aScreenNumber, TInt aHandle)
763 User::LeaveIfError(iWs.Connect());
764 iScrDev=new(ELeave) CWsScreenDevice(iWs);
765 User::LeaveIfError(iScrDev->Construct(aScreenNumber));
766 iGroup=RWindowGroup(iWs);
767 User::LeaveIfError(iGroup.Construct(aHandle,EFalse));
768 iGroup.SetOrdinalPosition(0,KMainTestBaseWindow);
771 void CWsBase::CreateBlankWindowL(RBlankWindow& iWin,TInt aHandle)
773 iWin=RBlankWindow(iWs);
774 User::LeaveIfError(iWin.Construct(iGroup,aHandle));
787 TInt CAnimating::StartLC(TAny* aScreenNumber)
789 CAnimating* self=new(ELeave) CAnimating();
790 CleanupStack::PushL(self);
791 self->ConstructL((TInt)aScreenNumber);
795 void CAnimating::ConstructL(TInt aScreenNumber)
797 CWsBase::ConstructL(aScreenNumber,798);
799 _LIT(KAnimate1,"Constructed CWsBase");
800 LogMessageText.Copy(KAnimate1);
801 iWs.LogMessage(LogMessageText);
804 iGroup.EnableReceiptOfFocus(EFalse);
805 CreateBlankWindowL(iWindow,799);
806 User::LeaveIfError(iWindow.SetRequiredDisplayMode(EGray16));
809 _LIT(KAnimate2,"Set up Windows");
810 LogMessageText.Copy(KAnimate2);
811 iWs.LogMessage(LogMessageText);
814 TDisplayMode displayMode=CWsBase::iScrDev->DisplayMode();
815 if (displayMode<EGray16)
817 iScrDev=CFbsScreenDevice::NewL(aScreenNumber,displayMode);
818 User::LeaveIfError(iScrDev->CreateContext(iGc));
820 _LIT(KAnimate3,"Created Screen Device");
821 LogMessageText.Copy(KAnimate3);
822 iWs.LogMessage(LogMessageText);
825 iDirect=CDirectScreenAccessOld::NewL(iWs,*this);
826 iTimer=CPeriodic::NewL(0);
827 User::LeaveIfError(iControlSem.OpenGlobal(SemControl,EOwnerThread)); //Must be thread relative, since it won't get cleaned up when the thread is killed otherwise
828 User::LeaveIfError(iControlQueue.OpenGlobal(QueueControl,EOwnerThread)); //Must be thread relative, since it won't get cleaned up when the thread is killed otherwise
831 _LIT(KAnimate5,"Created Direct, Timer and Semaphore");
832 LogMessageText.Copy(KAnimate5);
833 iWs.LogMessage(LogMessageText);
836 iScrSize=iScrDev->SizeInPixels();
837 iGc->SetPenStyle(CGraphicsContext::ENullPen);
838 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
841 _LIT(KAnimate6,"Started Animation");
842 LogMessageText.Copy(KAnimate6);
843 iWs.LogMessage(LogMessageText);
848 CAnimating::~CAnimating()
849 //This function should never actually get run in practice
854 iControlQueue.Close();
857 iDrawingRegion->Destroy();
865 void CAnimating::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/)
868 iControlSem.Signal();
870 iControlQueue.Send(&data,sizeof(TInt));
871 User::After(10000000); //10 secs
874 TInt NextColor(TAny* aAnimation)
876 STATIC_CAST(CAnimating*,aAnimation)->DrawFrame();
880 void CAnimating::DrawFrame()
882 iColor=(iColor+3)%16;
883 iGc->SetBrushColor(TRgb::Gray16(iColor));
884 iGc->DrawRect(iScrSize);
888 iControlSem.Signal();
890 iControlQueue.Send(&data,sizeof(TInt));
894 void CAnimating::StartAnimatingL()
896 iTimer->Start(0,150000,TCallBack(NextColor,this)); //0.15 secs
898 User::LeaveIfError(iDirect->Request(iDrawingRegion,iWindow));
899 iGc->SetClippingRegion(iDrawingRegion);
905 TInt CMoveWindow::StartLC(TAny* aScreenNumber)
907 CMoveWindow* self=new(ELeave) CMoveWindow();
908 CleanupStack::PushL(self);
909 self->ConstructL((TInt)aScreenNumber);
913 TInt CMoveWindow::FlipChange(TAny* aMoveWin)
915 Cast(aMoveWin)->FlipChange();
919 TInt CMoveWindow::StateChange(TAny* aMoveWin)
921 Cast(aMoveWin)->StateChange();
925 CMoveWindow::~CMoveWindow()
934 TInt MoveWin(TAny* aMoveWin)
936 STATIC_CAST(CMoveWindow*,aMoveWin)->MoveWindow();
940 void CMoveWindow::ConstructL(TInt aScreenNumber)
942 CWsBase::ConstructL(aScreenNumber,898);
943 iBounceArea=TRect(iScrDev->SizeInPixels());
944 iSize.iHeight=iBounceArea.iBr.iY/5;
945 iSize.iWidth=iBounceArea.iBr.iX/5;
946 iBounceArea.iTl.iX=iBounceArea.iBr.iX/6;
947 iBounceArea.iBr.iX=5*iBounceArea.iBr.iX/6;
948 iBounceArea.iTl.iY=iBounceArea.iBr.iY/4;
949 iBounceArea.iBr.iY=3*iBounceArea.iBr.iY/4;
952 CreateBlankWindowL(iWindow,899);
953 iWindow.SetExtent(iTl,iSize);
954 iWindow.SetShadowDisabled(ETrue);
955 iWindow.SetColor(TRgb::Gray4(2));
957 iBackUpWin=RBackedUpWindow(iWs);
958 User::LeaveIfError(iBackUpWin.Construct(iGroup,EGray4,698));
959 User::LeaveIfError(iBackUpWin.SetSizeErr(TSize(2,2)));
960 iGc=new(ELeave) CWindowGc(iScrDev);
961 User::LeaveIfError(iGc->Construct());
963 if (MoveInterval>TTimeIntervalMicroSeconds32(0))
965 if (ModeInterval>TTimeIntervalMicroSeconds32(0))
967 iStateTimer=CPeriodic::NewL(0);
968 iStateTimer->Start(ModeInterval,ModeInterval,TCallBack(CMoveWindow::StateChange,this));
970 if (FlipInterval>TTimeIntervalMicroSeconds32(0))
972 iDevice=new(ELeave) CWsScreenDevice(iWs);
973 User::LeaveIfError(iDevice->Construct(aScreenNumber));
974 iNumOfModes=iDevice->NumScreenModes();
977 iFlipTimer=CPeriodic::NewL(0);
978 iFlipTimer->Start(FlipInterval,FlipInterval,TCallBack(CMoveWindow::FlipChange,this));
984 void CMoveWindow::CreateTimerL()
986 iTimer=CPeriodic::NewL(0);
987 iTimer->Start(0,MoveInterval,TCallBack(MoveWin,this));
991 void CMoveWindow::MoveWindow()
993 if (--iStateCountDown>=0)
995 if (iStateCountDown==2)
999 TPoint iBr=iTl+iSize;
1001 if ((iDelta.iHeight<0 && iTl.iY<=iBounceArea.iTl.iY) || (iDelta.iHeight>0 && iBr.iY>=iBounceArea.iBr.iY))
1003 iDelta.iHeight=-iDelta.iHeight;
1004 iDeltaSize.iWidth=2;
1006 if ((iDelta.iWidth<0 && iTl.iX<=iBounceArea.iTl.iX) || (iDelta.iWidth>0 && iBr.iX>=iBounceArea.iBr.iX))
1008 iDelta.iWidth=-iDelta.iWidth;
1009 if (iDeltaSize.iWidth==0)
1010 iDeltaSize.iHeight=2;
1012 iDeltaSize.iWidth=0;
1016 iWindow.SetExtent(iTl,iSize);
1020 void CMoveWindow::StateChange()
1022 if (ImmediateModeSwitch>1)
1024 if (MoveInterval>TTimeIntervalMicroSeconds32(0) && iTimer==NULL)
1026 TRAPD(err,CreateTimerL());
1028 ImmediateModeSwitch=ETrue;
1031 if (ImmediateModeSwitch || MoveInterval==TTimeIntervalMicroSeconds32(0))
1032 ToggleDisplayMode();
1035 if (iStateCountDown<-8)
1040 void CMoveWindow::ToggleDisplayMode()
1042 if(iDisplayMode==EColor16MU)
1044 return; //Test probably doesn't work with mode EColor16MU
1046 iDisplayMode=(iDisplayMode==EColor16M ? EGray4:EColor16M);
1047 #if defined(LOGGING)
1050 iWindow.SetRequiredDisplayMode(iDisplayMode);
1051 iGc->Activate(iBackUpWin);
1052 iBackUpWin.SetPosition(iDisplayMode==EColor16M ? TPoint(1,0):TPoint(0,1));
1053 #if defined(LOGGING)
1054 TDisplayMode curentMode=iScrDev->DisplayMode();
1055 _LIT(KToggleMode,"Toggle Display Mode Mode=%d Window=%d Actual=%d");
1056 LogMessageText.Zero();
1057 LogMessageText.AppendFormat(KToggleMode,(TInt&)iDisplayMode,newMode,(TInt&)curentMode);
1058 iWs.LogMessage(LogMessageText);
1059 //iWs.LogCommand(RWsSession::ELoggingStatusDump);
1065 void CMoveWindow::FlipChange()
1067 if (++iCurrentMode==2) //flip between modes 0 and 1
1069 iDevice->SetScreenMode(iCurrentMode);
1074 // CBugFixColorAnimation
1076 // This class is used for reproducing a defect found on 6.1: KAA-5J3BLW "Unnecessary Wserv's DSA abort".
1077 // The problem was that a direct screen access client was getting an unnecessary abort notification
1078 // when a new window (or window group) was created but not visible.
1079 // This class will simulate the direct screen access client and it will check whether the first DSA abort
1080 // is not caused by just creating a window.
1082 CBugFixColorAnimation* CBugFixColorAnimation::NewL(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack,CTWindowGroup& aParent,TRect aExtent,TBool aStart)
1084 CBugFixColorAnimation* self=new(ELeave) CBugFixColorAnimation(aScreenNumber, aId,aCallBack);
1085 CleanupStack::PushL(self);
1086 self->ConstructL(aParent,aExtent);
1092 CleanupStack::Pop(self);
1096 CBugFixColorAnimation::CBugFixColorAnimation(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack)
1097 : CColorAnimation(aScreenNumber, aId, aCallBack)
1099 iThreadParam.iScreenNumber = aScreenNumber;
1102 CBugFixColorAnimation::~CBugFixColorAnimation()
1107 TRequestStatus status;
1108 iThread->Logon(status);
1109 if (iThread->StillAlive())
1111 iThread->Terminate(KErrNone);
1112 User::WaitForRequest(status);
1116 iTestFailed->Cancel();
1121 LOCAL_D TInt TestFailed(TAny* aAnimation)
1123 CBugFixColorAnimation* anim=reinterpret_cast<CBugFixColorAnimation*>(aAnimation);
1126 anim->CallBack().Fail();
1132 LOCAL_D TInt CreateNewWindowGroup(TAny* aParam)
1134 TDirectThreadParam* param = (TDirectThreadParam*)aParam;
1135 TRect rect = param->iRect;
1136 TBool isInFront = param->iIsInFront;
1138 TInt error=ws.Connect();
1140 CWsScreenDevice* screen = NULL;
1141 TRAP(error, screen = new (ELeave) CWsScreenDevice(ws));
1142 if (error!=KErrNone)
1145 RThread::Rendezvous(error);
1149 if ((error=screen->Construct(param->iScreenNumber))!=KErrNone)
1153 RThread::Rendezvous(error);
1157 error = sem.OpenGlobal(KSem_DefectFix_KAA_5J3BLW_Name, EOwnerThread);
1158 if (error!=KErrNone)
1161 RThread::Rendezvous(error);
1165 RThread::Rendezvous(KErrNone);
1167 // wait for the dsa to start before creating the new window group
1172 RWindowGroup group(ws);
1173 group.Construct(431,EFalse);
1176 group.SetOrdinalPosition(0,KAboveMainTestBaseWindow);
1180 group.SetOrdinalPosition(2);
1183 error=window.Construct(group, 432);
1184 if (error==KErrNone)
1186 window.SetExtentErr(rect.iTl, rect.Size());
1187 window.SetOrdinalPosition(0,0);
1193 group.SetOrdinalPosition(-1);
1196 //Wait for wserv to render new window on top of the existing DSA region.
1198 //Now the window has been rendered (and DSA should have been aborted).
1208 void CBugFixColorAnimation::ConstructL(CTWindowGroup& aParent,TRect aExtent)
1210 CColorAnimation::ConstructL(aParent, aExtent,KDrawingDsa);
1211 _LIT(ThreadName,"Create new Window");
1213 TInt error=iSem.CreateGlobal(KSem_DefectFix_KAA_5J3BLW_Name, 0);
1214 if (error==KErrNone)
1216 iThreadParam.iRect = iAnimRect;
1217 iThreadParam.iIsInFront = EFalse;
1218 TThreadStartUp function=TThreadStartUp(CreateNewWindowGroup, &iThreadParam);
1219 TRequestStatus status;
1220 iThread=CProcess::NewThreadRendezvousL(ThreadName,&function, status);
1221 User::WaitForRequest(status);
1222 if (status != KErrNone)
1224 RDebug::Printf("the request status is returned to be non KErrNone: %d", status.Int());
1227 iTestFailed = CIdle::NewL(0);
1235 void CBugFixColorAnimation::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/)
1238 if (!iTestFailed->IsActive())
1240 iTestFailed->Start(TCallBack(TestFailed,this));
1244 void CBugFixColorAnimation::Restart(RDirectScreenAccess::TTerminationReasons aReason)
1249 TInt CPanicDirect::DoTestOnNewSchedulerL(TInt aInt, TAny* aPtr)
1251 CActiveScheduler* activeScheduler=new(ELeave) CActiveScheduler;
1252 CActiveScheduler::Install(activeScheduler);
1253 CleanupStack::PushL(activeScheduler);
1254 DoTestNowL(aInt,aPtr);
1255 CleanupStack::PopAndDestroy(activeScheduler);
1256 return(EWsExitReasonBad); //calls to this method currently all ignore the return code anyway.
1259 TInt CPanicDirect::DoTestOnNewScheduler(TInt aInt, TAny* aPtr)
1261 TInt rv=EWsExitReasonBad;
1262 TRAP_IGNORE(rv=DoTestOnNewSchedulerL(aInt,aPtr));
1263 return(rv); //calls to this method currently all ignore the return code anyway.
1266 void CPanicDirect::DoTestNowL(TInt aInt, TAny* aPtr)
1268 CPanicDirect* self=new(ELeave) CPanicDirect();
1269 CleanupStack::PushL(self);
1270 self->ConstructL((TInt)aPtr, aInt);
1272 CleanupStack::PopAndDestroy(self);
1275 void CPanicDirect::ConstructL(TInt aScreenNumber, TInt aInt)
1277 iScreenNumber = aScreenNumber;
1279 User::LeaveIfError(iTimer.CreateLocal());
1280 User::LeaveIfError(iWs.Connect());
1281 iWsScrDev=new(ELeave) CWsScreenDevice(iWs);
1282 User::LeaveIfError(iWsScrDev->Construct(iScreenNumber));
1284 #if defined(LOGGING)
1285 _LIT(KPanicThead1,"PanicThread: Into ConstructL");
1286 LogMessageText.Copy(KPanicThead1);
1287 iWs.LogMessage(LogMessageText);
1290 iGroup=RWindowGroup(iWs);
1291 User::LeaveIfError(iGroup.Construct(2200+aInt,EFalse));
1292 iGroup.SetOrdinalPosition(0,KPanicTestOrdinalPriority);
1293 iBlankWin=RBlankWindow(iWs);
1294 User::LeaveIfError(iBlankWin.Construct(iGroup,2300+aInt));
1295 iBlankWin.Activate();
1296 iDirect=RDirectScreenAccess(iWs);
1297 User::LeaveIfError(iDirect.Construct());
1298 iDisplayMode=iWsScrDev->DisplayMode();
1299 #if defined(LOGGING)
1300 _LIT(KPanicThead2,"PanicThread: Creating Screen Device, Mode=%d");
1301 LogMessageText.Format(KPanicThead2,iDisplayMode);
1302 iWs.LogMessage(LogMessageText);
1305 iScreenDevice=CFbsScreenDevice::NewL(aScreenNumber,iDisplayMode);
1306 #if defined(LOGGING)
1307 _LIT(KPanicThead3,"PanicThread: Created Device");
1308 LogMessageText.Copy(KPanicThead3);
1309 iWs.LogMessage(LogMessageText);
1312 User::LeaveIfError(iScreenDevice->CreateContext(iGc));
1313 #if defined(LOGGING)
1314 _LIT(KPanicThead4,"PanicThread: Created Context");
1315 LogMessageText.Copy(KPanicThead4);
1316 iWs.LogMessage(LogMessageText);
1319 iTextDraw=CScrollingTextDrawer::NewL(iScreenNumber,iScreenDevice,*iGc);
1320 #if defined(LOGGING)
1321 _LIT(KPanicThead5,"PanicThread: Created ScrollDrawer");
1322 LogMessageText.Copy(KPanicThead5);
1323 iWs.LogMessage(LogMessageText);
1326 iTextDraw->SetScrollJump(4);
1327 #if defined(LOGGING)
1328 _LIT(KCreatedDrawer,"PanicThread: CreatedDrawer");
1329 LogMessageText.Copy(KCreatedDrawer);
1330 iWs.LogMessage(LogMessageText);
1336 CPanicDirect::~CPanicDirect()
1340 delete iScreenDevice;
1351 void CPanicDirect::TestL()
1355 iDirect.Completed();
1358 TInt err=iDirect.Request(iRegion,iDirectStatus,iBlankWin);
1359 if (err!=KErrNone || !iRegion)
1361 TRect screen(iScreenDevice->SizeInPixels());
1362 TRect bounding=iRegion->BoundingRect();
1363 if (!screen.Contains(bounding.iTl) || !screen.Contains(bounding.iBr-TPoint(1,1)))
1365 iGc->SetClippingRegion(iRegion);
1366 iDrawingAllowed=ETrue;
1367 iTimer.After(iTimerStatus,50000); //0.05secs
1370 User::WaitForRequest(iDirectStatus,iTimerStatus);
1371 if (iDirectStatus!=KRequestPending)
1372 iDrawingAllowed=EFalse;
1373 else if (iTimerStatus!=KRequestPending)
1375 if (iDrawingAllowed)
1377 iTimer.After(iTimerStatus,50000); //0.05secs
1388 void CPanicDirect::DoDrawingL()
1391 iTextDraw->Scroll();
1392 if (iTestNo==1 && iCount==8)
1394 iDirect.Request(iRegion,iDirectStatus,iBlankWin);
1397 if (iTestNo==3 && iCount==12)
1399 iDirect.Completed();
1400 iDirect.Completed();
1403 if (iTestNo==4 && iCount==16)
1405 iBlankWin.SetSize(TSize(20,25));
1407 User::LeaveIfError(iDirect.Request(iRegion,iDirectStatus,iBlankWin));
1410 if (iTestNo==5 && iCount==19)
1420 CTDirect::CTDirect(CTestStep* aStep):
1421 CTWsGraphicsBase(aStep)
1424 iNextFrameFinished = ETrue;
1425 iPackagingFinished = EFalse;
1426 iTimerRunning = EFalse;
1429 CTDirect::~CTDirect()
1435 TheClient->WaitForRedrawsToFinish();
1436 delete iCallBackWin;
1437 // put focus back to current screen as this test changed the focus screen to primary screen
1438 TheClient->iWs.SetFocusScreen(iTest->iScreenNumber);
1441 void CTDirect::ConstructL()
1443 _LIT(KCTDirectConstructL,"AUTO Construct Direct Test");
1444 LOG_MESSAGE(KCTDirectConstructL);
1445 FullScreenModeSize=TheClient->iScreen->SizeInPixels();
1446 iIsScalingSupported=CheckScalingSupportedOrNot();
1448 iCallBackWin=new(ELeave) CTBlankWindow;
1449 iCallBackWin->ConstructL(*TheClient->iGroup);
1450 User::LeaveIfError(iCallBackWin->BaseWin()->SetRequiredDisplayMode(EColor256));
1451 iCallBackWin->SetExt(TPoint(),TheClient->iScreen->SizeInPixels());
1452 iCallBackWin->SetVisible(EFalse);
1453 iCallBackWin->Activate();
1454 // the following line makes sure that a console object hidden outside of
1455 // screens range doesn't affect test results being on top of tested objects
1456 TheClient->iGroup->GroupWin()->SetOrdinalPosition(0, KMainTestBaseWindow);
1459 void CTDirect::ConstrucBlankWindowL()
1462 iWin=new(ELeave) CTBlankWindow;
1463 iWin->ConstructL(*TheClient->iGroup);
1464 iWin->BaseWin()->SetShadowDisabled(ETrue);
1465 iWin->BaseWin()->Activate();
1469 void CTDirect::InitialiseAnimationL()
1471 ConstrucBlankWindowL();
1473 TDisplayMode dispMode=TheClient->iWs.GetDefModeMaxNumColors(colors,greys);
1474 iScrDev=CFbsScreenDevice::NewL(iTest->iScreenNumber,dispMode);
1475 User::LeaveIfError(iScrDev->CreateContext(iGc));
1476 INFO_PRINTF1(_L(" Constructed Screen Device"));
1477 iScrSize=iScrDev->SizeInPixels();
1478 TFontSpec fontSpec(FontName,iScrSize.iHeight);
1479 fontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
1480 User::LeaveIfError(iScrDev->GetNearestFontToDesignHeightInPixels(iFont,fontSpec));
1481 iGc->UseFont(iFont);
1483 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1484 TInt fontHeight=iFont->HeightInPixels();
1485 iDrawRect.iTl.iY=(iScrSize.iHeight-fontHeight)/2;
1486 iDrawRect.SetHeight(fontHeight);
1487 iDrawHeight=iFont->AscentInPixels();
1488 TSize winSize(25,20);
1489 iWin2=new(ELeave) CTBlankWindow;
1490 iWin2->ConstructL(*TheClient->iGroup);
1491 iWin2->SetExt(TPoint((iScrSize.iWidth-winSize.iWidth)/2,(iScrSize.iHeight-winSize.iHeight)/2),winSize);
1492 iWin2->SetColor(TRgb::Gray4(2));
1493 iWin2->BaseWin()->Activate();
1494 INFO_PRINTF1(_L(" Setup Window"));
1496 TheClient->iWs.Finish();
1498 User::LeaveIfError(iControlSem.CreateGlobal(SemControl,0,KOwnerType));
1499 User::LeaveIfError(iControlQueue.CreateGlobal(QueueControl,1,sizeof(TInt),KOwnerType));
1501 iFlags|=eDirectControlSem;
1502 User::LeaveIfError(iWinSem.CreateGlobal(SemNextOp,0,KOwnerType));
1503 iFlags|=eDirectWindowSem;
1504 iProcess=CProcess::NewTL(CProcess::eProcessDirectTest,iTest->iScreenNumber,&iThreadStatus);
1505 INFO_PRINTF1(_L(" Constructed Semaphores & Thread"));
1508 iTimer=CPeriodic::NewL(iTest->EAutoTestPriority);
1509 iRestart=CIdle::NewL(iTest->EAutoTestPriority+5);
1510 iDirect=CDirectScreenAccessOld::NewL(TheClient->iWs,*this);
1513 void CTDirect::DestroyAnimation()
1515 ResetScreenSizeMode();
1516 if(iProcess && iProcess->StillAlive())
1518 if (iFlags&eDirectControlSem)
1520 iControlSem.Signal();
1522 iControlQueue.Send(&data,sizeof(TInt));
1524 if (iFlags&eDirectWindowSem)
1534 delete iChangeScreenModeTimer;
1535 iChangeScreenModeTimer=NULL;
1536 delete iScreenModeTimer;
1537 iScreenModeTimer=NULL;
1539 if (iFlags&eFontSet)
1542 iScrDev->ReleaseFont(iFont);
1546 iDrawingRegion->Destroy();
1552 User::WaitForRequest(iThreadStatus);
1556 if (iFlags&eDirectControlSem)
1558 iControlSem.Close();
1559 iControlQueue.Close();
1561 if (iFlags&eDirectWindowSem)
1565 void CTDirect::ResetScreenSizeMode()
1567 if (iModeBackup!=ESizeEnforcementNone)
1569 TheClient->iScreen->SetScreenModeEnforcement(ESizeEnforcementNone);
1570 iModeBackup=ESizeEnforcementNone;
1572 TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationNormal);
1573 TheClient->iScreen->SetScreenMode(0);
1574 TPixelsAndRotation pixelsAndRotation;
1575 TheClient->iScreen->GetDefaultScreenSizeAndRotation(pixelsAndRotation);
1576 TheClient->iScreen->SetScreenSizeAndRotation(pixelsAndRotation);
1577 User::After(350000); //0.35secs
1580 void CTDirect::ScanTypeFacesL()
1582 CFbsScreenDevice* scrdev=CFbsScreenDevice::NewL(iTest->iScreenNumber,EGray4);
1583 TTypefaceSupport typeFace;
1584 TInt numFaces=scrdev->NumTypefaces();
1586 for (ii=0;ii<numFaces;++ii)
1588 scrdev->TypefaceSupport(typeFace,ii);
1593 TInt RestartAnimation(TAny* aTest)
1595 STATIC_CAST(CTDirect*,aTest)->Restart();
1599 TInt NextFrame(TAny* aTest)
1601 STATIC_CAST(CTDirect*,aTest)->DrawFrame();
1605 void CTDirect::AbortNow(RDirectScreenAccess::TTerminationReasons aReason)
1607 TEST(aReason==RDirectScreenAccess::ETerminateRegion);
1610 User::After(2000000); //2 secs
1613 iFrameNo=eDirectNumFrames;
1617 iNextFrameFinished = ETrue;
1621 iRestart->Start(TCallBack(RestartAnimation,this));
1624 TBool CTDirect::Restart()
1630 #pragma warning( disable : 4244 ) //conversion from 'int' to 'unsigned short', possible loss of data
1631 TBool CTDirect::DrawFrame()
1633 if (iFrameNo==eDirectNumFrames)
1637 if (iFrameNo==eDirectNumFrames)
1639 iNextFrameFinished = ETrue;
1643 TBuf<2> iString(Text); //_LIT(Text,"ABCabc123");
1644 iString[0]+=iFrameNo;
1645 iString[1]+=iFrameNo;
1646 TInt textWidth=iFont->TextWidthInPixels(iString);
1647 TInt maxTextWidth=Max(textWidth,iLastTextWidth);
1648 iLastTextWidth=textWidth;
1649 if (iLastMaxTextWidth!=maxTextWidth)
1651 iLastMaxTextWidth=maxTextWidth;
1652 iDrawRect.iTl.iX=(iScrSize.iWidth-iLastMaxTextWidth)/2;
1653 iDrawRect.SetWidth(iLastMaxTextWidth);
1655 TInt colorOffset=iFrameNo%2;
1656 iGc->SetPenColor(TRgb::Gray4(colorOffset));
1657 iGc->DrawText(iString,iDrawRect,iDrawHeight,CGraphicsContext::ECenter);
1658 iGc->SetPenColor(TRgb::Gray4(1+colorOffset));
1659 iGc->DrawLine(TPoint(),iScrSize.AsPoint());
1660 iGc->DrawLine(TPoint(iScrSize.iWidth,0),TPoint(0,iScrSize.iHeight));
1661 iGc->DrawLine(TPoint(iScrSize.iWidth/2,0),TPoint(iScrSize.iWidth/2,iScrSize.iHeight));
1662 iGc->DrawLine(TPoint(0,iScrSize.iHeight/2),TPoint(iScrSize.iWidth,iScrSize.iHeight/2));
1665 if (iFrameNo==iFrameToSignalAfter)
1669 #pragma warning( default : 4244 )
1671 void CTDirect::SignalWindow()
1679 iFrameToSignalAfter=0;
1687 iFrameToSignalAfter=3;
1691 WinExt.SetSize(TSize(iScrSize.iWidth/2-5,iScrSize.iHeight/2+30));
1692 iFrameToSignalAfter=5;
1695 iFrameToSignalAfter=7;
1698 WinExt.SetSize(TSize(iScrSize.iWidth/2+30,iScrSize.iHeight/2-5));
1700 iFrameToSignalAfter=8;
1703 iFrameToSignalAfter=0;
1712 iFrameToSignalAfter=2;
1715 WinExt.SetRect(TPoint(iScrSize.iWidth/2-15,iScrSize.iHeight/2-20),TSize(iScrSize.iWidth/3,iScrSize.iHeight/3));
1717 iFrameToSignalAfter=5;
1720 iFrameToSignalAfter=6;
1723 WinExt.SetRect(TPoint(iScrSize.iWidth/2-50,iScrSize.iHeight/3),TSize(iScrSize.iWidth/4,iScrSize.iHeight/3));
1725 iFrameToSignalAfter=8;
1728 iFrameToSignalAfter=0;
1736 iFrameToSignalAfter=3;
1739 iFrameToSignalAfter=6;
1740 iWin2->SetVisible(EFalse);
1744 iFrameToSignalAfter=0;
1745 iWin2->SetVisible(ETrue);
1754 iFrameToSignalAfter=6;
1757 iFrameToSignalAfter=0;
1758 WinExt.SetRect(10,10,20,20);
1767 iFrameToSignalAfter=7;
1771 iFrameToSignalAfter=0;
1780 #if defined(LOGGING)
1781 _LIT(KSignal,"Signaling Move Window");
1782 LogMessageText.Copy(KSignal);
1783 TheClient->iWs.LogMessage(LogMessageText);
1789 void CTDirect::StartDirect()
1795 INFO_PRINTF3(_L("iWindowDead - Expected: %d, Actual: %d"), ETrue, iWindowDead);
1797 iFrameNo=eDirectNumFrames;
1802 INFO_PRINTF3(_L("iWindowDead - Expected: %d, Actual: %d"), EFalse, iWindowDead);
1805 iDrawingRegion->Destroy();
1806 TInt retVal = iDirect->Request(iDrawingRegion,*iWin->BaseWin());
1807 TEST(retVal==KErrNone);
1808 if (retVal!=KErrNone)
1809 INFO_PRINTF3(_L("iDirect->Request(iDrawingRegion,*iWin->BaseWin()) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1811 iGc->SetClippingRegion(iDrawingRegion);
1814 void CTDirect::LogLeave(TInt aErr)
1816 iTest->LogLeave(aErr);
1819 void CTDirect::Fail()
1824 void CTDirect::Finished(TInt aId)
1826 //aId refers to the animation, it is not the test number
1827 _LIT(KCTDirectFinished,"Destroying animation number %d");
1828 LOG_MESSAGE2(KCTDirectFinished,aId);
1833 ResetScreenSizeMode();
1835 iPackagingFinished = ETrue;
1838 //iPackagingFinished = ETrue;
1842 #if defined(LOGGING)
1843 _LIT(KDeleteScroll,"Deleting Scroll Text Id=%d TimerActive=%d");
1844 LogMessageText.Zero();
1845 LogMessageText.AppendFormat(KDeleteScroll,aId,iAnim->IsTimerActive());
1846 TheClient->iWs.LogMessage(LogMessageText);
1850 if (aId==8 && iAnim->IsTimerActive())
1854 case 25: //case DSA using Region tracking Only (abort signal expceted)
1855 case 26: //case DSA using Region tracking Only (abort signal not expceted)
1857 iPackagingFinished = ETrue;
1861 TInt numProcessHandles;
1862 TInt numThreadHandles;
1863 RThread().HandleCount(numProcessHandles,numThreadHandles);
1864 TEST(Abs(numThreadHandles-iNumThreadHandles)<2);
1865 if (Abs(numThreadHandles-iNumThreadHandles)>=2)
1866 INFO_PRINTF3(_L("Abs(numThreadHandles-iNumThreadHandles)<2 - Expected: %d or less, Actual: %d"), 2, Abs(numThreadHandles-iNumThreadHandles));
1872 // Stop the animation and delete it, but make sure that you don't increment iState and call Rquest()
1873 // until this is the second call i.e. one of aId = 15 or aId = 16 has already been finished.
1874 TInt index = aId-15;
1875 iAnims[index]->Stop();
1876 delete iAnims[index];
1878 // This test creates two animations iAnims[0] and iAnims[1].
1879 // Use (index ^ 1 ) = Toggle the Index, to get the index of other animation.
1880 // If iAnims [ index ^ 1] is NULL then this is the second Call and test is finished.
1881 if (iAnims[index ^ 1] != NULL)
1885 iPackagingFinished = ETrue;
1890 iPackagingFinished = ETrue;
1891 delete iBlankTopClientWin1;
1892 // delete iBlankTopClientWin2;
1894 for (jj=0;jj<4;++jj)
1896 for (jj=0;jj<4;++jj)
1902 iPackagingFinished = ETrue;
1905 if (iNumOfModes==iCurrentMode)
1907 ResetScreenSizeMode();
1908 iCallBackWin->SetVisible(EFalse);
1916 // Stop the animation and delete it, but make sure that you don't increment iState and call Rquest()
1917 // until this is the second call i.e. one of aId = 17 or aId = 18 has already been finished.
1919 TBool finished = ETrue;
1925 for (ii=1;ii<=iNumAnimation;++ii)
1936 for (ii=1;ii<=iNumAnimation;++ii)
1951 iPackagingFinished = ETrue;
1956 iPackagingFinished = ETrue;
1964 // Stop the animation and delete it, but make sure that you don't increment iState and call Rquest()
1965 // until this is the second call i.e. one of aId = 20 or aId = 21 has already been finished.
1966 TInt index = aId-20;
1967 iAnims[index]->Stop();
1968 delete iAnims[index];
1970 // This test creates two animations iAnims[0] and iAnims[1].
1971 // Use (index ^ 1 ) = Toggle the Index, to get the index of other animation.
1972 // If iAnims [ index ^ 1] is NULL then this is the second Call and test is finished.
1973 if (iAnims[index ^ 1] != NULL)
1978 iPackagingFinished = ETrue;
1980 } //unreachable line, no need for break
1982 iPackagingFinished = ETrue;
1986 //don't want to increase state, so decrement, since it is incremented below
1987 //as part of processing normal completions. This is to reenter the test
1988 //to call Fail() if required
1998 iAnims[aId-27]->Stop();
1999 delete iAnims[aId-27];
2000 iAnims[aId-27] = NULL;
2006 iPackagingFinished = ETrue;
2009 iPackagingFinished = ETrue;
2011 for (ii=0;ii<6;++ii)
2013 for (ii=0;ii<6;++ii)
2018 #if defined(LOGGING)
2019 _LIT(KRequest,"Signal Start NextTest Id=%d, State=%d(+1)");
2020 LogMessageText.Zero();
2021 LogMessageText.AppendFormat(KRequest,aId,iState);
2022 TheClient->iWs.LogMessage(LogMessageText);
2028 void CTDirect::DeleteMoveWindow()
2032 TRequestStatus status;
2033 iMoveWin->Logon(status);
2034 if (iMoveWin->StillAlive())
2036 iMoveWin->Terminate(KErrNone);
2037 User::WaitForRequest(status);
2044 void CTDirect::DeleteScroll()
2048 TheClient->iScreen->SetScreenMode(0);
2055 TDisplayMode CTDirect::DisplayMode(TInt aId)
2088 /*TDisplayMode mode=*/TheClient->iWs.GetDefModeMaxNumColors(colors,grays);
2091 return (aId==8? EGray16:EColor16);
2094 return TheClient->iScreen->DisplayMode();
2098 void CTDirect::Log(const TText8* aFile, TInt aLine, TInt aSeverity,const TDesC& aString)
2100 Logger().LogExtra(((TText8*)aFile), aLine, aSeverity, aString) ;
2103 TRgb CTDirect::BrushColorL(TInt aId,TInt& aColor,TBool& aFinished)
2119 aFinished=(aColor==20);
2120 return TRgb::Color16(27 + aColor++);
2122 aFinished=(aColor==17);
2123 return TRgb::Color16(28 + aColor++);
2125 aFinished=(aColor==15);
2126 return TRgb::Color16(29 + aColor++);
2131 aFinished=(iCycles==5);
2135 else if (!iScroll->IsRunning())
2136 iScroll->ContinueL();
2138 #if defined(LOGGING)
2139 if (aFinished || iScroll==NULL)
2141 _LIT(KColor,"Col=%d Cycles=%d Fin=%d iScroll=%d");
2142 LogMessageText.Zero();
2143 LogMessageText.AppendFormat(KColor,aColor,iCycles,aFinished,(TInt&)iScroll);
2144 TheClient->iWs.LogMessage(LogMessageText);
2152 return TRgb::Gray16(aColor++);
2155 aFinished=iCycles>3;
2163 return TRgb::Color16(aColor++);
2165 aFinished=(aColor==256);
2166 return TRgb::Color256(aColor++);
2170 return TRgb::Gray256(aColor++);
2175 return TRgb::Color4K(aColor);
2180 return TRgb::Color64K(aColor++);
2182 aFinished=2*(aColor>5);
2183 return TRgb::Color16(aColor++);
2189 CheckForTemporaryDeadlock();
2191 return TRgb::Color16(aColor++);
2193 aFinished=(aColor==256);
2194 return TRgb::Color16(aColor++);
2196 aFinished=(aColor==100);
2197 return TRgb::Color16(aColor++);
2199 aFinished=(aColor==300);
2200 return TRgb::Color16(aColor++);
2203 return TRgb::Gray2(1); //White
2207 TInt CTDirect::TimerInterval(TInt aId)
2262 void CTDirect::FailedReStart(TInt /*aId*/,TInt /*aReason*/)
2267 TInt CTDirect::SlowStopping(TInt aId,TInt aCount)
2270 return (aCount>1 ? CColorAnimation::eAbortAll : CColorAnimation::eStopNow);
2271 if (aId==9 || aId==10)
2272 return CColorAnimation::eStopNow;
2273 TInt ret=(2*aId-3==aCount%12);
2278 return CColorAnimation::eAbort;
2283 void CTDirect::ModeSwitch()
2285 TRAPD(err,iAnim->ChangeModeL(EGray4));
2286 iWin2->SetSize(TSize(20,25));
2292 TestState CTDirect::AnimateWindowL()
2294 // if (!iTimer->IsActive())
2302 iTimer->Start(0,200000,TCallBack(NextFrame,this)); //0.2 secs
2305 TEST(iDrawingRegion->BoundingRect()==iScrSize);
2314 TestState CTDirect::AnimationDiesL()
2316 INFO_PRINTF1(_L("AUTO Animation Dies "));
2317 _LIT(ThreadName,"AnimationDie");
2318 iFirstFunction=TThreadStartUp(CAnimating::StartLC,(TAny*)iTest->iScreenNumber);
2319 CProcess* thread=CProcess::NewThreadL(ThreadName,&iFirstFunction);
2320 CleanupStack::PushL(thread);
2321 thread->LeaveIfDied();
2322 INFO_PRINTF1(_L(" Constructed Thread"));
2324 RWindowGroup group(TheClient->iWs);
2325 group.Construct(431,EFalse);
2326 RBlankWindow win(TheClient->iWs);
2327 win.Construct(group,432);
2328 win.SetExtent(TPoint(12,34),TSize(56,78));
2330 INFO_PRINTF1(_L(" Constructed Windows"));
2332 User::After(1000000); //1 sec
2333 TRequestStatus threadDied;
2334 thread->Logon(threadDied);
2335 thread->Terminate(KErrGeneral);
2336 INFO_PRINTF1(_L(" Waiting for Thread"));
2337 User::WaitForRequest(threadDied);
2338 CleanupStack::PopAndDestroy(thread);
2341 INFO_PRINTF1(_L(" Finished"));
2345 TestState CTDirect::PackagingClassL()
2347 ConstrucBlankWindowL();
2348 TInt numProcessHandles;
2349 RThread().HandleCount(numProcessHandles,iNumThreadHandles);
2350 iAnim=CColorAnimation::NewL(iTest->iScreenNumber,1,*this,*TheClient->iGroup,TRect(10,10,630,230),ETrue);
2354 TestState CTDirect::MultipleL()
2356 TSize scrSize=TheClient->iScreen->SizeInPixels();
2359 iAnims[0]=CColorAnimation::NewL(iTest->iScreenNumber,2,*this,*TheClient->iGroup,
2360 TRect(0,10,scrSize.iWidth/3+20,scrSize.iHeight/2-5),EFalse);
2361 iAnims[1]=CColorAnimation::NewL(iTest->iScreenNumber,3,*this,*TheClient->iGroup,
2362 TRect(10,scrSize.iHeight/2-20,scrSize.iWidth/3-5,scrSize.iHeight),EFalse);
2363 iAnims[3]=CColorAnimation::NewL(iTest->iScreenNumber,5,*this,*TheClient->iGroup,
2364 TRect(scrSize.iWidth/3-20,scrSize.iHeight/2+5,2*scrSize.iWidth/3+20,scrSize.iHeight-10),EFalse);
2365 iAnims[2]=CColorAnimation::NewL(iTest->iScreenNumber,4,*this,*TheClient->iGroup,
2366 TRect(scrSize.iWidth/3+5,0,2*scrSize.iWidth/3-5,scrSize.iHeight/2+20),EFalse);
2367 iAnims[4]=CColorAnimation::NewL(iTest->iScreenNumber,6,*this,*TheClient->iGroup,
2368 TRect(2*scrSize.iWidth/3-20,15,scrSize.iWidth,scrSize.iHeight/2+50),EFalse);
2369 iAnims[5]=CColorAnimation::NewL(iTest->iScreenNumber,7,*this,*TheClient->iGroup,
2370 TRect(2*scrSize.iWidth/3+5,-20,scrSize.iWidth-15,scrSize.iHeight+10),ETrue);
2372 for (ii=0;ii<5;++ii)
2373 iAnims[ii]->StartL();
2374 _LIT(ThreadName,"MoveWin");
2376 MoveInterval=100000; //0.1 secs
2377 ModeInterval=1200000; //1.2 sec
2378 ImmediateModeSwitch=EFalse;
2379 iFirstFunction=TThreadStartUp(CMoveWindow::StartLC,(TAny*)iTest->iScreenNumber);
2380 iMoveWin=CProcess::NewThreadL(ThreadName,&iFirstFunction);
2384 TestState CTDirect::MixDsaAndRegionTrackingOnlyL(TBool aWhoExitsLast)
2386 TSize scrSize=TheClient->iScreen->SizeInPixels();
2389 TUint firstRegionTrackinOnlyDsa = (aWhoExitsLast == KRegionTrackingOnlyDsaExistLast ? 0 : 3);
2390 TUint firstDrawingDsa = (aWhoExitsLast == KDrawingDsaExistLast ? 0 : 3);
2392 //DSAs who use region tracking only
2393 iAnims[firstRegionTrackinOnlyDsa]=CColorAnimation::NewL(iTest->iScreenNumber,firstRegionTrackinOnlyDsa+27,*this,*TheClient->iGroup,
2394 TRect(10,scrSize.iHeight/2-20,scrSize.iWidth/3-5,scrSize.iHeight),EFalse,KRegionTrackingOnly);
2395 iAnims[firstRegionTrackinOnlyDsa+1]=CColorAnimation::NewL(iTest->iScreenNumber,firstRegionTrackinOnlyDsa+28,*this,*TheClient->iGroup,
2396 TRect(2*scrSize.iWidth/3-20,15,scrSize.iWidth,scrSize.iHeight/2+50),EFalse,KRegionTrackingOnly);
2397 iAnims[firstRegionTrackinOnlyDsa+2]=CColorAnimation::NewL(iTest->iScreenNumber,firstRegionTrackinOnlyDsa+29,*this,*TheClient->iGroup,
2398 TRect(2*scrSize.iWidth/3+5,-20,scrSize.iWidth-15,scrSize.iHeight+10),EFalse,KRegionTrackingOnly);
2400 //DSAs who actually draw
2401 iAnims[firstDrawingDsa]=CColorAnimation::NewL(iTest->iScreenNumber,firstDrawingDsa+27,*this,*TheClient->iGroup,
2402 TRect(0,10,scrSize.iWidth/3+20,scrSize.iHeight/2-5),EFalse,KDrawingDsa);
2403 iAnims[firstDrawingDsa+1]=CColorAnimation::NewL(iTest->iScreenNumber,firstDrawingDsa+28,*this,*TheClient->iGroup,
2404 TRect(scrSize.iWidth/3+5,0,2*scrSize.iWidth/3-5,scrSize.iHeight/2+20),EFalse,KDrawingDsa);
2405 iAnims[firstDrawingDsa+2]=CColorAnimation::NewL(iTest->iScreenNumber,firstDrawingDsa+29,*this,*TheClient->iGroup,
2406 TRect(scrSize.iWidth/3-20,scrSize.iHeight/2+5,2*scrSize.iWidth/3+20,scrSize.iHeight-10),EFalse,KDrawingDsa);
2409 for (ii=0;ii<6;++ii)
2412 iAnims[ii]->StartL();
2415 _LIT(ThreadName,"MoveWin");
2417 MoveInterval=100000; //0.1 secs
2418 ModeInterval=1200000; //1.2 secs
2419 ImmediateModeSwitch=EFalse;
2420 iFirstFunction=TThreadStartUp(CMoveWindow::StartLC,(TAny*)iTest->iScreenNumber);
2421 iMoveWin=CProcess::NewThreadL(ThreadName,&iFirstFunction);
2425 TestState CTDirect::TryDifferentSupportedModesL()
2429 User::LeaveIfError(session.Connect());
2430 CWsScreenDevice* device = new(ELeave) CWsScreenDevice(session);
2431 CleanupStack::PushL(device);
2432 User::LeaveIfError(device->Construct(iTest->iScreenNumber));
2433 TUint numOfModes=device->NumScreenModes();
2434 _LIT(KTryingCurrentMode,"Trying Mode = %d");
2435 for(TUint currentMode =0; currentMode < numOfModes; currentMode++)
2437 LOG_MESSAGE2(KTryingCurrentMode,currentMode);
2438 device->SetScreenMode(currentMode);
2439 TRAPD(err,iAnims[0]=CColorAnimation::NewL(iTest->iScreenNumber,4,*this,*TheClient->iGroup,
2440 TRect(0,0,50,50),ETrue));
2447 User::After(2000000);
2452 CleanupStack::PopAndDestroy(device);
2459 TestState CTDirect::FailCodesL()
2462 TRequestStatus status;
2463 RRegion region(TRect(0,0,10,10),1);
2464 RRegion* pRegion=®ion;
2465 RDirectScreenAccess direct(TheClient->iWs);
2466 User::LeaveIfError(direct.Construct());
2467 RBlankWindow window(TheClient->iWs);
2468 User::LeaveIfError(window.Construct(*TheClient->iGroup->WinTreeNode(),1234));
2469 TInt err=direct.Request(pRegion,status,window);
2470 TEST(err==KErrNone);
2472 INFO_PRINTF3(_L("direct.Request(pRegion,status,window) return value - Expected: %d, Actual: %d"), KErrNone, err);
2473 TEST(pRegion!=NULL);
2475 INFO_PRINTF3(_L("pRegion!=NULL - Expected: %d, Actual: %d"), 0, 0);
2478 User::WaitForRequest(status);
2480 window.SetOrdinalPosition(-2);
2482 err=direct.Request(pRegion,status,window);
2483 TEST(err==KErrNone);
2485 INFO_PRINTF3(_L("direct.Request(pRegion,status,window) return value - Expected: %d, Actual: %d"), KErrNone, err);
2486 TEST(pRegion!=NULL);
2488 INFO_PRINTF3(_L("pRegion!=NULL - Expected: %d, Actual: %d"), 0, 0);
2491 User::WaitForRequest(status);
2492 #if defined(__WINS__)
2493 // Loop over the allocations done.
2494 // There is one allocating of the rectangle list and
2495 // one of the region holding the list
2496 for (TInt rate = 1; rate <= 2; rate++)
2498 window.SetOrdinalPosition(0);
2501 __UHEAP_FAILNEXT(rate);
2502 err=direct.Request(pRegion,status,window);
2503 TEST(err==KErrNoMemory);
2504 if (err!=KErrNoMemory)
2505 INFO_PRINTF3(_L("direct.Request(pRegion,status,window) return value - Expected: %d, Actual: %d"), KErrNoMemory, err);
2507 TEST(pRegion==NULL);
2509 INFO_PRINTF3(_L("pRegion!=NULL - Expected: %d, Actual: %d"), 0, 0);
2519 void CTDirect::ScrolingTextL(TInt aId,TRect aWinRect,TBool aStartThread,TInt aScreenMode/*=0*/)
2521 INFO_PRINTF1(_L("AUTO Construct ScrolingText "));
2522 INFO_PRINTF1(_L(" Constructed Window"));
2524 TInt numProcessHandles;
2525 RThread().HandleCount(numProcessHandles,iNumThreadHandles);
2526 iAnim=CColorAnimation::NewL(iTest->iScreenNumber,aId,*this,*TheClient->iGroup,aWinRect,EFalse);
2527 iScroll=CScrollText::NewL(iTest->iScreenNumber,1,*TheClient->iGroup,5,EFalse);
2528 INFO_PRINTF1(_L(" Constructed Text Scroller & Animation"));
2529 iAnim->BringWindowToFront();
2532 _LIT(ThreadName,"MoveWin");
2533 INFO_PRINTF1(_L(" About to constructed Thread"));
2534 iFirstFunction=TThreadStartUp(CMoveWindow::StartLC,(TAny*)iTest->iScreenNumber);
2535 __ASSERT_DEBUG(!iMoveWin,AutoPanic(EAutoPanicDirect));
2536 iMoveWin=CProcess::NewThreadL(ThreadName,&iFirstFunction);
2537 INFO_PRINTF1(_L(" Constructed Thread"));
2541 TInt numScreenModes = TheClient->iScreen->NumScreenModes();
2542 if (aScreenMode < numScreenModes)
2543 TheClient->iScreen->SetScreenMode(aScreenMode);
2545 LOG_MESSAGE(_L("WARNING: Failed to change screen mode"));
2546 // We have to run the test anyway to avoid things going wrong later
2548 iAnim->StartOrPanic();
2550 INFO_PRINTF1(_L(" Constructed/Started"));
2551 #if defined(LOGGING)
2552 _LIT(KStarted,"Finished StartUp ScrollText");
2553 LogMessageText.Copy(KStarted);
2554 TheClient->iWs.LogMessage(LogMessageText);
2559 TestState CTDirect::ScrolingText1L()
2562 ModeInterval=1200000; //1.2 sec
2563 ScrolingTextL(8,TRect(20,20,40,40),ETrue);
2567 TestState CTDirect::RClassL()
2569 #if defined(LOGGING)
2570 _LIT(KRClass,"Starting Panic test on RClass");
2571 LogMessageText.Zero();
2572 LogMessageText.AppendFormat(KRClass);
2573 TheClient->iWs.LogMessage(LogMessageText);
2576 TEST(iTest->TestWsPanicL(CPanicDirect::DoTestOnNewScheduler,EWservPanicDirectMisuse,1,(TAny*)iTest->iScreenNumber));
2577 #if defined(LOGGING)
2578 _LIT(KPanic1,"Done First Panic");
2579 LogMessageText.Zero();
2580 LogMessageText.AppendFormat(KPanic1);
2581 TheClient->iWs.LogMessage(LogMessageText);
2584 #if defined(__WINS__)
2585 #if defined(LOGGING)
2586 _LIT(KPanic2,"Doing 2 debug panics");
2587 LogMessageText.Zero();
2588 LogMessageText.AppendFormat(KPanic2);
2589 TheClient->iWs.LogMessage(LogMessageText);
2592 TEST(iTest->TestW32PanicL(CPanicDirect::DoTestOnNewScheduler,EW32PanicDirectMisuse,2,(TAny*)iTest->iScreenNumber));
2593 TEST(iTest->TestW32PanicL(CPanicDirect::DoTestOnNewScheduler,EW32PanicDirectMisuse,3,(TAny*)iTest->iScreenNumber));
2595 #if defined(LOGGING)
2596 _LIT(KPanicTest,"Trying Panic %d");
2597 LogMessageText.Zero();
2598 LogMessageText.AppendFormat(KPanicTest,4);
2599 TheClient->iWs.LogMessage(LogMessageText);
2602 TEST(iTest->TestWsPanicL(CPanicDirect::DoTestOnNewScheduler,EWservPanicDirectMisuse,4,(TAny*)iTest->iScreenNumber));
2603 TEST(iTest->TestW32PanicL(CPanicDirect::DoTestOnNewScheduler,EW32PanicDirectMisuse,5,(TAny*)iTest->iScreenNumber));
2607 TestState CTDirect::ScrolingText2L()
2609 MoveInterval=81234; //0.08 sec
2610 ModeInterval=140123; //0.14 sec
2611 ImmediateModeSwitch=2;
2612 ScrolingTextL(9,TRect(15,25,45,35),ETrue);
2613 iScroll->SetCountDown(5);
2617 TestState CTDirect::ScrolingText3L()
2619 iModeBackup=TheClient->iScreen->ScreenModeEnforcement();
2620 if (iModeBackup!=ESizeEnforcementNone)
2621 TheClient->iScreen->SetScreenModeEnforcement(ESizeEnforcementNone);
2624 FlipInterval=1200000; //1.2 secs
2625 ScrolingTextL(10,TRect(25,30,35,45),ETrue,1);
2626 iScroll->SetBottomOfTest(80); //So it can be seen in both screen modes
2630 TestState CTDirect::ScrolingText4L()
2632 iModeBackup=TheClient->iScreen->ScreenModeEnforcement();
2633 if (iModeBackup!=ESizeEnforcementNone)
2634 TheClient->iScreen->SetScreenModeEnforcement(ESizeEnforcementNone);
2635 MoveInterval=876543; //0.88 secs
2636 ModeInterval=2178900; //2.18 secs
2637 FlipInterval=5000000; //5 secs
2638 ScrolingTextL(11,TRect(30,40,55,65),ETrue);
2639 iScroll->SetBottomOfTest(80); //So it can be seen in both screen modes
2643 void CTDirect::CreateAnimForScreenModeL(TInt aAnimIndex,CTWinBase& aParent,TRect aRect,TInt aId)
2645 iAnims[aAnimIndex]=CColorAnimation::NewL(iTest->iScreenNumber,aId,*this,aParent,aRect,EFalse);
2646 iAnims[aAnimIndex]->StartL();
2647 iAnims[aAnimIndex]->BringWindowToFront();
2650 void CTDirect::BlankTopClientWindowL(CTBlankWindow& aBlankWindow,TRect aRect)
2652 aBlankWindow.ConstructExtLD(*TheClient->iGroup,aRect.iTl,aRect.Size());
2653 User::LeaveIfError(aBlankWindow.BaseWin()->SetRequiredDisplayMode(EColor256));
2654 aBlankWindow.BaseWin()->SetShadowDisabled(ETrue);
2655 aBlankWindow.Activate();
2658 static TInt ChangeScreenModeL(TAny* aTest)
2660 STATIC_CAST(CTDirect*,aTest)->ChangeToNextScreenModeL();
2664 void CTDirect::ChangeToNextScreenModeL()
2666 #if defined(LOGGING)
2667 _LIT(KChangeMode,"AUTO Screen Mode Pos Test2 CallBack");
2668 LogMessageText.Copy(KChangeMode);
2669 TheClient->LogMessage(LogMessageText);
2670 TheClient->iWs.LogCommand(RWsSession::ELoggingStatusDump);
2672 iNumOfModes=TheClient->iScreen->NumScreenModes();
2673 if (iCurrentMode<iNumOfModes)
2675 TPixelsAndRotation pixelsAndRotation;
2676 SetScreenMode(iCurrentMode,pixelsAndRotation);
2677 TInt oldCurrentMode=iCurrentMode;
2678 CArrayFixFlat<TInt>* rotations=new(ELeave) CArrayFixFlat<TInt>(1);
2679 CleanupStack::PushL(rotations);
2680 User::LeaveIfError(TheClient->iScreen->GetRotationsList(iCurrentMode,rotations));
2681 TInt count=rotations->Count();
2685 for (jj=0;jj<count;)
2687 if ((*rotations)[jj++]==pixelsAndRotation.iRotation)
2701 TInt currentRotation=(*rotations)[jj];
2702 TheClient->iScreen->SetCurrentRotations(oldCurrentMode,REINTERPRET_CAST(CFbsBitGc::TGraphicsOrientation&,currentRotation));
2703 CleanupStack::PopAndDestroy(rotations);
2704 TheClient->iScreen->GetScreenModeSizeAndRotation(oldCurrentMode,pixelsAndRotation);
2705 TInt screenWidth=pixelsAndRotation.iPixelSize.iWidth;
2706 TInt screenHeight=pixelsAndRotation.iPixelSize.iHeight;
2707 TPoint screenModeOrigin=TheClient->iScreen->GetScreenModeScaledOrigin(oldCurrentMode);
2708 TPoint point1(screenModeOrigin.iX,screenModeOrigin.iY+(screenModeOrigin.iY+screenHeight)/2);
2709 TPoint point2(screenModeOrigin.iX+(screenModeOrigin.iX+screenWidth)/2,screenHeight+screenModeOrigin.iY);
2710 TRect rect0(point1,point2);
2711 TRect rect1(TPoint(0,0),rect0.Size());
2712 CreateAnimForScreenModeL(0,*TheClient->iGroup,rect1,14);
2713 TPoint pos=iAnims[0]->AbsoluteWindowPosition();
2714 TEST(pos==TPoint(0,0));
2718 TInt ChangeScreenScaleCallBack(TAny* aTest)
2720 static_cast<CTDirect*>(aTest)->ChangeScreenScale();
2724 void CTDirect::ChangeScreenScale()
2726 if (!iNumOfCallBack)
2728 iCurrentMode=TheClient->iScreen->CurrentScreenMode();
2729 iModeData=TheClient->iScreen->GetCurrentScreenModeAttributes();
2730 iModeData.iScreenScale.SetSize(1,1);
2732 TSizeMode testMode=iModeData;
2733 if (!iNumOfCallBack)
2735 testMode.iScreenScale.SetSize(2,2);
2737 else if (iNumOfCallBack==1)
2739 testMode.iScreenScale.SetSize(3,2);
2741 else if (iNumOfCallBack==2)
2743 testMode.iScreenScale.SetSize(2,3);
2745 TheClient->iScreen->SetCurrentScreenModeAttributes(testMode);
2746 TheClient->iScreen->SetAppScreenMode(iCurrentMode);
2747 TheClient->iScreen->SetScreenMode(iCurrentMode);
2748 if (iNumOfCallBack==2)
2750 iScreenModeTimer->Cancel();
2751 delete iScreenModeTimer;
2752 iScreenModeTimer=NULL;
2758 * Creates a DSA for screen mode 0. After DSA has displayd 2 or 3 frames screen mode
2759 * scale is changed with a timer. The DSA aborts and restarts once again
2760 * and completes itself in different screen mode.
2762 TestState CTDirect::ScreenModeTestForScalingL()
2764 CreateAnimForScreenModeL(0,*TheClient->iGroup,TRect(TSize(10,10)),19);
2765 iScreenModeTimer=CPeriodic::NewL(0);
2766 MoveInterval=2000000;
2767 iScreenModeTimer->Start(1000,MoveInterval,TCallBack(ChangeScreenScaleCallBack,this));
2772 * Creates a DSA for screen mode 0, tests API AbsoluteWindowPosition()
2773 * Then sets screen mode to last(test) screen mode, here it does the same thing as
2774 * done for screenmode 0, but with diffrerent scale (2,2) (2,3) (3,2) (3,3) and
2775 * with different origin (20,30) (30,20) (20,20).
2776 * Lastly copy back the test screen mode values.
2778 TestState CTDirect::ScreenModeScalingTestL()
2780 #if defined(LOGGING)
2781 INFO_PRINTF1("AUTO ScreenModeScalingTest ");
2783 // DisabledStartLogText();
2785 INFO_PRINTF1(_L(" Switch to mode 0"));
2786 iModeData.iScreenScale.iWidth=1;
2787 iModeData.iScreenScale.iHeight=1;
2788 TheClient->iScreen->SetCurrentScreenModeAttributes(iModeData);
2789 TheClient->iScreen->SetAppScreenMode(0);
2790 TheClient->iScreen->SetScreenMode(0);
2792 INFO_PRINTF1(_L(" Get Parameters"));
2793 iCurrentScreenModeOrigin=TheClient->iScreen->GetDefaultScreenModeOrigin();
2794 iCurrentScreenModeScale=TheClient->iScreen->GetCurrentScreenModeScale();
2795 Copy2ndHalfOfScreen=(iCurrentScreenModeOrigin.iX>FullScreenModeSize.iWidth/2? 1 : 0);
2796 TRect testWinRect(PhysicalToLogical(TPoint(),iCurrentScreenModeScale),
2797 PhysicalToLogical(TPoint((Copy2ndHalfOfScreen ? FullScreenModeSize.iWidth :
2798 FullScreenModeSize.iWidth/2),
2799 FullScreenModeSize.iHeight)-
2800 iCurrentScreenModeOrigin,iCurrentScreenModeScale)
2802 testWinRect.Shrink(10,10);
2803 INFO_PRINTF1(_L(" Create Animation"));
2804 CreateAnimForScreenModeL(0,*TheClient->iGroup,testWinRect,17);
2805 TPoint pos0=iAnims[0]->AbsoluteWindowPosition();
2806 TEST(pos0==TPoint(10,10));
2808 TInt numOfModes=TheClient->iScreen->NumScreenModes();
2809 iCurrentMode=numOfModes-1;
2810 INFO_PRINTF1(_L(" Switch to Last Mode"));
2811 TheClient->iScreen->SetAppScreenMode(iCurrentMode);
2812 TheClient->iScreen->SetScreenMode(iCurrentMode);
2813 TSizeMode storeModeData=TheClient->iScreen->GetCurrentScreenModeAttributes();
2814 TSizeMode testMode=storeModeData;
2816 for (TInt xScale=2;xScale<4;xScale++)
2818 INFO_PRINTF1(_L(" New X-Scale"));
2819 for (TInt yScale=2;yScale<4;yScale++)
2821 INFO_PRINTF1(_L(" New Y-Scale"));
2822 testMode.iScreenScale=TSize(xScale,yScale);
2823 TestDifferentOriginAndScaleL(testMode,TPoint(20,20));
2824 TestDifferentOriginAndScaleL(testMode,TPoint(20,30));
2825 TestDifferentOriginAndScaleL(testMode,TPoint(30,20));
2828 TheClient->iScreen->SetScreenMode(iCurrentMode);
2829 TheClient->iScreen->SetCurrentScreenModeAttributes(storeModeData);
2830 INFO_PRINTF1(_L(" Set To Mode 0"));
2831 TheClient->iScreen->SetAppScreenMode(0);
2832 TheClient->iScreen->SetScreenMode(0);
2836 void CTDirect::TestDifferentOriginAndScaleL(TSizeMode &aMode,TPoint aOrigin)
2838 aMode.iOrigin=aOrigin;
2839 TheClient->iScreen->SetCurrentScreenModeAttributes(aMode);
2840 TheClient->iScreen->SetAppScreenMode(iCurrentMode);
2841 TheClient->iScreen->SetScreenMode(iCurrentMode);
2842 iCurrentScreenModeOrigin=TheClient->iScreen->GetScreenModeOrigin(iCurrentMode);
2843 iCurrentScreenModeScale=TheClient->iScreen->GetScreenModeScale(iCurrentMode);
2844 Copy2ndHalfOfScreen=(iCurrentScreenModeOrigin.iX>FullScreenModeSize.iWidth/2? 1 : 0);
2845 TRect testWinRect(PhysicalToLogical(TPoint(),iCurrentScreenModeScale),
2846 PhysicalToLogical(TPoint((Copy2ndHalfOfScreen ? FullScreenModeSize.iWidth
2847 : FullScreenModeSize.iWidth/2),
2848 FullScreenModeSize.iHeight)
2849 -iCurrentScreenModeOrigin,iCurrentScreenModeScale)
2851 testWinRect.Shrink(10,10);
2853 CreateAnimForScreenModeL(iNumAnimation,*TheClient->iGroup,testWinRect,18);
2854 TPoint pos0=iAnims[iNumAnimation]->AbsoluteWindowPosition();
2855 TEST(pos0==TPoint(10,10));
2858 //REQUIREMENT: CR PHAR-5SJGAM, PREQ673
2859 //Tests that DSA works correctly in screen modes with non-zero screen mode origin.
2860 TestState CTDirect::DSAWithScreenModeOffset1L()
2862 TPoint screenModeTwoOrigin=TheClient->iScreen->GetScreenModeScaledOrigin(2);
2863 TPixelsAndRotation pixelsAndRotation;
2864 TheClient->iScreen->GetScreenModeSizeAndRotation(2,pixelsAndRotation);
2865 if(pixelsAndRotation.iRotation != CFbsBitGc::EGraphicsOrientationNormal)
2867 TheClient->iScreen->SetCurrentRotations(2, CFbsBitGc::EGraphicsOrientationNormal);
2869 TheClient->iScreen->GetScreenModeSizeAndRotation(2,pixelsAndRotation);
2870 //check that the current rotation is normal
2871 __ASSERT_DEBUG(pixelsAndRotation.iRotation==CFbsBitGc::EGraphicsOrientationNormal,AutoPanic(EAutoPanicDirect));
2872 TInt screenWidthMode2=pixelsAndRotation.iPixelSize.iWidth;
2873 TInt screenHeightMode2=pixelsAndRotation.iPixelSize.iHeight;
2874 TPoint point1(screenModeTwoOrigin.iX,screenModeTwoOrigin.iY+(screenModeTwoOrigin.iY+screenHeightMode2)/2);
2875 TPoint point2(screenModeTwoOrigin.iX+(screenModeTwoOrigin.iX+screenWidthMode2)/2,screenHeightMode2+screenModeTwoOrigin.iY);
2876 TPoint point3(screenModeTwoOrigin.iX+screenWidthMode2,screenModeTwoOrigin.iY+screenHeightMode2);
2878 SetScreenMode(0,pixelsAndRotation);
2879 TRect rect0(point1,point2);
2880 CreateAnimForScreenModeL(0,*TheClient->iGroup,rect0,13);
2881 TPoint pos0=iAnims[0]->AbsoluteWindowPosition();
2884 SetScreenMode(2,pixelsAndRotation);
2885 TRect rect1(TPoint(0,0),rect0.Size());
2886 CreateAnimForScreenModeL(1,*TheClient->iGroup,rect1,13);
2887 TPoint pos1=iAnims[1]->AbsoluteWindowPosition();
2888 TEST(pos1==rect1.iTl);
2890 SetScreenMode(0,pixelsAndRotation);
2891 iBlankTopClientWin1=new(ELeave) CTBlankWindow();
2892 // TInt ordpos = iBlankTopClientWin1->BaseWin()->OrdinalPosition();
2893 TRect rect2(TPoint(point2.iX,point1.iY),point3);
2894 BlankTopClientWindowL(*iBlankTopClientWin1,rect2);
2895 TInt x=rect2.Size().iWidth/4;
2896 TPoint animWinPt(x,0);
2898 CreateAnimForScreenModeL(2,*iBlankTopClientWin1,TRect(animWinPt,rect2.Size()),13);
2899 TPoint pos2=iAnims[2]->AbsoluteWindowPosition();
2900 TEST(pos2==rect2.iTl);
2902 SetScreenMode(2,pixelsAndRotation);
2903 iBlankTopClientWin2=new(ELeave) CTBlankWindow();
2904 // ordpos = iBlankTopClientWin2->BaseWin()->OrdinalPosition();
2905 TPoint tl(rect1.iBr.iX,0);
2906 TRect rect3(tl,TPoint(screenWidthMode2,rect1.iBr.iY));
2907 BlankTopClientWindowL(*iBlankTopClientWin2,rect3);
2908 x=rect3.Size().iWidth/4;
2909 animWinPt=TPoint(x,0);
2911 CreateAnimForScreenModeL(3,*iBlankTopClientWin2,TRect(animWinPt,rect3.Size()),13);
2912 TPoint pos3=iAnims[3]->AbsoluteWindowPosition();
2913 TEST(pos3==(animWinPt+tl));
2915 SetScreenMode(0,pixelsAndRotation);
2919 //REQUIREMENT: CR PHAR-5SJGAM, PREQ673
2920 //Tests that DSA works correctly in screen modes with non-zero screen mode origin and different rotations
2921 TestState CTDirect::DSAWithScreenModeOffset2L()
2924 TTimeIntervalMicroSeconds32 timeBetweenScreenModeChange=3200000;
2925 iCallBackWin->WinTreeNode()->SetOrdinalPosition(0);
2926 iCallBackWin->SetVisible(ETrue); //Used to forsce screen into Color256 so that it will rotate
2927 iChangeScreenModeTimer=CPeriodic::NewL(0);
2928 iChangeScreenModeTimer->Start(0,timeBetweenScreenModeChange,TCallBack(ChangeScreenModeL,this));
2932 void CTDirect::SetScreenMode(TInt aMode,TPixelsAndRotation& aPixelsAndRotation)
2934 TheClient->iScreen->SetScreenMode(aMode);
2935 TheClient->iScreen->SetScreenModeEnforcement(ESizeEnforcementNone);
2936 TheClient->iScreen->GetDefaultScreenSizeAndRotation(aPixelsAndRotation);
2937 TheClient->iScreen->SetScreenSizeAndRotation(aPixelsAndRotation);
2941 TestState CTDirect::DefectFix_KAA_5J3BLW_L()
2943 TInt numProcessHandles;
2944 RThread().HandleCount(numProcessHandles,iNumThreadHandles);
2945 const TSize screenSize(TheClient->iScreen->SizeInPixels());
2946 const TRect dsaRect(0,0,screenSize.iWidth>>2,screenSize.iHeight>>2);
2947 iAnim=CBugFixColorAnimation::NewL(iTest->iScreenNumber, 1, *this, *TheClient->iGroup, dsaRect,ETrue);
2951 TestState CTDirect::RegionTrackingOnlyNotificationsL(TUint aId)
2953 TInt numProcessHandles;
2954 RThread().HandleCount(numProcessHandles,iNumThreadHandles);
2955 const TSize screenSize(TheClient->iScreen->SizeInPixels());
2956 const TRect dsaRect(0,0,screenSize.iWidth>>2,screenSize.iHeight>>2);
2957 TBool isWindowOpenedInFrontOfDsa = (aId == KRegionTrackingOnlyDsaWaitingForAbortSignal);
2958 iAnim=CRegionTrackingOnly::NewL(iTest->iScreenNumber, aId, *this, *TheClient->iGroup, dsaRect,ETrue,isWindowOpenedInFrontOfDsa);
2962 // Tests the new function of getting the window's absolute position
2963 TestState CTDirect::WindowPoistionRelativeToScreenL()
2965 //.. delete screen mode timer
2966 delete iChangeScreenModeTimer;
2967 iChangeScreenModeTimer=NULL;
2969 TInt numProcessHandles;
2970 RThread().HandleCount(numProcessHandles,iNumThreadHandles);
2971 TSize screenSize(TheClient->iScreen->SizeInPixels());
2972 TRect rect(0,0,screenSize.iWidth>>1,screenSize.iHeight);
2974 // First animation is for showing that child window is within the visible part of the parent window and within the visible screen area
2975 iAnims[0]=new(ELeave) CColorAnimation(iTest->iScreenNumber,15,*this);
2976 iAnims[0]->ConstructL(*TheClient->iGroup,rect,KDrawingDsa,1);
2977 iAnims[0]->StartL(ETrue);
2978 // First animation is for showing that child window is to the side of visible part of parent window
2979 rect.Move(screenSize.iWidth>>1,0);
2980 iAnims[1]=new(ELeave) CColorAnimation(iTest->iScreenNumber,16,*this);
2981 iAnims[1]->ConstructL(*TheClient->iGroup,rect,KDrawingDsa,2);
2982 iAnims[1]->StartL(ETrue);
2986 TestState CTDirect::MultipleDSAsOnSameWindowL()
2988 TInt numProcessHandles;
2989 RThread().HandleCount(numProcessHandles,iNumThreadHandles);
2990 iCallBackWin->SetVisible(ETrue);
2991 iCallBackWin->WinTreeNode()->SetOrdinalPosition(0);
2992 iAnims[0]=new(ELeave) CColorAnimation(iTest->iScreenNumber,20,*this);
2993 iAnims[0]->ConstructL(*TheClient->iGroup,TRect(),KDrawingDsa,0,1);
2994 iAnims[0]->StartL();
2995 iAnims[1]=new(ELeave) CColorAnimation(iTest->iScreenNumber,21,*this);
2996 iAnims[1]->ConstructL(*TheClient->iGroup,TRect(),KDrawingDsa,0,2);
2997 iAnims[1]->StartL();
2998 _LIT(ThreadName,"MoveWin");
2999 MoveInterval=100000;
3002 ImmediateModeSwitch=EFalse;
3003 iFirstFunction=TThreadStartUp(CMoveWindow::StartLC,(TAny*)iTest->iScreenNumber);
3004 iMoveWin=CProcess::NewThreadL(ThreadName,&iFirstFunction);
3008 TestState CTDirect::KillAnimationL()
3010 TInt numProcessHandles;
3011 RThread().HandleCount(numProcessHandles,iNumThreadHandles);
3012 iAnim=CColorAnimation::NewL(iTest->iScreenNumber,12,*this,*TheClient->iGroup,TRect(15,15,625,225),ETrue);
3016 TestState CTDirect::TemporaryDeadlockL()
3019 if (iTestJustCompleted)
3021 if (iTestJustFailed)
3029 //make sure this code isn't called a second time
3030 __ASSERT_ALWAYS(iAnim==NULL,AutoPanic(EAutoPanicDirect));
3032 TSize screenSize(TheClient->iScreen->SizeInPixels());
3033 TRect rect(0,0,screenSize.iWidth>>1,screenSize.iHeight);
3035 iAnim=new(ELeave) CColorAnimation(iTest->iScreenNumber,24,*this);
3036 iAnim->ConstructL(*TheClient->iGroup,rect,KDrawingDsa,1);
3037 iAnim->StartL(ETrue);
3041 void CTDirect::CheckForTemporaryDeadlock()
3048 //Create a window for placing on top
3050 beforeTime.HomeTime();
3052 RWindow window(TheClient->iWs);
3054 error=window.Construct(*TheClient->iGroup->GroupWin(), reinterpret_cast<TInt>(&window));
3055 if (error==KErrNone)
3057 window.SetOrdinalPosition(0);
3058 window.SetExtent(TPoint(30,30),TSize(10,10));
3059 window.SetBackgroundColor(TRgb(255,0,255));
3061 //make sure the basewin is towards the back
3062 iCallBackWin->BaseWin()->SetOrdinalPosition(5);
3064 window.SetRequiredDisplayMode(EColor256);
3066 TheClient->iWs.Flush();
3067 //need code similar to below, but the status of the active object we
3068 //really want is too private
3069 //if (!iAnim->IsReadyToAbort())
3081 afterTime.HomeTime();
3082 TTimeIntervalMicroSeconds difference = afterTime.MicroSecondsFrom(beforeTime);
3084 //make time difference 350ms, since the two timers to be checked are 400ms and 500ms
3085 if (difference>TTimeIntervalMicroSeconds(1000*350))
3090 iTestJustCompleted = ETrue;
3093 iTestJustFailed=ETrue;
3097 void CTDirect::RunTestCaseL(TInt /*aCurTestCase*/)
3099 _LIT(Animation1,"Animating");
3100 _LIT(Animation2,"Animating Dies");
3101 _LIT(Animation3,"Packaging Class");
3102 _LIT(Animation4,"Many Animations");
3103 _LIT(Animation5,"Fail Codes");
3104 _LIT(Animation6,"Cancel The Other");
3105 _LIT(Animation7,"'R' Class API");
3106 _LIT(Animation8,"Switch Clear Type");
3107 _LIT(Animation9,"SizeMode Change");
3108 _LIT(Animation10,"Soak Testing");
3109 _LIT(Animation11,"Kill Animation");
3110 _LIT(Animation12,"Defect-Fix: KAA-5J3BLW");
3111 _LIT(Animation13,"Screen Mode Positioning DSA Test 1");
3112 _LIT(Animation14,"Screen Mode Positioning DSA Test 2");
3113 _LIT(Animation15,"Position Relative to Screen");
3114 _LIT(Animation16,"Screen mode Scaling DSA Test 1");
3115 _LIT(Animation17,"Screen mode Scaling DSA Test 2");
3116 _LIT(Animation18,"Multiple DSAs on same window");
3117 _LIT(Animation19,"DSA and windows temporary deadlock");
3118 _LIT(Animation25,"RegionTrackingOnly DSA, window opened in front");
3119 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
3120 _LIT(Animation26,"RegionTrackingOnly DSA, window opened behind");
3121 _LIT(Animation27,"Mixed DSAs, RegionTrackingOnly DSA last to exit");
3122 _LIT(Animation28,"Mixed DSAs, drawing DSA last to exit");
3123 _LIT(Animation29,"Trying all the screen supported modes");
3125 TestState ret=ENext;
3127 if (iTimerRunning && !iPackagingFinished)
3129 // Prevent test harness from repeatedly running the test case too quickly.
3130 User::After(SHORT_DELAY);
3133 //if (iState==0) iState=18;
3134 iTest->iState=iState;
3135 ((CTDirectStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
3139 @SYMTestCaseID GRAPHICS-WSERV-0158
3143 @SYMTestCaseDesc Create seven seperate animations and run them to completion
3145 @SYMTestPriority High
3147 @SYMTestStatus Implemented
3149 @SYMTestActions Create animations and start them running. Run until the animations finish.
3151 @SYMTestExpectedResults The animation run to completion without error
3154 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158"));
3155 if (iNextFrameFinished)
3156 InitialiseAnimationL();
3158 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158"));
3160 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158"));
3162 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158"));
3164 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158"));
3166 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158"));
3168 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158"));
3169 if (iNextFrameFinished)
3171 iTest->LogSubTest(Animation1);
3172 ret=AnimateWindowL();
3173 iNextFrameFinished=EFalse;
3177 // Prevent test harness from repeatedly running the test case too quickly.
3178 User::After(SHORT_DELAY);
3182 @SYMTestCaseID GRAPHICS-WSERV-0159
3186 @SYMTestCaseDesc Check animation dies correctly when run in a thread
3188 @SYMTestPriority High
3190 @SYMTestStatus Implemented
3192 @SYMTestActions Create animation and run in from a thread that dies. Once the thread
3193 has died check the animation has been dealt with correctly.
3195 @SYMTestExpectedResults The animation dies correctly
3198 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0159"));
3199 iTest->LogSubTest(Animation2);
3200 ret=AnimationDiesL();
3205 @SYMTestCaseID GRAPHICS-WSERV-0160
3209 @SYMTestCaseDesc Check animation runs correctly in blank window
3211 @SYMTestPriority High
3213 @SYMTestStatus Implemented
3215 @SYMTestActions Create an animation and run it in a blank window
3217 @SYMTestExpectedResults The animation runs to completion without error
3220 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0160"));
3223 iTest->LogSubTest(Animation3);
3224 ret=PackagingClassL();
3225 iTimerRunning = ETrue;
3227 if (iPackagingFinished)
3229 iPackagingFinished = EFalse;
3230 iTimerRunning = EFalse;
3234 @SYMTestCaseID GRAPHICS-WSERV-0161
3238 @SYMTestCaseDesc Check many animations can be run in the same window
3240 @SYMTestPriority High
3242 @SYMTestStatus Implemented
3244 @SYMTestActions Create multiple animations in a window and run them all
3247 @SYMTestExpectedResults The animations run without error
3250 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0161"));
3253 iTest->LogSubTest(Animation4);
3255 iTimerRunning = ETrue;
3257 if (iPackagingFinished)
3259 iPackagingFinished = EFalse;
3260 iTimerRunning = EFalse;
3264 @SYMTestCaseID GRAPHICS-WSERV-0162
3268 @SYMTestCaseDesc Direct screen access out of memory test
3270 @SYMTestPriority High
3272 @SYMTestStatus Implemented
3274 @SYMTestActions Direct screen access out of memory test
3276 @SYMTestExpectedResults The out of memory error is handled correctly
3279 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0162"));
3280 iTest->LogSubTest(Animation5);
3285 @SYMTestCaseID GRAPHICS-WSERV-0163
3289 @SYMTestCaseDesc Two animations, one scrolling text
3291 @SYMTestPriority High
3293 @SYMTestStatus Implemented
3295 @SYMTestActions Create two animations, one which scrolls text across the screen and
3296 run them to completion
3298 @SYMTestExpectedResults The animations run without error
3301 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0163"));
3304 iTest->LogSubTest(Animation6);
3305 ret=ScrolingText1L();
3306 iTimerRunning = ETrue;
3308 if (iPackagingFinished)
3310 iPackagingFinished = EFalse;
3311 iTimerRunning = EFalse;
3315 @SYMTestCaseID GRAPHICS-WSERV-0164
3319 @SYMTestCaseDesc Test direct screen access panic messages
3321 @SYMTestPriority High
3323 @SYMTestStatus Implemented
3325 @SYMTestActions Call the direct screen access panic's and check they are handled
3328 @SYMTestExpectedResults The panic's are handled correctly
3331 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0164"));
3332 iTest->LogSubTest(Animation7);
3334 iTest->CloseAllPanicWindows();
3338 @SYMTestCaseID GRAPHICS-WSERV-0165
3342 @SYMTestCaseDesc Two animations, one scrolling text
3344 @SYMTestPriority High
3346 @SYMTestStatus Implemented
3348 @SYMTestActions Create two animations, one which scrolls text across the screen and
3349 run them to completion
3351 @SYMTestExpectedResults The animations run without error
3354 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0165"));
3357 iTest->LogSubTest(Animation8);
3358 ret=ScrolingText2L();
3359 iTimerRunning = ETrue;
3361 if (iPackagingFinished)
3363 iPackagingFinished = EFalse;
3364 iTimerRunning = EFalse;
3368 @SYMTestCaseID GRAPHICS-WSERV-0166
3372 @SYMTestCaseDesc Two animations, one scrolling text. Change the screen mode an run.
3374 @SYMTestPriority High
3376 @SYMTestStatus Implemented
3378 @SYMTestActions Create two animations, one which scrolls text across the screen and
3379 run them to completion while changing the screen mode
3381 @SYMTestExpectedResults The animations run without error
3385 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0166"));
3388 iTest->LogSubTest(Animation9);
3389 ret=ScrolingText3L();
3391 iPackagingFinished = ETrue;
3393 iTimerRunning = ETrue;
3395 if (iPackagingFinished)
3397 iPackagingFinished = EFalse;
3398 iTimerRunning = EFalse;
3399 FlipInterval = 0; // Stops the tests (erroneously) flipping for the rest of the run
3403 @SYMTestCaseID GRAPHICS-WSERV-0167
3407 @SYMTestCaseDesc Start an animation then kill it
3409 @SYMTestPriority High
3411 @SYMTestStatus Implemented
3413 @SYMTestActions Start an animation running then kill it. Check the animation dies correctly
3415 @SYMTestExpectedResults The animations dies correctly
3418 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0167"));
3421 iTest->LogSubTest(Animation11);
3422 ret=KillAnimationL();
3423 iTimerRunning = ETrue;
3425 if (iPackagingFinished)
3427 iPackagingFinished = EFalse;
3428 iTimerRunning = EFalse;
3432 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0167"));
3433 iTest->LogSubTest(Animation10); //This test is designed to be left running for at least several hours
3434 //ret=ScrolingText4L();
3438 @SYMTestCaseID GRAPHICS-WSERV-0168
3442 @SYMTestCaseDesc CBugFixColorAnimation
3444 @SYMTestPriority High
3446 @SYMTestStatus Implemented
3448 @SYMTestActions This class is used for reproducing a defect found on 6.1: KAA-5J3BLW "Unnecessary Wserv's DSA abort".
3449 The problem was that a direct screen access client was getting an unnecessary abort notification
3450 when a new window (or window group) was created but not visible.
3451 This class will simulate the direct screen access client and it will check whether the first DSA abort
3452 is not caused by just creating a window.
3454 @SYMTestExpectedResults Abort is not caused when creatung a window
3457 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0168"));
3460 iTest->LogSubTest(Animation12);
3461 ret=DefectFix_KAA_5J3BLW_L();
3462 iTimerRunning = ETrue;
3464 if (iPackagingFinished)
3466 iPackagingFinished = EFalse;
3467 iTimerRunning = EFalse;
3471 @SYMTestCaseID GRAPHICS-WSERV-0169
3475 @SYMTestCaseDesc Direct screen access in screen modes with non-zero screen mode origin
3477 @SYMTestPriority High
3479 @SYMTestStatus Implemented
3481 @SYMTestActions Tests that DSA works correctly in screen modes with non-zero screen mode origin
3483 @SYMTestExpectedResults The DSA works correctly
3486 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0169"));
3487 if (!CheckNonZeroOriginsSupportedOrNot())
3489 INFO_PRINTF1(_L("Non Zero Origins not supported\n"));
3496 iTest->LogSubTest(Animation13);
3497 ret=DSAWithScreenModeOffset1L();
3498 iTimerRunning = ETrue;
3500 if (iPackagingFinished)
3502 iPackagingFinished = EFalse;
3503 iTimerRunning = EFalse;
3508 @SYMTestCaseID GRAPHICS-WSERV-0170
3512 @SYMTestCaseDesc Direct screen access in screen modes with non-zero screen mode origin
3514 @SYMTestPriority High
3516 @SYMTestStatus Implemented
3518 @SYMTestActions Tests that DSA works correctly in screen modes with non-zero screen mode origin and different rotations
3520 @SYMTestExpectedResults The DSA works correctly
3523 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0170"));
3524 if (!CheckNonZeroOriginsSupportedOrNot())
3526 INFO_PRINTF1(_L("Non Zero Origins not supported\n"));
3533 iTest->LogSubTest(Animation14);
3534 ret=DSAWithScreenModeOffset2L();
3535 iTimerRunning = ETrue;
3537 if (iPackagingFinished)
3539 iPackagingFinished = EFalse;
3540 iTimerRunning = EFalse;
3545 @SYMTestCaseID GRAPHICS-WSERV-0171
3549 @SYMTestCaseDesc Window absolute position
3551 @SYMTestPriority High
3553 @SYMTestStatus Implemented
3555 @SYMTestActions Tests the new function of getting the window's absolute position
3557 @SYMTestExpectedResults Function works correctly
3560 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0171"));
3563 iTest->LogSubTest(Animation15);
3564 ret=WindowPoistionRelativeToScreenL();
3565 iTimerRunning = ETrue;
3567 if (iPackagingFinished)
3569 iPackagingFinished = EFalse;
3570 iTimerRunning = EFalse;
3574 @SYMTestCaseID GRAPHICS-WSERV-0172
3578 @SYMTestCaseDesc Test direct screen access restart
3580 @SYMTestPriority High
3582 @SYMTestStatus Implemented
3584 @SYMTestActions Creates a DSA for screen mode 0. After DSA has displayed 2 or 3 frames screen mode
3585 scale is changed with a timer. The DSA aborts and restarts once again
3586 and completes itself in different screen mode.
3588 @SYMTestExpectedResults DSA restarts and completes correctly
3591 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0172"));
3592 if (iIsScalingSupported)
3596 iTest->LogSubTest(Animation16);
3597 ret=ScreenModeTestForScalingL();
3598 iTimerRunning = ETrue;
3600 if (iPackagingFinished)
3602 iPackagingFinished = EFalse;
3603 iTimerRunning = EFalse;
3610 @SYMTestCaseID GRAPHICS-WSERV-0173
3614 @SYMTestCaseDesc Test direct screen access scaling
3616 @SYMTestPriority High
3618 @SYMTestStatus Implemented
3620 @SYMTestActions Creates a DSA for screen mode 0, tests API AbsoluteWindowPosition()
3621 Then sets screen mode to last(test) screen mode, here it does the same thing as
3622 done for screenmode 0, but with diffrerent scale (2,2) (2,3) (3,2) (3,3) and
3623 with different origin (20,30) (30,20) (20,20).
3624 Lastly copy back the test screen mode values.
3626 @SYMTestExpectedResults DSA scales correctly
3629 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0173"));
3630 if (iIsScalingSupported)
3634 iTest->LogSubTest(Animation17);
3635 ret=ScreenModeScalingTestL();
3636 iTimerRunning = ETrue;
3638 if (iPackagingFinished)
3640 iPackagingFinished = EFalse;
3641 iTimerRunning = EFalse;
3648 @SYMTestCaseID GRAPHICS-WSERV-0174
3652 @SYMTestCaseDesc Test multiple direct screen access elements on the same window
3654 @SYMTestPriority High
3656 @SYMTestStatus Implemented
3658 @SYMTestActions Create a number of direct screen access elements on the same window and
3659 check that they work correctly
3661 @SYMTestExpectedResults DSAs work correctly
3664 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0174"));
3665 if (iIsScalingSupported)
3669 iTest->LogSubTest(Animation18);
3670 ret=MultipleDSAsOnSameWindowL();
3671 iTimerRunning = ETrue;
3673 if (iPackagingFinished)
3675 iPackagingFinished = EFalse;
3676 iTimerRunning = EFalse;
3683 @SYMTestCaseID GRAPHICS-WSERV-0175
3687 @SYMTestCaseDesc Create a temporary deadlock on a DSA and resolve it
3689 @SYMTestPriority High
3691 @SYMTestStatus Implemented
3693 @SYMTestActions Resolve a temporary deadlock on a DSA
3695 @SYMTestExpectedResults DSA resolves the deadlock
3698 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0175"));
3701 iTest->LogSubTest(Animation19);
3702 ret=TemporaryDeadlockL();//for INC072887 - removing a 0.5s delay in wserv.
3703 iTimerRunning = ETrue;
3705 if (iPackagingFinished)
3707 iPackagingFinished = EFalse;
3708 iTimerRunning = EFalse;
3712 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
3715 @SYMTestCaseID GRAPHICS-WSERV-0533
3717 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0533"));
3721 iTest->LogSubTest(Animation25);
3722 //Opens a window in front of a region tracking only DSA
3723 ret=RegionTrackingOnlyNotificationsL(KRegionTrackingOnlyDsaWaitingForAbortSignal);
3724 iTimerRunning = ETrue;
3726 if (iPackagingFinished)
3728 iPackagingFinished = EFalse;
3729 iTimerRunning = EFalse;
3734 @SYMTestCaseID GRAPHICS-WSERV-0534
3736 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0534"));
3739 iTest->LogSubTest(Animation26);
3740 //Opens a window behind a region tracking only DSA
3741 ret=RegionTrackingOnlyNotificationsL(KRegionTrackingOnlyDsaNoAbortSignal);
3742 iTimerRunning = ETrue;
3744 if (iPackagingFinished)
3746 iPackagingFinished = EFalse;
3747 iTimerRunning = EFalse;
3752 @SYMTestCaseID GRAPHICS-WSERV-0535
3754 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0535"));
3757 iTest->LogSubTest(Animation27);
3758 ret=MixDsaAndRegionTrackingOnlyL(KRegionTrackingOnlyDsaExistLast);
3759 iTimerRunning = ETrue;
3761 if (iPackagingFinished)
3763 iPackagingFinished = EFalse;
3764 iTimerRunning = EFalse;
3769 @SYMTestCaseID GRAPHICS-WSERV-0536
3771 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0536"));
3774 iTest->LogSubTest(Animation28);
3775 ret=MixDsaAndRegionTrackingOnlyL(KDrawingDsaExistLast);
3776 iTimerRunning = ETrue;
3778 if (iPackagingFinished)
3780 iPackagingFinished = EFalse;
3781 iTimerRunning = EFalse;
3786 @SYMTestCaseID GRAPHICS-WSERV-0537
3788 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0537"));
3791 iTest->LogSubTest(Animation29);
3792 ret=TryDifferentSupportedModesL();
3793 iTimerRunning = ETrue;
3795 if (iPackagingFinished)
3797 iPackagingFinished = EFalse;
3798 iTimerRunning = EFalse;
3802 //NON NGA negative test for RegionTrackingOnly DSA
3805 @SYMTestCaseID GRAPHICS-WSERV-0575
3807 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0575"));
3811 iTest->LogSubTest(Animation25);
3812 CColorAnimation* temp = NULL;
3813 //Attempt to create a RegionTrackingOnly DSA in non NGA code
3814 TRAPD(err,temp = CColorAnimation::NewL(iTest->iScreenNumber,1,*this,*TheClient->iGroup,TRect(10,10,630,230),ETrue,KRegionTrackingOnly));
3815 if(err!=KErrNotSupported)
3817 _LIT(KCTDirectNonNgaError,"Attempt to creat a RegionTrackingOnly DSA did not return KErrNotSupported on non-NGA");
3818 LOG_MESSAGE(KCTDirectNonNgaError);
3827 _LIT(KCTDirectNonNgaSuccess,"RegionTrackingOnly DSA not supported on non-NGA as expected");
3828 LOG_MESSAGE(KCTDirectNonNgaSuccess);
3835 ((CTDirectStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
3836 ((CTDirectStep*)iStep)->CloseTMSGraphicsStep();
3840 ((CTDirectStep*)iStep)->RecordTestResultL();
3843 CRegionTrackingOnly* CRegionTrackingOnly::NewL(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack,CTWindowGroup& aParent,TRect aExtent,TBool aStart,TBool aOpenWindowInFrontDsa)
3845 CRegionTrackingOnly* self=new(ELeave) CRegionTrackingOnly(aScreenNumber, aId,aCallBack);
3846 CleanupStack::PushL(self);
3847 self->ConstructL(aParent,aExtent,aOpenWindowInFrontDsa);
3853 CleanupStack::Pop(self);
3857 CRegionTrackingOnly::CRegionTrackingOnly(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack)
3858 : CColorAnimation(aScreenNumber, aId, aCallBack)
3860 iThreadParam.iScreenNumber = aScreenNumber;
3863 void CRegionTrackingOnly::ConstructL(CTWindowGroup& aParent,TRect aExtent,TBool aOpenWindowInFrontDsa)
3865 iExpectedToAbort = aOpenWindowInFrontDsa;
3866 CColorAnimation::ConstructL(aParent, aExtent, KRegionTrackingOnly);
3867 _LIT(ThreadName,"Create new Window");
3869 TInt error=iSem.CreateGlobal(KSem_DefectFix_KAA_5J3BLW_Name, 0);
3870 if (error==KErrNone)
3873 iThreadParam.iRect = iAnimRect;
3874 iThreadParam.iIsInFront = aOpenWindowInFrontDsa;
3875 TThreadStartUp function=TThreadStartUp(CreateNewWindowGroup, &iThreadParam);
3876 TRequestStatus status;
3877 iThread=CProcess::NewThreadRendezvousL(ThreadName,&function,status);
3878 User::WaitForRequest(status);
3879 if (status != KErrNone)
3881 RDebug::Printf("the request status is returned to be non KErrNone: %d", status.Int());
3891 TBool CColorAnimation::TestGcAndScreenDeviceValues()
3893 TBool succeeded = ETrue;
3894 _LIT(KErrorLogGraphicContext,"GraphicsContext not NULL when using the region tracking feature only");
3895 _LIT(KErrorLogScreenDevice,"ScreenDevice not NULL when using the region tracking feature only");
3896 if(iRegionTrackingOnly && iDrawer->Gc() != NULL)
3898 CallBack().Log((TText8*)__FILE__,__LINE__, ESevrErr,KErrorLogGraphicContext);
3901 if(iRegionTrackingOnly && iDrawer->ScreenDevice() != NULL)
3903 CallBack().Log((TText8*)__FILE__,__LINE__, ESevrErr,KErrorLogScreenDevice);
3909 void CRegionTrackingOnly::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/)
3914 void CRegionTrackingOnly::Restart(RDirectScreenAccess::TTerminationReasons/* aReason*/)
3916 if(!TestGcAndScreenDeviceValues())
3920 if (iExpectedToAbort)
3922 _LIT(KExpected,"DSA got an abort signal as expected");
3923 CallBack().Log((TText8*)__FILE__,__LINE__,ESevrInfo,KExpected);
3927 _LIT(KError,"DSA got an abort signal even though the window was opened behind it");
3928 CallBack().Log((TText8*)__FILE__,__LINE__,ESevrErr,KError);
3934 CRegionTrackingOnly::~CRegionTrackingOnly()
3939 TRequestStatus status;
3940 iThread->Logon(status);
3941 if (iThread->StillAlive())
3943 iThread->Terminate(KErrNone);
3944 User::WaitForRequest(status);
3950 __WS_CONSTRUCT_STEP__(Direct)