sl@0: // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Test Direct Screen Access sl@0: // sl@0: // sl@0: sl@0: #include "tdirecta.h" sl@0: sl@0: static TRect WinExt; sl@0: static TInt WinCol=0; sl@0: static TTimeIntervalMicroSeconds32 MoveInterval; sl@0: static TTimeIntervalMicroSeconds32 ModeInterval; sl@0: static TTimeIntervalMicroSeconds32 FlipInterval; sl@0: static TBool ImmediateModeSwitch; sl@0: #if defined(LOGGING) sl@0: LOCAL_D TLogMessageText LogMessageText; sl@0: #endif sl@0: sl@0: _LIT(SemControl,"Control"); sl@0: _LIT(SemNextOp,"TrigerWindow"); sl@0: _LIT(FontName,"DejaVu Serif Condensed"); sl@0: _LIT(QueueControl,"Queue"); sl@0: sl@0: LOCAL_D TSize FullScreenModeSize; sl@0: LOCAL_D TInt Copy2ndHalfOfScreen; sl@0: sl@0: const TBool KRegionTrackingOnly = ETrue; sl@0: const TBool KDrawingDsa = EFalse; sl@0: sl@0: const TInt KPanicTestOrdinalPriority=65536; sl@0: const TInt KMainTestOrdinalPriority=65535; sl@0: const TInt KMainTestBaseWindow=KMainTestOrdinalPriority/3; sl@0: const TInt KAboveMainTestBaseWindow = KMainTestBaseWindow +1; sl@0: sl@0: const TInt KMaxIdlingTime = 25; //used for RegionTrackingOnly DSAs, it represents the maximum number of times the Idling function can be called sl@0: //Ids of two RegionTrackingOnly DSAs sl@0: const TInt KRegionTrackingOnlyDsaWaitingForAbortSignal = 25; sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: const TInt KRegionTrackingOnlyDsaNoAbortSignal = 26; sl@0: #endif sl@0: sl@0: const TInt KRegionTrackingOnlyDsaExistLast = 0; sl@0: const TInt KDrawingDsaExistLast = 1; sl@0: const TInt KShortDelay = 5000; sl@0: #define SHORT_DELAY TTimeIntervalMicroSeconds32(KShortDelay) sl@0: sl@0: _LIT(KSem_DefectFix_KAA_5J3BLW_Name, "DefectFix_KAA_5J3BLW"); sl@0: sl@0: GLDEF_C TInt ProcDirect(TAny *aScreenNumber) sl@0: { sl@0: CTrapCleanup* cleanupStack = NULL; sl@0: User::LeaveIfNull(cleanupStack = CTrapCleanup::New()); sl@0: sl@0: #if defined(LOGGING) sl@0: _LIT(KWindow,"Window Toggle Vis="); sl@0: _LIT(KParams,"%d, Pos=(%d,%d,%d,%d), Col=%d"); sl@0: #endif sl@0: RSemaphore controlSem; sl@0: RSemaphore windowSem; sl@0: User::LeaveIfError(controlSem.OpenGlobal(SemControl)); sl@0: User::LeaveIfError(windowSem.OpenGlobal(SemNextOp)); sl@0: RWsSession ws; sl@0: User::LeaveIfError(ws.Connect()); sl@0: sl@0: // assign to the correct screen sl@0: CWsScreenDevice* screen = NULL; sl@0: TInt err; sl@0: TRAP(err, screen = new (ELeave) CWsScreenDevice(ws)); sl@0: if (err!=KErrNone) sl@0: return err; sl@0: sl@0: if ((err=screen->Construct((TInt)aScreenNumber))!=KErrNone) sl@0: { sl@0: delete screen; sl@0: return err; sl@0: } sl@0: sl@0: RWindowGroup group(ws); sl@0: User::LeaveIfError(group.Construct(898)); sl@0: group.EnableReceiptOfFocus(EFalse); sl@0: group.SetOrdinalPosition(0,KAboveMainTestBaseWindow ); sl@0: RBlankWindow window(ws); sl@0: User::LeaveIfError(window.Construct(group,899)); sl@0: TBool vis=EFalse; sl@0: window.SetVisible(vis); sl@0: window.Activate(); sl@0: ws.Flush(); sl@0: controlSem.Signal(); sl@0: windowSem.Wait(); sl@0: RMsgQueueBase queue; sl@0: TInt open = queue.OpenGlobal(QueueControl); sl@0: TInt data; sl@0: while (queue.Receive(&data,sizeof(TInt)) != KErrNone) sl@0: { sl@0: vis=!vis; sl@0: if (vis) sl@0: { sl@0: window.SetColor(TRgb::Gray4(WinCol)); sl@0: window.SetExtent(WinExt.iTl,WinExt.Size()); sl@0: #if defined(LOGGING) sl@0: LogMessageText.Copy(KWindow); sl@0: LogMessageText.AppendFormat(KParams,vis,WinExt.iTl.iX,WinExt.iTl.iY,WinExt.iBr.iX,WinExt.iBr.iY,WinCol); sl@0: ws.LogMessage(LogMessageText); sl@0: #endif sl@0: } sl@0: window.SetVisible(vis); sl@0: ws.Flush(); sl@0: windowSem.Wait(); sl@0: } sl@0: queue.Close(); sl@0: sl@0: window.Close(); sl@0: group.Close(); sl@0: sl@0: delete screen; sl@0: ws.Close(); sl@0: controlSem.Close(); sl@0: windowSem.Close(); sl@0: sl@0: delete cleanupStack; sl@0: return(KErrNone); sl@0: } sl@0: sl@0: sl@0: /*CDirectScreenAccessOld*/ sl@0: sl@0: CDirectScreenAccessOld* CDirectScreenAccessOld::NewL(RWsSession& aWs,MAbortDirectScreenAccess& aAborter) sl@0: { sl@0: CDirectScreenAccessOld* self=new(ELeave) CDirectScreenAccessOld(aWs,aAborter); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CDirectScreenAccessOld::~CDirectScreenAccessOld() sl@0: { sl@0: __ASSERT_ALWAYS(!iAborting,AutoPanic(EAutoPanicDirect)); sl@0: Cancel(); sl@0: iDirectAccess.Close(); sl@0: } sl@0: sl@0: void CDirectScreenAccessOld::ConstructL() sl@0: { sl@0: User::LeaveIfError(iDirectAccess.Construct()); sl@0: CActiveScheduler::Add(this); sl@0: } sl@0: sl@0: TInt CDirectScreenAccessOld::Request(RRegion*& aRegion, RWindowBase& aWindow) sl@0: { sl@0: TInt ret=iDirectAccess.Request(aRegion,iStatus,aWindow); sl@0: if (ret==KErrNone) sl@0: SetActive(); sl@0: return ret; sl@0: } sl@0: sl@0: void CDirectScreenAccessOld::DoCancel() sl@0: { sl@0: iDirectAccess.Cancel(); sl@0: } sl@0: sl@0: void CDirectScreenAccessOld::RunL() sl@0: { sl@0: iAborting=ETrue; sl@0: iAborter.AbortNow(REINTERPRET_CAST(RDirectScreenAccess::TTerminationReasons&,iStatus)); sl@0: iAborting=EFalse; sl@0: iDirectAccess.Completed(); sl@0: } sl@0: sl@0: sl@0: /*CColorAnimation*/ sl@0: sl@0: CColorAnimation* CColorAnimation::NewL(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack,CTWinBase& aParent,TRect aExtent,TBool aStart,TBool aRegionTrackingOnly) sl@0: { sl@0: CColorAnimation* self=new(ELeave) CColorAnimation(aScreenNumber,aId,aCallBack); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aParent,aExtent,aRegionTrackingOnly); sl@0: if (aStart) sl@0: self->StartL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CColorAnimation::~CColorAnimation() sl@0: { sl@0: delete iTimer; sl@0: delete iDrawer; sl@0: delete iWindow; sl@0: delete iWindow2; sl@0: TheClient->Flush(); sl@0: } sl@0: sl@0: void CColorAnimation::ConstructL(CTWinBase& aParent,TRect aExtent,TBool aRegionTrackingOnly,TInt aTypeWindow/*=0*/,TInt aSingleWinForMultipleDSA/*=0*/) sl@0: { sl@0: iRegionTrackingOnly = aRegionTrackingOnly; sl@0: // Make sure that the top right corner is not 0,0 sl@0: if (aTypeWindow && aExtent.iTl==TPoint(0,0)) sl@0: { sl@0: aExtent.iTl=TPoint(10,10); sl@0: } sl@0: RWindowBase* win=NULL; sl@0: iSingleWinForMultipleDSA=aSingleWinForMultipleDSA; sl@0: if (aSingleWinForMultipleDSA) sl@0: { sl@0: win=iCallBack.iCallBackWin->BaseWin(); sl@0: iWinSize=TheClient->iScreen->SizeInPixels(); sl@0: } sl@0: else sl@0: { sl@0: iWindow=new(ELeave) CTBlankWindow(); sl@0: iWinSize=aExtent.Size(); sl@0: iWindow->ConstructExtLD(aParent,aExtent.iTl,iWinSize); sl@0: ChangeModeL(iCallBack.DisplayMode(iId)); sl@0: win=iWindow->BaseWin(); sl@0: win->SetShadowDisabled(ETrue); sl@0: win->Activate(); sl@0: } sl@0: if (!aTypeWindow) sl@0: { sl@0: if(iRegionTrackingOnly) sl@0: { sl@0: iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,*win,*this,iRegionTrackingOnly); sl@0: } sl@0: else sl@0: { sl@0: //needed for the non NGA case: only the old API is allowed to be used sl@0: iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,*win,*this); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: TRect childRect(0,0,100,100); sl@0: switch(aTypeWindow) sl@0: { sl@0: case 1: sl@0: { sl@0: // Create a Blank Window smaller than it's parent and its top left corner within the parent area and withn the screen area sl@0: childRect.Shrink(10,10); sl@0: break; sl@0: } sl@0: case 2: sl@0: { sl@0: // Create a Blank Window with its top left corner being left side of its parent sl@0: childRect.Move(-10,0); sl@0: break; sl@0: } sl@0: } sl@0: iWindow2=new(ELeave) CTBlankWindow(); sl@0: iWindow2->ConstructExtLD(*iWindow,childRect.iTl,childRect.Size()); sl@0: // Finish constructing the window sl@0: RWindowBase& win=*iWindow2->BaseWin(); sl@0: win.SetShadowDisabled(ETrue); sl@0: win.Activate(); sl@0: // Create the Direct Screen Access object sl@0: if(iRegionTrackingOnly) sl@0: { sl@0: iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,win,*this,iRegionTrackingOnly); sl@0: } sl@0: else sl@0: { sl@0: //needed for the non NGA case: only the old API is allowed to be used sl@0: iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,win,*this); sl@0: } sl@0: } sl@0: TheClient->Flush(); sl@0: if (iId == 4) sl@0: { sl@0: // This clause is needed to prevent sub-test 9 from taking an sl@0: // exceedingly large amount of time. The CColorAnimation with iId 4 is sl@0: // the one which controls when the test stops. This raise in sl@0: // priority compared to the other CColorAnimations, allows it's sl@0: // callbacks to get through when otherwise they would take much longer sl@0: // due to the volume of callbacks generated by the other sl@0: // CColorAnimations sl@0: iTimer=CPeriodic::NewL(1); sl@0: } sl@0: else sl@0: { sl@0: iTimer=CPeriodic::NewL(0); sl@0: } sl@0: } sl@0: sl@0: TPoint CColorAnimation::AbsoluteWindowPosition(TInt aWindowId/*=0*/) sl@0: { sl@0: if (iSingleWinForMultipleDSA) sl@0: { sl@0: return iCallBack.iCallBackWin->BaseWin()->AbsPosition(); sl@0: } sl@0: if (!aWindowId) sl@0: { sl@0: // Return the absolute position of iWindow, if Color Animation is not for Position Relative to Screen test. sl@0: return iWindow->BaseWin()->AbsPosition(); sl@0: } sl@0: else sl@0: { sl@0: // Return the absolute position of iWindow2, if it is for Position Relative to Screen test. sl@0: return iWindow2->BaseWin()->AbsPosition(); sl@0: } sl@0: } sl@0: sl@0: TInt CColorAnimation::DrawColorL(TAny* aAnimation) sl@0: { sl@0: STATIC_CAST(CColorAnimation*,aAnimation)->DrawColorL(); sl@0: return(KErrNone); sl@0: } sl@0: sl@0: TInt CColorAnimation::IdlingL(TAny* aAnimation) sl@0: { sl@0: (static_cast(aAnimation))->IdlingL(); sl@0: return(KErrNone); sl@0: } sl@0: sl@0: void CColorAnimation::StartL(TBool aChildWindow/*=EFalse*/) sl@0: { sl@0: iDrawer->StartL(); sl@0: TRect bounding=iDrawer->DrawingRegion()->BoundingRect(); sl@0: TRect window; sl@0: if (aChildWindow) sl@0: { sl@0: window.SetRect(AbsoluteWindowPosition(1),iWinSize); sl@0: } sl@0: else sl@0: { sl@0: window.SetRect(AbsoluteWindowPosition(),iWinSize); sl@0: } sl@0: // Check that the window contains the bounding area (a bounding rect of (0,0,0,0) shouldn't fail the test) sl@0: if (!(window.Contains(bounding.iTl) && window.Contains(bounding.iBr-TPoint(1,1))) && bounding.Size()!=TSize(0,0)) sl@0: { sl@0: iCallBack.Fail(); sl@0: // iDrawer->Cancel(); sl@0: // iDrawer->StartL(); sl@0: // bounding=iDrawer->DrawingRegion()->BoundingRect(); sl@0: } sl@0: if(!iRegionTrackingOnly) sl@0: { sl@0: iTimer->Start(0,iCallBack.TimerInterval(iId),TCallBack(CColorAnimation::DrawColorL,this)); sl@0: iDrawer->Gc()->SetPenStyle(CGraphicsContext::ENullPen); sl@0: iDrawer->Gc()->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: } sl@0: else sl@0: { sl@0: iTimer->Start(0,iCallBack.TimerInterval(iId),TCallBack(CColorAnimation::IdlingL,this)); sl@0: } sl@0: } sl@0: sl@0: void CColorAnimation::StartOrPanic() sl@0: { sl@0: TRAPD(err,StartL()); sl@0: if (err!=KErrNone) sl@0: { sl@0: iCallBack.LogLeave(err); sl@0: iCallBack.Fail(); sl@0: } sl@0: } sl@0: sl@0: void CColorAnimation::Stop() sl@0: { sl@0: iTimer->Cancel(); sl@0: iDrawer->Cancel(); sl@0: } sl@0: sl@0: void CColorAnimation::BringWindowToFront() sl@0: { sl@0: iWindow->WinTreeNode()->SetOrdinalPosition(0); sl@0: } sl@0: sl@0: void CColorAnimation::ChangeModeL(TDisplayMode aMode) sl@0: { sl@0: User::LeaveIfError(iWindow->BaseWin()->SetRequiredDisplayMode(aMode)); sl@0: TheClient->Flush(); sl@0: } sl@0: sl@0: void CColorAnimation::FinishTest() sl@0: { sl@0: iCallBack.Finished(iId); sl@0: } sl@0: sl@0: inline CDirectScreenAccess* CColorAnimation::GetDrawer() sl@0: { sl@0: return iDrawer; sl@0: } sl@0: sl@0: void CColorAnimation::DrawColorL() sl@0: { sl@0: TBool aFinished; sl@0: iDrawer->Gc()->SetBrushColor(iCallBack.BrushColorL(iId,iColor,aFinished)); sl@0: if (iSingleWinForMultipleDSA==1) sl@0: { sl@0: iDrawer->Gc()->DrawRect(iWinSize-TSize(iWinSize.iWidth/2,iWinSize.iHeight/2)); sl@0: } sl@0: else if (iSingleWinForMultipleDSA==2) sl@0: { sl@0: iDrawer->Gc()->DrawRect(TRect(TPoint(iWinSize.iWidth/2,iWinSize.iHeight/2),TSize(iWinSize.iWidth/2,iWinSize.iHeight/2))); sl@0: } sl@0: else sl@0: { sl@0: iDrawer->Gc()->DrawRect(iWinSize); sl@0: } sl@0: iDrawer->ScreenDevice()->Update(); sl@0: if (aFinished) sl@0: { sl@0: if (iId==1) sl@0: { sl@0: iWindow->SetSize(TSize(48,52)); sl@0: TheClient->Flush(); sl@0: } sl@0: if (aFinished==1) sl@0: Stop(); sl@0: iCallBack.Finished(iId); sl@0: } sl@0: } sl@0: sl@0: void CColorAnimation::IdlingL() sl@0: { sl@0: iIdling++; sl@0: if(iIdling == KMaxIdlingTime) sl@0: { sl@0: Stop(); sl@0: iIdling = 0; sl@0: if (iId == KRegionTrackingOnlyDsaWaitingForAbortSignal) sl@0: { sl@0: _LIT(KErrorAbortNotReceived,"DSA didn't get an abort signal even though the window was opened in front"); sl@0: CallBack().Log((TText8*)__FILE__,__LINE__, ESevrErr,KErrorAbortNotReceived); sl@0: CallBack().Fail(); sl@0: } sl@0: iCallBack.Finished(iId); sl@0: } sl@0: } sl@0: sl@0: void CColorAnimation::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/) sl@0: { sl@0: TInt slow=iCallBack.SlowStopping(iId,iCount); sl@0: switch (slow) sl@0: { sl@0: case eAbortAll: sl@0: iCallBack.Finished(iId); sl@0: case eAbort: sl@0: Stop(); sl@0: return; sl@0: case eStopDelayed: sl@0: User::After(750000); //0.75 secs sl@0: break; sl@0: default:; sl@0: } sl@0: ++iCount; sl@0: iTimer->Cancel(); sl@0: } sl@0: sl@0: void CColorAnimation::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/) sl@0: { sl@0: TRAPD(err,StartL()); sl@0: if (err!=KErrNone) sl@0: iCallBack.FailedReStart(iId,err); sl@0: } sl@0: sl@0: sl@0: /*CScrollingTextDrawer*/ sl@0: sl@0: CScrollingTextDrawer* CScrollingTextDrawer::NewL(TInt aScreenNumber,CFbsScreenDevice*& aDevice,CFbsBitGc& aGc) sl@0: { sl@0: CScrollingTextDrawer* self=new(ELeave) CScrollingTextDrawer(aDevice,aGc); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aScreenNumber); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CScrollingTextDrawer::~CScrollingTextDrawer() sl@0: { sl@0: if(iFontDevice) sl@0: { sl@0: iFontDevice->ReleaseFont(iFont); sl@0: delete iFontDevice; sl@0: } sl@0: } sl@0: sl@0: void CScrollingTextDrawer::ConstructL(TInt aScreenNumber) sl@0: { sl@0: iFontDevice=CFbsScreenDevice::NewL(aScreenNumber,iDevice->DisplayMode()); sl@0: _LIT(text,"ABCDEFGHIJKLMNOPQRSTUVWXYZ"); sl@0: iText=text; sl@0: CreateFontL(); sl@0: //iFirstChar=0; sl@0: iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: #if defined(LOGGING) sl@0: iWs.Connect(); sl@0: // point to correct screen sl@0: CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(iWs); sl@0: CleanupStack::PushL(screen); sl@0: User::LeaveIfError(screen->Construct(aScreenNumber)); sl@0: CleanupStack::Pop(screen); sl@0: sl@0: _LIT(KConstTextDrawer,"Constructed Text Drawer"); sl@0: LogMessageText.Copy(KConstTextDrawer); sl@0: iWs.LogMessage(LogMessageText); sl@0: iWs.Flush(); sl@0: sl@0: delete screen; sl@0: iWs.Close(); sl@0: #endif sl@0: } sl@0: sl@0: void CScrollingTextDrawer::CreateFontL() sl@0: { sl@0: TInt screenHeight=iDevice->SizeInPixels().iHeight; sl@0: TFontSpec fontSpec(FontName,screenHeight); sl@0: User::LeaveIfError(iFontDevice->GetNearestFontToDesignHeightInPixels(iFont,fontSpec)); sl@0: iGc->UseFont(iFont); sl@0: TInt fontHeight=iFont->HeightInPixels(); sl@0: iDrawRect.iTl.iY=(screenHeight-fontHeight)/2; sl@0: iDrawRect.iBr.iY=iDrawRect.iTl.iY+fontHeight; sl@0: iDrawHeight=iFont->AscentInPixels(); sl@0: iCharWidth=iFont->CharWidthInPixels(iText[iFirstChar]); sl@0: iDrawRect.iBr.iX=Max(iDevice->SizeInPixels().iWidth,iDevice->SizeInPixels().iHeight); sl@0: iDrawRect.iTl.iX=iDrawRect.iBr.iX-iCharWidth; sl@0: } sl@0: sl@0: void CScrollingTextDrawer::SetBottomOfTest(TInt aBottom) sl@0: { sl@0: if (iDrawRect.iBr.iY>aBottom) sl@0: { sl@0: iDrawRect.iTl.iY-=iDrawRect.iBr.iY-aBottom; sl@0: iDrawRect.iBr.iY=aBottom; sl@0: } sl@0: } sl@0: sl@0: void CScrollingTextDrawer::Scroll() sl@0: { sl@0: iCharWidth=iFont->CharWidthInPixels(iText[iFirstChar]); sl@0: iDrawRect.iTl.iX-=iJump; sl@0: iGc->DrawText(iText.Mid(iFirstChar),iDrawRect,iDrawHeight); sl@0: iDevice->Update(); sl@0: if (iDrawRect.iTl.iX<-iCharWidth) sl@0: { sl@0: if (++iFirstChar==iText.Length()) sl@0: { sl@0: iFirstChar=0; sl@0: iDrawRect.iTl.iX=iDevice->SizeInPixels().iWidth; sl@0: } sl@0: else sl@0: iDrawRect.iTl.iX+=iCharWidth; sl@0: iCharWidth=iFont->CharWidthInPixels(iText[iFirstChar]); sl@0: } sl@0: } sl@0: sl@0: sl@0: /*CScrollText*/ sl@0: sl@0: TInt CScrollText::DrawText(TAny* aAnimation) sl@0: { sl@0: STATIC_CAST(CScrollText*,aAnimation)->ScrollText(); sl@0: return(KErrNone); sl@0: } sl@0: sl@0: CScrollText* CScrollText::NewL(TInt aScreenNumber,TInt aId,CTWindowGroup& aParent,TInt aScrollJump,TBool aStart/*=EFalse*/) sl@0: { sl@0: CScrollText* self=new(ELeave) CScrollText(aId,aScrollJump,aScreenNumber); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aParent); sl@0: if (aStart) sl@0: self->StartL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CScrollText::~CScrollText() sl@0: { sl@0: delete iTimer; sl@0: delete iTextDraw; sl@0: iTextDraw=NULL; sl@0: delete iDrawer; sl@0: delete iWindow; sl@0: TheClient->Flush(); sl@0: } sl@0: sl@0: void CScrollText::ConstructL(CTWindowGroup& aParent) sl@0: { sl@0: iWindow=new(ELeave) CTBlankWindow(); sl@0: iWindow->ConstructL(aParent); sl@0: RWindowBase& win=*iWindow->BaseWin(); sl@0: win.Activate(); sl@0: iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,win,*this); sl@0: TheClient->Flush(); sl@0: iTimer=CPeriodic::NewL(0); sl@0: } sl@0: sl@0: void CScrollText::StartL() sl@0: { sl@0: DoContinueL(); sl@0: iDrawer->Gc()->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: if (!iTextDraw) sl@0: { sl@0: iTextDraw=CScrollingTextDrawer::NewL(iScreenNumber,iDrawer->ScreenDevice(),*iDrawer->Gc()); sl@0: iTextDraw->SetScrollJump(iScrollJump); sl@0: } sl@0: } sl@0: sl@0: void CScrollText::ContinueL() sl@0: { sl@0: DoContinueL(); sl@0: } sl@0: sl@0: void CScrollText::DoContinueL() sl@0: { sl@0: iTimer->Start(0,10000,TCallBack(CScrollText::DrawText,this)); sl@0: sl@0: //0.01secs sl@0: iDrawer->StartL(); sl@0: TRect bounding=iDrawer->DrawingRegion()->BoundingRect(); sl@0: #if defined(LOGGING) sl@0: _LIT(KBoundRect,"Continue Scroll Text Rect=(%d,%d,%d,%d)"); sl@0: LogMessageText.Zero(); sl@0: LogMessageText.AppendFormat(KBoundRect,bounding.iTl.iX,bounding.iTl.iY,bounding.iBr.iX,bounding.iBr.iY); sl@0: TheClient->iWs.LogMessage(LogMessageText); sl@0: TheClient->Flush(); sl@0: #endif sl@0: TRect window=TRect(iWindow->BaseWin()->AbsPosition(),iWindow->Size()); sl@0: if (!window.Contains(bounding.iTl) || !window.Contains(bounding.iBr-TPoint(1,1))) sl@0: AutoPanic(EAutoPanicTestFailed); sl@0: } sl@0: sl@0: void CScrollText::Stop() sl@0: { sl@0: iTimer->Cancel(); sl@0: iDrawer->Cancel(); sl@0: } sl@0: sl@0: void CScrollText::ScrollText() sl@0: { sl@0: iTextDraw->Scroll(); sl@0: } sl@0: sl@0: void CScrollText::AbortNow(RDirectScreenAccess::TTerminationReasons aReason) sl@0: { sl@0: iTimer->Cancel(); sl@0: if (!iCounting) sl@0: return; sl@0: if (iAbortCountDown>0) sl@0: --iAbortCountDown; sl@0: else sl@0: { sl@0: if (aReason==RDirectScreenAccess::ETerminateRegion) sl@0: { sl@0: User::After(1500000); //1.5secs sl@0: iAbortCountDown=7; sl@0: } sl@0: } sl@0: } sl@0: sl@0: void CScrollText::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/) sl@0: //This function is pure virtual and so cannot have an 'L' at the end of it's name sl@0: { sl@0: ContinueL(); sl@0: } sl@0: sl@0: /*CWindowWithChild*/ sl@0: sl@0: CWindowWithChild* CWindowWithChild::NewL(TInt aScreenNumber, CTWindowGroup& aParent,TBool aStart/*=EFalse*/) sl@0: { sl@0: CWindowWithChild* self=new(ELeave) CWindowWithChild(aScreenNumber); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aParent); sl@0: if (aStart) sl@0: self->StartL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CWindowWithChild::~CWindowWithChild() sl@0: { sl@0: delete iDrawer; sl@0: delete iChildWindow; sl@0: delete iWindow; sl@0: TheClient->Flush(); sl@0: } sl@0: sl@0: void CWindowWithChild::ConstructL(CTWindowGroup& aParent) sl@0: { sl@0: iWindow=new(ELeave) CTBlankWindow(); sl@0: iWindow->ConstructL(aParent); sl@0: sl@0: iChildWindow = new(ELeave) CTWin(); sl@0: iChildWindow->ConstructWin(*iWindow); sl@0: sl@0: iChildWindow->SetExt(TPoint(0,0), TSize(4,4)); sl@0: RWindowBase& cwin=*iChildWindow->BaseWin(); sl@0: cwin.Activate(); sl@0: sl@0: RWindowBase& win=*iWindow->BaseWin(); sl@0: win.Activate(); sl@0: sl@0: iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,win,*this); sl@0: sl@0: TheClient->Flush(); sl@0: } sl@0: sl@0: void CWindowWithChild::StartL() sl@0: { sl@0: DoContinueL(); sl@0: } sl@0: sl@0: void CWindowWithChild::ContinueL() sl@0: { sl@0: DoContinueL(); sl@0: } sl@0: sl@0: void CWindowWithChild::DoContinueL() sl@0: { sl@0: iDrawer->StartL(); sl@0: iRunning = ETrue; sl@0: } sl@0: sl@0: void CWindowWithChild::Stop() sl@0: { sl@0: iDrawer->Cancel(); sl@0: } sl@0: sl@0: void CWindowWithChild::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/) sl@0: { sl@0: iRunning = EFalse; sl@0: } sl@0: sl@0: void CWindowWithChild::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/) sl@0: //This function is pure virtual and so cannot have an 'L' at the end of it's name sl@0: { sl@0: ContinueL(); sl@0: } sl@0: sl@0: void CWindowWithChild::PerformCoverageCalls() sl@0: { sl@0: //add coverage to commands with no/partial coverage sl@0: RWindow& cwin=*iChildWindow->Win(); sl@0: TInt priority = 0; sl@0: sl@0: cwin.SetPointerCapturePriority(priority); sl@0: __ASSERT_ALWAYS(cwin.GetPointerCapturePriority()==priority, User::Invariant()); sl@0: cwin.ClaimPointerGrab(EFalse); sl@0: cwin.EnableBackup(0); sl@0: __ASSERT_ALWAYS(cwin.PrevSibling()==0, User::Invariant()); sl@0: cwin.Invalidate(TRect(0, 0, 10, 10)); sl@0: cwin.FadeBehind(ETrue); sl@0: TheClient->Flush(); sl@0: // cover (empty) False condition in CWsWindow::SetFadeBehind sl@0: cwin.FadeBehind(ETrue); sl@0: TheClient->Flush(); sl@0: } sl@0: sl@0: /*CWsBase*/ sl@0: sl@0: void CWsBase::ConstructL(TInt aScreenNumber, TInt aHandle) sl@0: { sl@0: User::LeaveIfError(iWs.Connect()); sl@0: iScrDev=new(ELeave) CWsScreenDevice(iWs); sl@0: User::LeaveIfError(iScrDev->Construct(aScreenNumber)); sl@0: iGroup=RWindowGroup(iWs); sl@0: User::LeaveIfError(iGroup.Construct(aHandle,EFalse)); sl@0: iGroup.SetOrdinalPosition(0,KMainTestBaseWindow); sl@0: } sl@0: sl@0: void CWsBase::CreateBlankWindowL(RBlankWindow& iWin,TInt aHandle) sl@0: { sl@0: iWin=RBlankWindow(iWs); sl@0: User::LeaveIfError(iWin.Construct(iGroup,aHandle)); sl@0: } sl@0: sl@0: CWsBase::~CWsBase() sl@0: { sl@0: iGroup.Close(); sl@0: delete iScrDev; sl@0: iWs.Close(); sl@0: } sl@0: sl@0: sl@0: /*CAnimating*/ sl@0: sl@0: TInt CAnimating::StartLC(TAny* aScreenNumber) sl@0: { sl@0: CAnimating* self=new(ELeave) CAnimating(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL((TInt)aScreenNumber); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void CAnimating::ConstructL(TInt aScreenNumber) sl@0: { sl@0: CWsBase::ConstructL(aScreenNumber,798); sl@0: #if defined(LOGGING) sl@0: _LIT(KAnimate1,"Constructed CWsBase"); sl@0: LogMessageText.Copy(KAnimate1); sl@0: iWs.LogMessage(LogMessageText); sl@0: iWs.Flush(); sl@0: #endif sl@0: iGroup.EnableReceiptOfFocus(EFalse); sl@0: CreateBlankWindowL(iWindow,799); sl@0: User::LeaveIfError(iWindow.SetRequiredDisplayMode(EGray16)); sl@0: iWindow.Activate(); sl@0: #if defined(LOGGING) sl@0: _LIT(KAnimate2,"Set up Windows"); sl@0: LogMessageText.Copy(KAnimate2); sl@0: iWs.LogMessage(LogMessageText); sl@0: #endif sl@0: iWs.Flush(); sl@0: TDisplayMode displayMode=CWsBase::iScrDev->DisplayMode(); sl@0: if (displayModeCreateContext(iGc)); sl@0: #if defined(LOGGING) sl@0: _LIT(KAnimate3,"Created Screen Device"); sl@0: LogMessageText.Copy(KAnimate3); sl@0: iWs.LogMessage(LogMessageText); sl@0: iWs.Flush(); sl@0: #endif sl@0: iDirect=CDirectScreenAccessOld::NewL(iWs,*this); sl@0: iTimer=CPeriodic::NewL(0); sl@0: User::LeaveIfError(iControlSem.OpenGlobal(SemControl,EOwnerThread)); //Must be thread relative, since it won't get cleaned up when the thread is killed otherwise sl@0: User::LeaveIfError(iControlQueue.OpenGlobal(QueueControl,EOwnerThread)); //Must be thread relative, since it won't get cleaned up when the thread is killed otherwise sl@0: iSemCreated=ETrue; sl@0: #if defined(LOGGING) sl@0: _LIT(KAnimate5,"Created Direct, Timer and Semaphore"); sl@0: LogMessageText.Copy(KAnimate5); sl@0: iWs.LogMessage(LogMessageText); sl@0: iWs.Flush(); sl@0: #endif sl@0: iScrSize=iScrDev->SizeInPixels(); sl@0: iGc->SetPenStyle(CGraphicsContext::ENullPen); sl@0: iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: StartAnimatingL(); sl@0: #if defined(LOGGING) sl@0: _LIT(KAnimate6,"Started Animation"); sl@0: LogMessageText.Copy(KAnimate6); sl@0: iWs.LogMessage(LogMessageText); sl@0: iWs.Flush(); sl@0: #endif sl@0: } sl@0: sl@0: CAnimating::~CAnimating() sl@0: //This function should never actually get run in practice sl@0: { sl@0: if (iSemCreated) sl@0: { sl@0: iControlSem.Close(); sl@0: iControlQueue.Close(); sl@0: } sl@0: if (iDrawingRegion) sl@0: iDrawingRegion->Destroy(); sl@0: delete iTimer; sl@0: delete iDirect; sl@0: delete iGc; sl@0: delete iScrDev; sl@0: iWindow.Close(); sl@0: } sl@0: sl@0: void CAnimating::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/) sl@0: { sl@0: iTimer->Cancel(); sl@0: iControlSem.Signal(); sl@0: TInt data = 2; sl@0: iControlQueue.Send(&data,sizeof(TInt)); sl@0: User::After(10000000); //10 secs sl@0: } sl@0: sl@0: TInt NextColor(TAny* aAnimation) sl@0: { sl@0: STATIC_CAST(CAnimating*,aAnimation)->DrawFrame(); sl@0: return(KErrNone); sl@0: } sl@0: sl@0: void CAnimating::DrawFrame() sl@0: { sl@0: iColor=(iColor+3)%16; sl@0: iGc->SetBrushColor(TRgb::Gray16(iColor)); sl@0: iGc->DrawRect(iScrSize); sl@0: iScrDev->Update(); sl@0: if (iColor==2) sl@0: { sl@0: iControlSem.Signal(); sl@0: TInt data = 1; sl@0: iControlQueue.Send(&data,sizeof(TInt)); sl@0: } sl@0: } sl@0: sl@0: void CAnimating::StartAnimatingL() sl@0: { sl@0: iTimer->Start(0,150000,TCallBack(NextColor,this)); //0.15 secs sl@0: sl@0: User::LeaveIfError(iDirect->Request(iDrawingRegion,iWindow)); sl@0: iGc->SetClippingRegion(iDrawingRegion); sl@0: } sl@0: sl@0: sl@0: /*CMoveWindow*/ sl@0: sl@0: TInt CMoveWindow::StartLC(TAny* aScreenNumber) sl@0: { sl@0: CMoveWindow* self=new(ELeave) CMoveWindow(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL((TInt)aScreenNumber); sl@0: return KErrNone; sl@0: } sl@0: sl@0: TInt CMoveWindow::FlipChange(TAny* aMoveWin) sl@0: { sl@0: Cast(aMoveWin)->FlipChange(); sl@0: return(KErrNone); sl@0: } sl@0: sl@0: TInt CMoveWindow::StateChange(TAny* aMoveWin) sl@0: { sl@0: Cast(aMoveWin)->StateChange(); sl@0: return(KErrNone); sl@0: } sl@0: sl@0: CMoveWindow::~CMoveWindow() sl@0: { sl@0: delete iStateTimer; sl@0: delete iTimer; sl@0: iWindow.Close(); sl@0: iBackUpWin.Close(); sl@0: delete iGc; sl@0: } sl@0: sl@0: TInt MoveWin(TAny* aMoveWin) sl@0: { sl@0: STATIC_CAST(CMoveWindow*,aMoveWin)->MoveWindow(); sl@0: return(KErrNone); sl@0: } sl@0: sl@0: void CMoveWindow::ConstructL(TInt aScreenNumber) sl@0: { sl@0: CWsBase::ConstructL(aScreenNumber,898); sl@0: iBounceArea=TRect(iScrDev->SizeInPixels()); sl@0: iSize.iHeight=iBounceArea.iBr.iY/5; sl@0: iSize.iWidth=iBounceArea.iBr.iX/5; sl@0: iBounceArea.iTl.iX=iBounceArea.iBr.iX/6; sl@0: iBounceArea.iBr.iX=5*iBounceArea.iBr.iX/6; sl@0: iBounceArea.iTl.iY=iBounceArea.iBr.iY/4; sl@0: iBounceArea.iBr.iY=3*iBounceArea.iBr.iY/4; sl@0: iDelta=TSize(3,3); sl@0: iTl=iBounceArea.iTl; sl@0: CreateBlankWindowL(iWindow,899); sl@0: iWindow.SetExtent(iTl,iSize); sl@0: iWindow.SetShadowDisabled(ETrue); sl@0: iWindow.SetColor(TRgb::Gray4(2)); sl@0: iWindow.Activate(); sl@0: iBackUpWin=RBackedUpWindow(iWs); sl@0: User::LeaveIfError(iBackUpWin.Construct(iGroup,EGray4,698)); sl@0: User::LeaveIfError(iBackUpWin.SetSizeErr(TSize(2,2))); sl@0: iGc=new(ELeave) CWindowGc(iScrDev); sl@0: User::LeaveIfError(iGc->Construct()); sl@0: iDisplayMode=EGray4; sl@0: if (MoveInterval>TTimeIntervalMicroSeconds32(0)) sl@0: CreateTimerL(); sl@0: if (ModeInterval>TTimeIntervalMicroSeconds32(0)) sl@0: { sl@0: iStateTimer=CPeriodic::NewL(0); sl@0: iStateTimer->Start(ModeInterval,ModeInterval,TCallBack(CMoveWindow::StateChange,this)); sl@0: } sl@0: if (FlipInterval>TTimeIntervalMicroSeconds32(0)) sl@0: { sl@0: iDevice=new(ELeave) CWsScreenDevice(iWs); sl@0: User::LeaveIfError(iDevice->Construct(aScreenNumber)); sl@0: iNumOfModes=iDevice->NumScreenModes(); sl@0: if (iNumOfModes>1) sl@0: { sl@0: iFlipTimer=CPeriodic::NewL(0); sl@0: iFlipTimer->Start(FlipInterval,FlipInterval,TCallBack(CMoveWindow::FlipChange,this)); sl@0: } sl@0: } sl@0: iStateCountDown=0; sl@0: } sl@0: sl@0: void CMoveWindow::CreateTimerL() sl@0: { sl@0: iTimer=CPeriodic::NewL(0); sl@0: iTimer->Start(0,MoveInterval,TCallBack(MoveWin,this)); sl@0: sl@0: } sl@0: sl@0: void CMoveWindow::MoveWindow() sl@0: { sl@0: if (--iStateCountDown>=0) sl@0: { sl@0: if (iStateCountDown==2) sl@0: ToggleDisplayMode(); sl@0: return; sl@0: } sl@0: TPoint iBr=iTl+iSize; sl@0: TSize iDeltaSize; sl@0: if ((iDelta.iHeight<0 && iTl.iY<=iBounceArea.iTl.iY) || (iDelta.iHeight>0 && iBr.iY>=iBounceArea.iBr.iY)) sl@0: { sl@0: iDelta.iHeight=-iDelta.iHeight; sl@0: iDeltaSize.iWidth=2; sl@0: } sl@0: if ((iDelta.iWidth<0 && iTl.iX<=iBounceArea.iTl.iX) || (iDelta.iWidth>0 && iBr.iX>=iBounceArea.iBr.iX)) sl@0: { sl@0: iDelta.iWidth=-iDelta.iWidth; sl@0: if (iDeltaSize.iWidth==0) sl@0: iDeltaSize.iHeight=2; sl@0: else sl@0: iDeltaSize.iWidth=0; sl@0: } sl@0: iTl+=iDelta; sl@0: iSize+=iDeltaSize; sl@0: iWindow.SetExtent(iTl,iSize); sl@0: iWs.Flush(); sl@0: } sl@0: sl@0: void CMoveWindow::StateChange() sl@0: { sl@0: if (ImmediateModeSwitch>1) sl@0: { sl@0: if (MoveInterval>TTimeIntervalMicroSeconds32(0) && iTimer==NULL) sl@0: { sl@0: TRAPD(err,CreateTimerL()); sl@0: if (err==KErrNone) sl@0: ImmediateModeSwitch=ETrue; sl@0: } sl@0: } sl@0: if (ImmediateModeSwitch || MoveInterval==TTimeIntervalMicroSeconds32(0)) sl@0: ToggleDisplayMode(); sl@0: else sl@0: { sl@0: if (iStateCountDown<-8) sl@0: iStateCountDown=6; sl@0: } sl@0: } sl@0: sl@0: void CMoveWindow::ToggleDisplayMode() sl@0: { sl@0: if(iDisplayMode==EColor16MU) sl@0: { sl@0: return; //Test probably doesn't work with mode EColor16MU sl@0: } sl@0: iDisplayMode=(iDisplayMode==EColor16M ? EGray4:EColor16M); sl@0: #if defined(LOGGING) sl@0: TInt newMode= sl@0: #endif sl@0: iWindow.SetRequiredDisplayMode(iDisplayMode); sl@0: iGc->Activate(iBackUpWin); sl@0: iBackUpWin.SetPosition(iDisplayMode==EColor16M ? TPoint(1,0):TPoint(0,1)); sl@0: #if defined(LOGGING) sl@0: TDisplayMode curentMode=iScrDev->DisplayMode(); sl@0: _LIT(KToggleMode,"Toggle Display Mode Mode=%d Window=%d Actual=%d"); sl@0: LogMessageText.Zero(); sl@0: LogMessageText.AppendFormat(KToggleMode,(TInt&)iDisplayMode,newMode,(TInt&)curentMode); sl@0: iWs.LogMessage(LogMessageText); sl@0: //iWs.LogCommand(RWsSession::ELoggingStatusDump); sl@0: #endif sl@0: iWs.Flush(); sl@0: iGc->Deactivate(); sl@0: } sl@0: sl@0: void CMoveWindow::FlipChange() sl@0: { sl@0: if (++iCurrentMode==2) //flip between modes 0 and 1 sl@0: iCurrentMode=0; sl@0: iDevice->SetScreenMode(iCurrentMode); sl@0: iWs.Flush(); sl@0: } sl@0: sl@0: // sl@0: // CBugFixColorAnimation sl@0: // sl@0: // This class is used for reproducing a defect found on 6.1: KAA-5J3BLW "Unnecessary Wserv's DSA abort". sl@0: // The problem was that a direct screen access client was getting an unnecessary abort notification sl@0: // when a new window (or window group) was created but not visible. sl@0: // This class will simulate the direct screen access client and it will check whether the first DSA abort sl@0: // is not caused by just creating a window. sl@0: sl@0: CBugFixColorAnimation* CBugFixColorAnimation::NewL(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack,CTWindowGroup& aParent,TRect aExtent,TBool aStart) sl@0: { sl@0: CBugFixColorAnimation* self=new(ELeave) CBugFixColorAnimation(aScreenNumber, aId,aCallBack); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aParent,aExtent); sl@0: if (aStart) sl@0: { sl@0: self->StartL(); sl@0: self->Started(); sl@0: } sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CBugFixColorAnimation::CBugFixColorAnimation(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack) sl@0: : CColorAnimation(aScreenNumber, aId, aCallBack) sl@0: { sl@0: iThreadParam.iScreenNumber = aScreenNumber; sl@0: } sl@0: sl@0: CBugFixColorAnimation::~CBugFixColorAnimation() sl@0: { sl@0: iSem.Close(); sl@0: if(iThread) sl@0: { sl@0: TRequestStatus status; sl@0: iThread->Logon(status); sl@0: if (iThread->StillAlive()) sl@0: { sl@0: iThread->Terminate(KErrNone); sl@0: User::WaitForRequest(status); sl@0: } sl@0: delete iThread; sl@0: } sl@0: iTestFailed->Cancel(); sl@0: delete iTestFailed; sl@0: } sl@0: sl@0: sl@0: LOCAL_D TInt TestFailed(TAny* aAnimation) sl@0: { sl@0: CBugFixColorAnimation* anim=reinterpret_cast(aAnimation); sl@0: TRAP_IGNORE( sl@0: anim->Stop(); sl@0: anim->CallBack().Fail(); sl@0: anim->FinishTest(); sl@0: ); sl@0: return KErrNone; sl@0: } sl@0: sl@0: LOCAL_D TInt CreateNewWindowGroup(TAny* aParam) sl@0: { sl@0: TDirectThreadParam* param = (TDirectThreadParam*)aParam; sl@0: TRect rect = param->iRect; sl@0: TBool isInFront = param->iIsInFront; sl@0: RWsSession ws; sl@0: TInt error=ws.Connect(); sl@0: sl@0: CWsScreenDevice* screen = NULL; sl@0: TRAP(error, screen = new (ELeave) CWsScreenDevice(ws)); sl@0: if (error!=KErrNone) sl@0: { sl@0: ws.Close(); sl@0: RThread::Rendezvous(error); sl@0: return error; sl@0: } sl@0: sl@0: if ((error=screen->Construct(param->iScreenNumber))!=KErrNone) sl@0: { sl@0: delete screen; sl@0: ws.Close(); sl@0: RThread::Rendezvous(error); sl@0: return error; sl@0: } sl@0: RSemaphore sem; sl@0: error = sem.OpenGlobal(KSem_DefectFix_KAA_5J3BLW_Name, EOwnerThread); sl@0: if (error!=KErrNone) sl@0: { sl@0: ws.Close(); sl@0: RThread::Rendezvous(error); sl@0: return error; sl@0: } sl@0: sl@0: RThread::Rendezvous(KErrNone); sl@0: sl@0: // wait for the dsa to start before creating the new window group sl@0: sem.Wait(); sl@0: sem.Close(); sl@0: sl@0: sl@0: RWindowGroup group(ws); sl@0: group.Construct(431,EFalse); sl@0: if(isInFront) sl@0: { sl@0: group.SetOrdinalPosition(0,KAboveMainTestBaseWindow); sl@0: } sl@0: else sl@0: { sl@0: group.SetOrdinalPosition(2); sl@0: } sl@0: RWindow window(ws); sl@0: error=window.Construct(group, 432); sl@0: if (error==KErrNone) sl@0: { sl@0: window.SetExtentErr(rect.iTl, rect.Size()); sl@0: window.SetOrdinalPosition(0,0); sl@0: ws.Flush(); sl@0: window.Activate(); sl@0: ws.Flush(); sl@0: if(!isInFront) sl@0: { sl@0: group.SetOrdinalPosition(-1); sl@0: } sl@0: ws.Flush(); sl@0: //Wait for wserv to render new window on top of the existing DSA region. sl@0: ws.Finish(); sl@0: //Now the window has been rendered (and DSA should have been aborted). sl@0: window.Close(); sl@0: } sl@0: sl@0: group.Close(); sl@0: delete screen; sl@0: ws.Close(); sl@0: return error; sl@0: } sl@0: sl@0: void CBugFixColorAnimation::ConstructL(CTWindowGroup& aParent,TRect aExtent) sl@0: { sl@0: CColorAnimation::ConstructL(aParent, aExtent,KDrawingDsa); sl@0: _LIT(ThreadName,"Create new Window"); sl@0: iAnimRect=aExtent; sl@0: TInt error=iSem.CreateGlobal(KSem_DefectFix_KAA_5J3BLW_Name, 0); sl@0: if (error==KErrNone) sl@0: { sl@0: iThreadParam.iRect = iAnimRect; sl@0: iThreadParam.iIsInFront = EFalse; sl@0: TThreadStartUp function=TThreadStartUp(CreateNewWindowGroup, &iThreadParam); sl@0: TRequestStatus status; sl@0: iThread=CProcess::NewThreadRendezvousL(ThreadName,&function, status); sl@0: User::WaitForRequest(status); sl@0: if (status != KErrNone) sl@0: { sl@0: RDebug::Printf("the request status is returned to be non KErrNone: %d", status.Int()); sl@0: TestFailed(this); sl@0: } sl@0: iTestFailed = CIdle::NewL(0); sl@0: } sl@0: else sl@0: { sl@0: TestFailed(this); sl@0: } sl@0: } sl@0: sl@0: void CBugFixColorAnimation::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/) sl@0: { sl@0: Stop(); sl@0: if (!iTestFailed->IsActive()) sl@0: { sl@0: iTestFailed->Start(TCallBack(TestFailed,this)); sl@0: } sl@0: } sl@0: sl@0: void CBugFixColorAnimation::Restart(RDirectScreenAccess::TTerminationReasons aReason) sl@0: { sl@0: AbortNow(aReason); sl@0: } sl@0: sl@0: TInt CPanicDirect::DoTestOnNewSchedulerL(TInt aInt, TAny* aPtr) sl@0: { sl@0: CActiveScheduler* activeScheduler=new(ELeave) CActiveScheduler; sl@0: CActiveScheduler::Install(activeScheduler); sl@0: CleanupStack::PushL(activeScheduler); sl@0: DoTestNowL(aInt,aPtr); sl@0: CleanupStack::PopAndDestroy(activeScheduler); sl@0: return(EWsExitReasonBad); //calls to this method currently all ignore the return code anyway. sl@0: } sl@0: sl@0: TInt CPanicDirect::DoTestOnNewScheduler(TInt aInt, TAny* aPtr) sl@0: { sl@0: TInt rv=EWsExitReasonBad; sl@0: TRAP_IGNORE(rv=DoTestOnNewSchedulerL(aInt,aPtr)); sl@0: return(rv); //calls to this method currently all ignore the return code anyway. sl@0: } sl@0: sl@0: void CPanicDirect::DoTestNowL(TInt aInt, TAny* aPtr) sl@0: { sl@0: CPanicDirect* self=new(ELeave) CPanicDirect(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL((TInt)aPtr, aInt); sl@0: self->TestL(); sl@0: CleanupStack::PopAndDestroy(self); sl@0: } sl@0: sl@0: void CPanicDirect::ConstructL(TInt aScreenNumber, TInt aInt) sl@0: { sl@0: iScreenNumber = aScreenNumber; sl@0: sl@0: User::LeaveIfError(iTimer.CreateLocal()); sl@0: User::LeaveIfError(iWs.Connect()); sl@0: iWsScrDev=new(ELeave) CWsScreenDevice(iWs); sl@0: User::LeaveIfError(iWsScrDev->Construct(iScreenNumber)); sl@0: sl@0: #if defined(LOGGING) sl@0: _LIT(KPanicThead1,"PanicThread: Into ConstructL"); sl@0: LogMessageText.Copy(KPanicThead1); sl@0: iWs.LogMessage(LogMessageText); sl@0: iWs.Flush(); sl@0: #endif sl@0: iGroup=RWindowGroup(iWs); sl@0: User::LeaveIfError(iGroup.Construct(2200+aInt,EFalse)); sl@0: iGroup.SetOrdinalPosition(0,KPanicTestOrdinalPriority); sl@0: iBlankWin=RBlankWindow(iWs); sl@0: User::LeaveIfError(iBlankWin.Construct(iGroup,2300+aInt)); sl@0: iBlankWin.Activate(); sl@0: iDirect=RDirectScreenAccess(iWs); sl@0: User::LeaveIfError(iDirect.Construct()); sl@0: iDisplayMode=iWsScrDev->DisplayMode(); sl@0: #if defined(LOGGING) sl@0: _LIT(KPanicThead2,"PanicThread: Creating Screen Device, Mode=%d"); sl@0: LogMessageText.Format(KPanicThead2,iDisplayMode); sl@0: iWs.LogMessage(LogMessageText); sl@0: iWs.Flush(); sl@0: #endif sl@0: iScreenDevice=CFbsScreenDevice::NewL(aScreenNumber,iDisplayMode); sl@0: #if defined(LOGGING) sl@0: _LIT(KPanicThead3,"PanicThread: Created Device"); sl@0: LogMessageText.Copy(KPanicThead3); sl@0: iWs.LogMessage(LogMessageText); sl@0: iWs.Flush(); sl@0: #endif sl@0: User::LeaveIfError(iScreenDevice->CreateContext(iGc)); sl@0: #if defined(LOGGING) sl@0: _LIT(KPanicThead4,"PanicThread: Created Context"); sl@0: LogMessageText.Copy(KPanicThead4); sl@0: iWs.LogMessage(LogMessageText); sl@0: iWs.Flush(); sl@0: #endif sl@0: iTextDraw=CScrollingTextDrawer::NewL(iScreenNumber,iScreenDevice,*iGc); sl@0: #if defined(LOGGING) sl@0: _LIT(KPanicThead5,"PanicThread: Created ScrollDrawer"); sl@0: LogMessageText.Copy(KPanicThead5); sl@0: iWs.LogMessage(LogMessageText); sl@0: iWs.Flush(); sl@0: #endif sl@0: iTextDraw->SetScrollJump(4); sl@0: #if defined(LOGGING) sl@0: _LIT(KCreatedDrawer,"PanicThread: CreatedDrawer"); sl@0: LogMessageText.Copy(KCreatedDrawer); sl@0: iWs.LogMessage(LogMessageText); sl@0: iWs.Flush(); sl@0: #endif sl@0: iTestNo=aInt; sl@0: } sl@0: sl@0: CPanicDirect::~CPanicDirect() sl@0: { sl@0: iDirect.Close(); sl@0: delete iGc; sl@0: delete iScreenDevice; sl@0: delete iTextDraw; sl@0: iBlankWin.Close(); sl@0: iGroup.Close(); sl@0: delete iWsScrDev; sl@0: iWs.Close(); sl@0: if (iRegion) sl@0: iRegion->Close(); sl@0: iTimer.Close(); sl@0: } sl@0: sl@0: void CPanicDirect::TestL() sl@0: { sl@0: if (iTestNo==2) sl@0: { sl@0: iDirect.Completed(); sl@0: return; sl@0: } sl@0: TInt err=iDirect.Request(iRegion,iDirectStatus,iBlankWin); sl@0: if (err!=KErrNone || !iRegion) sl@0: return; sl@0: TRect screen(iScreenDevice->SizeInPixels()); sl@0: TRect bounding=iRegion->BoundingRect(); sl@0: if (!screen.Contains(bounding.iTl) || !screen.Contains(bounding.iBr-TPoint(1,1))) sl@0: goto Cancel; sl@0: iGc->SetClippingRegion(iRegion); sl@0: iDrawingAllowed=ETrue; sl@0: iTimer.After(iTimerStatus,50000); //0.05secs sl@0: FOREVER sl@0: { sl@0: User::WaitForRequest(iDirectStatus,iTimerStatus); sl@0: if (iDirectStatus!=KRequestPending) sl@0: iDrawingAllowed=EFalse; sl@0: else if (iTimerStatus!=KRequestPending) sl@0: { sl@0: if (iDrawingAllowed) sl@0: DoDrawingL(); sl@0: iTimer.After(iTimerStatus,50000); //0.05secs sl@0: } sl@0: else sl@0: { sl@0: Cancel: sl@0: iDirect.Cancel(); sl@0: return; sl@0: } sl@0: } sl@0: } sl@0: sl@0: void CPanicDirect::DoDrawingL() sl@0: { sl@0: ++iCount; sl@0: iTextDraw->Scroll(); sl@0: if (iTestNo==1 && iCount==8) sl@0: { sl@0: iDirect.Request(iRegion,iDirectStatus,iBlankWin); sl@0: return; sl@0: } sl@0: if (iTestNo==3 && iCount==12) sl@0: { sl@0: iDirect.Completed(); sl@0: iDirect.Completed(); sl@0: return; sl@0: } sl@0: if (iTestNo==4 && iCount==16) sl@0: { sl@0: iBlankWin.SetSize(TSize(20,25)); sl@0: delete iRegion; sl@0: User::LeaveIfError(iDirect.Request(iRegion,iDirectStatus,iBlankWin)); sl@0: return; sl@0: } sl@0: if (iTestNo==5 && iCount==19) sl@0: { sl@0: iWs.Close(); sl@0: return; sl@0: } sl@0: } sl@0: sl@0: sl@0: /*CTDirect*/ sl@0: sl@0: CTDirect::CTDirect(CTestStep* aStep): sl@0: CTWsGraphicsBase(aStep) sl@0: { sl@0: iState = 0; sl@0: iNextFrameFinished = ETrue; sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: sl@0: CTDirect::~CTDirect() sl@0: { sl@0: DeleteMoveWindow(); sl@0: DeleteScroll(); sl@0: sl@0: delete iAnim; sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: delete iCallBackWin; sl@0: // put focus back to current screen as this test changed the focus screen to primary screen sl@0: TheClient->iWs.SetFocusScreen(iTest->iScreenNumber); sl@0: } sl@0: sl@0: void CTDirect::ConstructL() sl@0: { sl@0: _LIT(KCTDirectConstructL,"AUTO Construct Direct Test"); sl@0: LOG_MESSAGE(KCTDirectConstructL); sl@0: FullScreenModeSize=TheClient->iScreen->SizeInPixels(); sl@0: iIsScalingSupported=CheckScalingSupportedOrNot(); sl@0: iNumOfCallBack=0; sl@0: iCallBackWin=new(ELeave) CTBlankWindow; sl@0: iCallBackWin->ConstructL(*TheClient->iGroup); sl@0: User::LeaveIfError(iCallBackWin->BaseWin()->SetRequiredDisplayMode(EColor256)); sl@0: iCallBackWin->SetExt(TPoint(),TheClient->iScreen->SizeInPixels()); sl@0: iCallBackWin->SetVisible(EFalse); sl@0: iCallBackWin->Activate(); sl@0: // the following line makes sure that a console object hidden outside of sl@0: // screens range doesn't affect test results being on top of tested objects sl@0: TheClient->iGroup->GroupWin()->SetOrdinalPosition(0, KMainTestBaseWindow); sl@0: } sl@0: sl@0: void CTDirect::ConstrucBlankWindowL() sl@0: { sl@0: delete iWin; sl@0: iWin=new(ELeave) CTBlankWindow; sl@0: iWin->ConstructL(*TheClient->iGroup); sl@0: iWin->BaseWin()->SetShadowDisabled(ETrue); sl@0: iWin->BaseWin()->Activate(); sl@0: TheClient->Flush(); sl@0: } sl@0: sl@0: void CTDirect::InitialiseAnimationL() sl@0: { sl@0: ConstrucBlankWindowL(); sl@0: TInt colors,greys; sl@0: TDisplayMode dispMode=TheClient->iWs.GetDefModeMaxNumColors(colors,greys); sl@0: iScrDev=CFbsScreenDevice::NewL(iTest->iScreenNumber,dispMode); sl@0: User::LeaveIfError(iScrDev->CreateContext(iGc)); sl@0: INFO_PRINTF1(_L(" Constructed Screen Device")); sl@0: iScrSize=iScrDev->SizeInPixels(); sl@0: TFontSpec fontSpec(FontName,iScrSize.iHeight); sl@0: fontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold); sl@0: User::LeaveIfError(iScrDev->GetNearestFontToDesignHeightInPixels(iFont,fontSpec)); sl@0: iGc->UseFont(iFont); sl@0: iFlags|=eFontSet; sl@0: iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TInt fontHeight=iFont->HeightInPixels(); sl@0: iDrawRect.iTl.iY=(iScrSize.iHeight-fontHeight)/2; sl@0: iDrawRect.SetHeight(fontHeight); sl@0: iDrawHeight=iFont->AscentInPixels(); sl@0: TSize winSize(25,20); sl@0: iWin2=new(ELeave) CTBlankWindow; sl@0: iWin2->ConstructL(*TheClient->iGroup); sl@0: iWin2->SetExt(TPoint((iScrSize.iWidth-winSize.iWidth)/2,(iScrSize.iHeight-winSize.iHeight)/2),winSize); sl@0: iWin2->SetColor(TRgb::Gray4(2)); sl@0: iWin2->BaseWin()->Activate(); sl@0: INFO_PRINTF1(_L(" Setup Window")); sl@0: iScrDev->Update(); sl@0: TheClient->iWs.Finish(); sl@0: sl@0: User::LeaveIfError(iControlSem.CreateGlobal(SemControl,0,KOwnerType)); sl@0: User::LeaveIfError(iControlQueue.CreateGlobal(QueueControl,1,sizeof(TInt),KOwnerType)); sl@0: sl@0: iFlags|=eDirectControlSem; sl@0: User::LeaveIfError(iWinSem.CreateGlobal(SemNextOp,0,KOwnerType)); sl@0: iFlags|=eDirectWindowSem; sl@0: iProcess=CProcess::NewTL(CProcess::eProcessDirectTest,iTest->iScreenNumber,&iThreadStatus); sl@0: INFO_PRINTF1(_L(" Constructed Semaphores & Thread")); sl@0: iControlSem.Wait(); sl@0: sl@0: iTimer=CPeriodic::NewL(iTest->EAutoTestPriority); sl@0: iRestart=CIdle::NewL(iTest->EAutoTestPriority+5); sl@0: iDirect=CDirectScreenAccessOld::NewL(TheClient->iWs,*this); sl@0: } sl@0: sl@0: void CTDirect::DestroyAnimation() sl@0: { sl@0: ResetScreenSizeMode(); sl@0: if(iProcess && iProcess->StillAlive()) sl@0: { sl@0: if (iFlags&eDirectControlSem) sl@0: { sl@0: iControlSem.Signal(); sl@0: TInt data = 3; sl@0: iControlQueue.Send(&data,sizeof(TInt)); sl@0: } sl@0: if (iFlags&eDirectWindowSem) sl@0: iWinSem.Signal(); sl@0: } sl@0: sl@0: delete iTimer; sl@0: iTimer=NULL; sl@0: delete iRestart; sl@0: iRestart=NULL; sl@0: delete iDirect; sl@0: iDirect=NULL; sl@0: delete iChangeScreenModeTimer; sl@0: iChangeScreenModeTimer=NULL; sl@0: delete iScreenModeTimer; sl@0: iScreenModeTimer=NULL; sl@0: sl@0: if (iFlags&eFontSet) sl@0: { sl@0: iGc->DiscardFont(); sl@0: iScrDev->ReleaseFont(iFont); sl@0: } sl@0: delete iGc; sl@0: if (iDrawingRegion) sl@0: iDrawingRegion->Destroy(); sl@0: delete iScrDev; sl@0: delete iWin; sl@0: delete iWin2; sl@0: if (iProcess) sl@0: { sl@0: User::WaitForRequest(iThreadStatus); sl@0: delete iProcess; sl@0: iProcess = NULL; sl@0: } sl@0: if (iFlags&eDirectControlSem) sl@0: { sl@0: iControlSem.Close(); sl@0: iControlQueue.Close(); sl@0: } sl@0: if (iFlags&eDirectWindowSem) sl@0: iWinSem.Close(); sl@0: } sl@0: sl@0: void CTDirect::ResetScreenSizeMode() sl@0: { sl@0: if (iModeBackup!=ESizeEnforcementNone) sl@0: { sl@0: TheClient->iScreen->SetScreenModeEnforcement(ESizeEnforcementNone); sl@0: iModeBackup=ESizeEnforcementNone; sl@0: } sl@0: TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationNormal); sl@0: TheClient->iScreen->SetScreenMode(0); sl@0: TPixelsAndRotation pixelsAndRotation; sl@0: TheClient->iScreen->GetDefaultScreenSizeAndRotation(pixelsAndRotation); sl@0: TheClient->iScreen->SetScreenSizeAndRotation(pixelsAndRotation); sl@0: User::After(350000); //0.35secs sl@0: } sl@0: sl@0: void CTDirect::ScanTypeFacesL() sl@0: { sl@0: CFbsScreenDevice* scrdev=CFbsScreenDevice::NewL(iTest->iScreenNumber,EGray4); sl@0: TTypefaceSupport typeFace; sl@0: TInt numFaces=scrdev->NumTypefaces(); sl@0: TInt ii; sl@0: for (ii=0;iiTypefaceSupport(typeFace,ii); sl@0: } sl@0: delete scrdev; sl@0: } sl@0: sl@0: TInt RestartAnimation(TAny* aTest) sl@0: { sl@0: STATIC_CAST(CTDirect*,aTest)->Restart(); sl@0: return(KErrNone); sl@0: } sl@0: sl@0: TInt NextFrame(TAny* aTest) sl@0: { sl@0: STATIC_CAST(CTDirect*,aTest)->DrawFrame(); sl@0: return(KErrNone); sl@0: } sl@0: sl@0: void CTDirect::AbortNow(RDirectScreenAccess::TTerminationReasons aReason) sl@0: { sl@0: TEST(aReason==RDirectScreenAccess::ETerminateRegion); sl@0: sl@0: if (iDelay) sl@0: User::After(2000000); //2 secs sl@0: if (iCancelNext) sl@0: { sl@0: iFrameNo=eDirectNumFrames; sl@0: iTimer->Cancel(); sl@0: iDirect->Cancel(); sl@0: TheClient->Flush(); sl@0: iNextFrameFinished = ETrue; sl@0: iState++; sl@0: return; sl@0: } sl@0: iRestart->Start(TCallBack(RestartAnimation,this)); sl@0: } sl@0: sl@0: TBool CTDirect::Restart() sl@0: { sl@0: StartDirect(); sl@0: return ETrue; sl@0: } sl@0: sl@0: #pragma warning( disable : 4244 ) //conversion from 'int' to 'unsigned short', possible loss of data sl@0: TBool CTDirect::DrawFrame() sl@0: { sl@0: if (iFrameNo==eDirectNumFrames) sl@0: { sl@0: iState++; sl@0: iTimer->Cancel(); sl@0: if (iFrameNo==eDirectNumFrames) sl@0: iDirect->Cancel(); sl@0: iNextFrameFinished = ETrue; sl@0: return EFalse; sl@0: } sl@0: _LIT(Text,"A0"); sl@0: TBuf<2> iString(Text); //_LIT(Text,"ABCabc123"); sl@0: iString[0]+=iFrameNo; sl@0: iString[1]+=iFrameNo; sl@0: TInt textWidth=iFont->TextWidthInPixels(iString); sl@0: TInt maxTextWidth=Max(textWidth,iLastTextWidth); sl@0: iLastTextWidth=textWidth; sl@0: if (iLastMaxTextWidth!=maxTextWidth) sl@0: { sl@0: iLastMaxTextWidth=maxTextWidth; sl@0: iDrawRect.iTl.iX=(iScrSize.iWidth-iLastMaxTextWidth)/2; sl@0: iDrawRect.SetWidth(iLastMaxTextWidth); sl@0: } sl@0: TInt colorOffset=iFrameNo%2; sl@0: iGc->SetPenColor(TRgb::Gray4(colorOffset)); sl@0: iGc->DrawText(iString,iDrawRect,iDrawHeight,CGraphicsContext::ECenter); sl@0: iGc->SetPenColor(TRgb::Gray4(1+colorOffset)); sl@0: iGc->DrawLine(TPoint(),iScrSize.AsPoint()); sl@0: iGc->DrawLine(TPoint(iScrSize.iWidth,0),TPoint(0,iScrSize.iHeight)); sl@0: iGc->DrawLine(TPoint(iScrSize.iWidth/2,0),TPoint(iScrSize.iWidth/2,iScrSize.iHeight)); sl@0: iGc->DrawLine(TPoint(0,iScrSize.iHeight/2),TPoint(iScrSize.iWidth,iScrSize.iHeight/2)); sl@0: iScrDev->Update(); sl@0: ++iFrameNo; sl@0: if (iFrameNo==iFrameToSignalAfter) sl@0: SignalWindow(); sl@0: return ETrue; sl@0: } sl@0: #pragma warning( default : 4244 ) sl@0: sl@0: void CTDirect::SignalWindow() sl@0: { sl@0: switch(iState) sl@0: { sl@0: case 0: sl@0: switch(iFrameNo) sl@0: { sl@0: case 0: sl@0: iFrameToSignalAfter=0; sl@0: } sl@0: return; sl@0: case 1: sl@0: case 3: sl@0: switch(iFrameNo) sl@0: { sl@0: case 0: sl@0: iFrameToSignalAfter=3; sl@0: iDelay=(iState==3); sl@0: return; sl@0: case 3: sl@0: WinExt.SetSize(TSize(iScrSize.iWidth/2-5,iScrSize.iHeight/2+30)); sl@0: iFrameToSignalAfter=5; sl@0: break; sl@0: case 5: sl@0: iFrameToSignalAfter=7; sl@0: break; sl@0: case 7: sl@0: WinExt.SetSize(TSize(iScrSize.iWidth/2+30,iScrSize.iHeight/2-5)); sl@0: WinCol=1; sl@0: iFrameToSignalAfter=8; sl@0: break; sl@0: case 8: sl@0: iFrameToSignalAfter=0; sl@0: iDelay=EFalse; sl@0: break; sl@0: } sl@0: break; sl@0: case 2: sl@0: switch(iFrameNo) sl@0: { sl@0: case 0: sl@0: iFrameToSignalAfter=2; sl@0: return; sl@0: case 2: sl@0: WinExt.SetRect(TPoint(iScrSize.iWidth/2-15,iScrSize.iHeight/2-20),TSize(iScrSize.iWidth/3,iScrSize.iHeight/3)); sl@0: WinCol=2; sl@0: iFrameToSignalAfter=5; sl@0: break; sl@0: case 5: sl@0: iFrameToSignalAfter=6; sl@0: break; sl@0: case 6: sl@0: WinExt.SetRect(TPoint(iScrSize.iWidth/2-50,iScrSize.iHeight/3),TSize(iScrSize.iWidth/4,iScrSize.iHeight/3)); sl@0: WinCol=3; sl@0: iFrameToSignalAfter=8; sl@0: break; sl@0: case 8: sl@0: iFrameToSignalAfter=0; sl@0: break; sl@0: } sl@0: break; sl@0: case 4: sl@0: switch(iFrameNo) sl@0: { sl@0: case 0: sl@0: iFrameToSignalAfter=3; sl@0: return; sl@0: case 3: sl@0: iFrameToSignalAfter=6; sl@0: iWin2->SetVisible(EFalse); sl@0: TheClient->Flush(); sl@0: return; sl@0: case 6: sl@0: iFrameToSignalAfter=0; sl@0: iWin2->SetVisible(ETrue); sl@0: TheClient->Flush(); sl@0: return; sl@0: } sl@0: break; sl@0: case 5: sl@0: switch(iFrameNo) sl@0: { sl@0: case 0: sl@0: iFrameToSignalAfter=6; sl@0: return; sl@0: case 6: sl@0: iFrameToSignalAfter=0; sl@0: WinExt.SetRect(10,10,20,20); sl@0: iCancelNext=ETrue; sl@0: break; sl@0: } sl@0: break; sl@0: case 6: sl@0: switch(iFrameNo) sl@0: { sl@0: case 0: sl@0: iFrameToSignalAfter=7; sl@0: iCancelNext=EFalse; sl@0: return; sl@0: case 7: sl@0: iFrameToSignalAfter=0; sl@0: delete iWin; sl@0: TheClient->Flush(); sl@0: iWin=NULL; sl@0: iWindowDead=ETrue; sl@0: return; sl@0: } sl@0: break; sl@0: } sl@0: #if defined(LOGGING) sl@0: _LIT(KSignal,"Signaling Move Window"); sl@0: LogMessageText.Copy(KSignal); sl@0: TheClient->iWs.LogMessage(LogMessageText); sl@0: TheClient->Flush(); sl@0: #endif sl@0: iWinSem.Signal(); sl@0: } sl@0: sl@0: void CTDirect::StartDirect() sl@0: { sl@0: if (iWin==NULL) sl@0: { sl@0: TEST(iWindowDead); sl@0: if (!iWindowDead) sl@0: INFO_PRINTF3(_L("iWindowDead - Expected: %d, Actual: %d"), ETrue, iWindowDead); sl@0: sl@0: iFrameNo=eDirectNumFrames; sl@0: return; sl@0: } sl@0: TEST(!iWindowDead); sl@0: if (iWindowDead) sl@0: INFO_PRINTF3(_L("iWindowDead - Expected: %d, Actual: %d"), EFalse, iWindowDead); sl@0: sl@0: if (iDrawingRegion) sl@0: iDrawingRegion->Destroy(); sl@0: TInt retVal = iDirect->Request(iDrawingRegion,*iWin->BaseWin()); sl@0: TEST(retVal==KErrNone); sl@0: if (retVal!=KErrNone) sl@0: INFO_PRINTF3(_L("iDirect->Request(iDrawingRegion,*iWin->BaseWin()) return value - Expected: %d, Actual: %d"), KErrNone, retVal); sl@0: sl@0: iGc->SetClippingRegion(iDrawingRegion); sl@0: } sl@0: sl@0: void CTDirect::LogLeave(TInt aErr) sl@0: { sl@0: iTest->LogLeave(aErr); sl@0: } sl@0: sl@0: void CTDirect::Fail() sl@0: { sl@0: TEST(EFalse); sl@0: } sl@0: sl@0: void CTDirect::Finished(TInt aId) sl@0: { sl@0: //aId refers to the animation, it is not the test number sl@0: _LIT(KCTDirectFinished,"Destroying animation number %d"); sl@0: LOG_MESSAGE2(KCTDirectFinished,aId); sl@0: switch (aId) sl@0: { sl@0: case 10: sl@0: case 11: sl@0: ResetScreenSizeMode(); sl@0: case 9: sl@0: iPackagingFinished = ETrue; sl@0: case 8: sl@0: DeleteMoveWindow(); sl@0: //iPackagingFinished = ETrue; sl@0: if (iScroll) sl@0: { sl@0: DeleteScroll(); sl@0: #if defined(LOGGING) sl@0: _LIT(KDeleteScroll,"Deleting Scroll Text Id=%d TimerActive=%d"); sl@0: LogMessageText.Zero(); sl@0: LogMessageText.AppendFormat(KDeleteScroll,aId,iAnim->IsTimerActive()); sl@0: TheClient->iWs.LogMessage(LogMessageText); sl@0: TheClient->Flush(); sl@0: #endif sl@0: } sl@0: if (aId==8 && iAnim->IsTimerActive()) sl@0: return; sl@0: case 1: sl@0: case 12: sl@0: case 25: //case DSA using Region tracking Only (abort signal expceted) sl@0: case 26: //case DSA using Region tracking Only (abort signal not expceted) sl@0: { sl@0: iPackagingFinished = ETrue; sl@0: delete iAnim; sl@0: iAnim=NULL; sl@0: CHECKHANDLES: sl@0: TInt numProcessHandles; sl@0: TInt numThreadHandles; sl@0: RThread().HandleCount(numProcessHandles,numThreadHandles); sl@0: TEST(Abs(numThreadHandles-iNumThreadHandles)<2); sl@0: if (Abs(numThreadHandles-iNumThreadHandles)>=2) sl@0: INFO_PRINTF3(_L("Abs(numThreadHandles-iNumThreadHandles)<2 - Expected: %d or less, Actual: %d"), 2, Abs(numThreadHandles-iNumThreadHandles)); sl@0: } sl@0: break; sl@0: case 16: sl@0: case 15: sl@0: { sl@0: // Stop the animation and delete it, but make sure that you don't increment iState and call Rquest() sl@0: // until this is the second call i.e. one of aId = 15 or aId = 16 has already been finished. sl@0: TInt index = aId-15; sl@0: iAnims[index]->Stop(); sl@0: delete iAnims[index]; sl@0: iAnims[index]=NULL; sl@0: // This test creates two animations iAnims[0] and iAnims[1]. sl@0: // Use (index ^ 1 ) = Toggle the Index, to get the index of other animation. sl@0: // If iAnims [ index ^ 1] is NULL then this is the second Call and test is finished. sl@0: if (iAnims[index ^ 1] != NULL) sl@0: { sl@0: return; sl@0: } sl@0: iPackagingFinished = ETrue; sl@0: goto CHECKHANDLES; sl@0: } sl@0: case 13: sl@0: { sl@0: iPackagingFinished = ETrue; sl@0: delete iBlankTopClientWin1; sl@0: // delete iBlankTopClientWin2; sl@0: TInt jj; sl@0: for (jj=0;jj<4;++jj) sl@0: iAnims[jj]->Stop(); sl@0: for (jj=0;jj<4;++jj) sl@0: delete iAnims[jj]; sl@0: break; sl@0: } sl@0: case 14: sl@0: { sl@0: iPackagingFinished = ETrue; sl@0: iAnims[0]->Stop(); sl@0: delete iAnims[0]; sl@0: if (iNumOfModes==iCurrentMode) sl@0: { sl@0: ResetScreenSizeMode(); sl@0: iCallBackWin->SetVisible(EFalse); sl@0: break; sl@0: } sl@0: break; sl@0: } sl@0: case 18: sl@0: case 17: sl@0: { sl@0: // Stop the animation and delete it, but make sure that you don't increment iState and call Rquest() sl@0: // until this is the second call i.e. one of aId = 17 or aId = 18 has already been finished. sl@0: TInt ii = 0; sl@0: TBool finished = ETrue; sl@0: if (aId == 17) sl@0: { sl@0: iAnims[0]->Stop(); sl@0: delete iAnims[0]; sl@0: iAnims[0] = NULL; sl@0: for (ii=1;ii<=iNumAnimation;++ii) sl@0: { sl@0: if (iAnims[ii]) sl@0: { sl@0: finished = EFalse; sl@0: break; sl@0: } sl@0: } sl@0: } sl@0: else // aId == 18 sl@0: { sl@0: for (ii=1;ii<=iNumAnimation;++ii) sl@0: { sl@0: iAnims[ii]->Stop(); sl@0: delete iAnims[ii]; sl@0: iAnims[ii] = NULL; sl@0: } sl@0: if (iAnims[0]) sl@0: { sl@0: finished = EFalse; sl@0: } sl@0: } sl@0: if (!finished) sl@0: { sl@0: return; sl@0: } sl@0: iPackagingFinished = ETrue; sl@0: break; sl@0: } sl@0: case 19: sl@0: { sl@0: iPackagingFinished = ETrue; sl@0: iAnims[0]->Stop(); sl@0: delete iAnims[0]; sl@0: break; sl@0: } sl@0: case 21: sl@0: case 20: sl@0: { sl@0: // Stop the animation and delete it, but make sure that you don't increment iState and call Rquest() sl@0: // until this is the second call i.e. one of aId = 20 or aId = 21 has already been finished. sl@0: TInt index = aId-20; sl@0: iAnims[index]->Stop(); sl@0: delete iAnims[index]; sl@0: iAnims[index]=NULL; sl@0: // This test creates two animations iAnims[0] and iAnims[1]. sl@0: // Use (index ^ 1 ) = Toggle the Index, to get the index of other animation. sl@0: // If iAnims [ index ^ 1] is NULL then this is the second Call and test is finished. sl@0: if (iAnims[index ^ 1] != NULL) sl@0: { sl@0: return; sl@0: } sl@0: DeleteMoveWindow(); sl@0: iPackagingFinished = ETrue; sl@0: goto CHECKHANDLES; sl@0: } //unreachable line, no need for break sl@0: case 24: sl@0: iPackagingFinished = ETrue; sl@0: iAnim->Stop(); sl@0: delete iAnim; sl@0: iAnim=NULL; sl@0: //don't want to increase state, so decrement, since it is incremented below sl@0: //as part of processing normal completions. This is to reenter the test sl@0: //to call Fail() if required sl@0: iState--; sl@0: break; sl@0: sl@0: case 27: sl@0: case 28: sl@0: case 29: sl@0: case 30: sl@0: case 31: sl@0: case 32: sl@0: iAnims[aId-27]->Stop(); sl@0: delete iAnims[aId-27]; sl@0: iAnims[aId-27] = NULL; sl@0: if(aId != 32) sl@0: { sl@0: return; sl@0: } sl@0: DeleteMoveWindow(); sl@0: iPackagingFinished = ETrue; sl@0: break; sl@0: default: sl@0: iPackagingFinished = ETrue; sl@0: TInt ii; sl@0: for (ii=0;ii<6;++ii) sl@0: iAnims[ii]->Stop(); sl@0: for (ii=0;ii<6;++ii) sl@0: delete iAnims[ii]; sl@0: DeleteMoveWindow(); sl@0: break; sl@0: } sl@0: #if defined(LOGGING) sl@0: _LIT(KRequest,"Signal Start NextTest Id=%d, State=%d(+1)"); sl@0: LogMessageText.Zero(); sl@0: LogMessageText.AppendFormat(KRequest,aId,iState); sl@0: TheClient->iWs.LogMessage(LogMessageText); sl@0: TheClient->Flush(); sl@0: #endif sl@0: iState++; sl@0: } sl@0: sl@0: void CTDirect::DeleteMoveWindow() sl@0: { sl@0: if (iMoveWin) sl@0: { sl@0: TRequestStatus status; sl@0: iMoveWin->Logon(status); sl@0: if (iMoveWin->StillAlive()) sl@0: { sl@0: iMoveWin->Terminate(KErrNone); sl@0: User::WaitForRequest(status); sl@0: } sl@0: delete iMoveWin; sl@0: iMoveWin=NULL; sl@0: } sl@0: } sl@0: sl@0: void CTDirect::DeleteScroll() sl@0: { sl@0: if (iScroll) sl@0: { sl@0: TheClient->iScreen->SetScreenMode(0); sl@0: iScroll->Stop(); sl@0: delete iScroll; sl@0: iScroll=NULL; sl@0: } sl@0: } sl@0: sl@0: TDisplayMode CTDirect::DisplayMode(TInt aId) sl@0: { sl@0: switch (aId) sl@0: { sl@0: case 1: sl@0: case 13: sl@0: case 15: sl@0: case 16: sl@0: return EColor16; sl@0: case 2: sl@0: return EGray16; sl@0: case 3: sl@0: return EColor16; sl@0: case 4: sl@0: case 14: sl@0: case 17: sl@0: case 18: sl@0: case 19: sl@0: case 24: sl@0: return EColor256; sl@0: case 5: sl@0: return EGray256; sl@0: case 6: sl@0: return EColor4K; sl@0: case 7: sl@0: return EColor64K; sl@0: case 8: sl@0: case 9: sl@0: case 10: sl@0: case 11: sl@0: case 12: sl@0: { sl@0: TInt colors,grays; sl@0: /*TDisplayMode mode=*/TheClient->iWs.GetDefModeMaxNumColors(colors,grays); sl@0: if (colors==0) sl@0: return EGray4; sl@0: return (aId==8? EGray16:EColor16); sl@0: } sl@0: default:; sl@0: return TheClient->iScreen->DisplayMode(); sl@0: } sl@0: } sl@0: sl@0: void CTDirect::Log(const TText8* aFile, TInt aLine, TInt aSeverity,const TDesC& aString) sl@0: { sl@0: Logger().LogExtra(((TText8*)aFile), aLine, aSeverity, aString) ; sl@0: } sl@0: sl@0: TRgb CTDirect::BrushColorL(TInt aId,TInt& aColor,TBool& aFinished) sl@0: { sl@0: aFinished=EFalse; sl@0: switch (aId) sl@0: { sl@0: case 1: sl@0: case 13: sl@0: case 14: sl@0: case 15: sl@0: case 16: sl@0: case 17: sl@0: case 18: sl@0: case 19: sl@0: case 20: sl@0: case 21: sl@0: case 27: sl@0: aFinished=(aColor==20); sl@0: return TRgb::Color16(27 + aColor++); sl@0: case 28: sl@0: aFinished=(aColor==17); sl@0: return TRgb::Color16(28 + aColor++); sl@0: case 29: sl@0: aFinished=(aColor==15); sl@0: return TRgb::Color16(29 + aColor++); sl@0: case 8: sl@0: if (aColor==15) sl@0: { sl@0: ++iCycles; sl@0: aFinished=(iCycles==5); sl@0: } sl@0: else if (!iScroll) sl@0: aFinished=ETrue; sl@0: else if (!iScroll->IsRunning()) sl@0: iScroll->ContinueL(); sl@0: { sl@0: #if defined(LOGGING) sl@0: if (aFinished || iScroll==NULL) sl@0: { sl@0: _LIT(KColor,"Col=%d Cycles=%d Fin=%d iScroll=%d"); sl@0: LogMessageText.Zero(); sl@0: LogMessageText.AppendFormat(KColor,aColor,iCycles,aFinished,(TInt&)iScroll); sl@0: TheClient->iWs.LogMessage(LogMessageText); sl@0: TheClient->Flush(); sl@0: } sl@0: #endif sl@0: } sl@0: case 2: sl@0: if (aColor==16) sl@0: aColor=0; sl@0: return TRgb::Gray16(aColor++); sl@0: case 9: sl@0: case 10: sl@0: aFinished=iCycles>3; sl@0: case 11: sl@0: case 3: sl@0: if (aColor==16) sl@0: { sl@0: ++iCycles; sl@0: aColor=0; sl@0: } sl@0: return TRgb::Color16(aColor++); sl@0: case 4: sl@0: aFinished=(aColor==256); sl@0: return TRgb::Color256(aColor++); sl@0: case 5: sl@0: if (aColor==256) sl@0: aColor=0; sl@0: return TRgb::Gray256(aColor++); sl@0: case 6: sl@0: aColor+=127; sl@0: if (aColor>4095) sl@0: aColor-=4096; sl@0: return TRgb::Color4K(aColor); sl@0: case 7: sl@0: aColor+=211; sl@0: if (aColor>65535) sl@0: aColor-=65536; sl@0: return TRgb::Color64K(aColor++); sl@0: case 12: sl@0: aFinished=2*(aColor>5); sl@0: return TRgb::Color16(aColor++); sl@0: case 24: sl@0: iCycles++; sl@0: if (iCycles==5) sl@0: { sl@0: aFinished=ETrue; sl@0: CheckForTemporaryDeadlock(); sl@0: } sl@0: return TRgb::Color16(aColor++); sl@0: case 30: sl@0: aFinished=(aColor==256); sl@0: return TRgb::Color16(aColor++); sl@0: case 31: sl@0: aFinished=(aColor==100); sl@0: return TRgb::Color16(aColor++); sl@0: case 32: sl@0: aFinished=(aColor==300); sl@0: return TRgb::Color16(aColor++); sl@0: default:; sl@0: aFinished=ETrue; sl@0: return TRgb::Gray2(1); //White sl@0: } sl@0: } sl@0: sl@0: TInt CTDirect::TimerInterval(TInt aId) sl@0: { sl@0: switch (aId) sl@0: { sl@0: case 1: sl@0: case 15: sl@0: case 16: sl@0: case 17: sl@0: case 18: sl@0: case 20: sl@0: case 21: sl@0: return 143200; sl@0: case 27: sl@0: return 200000; sl@0: case 28: sl@0: return 180000; sl@0: case 29: sl@0: return 170000; sl@0: case 30: sl@0: return 200000; sl@0: case 31: sl@0: return 205000; sl@0: case 32: sl@0: return 300000; sl@0: case 2: sl@0: case 25: sl@0: case 26: sl@0: return 234567; sl@0: case 3: sl@0: return 200000; sl@0: case 4: sl@0: return 11718; sl@0: case 5: sl@0: return 13719; sl@0: case 6: sl@0: return 14719; sl@0: case 7: sl@0: return 15719; sl@0: case 8: sl@0: return 275000; sl@0: case 9: sl@0: return 210000; sl@0: case 10: sl@0: return 110000; sl@0: case 11: sl@0: return 123456; sl@0: case 12: sl@0: return 10627; sl@0: case 19: sl@0: return 1000000; sl@0: default:; sl@0: return 1; sl@0: } sl@0: } sl@0: sl@0: void CTDirect::FailedReStart(TInt /*aId*/,TInt /*aReason*/) sl@0: { sl@0: Fail(); sl@0: } sl@0: sl@0: TInt CTDirect::SlowStopping(TInt aId,TInt aCount) sl@0: { sl@0: if (aId==8) sl@0: return (aCount>1 ? CColorAnimation::eAbortAll : CColorAnimation::eStopNow); sl@0: if (aId==9 || aId==10) sl@0: return CColorAnimation::eStopNow; sl@0: TInt ret=(2*aId-3==aCount%12); sl@0: if (ret && aId==5) sl@0: { sl@0: ++iCount; sl@0: if (iCount==5) sl@0: return CColorAnimation::eAbort; sl@0: } sl@0: return ret; sl@0: } sl@0: sl@0: void CTDirect::ModeSwitch() sl@0: { sl@0: TRAPD(err,iAnim->ChangeModeL(EGray4)); sl@0: iWin2->SetSize(TSize(20,25)); sl@0: TheClient->Flush(); sl@0: if (err!=KErrNone) sl@0: Fail(); sl@0: } sl@0: sl@0: TestState CTDirect::AnimateWindowL() sl@0: { sl@0: // if (!iTimer->IsActive()) sl@0: { sl@0: sl@0: sl@0: iFrameNo=0; sl@0: SignalWindow(); sl@0: sl@0: sl@0: iTimer->Start(0,200000,TCallBack(NextFrame,this)); //0.2 secs sl@0: sl@0: StartDirect(); sl@0: TEST(iDrawingRegion->BoundingRect()==iScrSize); sl@0: } sl@0: // else sl@0: // { sl@0: // int i=0; sl@0: // } sl@0: return EWait; sl@0: } sl@0: sl@0: TestState CTDirect::AnimationDiesL() sl@0: { sl@0: INFO_PRINTF1(_L("AUTO Animation Dies ")); sl@0: _LIT(ThreadName,"AnimationDie"); sl@0: iFirstFunction=TThreadStartUp(CAnimating::StartLC,(TAny*)iTest->iScreenNumber); sl@0: CProcess* thread=CProcess::NewThreadL(ThreadName,&iFirstFunction); sl@0: CleanupStack::PushL(thread); sl@0: thread->LeaveIfDied(); sl@0: INFO_PRINTF1(_L(" Constructed Thread")); sl@0: iControlSem.Wait(); sl@0: RWindowGroup group(TheClient->iWs); sl@0: group.Construct(431,EFalse); sl@0: RBlankWindow win(TheClient->iWs); sl@0: win.Construct(group,432); sl@0: win.SetExtent(TPoint(12,34),TSize(56,78)); sl@0: win.Activate(); sl@0: INFO_PRINTF1(_L(" Constructed Windows")); sl@0: iControlSem.Wait(); sl@0: User::After(1000000); //1 sec sl@0: TRequestStatus threadDied; sl@0: thread->Logon(threadDied); sl@0: thread->Terminate(KErrGeneral); sl@0: INFO_PRINTF1(_L(" Waiting for Thread")); sl@0: User::WaitForRequest(threadDied); sl@0: CleanupStack::PopAndDestroy(thread); sl@0: win.Close(); sl@0: group.Close(); sl@0: INFO_PRINTF1(_L(" Finished")); sl@0: return ENext; sl@0: } sl@0: sl@0: TestState CTDirect::PackagingClassL() sl@0: { sl@0: ConstrucBlankWindowL(); sl@0: TInt numProcessHandles; sl@0: RThread().HandleCount(numProcessHandles,iNumThreadHandles); sl@0: iAnim=CColorAnimation::NewL(iTest->iScreenNumber,1,*this,*TheClient->iGroup,TRect(10,10,630,230),ETrue); sl@0: return EWait; sl@0: } sl@0: sl@0: TestState CTDirect::MultipleL() sl@0: { sl@0: TSize scrSize=TheClient->iScreen->SizeInPixels(); sl@0: sl@0: iFlags|=eMultiAnim; sl@0: iAnims[0]=CColorAnimation::NewL(iTest->iScreenNumber,2,*this,*TheClient->iGroup, sl@0: TRect(0,10,scrSize.iWidth/3+20,scrSize.iHeight/2-5),EFalse); sl@0: iAnims[1]=CColorAnimation::NewL(iTest->iScreenNumber,3,*this,*TheClient->iGroup, sl@0: TRect(10,scrSize.iHeight/2-20,scrSize.iWidth/3-5,scrSize.iHeight),EFalse); sl@0: iAnims[3]=CColorAnimation::NewL(iTest->iScreenNumber,5,*this,*TheClient->iGroup, sl@0: TRect(scrSize.iWidth/3-20,scrSize.iHeight/2+5,2*scrSize.iWidth/3+20,scrSize.iHeight-10),EFalse); sl@0: iAnims[2]=CColorAnimation::NewL(iTest->iScreenNumber,4,*this,*TheClient->iGroup, sl@0: TRect(scrSize.iWidth/3+5,0,2*scrSize.iWidth/3-5,scrSize.iHeight/2+20),EFalse); sl@0: iAnims[4]=CColorAnimation::NewL(iTest->iScreenNumber,6,*this,*TheClient->iGroup, sl@0: TRect(2*scrSize.iWidth/3-20,15,scrSize.iWidth,scrSize.iHeight/2+50),EFalse); sl@0: iAnims[5]=CColorAnimation::NewL(iTest->iScreenNumber,7,*this,*TheClient->iGroup, sl@0: TRect(2*scrSize.iWidth/3+5,-20,scrSize.iWidth-15,scrSize.iHeight+10),ETrue); sl@0: TInt ii; sl@0: for (ii=0;ii<5;++ii) sl@0: iAnims[ii]->StartL(); sl@0: _LIT(ThreadName,"MoveWin"); sl@0: sl@0: MoveInterval=100000; //0.1 secs sl@0: ModeInterval=1200000; //1.2 sec sl@0: ImmediateModeSwitch=EFalse; sl@0: iFirstFunction=TThreadStartUp(CMoveWindow::StartLC,(TAny*)iTest->iScreenNumber); sl@0: iMoveWin=CProcess::NewThreadL(ThreadName,&iFirstFunction); sl@0: return EWait; sl@0: } sl@0: sl@0: TestState CTDirect::MixDsaAndRegionTrackingOnlyL(TBool aWhoExitsLast) sl@0: { sl@0: TSize scrSize=TheClient->iScreen->SizeInPixels(); sl@0: sl@0: iFlags|=eMultiAnim; sl@0: TUint firstRegionTrackinOnlyDsa = (aWhoExitsLast == KRegionTrackingOnlyDsaExistLast ? 0 : 3); sl@0: TUint firstDrawingDsa = (aWhoExitsLast == KDrawingDsaExistLast ? 0 : 3); sl@0: sl@0: //DSAs who use region tracking only sl@0: iAnims[firstRegionTrackinOnlyDsa]=CColorAnimation::NewL(iTest->iScreenNumber,firstRegionTrackinOnlyDsa+27,*this,*TheClient->iGroup, sl@0: TRect(10,scrSize.iHeight/2-20,scrSize.iWidth/3-5,scrSize.iHeight),EFalse,KRegionTrackingOnly); sl@0: iAnims[firstRegionTrackinOnlyDsa+1]=CColorAnimation::NewL(iTest->iScreenNumber,firstRegionTrackinOnlyDsa+28,*this,*TheClient->iGroup, sl@0: TRect(2*scrSize.iWidth/3-20,15,scrSize.iWidth,scrSize.iHeight/2+50),EFalse,KRegionTrackingOnly); sl@0: iAnims[firstRegionTrackinOnlyDsa+2]=CColorAnimation::NewL(iTest->iScreenNumber,firstRegionTrackinOnlyDsa+29,*this,*TheClient->iGroup, sl@0: TRect(2*scrSize.iWidth/3+5,-20,scrSize.iWidth-15,scrSize.iHeight+10),EFalse,KRegionTrackingOnly); sl@0: sl@0: //DSAs who actually draw sl@0: iAnims[firstDrawingDsa]=CColorAnimation::NewL(iTest->iScreenNumber,firstDrawingDsa+27,*this,*TheClient->iGroup, sl@0: TRect(0,10,scrSize.iWidth/3+20,scrSize.iHeight/2-5),EFalse,KDrawingDsa); sl@0: iAnims[firstDrawingDsa+1]=CColorAnimation::NewL(iTest->iScreenNumber,firstDrawingDsa+28,*this,*TheClient->iGroup, sl@0: TRect(scrSize.iWidth/3+5,0,2*scrSize.iWidth/3-5,scrSize.iHeight/2+20),EFalse,KDrawingDsa); sl@0: iAnims[firstDrawingDsa+2]=CColorAnimation::NewL(iTest->iScreenNumber,firstDrawingDsa+29,*this,*TheClient->iGroup, sl@0: TRect(scrSize.iWidth/3-20,scrSize.iHeight/2+5,2*scrSize.iWidth/3+20,scrSize.iHeight-10),EFalse,KDrawingDsa); sl@0: sl@0: TInt ii; sl@0: for (ii=0;ii<6;++ii) sl@0: { sl@0: if(iAnims[ii]) sl@0: iAnims[ii]->StartL(); sl@0: } sl@0: sl@0: _LIT(ThreadName,"MoveWin"); sl@0: sl@0: MoveInterval=100000; //0.1 secs sl@0: ModeInterval=1200000; //1.2 secs sl@0: ImmediateModeSwitch=EFalse; sl@0: iFirstFunction=TThreadStartUp(CMoveWindow::StartLC,(TAny*)iTest->iScreenNumber); sl@0: iMoveWin=CProcess::NewThreadL(ThreadName,&iFirstFunction); sl@0: return EWait; sl@0: } sl@0: sl@0: TestState CTDirect::TryDifferentSupportedModesL() sl@0: { sl@0: sl@0: RWsSession session; sl@0: User::LeaveIfError(session.Connect()); sl@0: CWsScreenDevice* device = new(ELeave) CWsScreenDevice(session); sl@0: CleanupStack::PushL(device); sl@0: User::LeaveIfError(device->Construct(iTest->iScreenNumber)); sl@0: TUint numOfModes=device->NumScreenModes(); sl@0: _LIT(KTryingCurrentMode,"Trying Mode = %d"); sl@0: for(TUint currentMode =0; currentMode < numOfModes; currentMode++) sl@0: { sl@0: LOG_MESSAGE2(KTryingCurrentMode,currentMode); sl@0: device->SetScreenMode(currentMode); sl@0: TRAPD(err,iAnims[0]=CColorAnimation::NewL(iTest->iScreenNumber,4,*this,*TheClient->iGroup, sl@0: TRect(0,0,50,50),ETrue)); sl@0: if(err!=KErrNone) sl@0: { sl@0: TEST(EFalse); sl@0: } sl@0: else sl@0: { sl@0: User::After(2000000); sl@0: iAnims[0]->Stop(); sl@0: delete iAnims[0]; sl@0: } sl@0: } sl@0: CleanupStack::PopAndDestroy(device); sl@0: session.Close(); sl@0: iState++; sl@0: return EWait; sl@0: } sl@0: sl@0: sl@0: TestState CTDirect::FailCodesL() sl@0: { sl@0: __UHEAP_MARK; sl@0: TRequestStatus status; sl@0: RRegion region(TRect(0,0,10,10),1); sl@0: RRegion* pRegion=®ion; sl@0: RDirectScreenAccess direct(TheClient->iWs); sl@0: User::LeaveIfError(direct.Construct()); sl@0: RBlankWindow window(TheClient->iWs); sl@0: User::LeaveIfError(window.Construct(*TheClient->iGroup->WinTreeNode(),1234)); sl@0: TInt err=direct.Request(pRegion,status,window); sl@0: TEST(err==KErrNone); sl@0: if (err!=KErrNone) sl@0: INFO_PRINTF3(_L("direct.Request(pRegion,status,window) return value - Expected: %d, Actual: %d"), KErrNone, err); sl@0: TEST(pRegion!=NULL); sl@0: if (pRegion==NULL) sl@0: INFO_PRINTF3(_L("pRegion!=NULL - Expected: %d, Actual: %d"), 0, 0); sl@0: pRegion->Destroy(); sl@0: direct.Cancel(); sl@0: User::WaitForRequest(status); sl@0: window.Activate(); sl@0: window.SetOrdinalPosition(-2); sl@0: pRegion=®ion; sl@0: err=direct.Request(pRegion,status,window); sl@0: TEST(err==KErrNone); sl@0: if (err!=KErrNone) sl@0: INFO_PRINTF3(_L("direct.Request(pRegion,status,window) return value - Expected: %d, Actual: %d"), KErrNone, err); sl@0: TEST(pRegion!=NULL); sl@0: if (pRegion==NULL) sl@0: INFO_PRINTF3(_L("pRegion!=NULL - Expected: %d, Actual: %d"), 0, 0); sl@0: pRegion->Destroy(); sl@0: direct.Cancel(); sl@0: User::WaitForRequest(status); sl@0: #if defined(__WINS__) sl@0: // Loop over the allocations done. sl@0: // There is one allocating of the rectangle list and sl@0: // one of the region holding the list sl@0: for (TInt rate = 1; rate <= 2; rate++) sl@0: { sl@0: window.SetOrdinalPosition(0); sl@0: pRegion=®ion; sl@0: TheClient->Flush(); sl@0: __UHEAP_FAILNEXT(rate); sl@0: err=direct.Request(pRegion,status,window); sl@0: TEST(err==KErrNoMemory); sl@0: if (err!=KErrNoMemory) sl@0: INFO_PRINTF3(_L("direct.Request(pRegion,status,window) return value - Expected: %d, Actual: %d"), KErrNoMemory, err); sl@0: sl@0: TEST(pRegion==NULL); sl@0: if (pRegion!=NULL) sl@0: INFO_PRINTF3(_L("pRegion!=NULL - Expected: %d, Actual: %d"), 0, 0); sl@0: } sl@0: #endif sl@0: window.Close(); sl@0: direct.Close(); sl@0: region.Close(); sl@0: __UHEAP_MARKEND; sl@0: return ENext; sl@0: } sl@0: sl@0: void CTDirect::ScrolingTextL(TInt aId,TRect aWinRect,TBool aStartThread,TInt aScreenMode/*=0*/) sl@0: { sl@0: INFO_PRINTF1(_L("AUTO Construct ScrolingText ")); sl@0: INFO_PRINTF1(_L(" Constructed Window")); sl@0: iCycles=0; sl@0: TInt numProcessHandles; sl@0: RThread().HandleCount(numProcessHandles,iNumThreadHandles); sl@0: iAnim=CColorAnimation::NewL(iTest->iScreenNumber,aId,*this,*TheClient->iGroup,aWinRect,EFalse); sl@0: iScroll=CScrollText::NewL(iTest->iScreenNumber,1,*TheClient->iGroup,5,EFalse); sl@0: INFO_PRINTF1(_L(" Constructed Text Scroller & Animation")); sl@0: iAnim->BringWindowToFront(); sl@0: if (aStartThread) sl@0: { sl@0: _LIT(ThreadName,"MoveWin"); sl@0: INFO_PRINTF1(_L(" About to constructed Thread")); sl@0: iFirstFunction=TThreadStartUp(CMoveWindow::StartLC,(TAny*)iTest->iScreenNumber); sl@0: __ASSERT_DEBUG(!iMoveWin,AutoPanic(EAutoPanicDirect)); sl@0: iMoveWin=CProcess::NewThreadL(ThreadName,&iFirstFunction); sl@0: INFO_PRINTF1(_L(" Constructed Thread")); sl@0: } sl@0: if (aScreenMode>0) sl@0: { sl@0: TInt numScreenModes = TheClient->iScreen->NumScreenModes(); sl@0: if (aScreenMode < numScreenModes) sl@0: TheClient->iScreen->SetScreenMode(aScreenMode); sl@0: else sl@0: LOG_MESSAGE(_L("WARNING: Failed to change screen mode")); sl@0: // We have to run the test anyway to avoid things going wrong later sl@0: } sl@0: iAnim->StartOrPanic(); sl@0: iScroll->StartL(); sl@0: INFO_PRINTF1(_L(" Constructed/Started")); sl@0: #if defined(LOGGING) sl@0: _LIT(KStarted,"Finished StartUp ScrollText"); sl@0: LogMessageText.Copy(KStarted); sl@0: TheClient->iWs.LogMessage(LogMessageText); sl@0: TheClient->Flush(); sl@0: #endif sl@0: } sl@0: sl@0: TestState CTDirect::ScrolingText1L() sl@0: { sl@0: MoveInterval=0; sl@0: ModeInterval=1200000; //1.2 sec sl@0: ScrolingTextL(8,TRect(20,20,40,40),ETrue); sl@0: return EWait; sl@0: } sl@0: sl@0: TestState CTDirect::RClassL() sl@0: { sl@0: #if defined(LOGGING) sl@0: _LIT(KRClass,"Starting Panic test on RClass"); sl@0: LogMessageText.Zero(); sl@0: LogMessageText.AppendFormat(KRClass); sl@0: TheClient->iWs.LogMessage(LogMessageText); sl@0: TheClient->Flush(); sl@0: #endif sl@0: TEST(iTest->TestWsPanicL(CPanicDirect::DoTestOnNewScheduler,EWservPanicDirectMisuse,1,(TAny*)iTest->iScreenNumber)); sl@0: #if defined(LOGGING) sl@0: _LIT(KPanic1,"Done First Panic"); sl@0: LogMessageText.Zero(); sl@0: LogMessageText.AppendFormat(KPanic1); sl@0: TheClient->iWs.LogMessage(LogMessageText); sl@0: TheClient->Flush(); sl@0: #endif sl@0: #if defined(__WINS__) sl@0: #if defined(LOGGING) sl@0: _LIT(KPanic2,"Doing 2 debug panics"); sl@0: LogMessageText.Zero(); sl@0: LogMessageText.AppendFormat(KPanic2); sl@0: TheClient->iWs.LogMessage(LogMessageText); sl@0: TheClient->Flush(); sl@0: #endif sl@0: TEST(iTest->TestW32PanicL(CPanicDirect::DoTestOnNewScheduler,EW32PanicDirectMisuse,2,(TAny*)iTest->iScreenNumber)); sl@0: TEST(iTest->TestW32PanicL(CPanicDirect::DoTestOnNewScheduler,EW32PanicDirectMisuse,3,(TAny*)iTest->iScreenNumber)); sl@0: #endif sl@0: #if defined(LOGGING) sl@0: _LIT(KPanicTest,"Trying Panic %d"); sl@0: LogMessageText.Zero(); sl@0: LogMessageText.AppendFormat(KPanicTest,4); sl@0: TheClient->iWs.LogMessage(LogMessageText); sl@0: TheClient->Flush(); sl@0: #endif sl@0: TEST(iTest->TestWsPanicL(CPanicDirect::DoTestOnNewScheduler,EWservPanicDirectMisuse,4,(TAny*)iTest->iScreenNumber)); sl@0: TEST(iTest->TestW32PanicL(CPanicDirect::DoTestOnNewScheduler,EW32PanicDirectMisuse,5,(TAny*)iTest->iScreenNumber)); sl@0: return ENext; sl@0: } sl@0: sl@0: TestState CTDirect::ScrolingText2L() sl@0: { sl@0: MoveInterval=81234; //0.08 sec sl@0: ModeInterval=140123; //0.14 sec sl@0: ImmediateModeSwitch=2; sl@0: ScrolingTextL(9,TRect(15,25,45,35),ETrue); sl@0: iScroll->SetCountDown(5); sl@0: return EWait; sl@0: } sl@0: sl@0: TestState CTDirect::ScrolingText3L() sl@0: { sl@0: iModeBackup=TheClient->iScreen->ScreenModeEnforcement(); sl@0: if (iModeBackup!=ESizeEnforcementNone) sl@0: TheClient->iScreen->SetScreenModeEnforcement(ESizeEnforcementNone); sl@0: MoveInterval=0; sl@0: ModeInterval=0; sl@0: FlipInterval=1200000; //1.2 secs sl@0: ScrolingTextL(10,TRect(25,30,35,45),ETrue,1); sl@0: iScroll->SetBottomOfTest(80); //So it can be seen in both screen modes sl@0: return EWait; sl@0: } sl@0: sl@0: TestState CTDirect::ScrolingText4L() sl@0: { sl@0: iModeBackup=TheClient->iScreen->ScreenModeEnforcement(); sl@0: if (iModeBackup!=ESizeEnforcementNone) sl@0: TheClient->iScreen->SetScreenModeEnforcement(ESizeEnforcementNone); sl@0: MoveInterval=876543; //0.88 secs sl@0: ModeInterval=2178900; //2.18 secs sl@0: FlipInterval=5000000; //5 secs sl@0: ScrolingTextL(11,TRect(30,40,55,65),ETrue); sl@0: iScroll->SetBottomOfTest(80); //So it can be seen in both screen modes sl@0: return EWait; sl@0: } sl@0: sl@0: void CTDirect::CreateAnimForScreenModeL(TInt aAnimIndex,CTWinBase& aParent,TRect aRect,TInt aId) sl@0: { sl@0: iAnims[aAnimIndex]=CColorAnimation::NewL(iTest->iScreenNumber,aId,*this,aParent,aRect,EFalse); sl@0: iAnims[aAnimIndex]->StartL(); sl@0: iAnims[aAnimIndex]->BringWindowToFront(); sl@0: } sl@0: sl@0: void CTDirect::BlankTopClientWindowL(CTBlankWindow& aBlankWindow,TRect aRect) sl@0: { sl@0: aBlankWindow.ConstructExtLD(*TheClient->iGroup,aRect.iTl,aRect.Size()); sl@0: User::LeaveIfError(aBlankWindow.BaseWin()->SetRequiredDisplayMode(EColor256)); sl@0: aBlankWindow.BaseWin()->SetShadowDisabled(ETrue); sl@0: aBlankWindow.Activate(); sl@0: } sl@0: sl@0: static TInt ChangeScreenModeL(TAny* aTest) sl@0: { sl@0: STATIC_CAST(CTDirect*,aTest)->ChangeToNextScreenModeL(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void CTDirect::ChangeToNextScreenModeL() sl@0: { sl@0: #if defined(LOGGING) sl@0: _LIT(KChangeMode,"AUTO Screen Mode Pos Test2 CallBack"); sl@0: LogMessageText.Copy(KChangeMode); sl@0: TheClient->LogMessage(LogMessageText); sl@0: TheClient->iWs.LogCommand(RWsSession::ELoggingStatusDump); sl@0: #endif sl@0: iNumOfModes=TheClient->iScreen->NumScreenModes(); sl@0: if (iCurrentMode* rotations=new(ELeave) CArrayFixFlat(1); sl@0: CleanupStack::PushL(rotations); sl@0: User::LeaveIfError(TheClient->iScreen->GetRotationsList(iCurrentMode,rotations)); sl@0: TInt count=rotations->Count(); sl@0: TInt jj=0; sl@0: if (count>1) sl@0: { sl@0: for (jj=0;jjiScreen->SetCurrentRotations(oldCurrentMode,REINTERPRET_CAST(CFbsBitGc::TGraphicsOrientation&,currentRotation)); sl@0: CleanupStack::PopAndDestroy(rotations); sl@0: TheClient->iScreen->GetScreenModeSizeAndRotation(oldCurrentMode,pixelsAndRotation); sl@0: TInt screenWidth=pixelsAndRotation.iPixelSize.iWidth; sl@0: TInt screenHeight=pixelsAndRotation.iPixelSize.iHeight; sl@0: TPoint screenModeOrigin=TheClient->iScreen->GetScreenModeScaledOrigin(oldCurrentMode); sl@0: TPoint point1(screenModeOrigin.iX,screenModeOrigin.iY+(screenModeOrigin.iY+screenHeight)/2); sl@0: TPoint point2(screenModeOrigin.iX+(screenModeOrigin.iX+screenWidth)/2,screenHeight+screenModeOrigin.iY); sl@0: TRect rect0(point1,point2); sl@0: TRect rect1(TPoint(0,0),rect0.Size()); sl@0: CreateAnimForScreenModeL(0,*TheClient->iGroup,rect1,14); sl@0: TPoint pos=iAnims[0]->AbsoluteWindowPosition(); sl@0: TEST(pos==TPoint(0,0)); sl@0: } sl@0: } sl@0: sl@0: TInt ChangeScreenScaleCallBack(TAny* aTest) sl@0: { sl@0: static_cast(aTest)->ChangeScreenScale(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void CTDirect::ChangeScreenScale() sl@0: { sl@0: if (!iNumOfCallBack) sl@0: { sl@0: iCurrentMode=TheClient->iScreen->CurrentScreenMode(); sl@0: iModeData=TheClient->iScreen->GetCurrentScreenModeAttributes(); sl@0: iModeData.iScreenScale.SetSize(1,1); sl@0: } sl@0: TSizeMode testMode=iModeData; sl@0: if (!iNumOfCallBack) sl@0: { sl@0: testMode.iScreenScale.SetSize(2,2); sl@0: } sl@0: else if (iNumOfCallBack==1) sl@0: { sl@0: testMode.iScreenScale.SetSize(3,2); sl@0: } sl@0: else if (iNumOfCallBack==2) sl@0: { sl@0: testMode.iScreenScale.SetSize(2,3); sl@0: } sl@0: TheClient->iScreen->SetCurrentScreenModeAttributes(testMode); sl@0: TheClient->iScreen->SetAppScreenMode(iCurrentMode); sl@0: TheClient->iScreen->SetScreenMode(iCurrentMode); sl@0: if (iNumOfCallBack==2) sl@0: { sl@0: iScreenModeTimer->Cancel(); sl@0: delete iScreenModeTimer; sl@0: iScreenModeTimer=NULL; sl@0: } sl@0: iNumOfCallBack++; sl@0: } sl@0: sl@0: /* sl@0: * Creates a DSA for screen mode 0. After DSA has displayd 2 or 3 frames screen mode sl@0: * scale is changed with a timer. The DSA aborts and restarts once again sl@0: * and completes itself in different screen mode. sl@0: */ sl@0: TestState CTDirect::ScreenModeTestForScalingL() sl@0: { sl@0: CreateAnimForScreenModeL(0,*TheClient->iGroup,TRect(TSize(10,10)),19); sl@0: iScreenModeTimer=CPeriodic::NewL(0); sl@0: MoveInterval=2000000; sl@0: iScreenModeTimer->Start(1000,MoveInterval,TCallBack(ChangeScreenScaleCallBack,this)); sl@0: return EWait; sl@0: } sl@0: sl@0: /* sl@0: * Creates a DSA for screen mode 0, tests API AbsoluteWindowPosition() sl@0: * Then sets screen mode to last(test) screen mode, here it does the same thing as sl@0: * done for screenmode 0, but with diffrerent scale (2,2) (2,3) (3,2) (3,3) and sl@0: * with different origin (20,30) (30,20) (20,20). sl@0: * Lastly copy back the test screen mode values. sl@0: */ sl@0: TestState CTDirect::ScreenModeScalingTestL() sl@0: { sl@0: #if defined(LOGGING) sl@0: INFO_PRINTF1("AUTO ScreenModeScalingTest "); sl@0: #else sl@0: // DisabledStartLogText(); sl@0: #endif sl@0: INFO_PRINTF1(_L(" Switch to mode 0")); sl@0: iModeData.iScreenScale.iWidth=1; sl@0: iModeData.iScreenScale.iHeight=1; sl@0: TheClient->iScreen->SetCurrentScreenModeAttributes(iModeData); sl@0: TheClient->iScreen->SetAppScreenMode(0); sl@0: TheClient->iScreen->SetScreenMode(0); sl@0: iCurrentMode=0; sl@0: INFO_PRINTF1(_L(" Get Parameters")); sl@0: iCurrentScreenModeOrigin=TheClient->iScreen->GetDefaultScreenModeOrigin(); sl@0: iCurrentScreenModeScale=TheClient->iScreen->GetCurrentScreenModeScale(); sl@0: Copy2ndHalfOfScreen=(iCurrentScreenModeOrigin.iX>FullScreenModeSize.iWidth/2? 1 : 0); sl@0: TRect testWinRect(PhysicalToLogical(TPoint(),iCurrentScreenModeScale), sl@0: PhysicalToLogical(TPoint((Copy2ndHalfOfScreen ? FullScreenModeSize.iWidth : sl@0: FullScreenModeSize.iWidth/2), sl@0: FullScreenModeSize.iHeight)- sl@0: iCurrentScreenModeOrigin,iCurrentScreenModeScale) sl@0: ); sl@0: testWinRect.Shrink(10,10); sl@0: INFO_PRINTF1(_L(" Create Animation")); sl@0: CreateAnimForScreenModeL(0,*TheClient->iGroup,testWinRect,17); sl@0: TPoint pos0=iAnims[0]->AbsoluteWindowPosition(); sl@0: TEST(pos0==TPoint(10,10)); sl@0: sl@0: TInt numOfModes=TheClient->iScreen->NumScreenModes(); sl@0: iCurrentMode=numOfModes-1; sl@0: INFO_PRINTF1(_L(" Switch to Last Mode")); sl@0: TheClient->iScreen->SetAppScreenMode(iCurrentMode); sl@0: TheClient->iScreen->SetScreenMode(iCurrentMode); sl@0: TSizeMode storeModeData=TheClient->iScreen->GetCurrentScreenModeAttributes(); sl@0: TSizeMode testMode=storeModeData; sl@0: iNumAnimation=0; sl@0: for (TInt xScale=2;xScale<4;xScale++) sl@0: { sl@0: INFO_PRINTF1(_L(" New X-Scale")); sl@0: for (TInt yScale=2;yScale<4;yScale++) sl@0: { sl@0: INFO_PRINTF1(_L(" New Y-Scale")); sl@0: testMode.iScreenScale=TSize(xScale,yScale); sl@0: TestDifferentOriginAndScaleL(testMode,TPoint(20,20)); sl@0: TestDifferentOriginAndScaleL(testMode,TPoint(20,30)); sl@0: TestDifferentOriginAndScaleL(testMode,TPoint(30,20)); sl@0: } sl@0: } sl@0: TheClient->iScreen->SetScreenMode(iCurrentMode); sl@0: TheClient->iScreen->SetCurrentScreenModeAttributes(storeModeData); sl@0: INFO_PRINTF1(_L(" Set To Mode 0")); sl@0: TheClient->iScreen->SetAppScreenMode(0); sl@0: TheClient->iScreen->SetScreenMode(0); sl@0: return EWait; sl@0: } sl@0: sl@0: void CTDirect::TestDifferentOriginAndScaleL(TSizeMode &aMode,TPoint aOrigin) sl@0: { sl@0: aMode.iOrigin=aOrigin; sl@0: TheClient->iScreen->SetCurrentScreenModeAttributes(aMode); sl@0: TheClient->iScreen->SetAppScreenMode(iCurrentMode); sl@0: TheClient->iScreen->SetScreenMode(iCurrentMode); sl@0: iCurrentScreenModeOrigin=TheClient->iScreen->GetScreenModeOrigin(iCurrentMode); sl@0: iCurrentScreenModeScale=TheClient->iScreen->GetScreenModeScale(iCurrentMode); sl@0: Copy2ndHalfOfScreen=(iCurrentScreenModeOrigin.iX>FullScreenModeSize.iWidth/2? 1 : 0); sl@0: TRect testWinRect(PhysicalToLogical(TPoint(),iCurrentScreenModeScale), sl@0: PhysicalToLogical(TPoint((Copy2ndHalfOfScreen ? FullScreenModeSize.iWidth sl@0: : FullScreenModeSize.iWidth/2), sl@0: FullScreenModeSize.iHeight) sl@0: -iCurrentScreenModeOrigin,iCurrentScreenModeScale) sl@0: ); sl@0: testWinRect.Shrink(10,10); sl@0: ++iNumAnimation; sl@0: CreateAnimForScreenModeL(iNumAnimation,*TheClient->iGroup,testWinRect,18); sl@0: TPoint pos0=iAnims[iNumAnimation]->AbsoluteWindowPosition(); sl@0: TEST(pos0==TPoint(10,10)); sl@0: } sl@0: sl@0: //REQUIREMENT: CR PHAR-5SJGAM, PREQ673 sl@0: //Tests that DSA works correctly in screen modes with non-zero screen mode origin. sl@0: TestState CTDirect::DSAWithScreenModeOffset1L() sl@0: { sl@0: TPoint screenModeTwoOrigin=TheClient->iScreen->GetScreenModeScaledOrigin(2); sl@0: TPixelsAndRotation pixelsAndRotation; sl@0: TheClient->iScreen->GetScreenModeSizeAndRotation(2,pixelsAndRotation); sl@0: if(pixelsAndRotation.iRotation != CFbsBitGc::EGraphicsOrientationNormal) sl@0: { sl@0: TheClient->iScreen->SetCurrentRotations(2, CFbsBitGc::EGraphicsOrientationNormal); sl@0: } sl@0: TheClient->iScreen->GetScreenModeSizeAndRotation(2,pixelsAndRotation); sl@0: //check that the current rotation is normal sl@0: __ASSERT_DEBUG(pixelsAndRotation.iRotation==CFbsBitGc::EGraphicsOrientationNormal,AutoPanic(EAutoPanicDirect)); sl@0: TInt screenWidthMode2=pixelsAndRotation.iPixelSize.iWidth; sl@0: TInt screenHeightMode2=pixelsAndRotation.iPixelSize.iHeight; sl@0: TPoint point1(screenModeTwoOrigin.iX,screenModeTwoOrigin.iY+(screenModeTwoOrigin.iY+screenHeightMode2)/2); sl@0: TPoint point2(screenModeTwoOrigin.iX+(screenModeTwoOrigin.iX+screenWidthMode2)/2,screenHeightMode2+screenModeTwoOrigin.iY); sl@0: TPoint point3(screenModeTwoOrigin.iX+screenWidthMode2,screenModeTwoOrigin.iY+screenHeightMode2); sl@0: sl@0: SetScreenMode(0,pixelsAndRotation); sl@0: TRect rect0(point1,point2); sl@0: CreateAnimForScreenModeL(0,*TheClient->iGroup,rect0,13); sl@0: TPoint pos0=iAnims[0]->AbsoluteWindowPosition(); sl@0: TEST(pos0==point1); sl@0: sl@0: SetScreenMode(2,pixelsAndRotation); sl@0: TRect rect1(TPoint(0,0),rect0.Size()); sl@0: CreateAnimForScreenModeL(1,*TheClient->iGroup,rect1,13); sl@0: TPoint pos1=iAnims[1]->AbsoluteWindowPosition(); sl@0: TEST(pos1==rect1.iTl); sl@0: sl@0: SetScreenMode(0,pixelsAndRotation); sl@0: iBlankTopClientWin1=new(ELeave) CTBlankWindow(); sl@0: // TInt ordpos = iBlankTopClientWin1->BaseWin()->OrdinalPosition(); sl@0: TRect rect2(TPoint(point2.iX,point1.iY),point3); sl@0: BlankTopClientWindowL(*iBlankTopClientWin1,rect2); sl@0: TInt x=rect2.Size().iWidth/4; sl@0: TPoint animWinPt(x,0); sl@0: rect2.Shrink(x,0); sl@0: CreateAnimForScreenModeL(2,*iBlankTopClientWin1,TRect(animWinPt,rect2.Size()),13); sl@0: TPoint pos2=iAnims[2]->AbsoluteWindowPosition(); sl@0: TEST(pos2==rect2.iTl); sl@0: sl@0: SetScreenMode(2,pixelsAndRotation); sl@0: iBlankTopClientWin2=new(ELeave) CTBlankWindow(); sl@0: // ordpos = iBlankTopClientWin2->BaseWin()->OrdinalPosition(); sl@0: TPoint tl(rect1.iBr.iX,0); sl@0: TRect rect3(tl,TPoint(screenWidthMode2,rect1.iBr.iY)); sl@0: BlankTopClientWindowL(*iBlankTopClientWin2,rect3); sl@0: x=rect3.Size().iWidth/4; sl@0: animWinPt=TPoint(x,0); sl@0: rect3.Shrink(x,0); sl@0: CreateAnimForScreenModeL(3,*iBlankTopClientWin2,TRect(animWinPt,rect3.Size()),13); sl@0: TPoint pos3=iAnims[3]->AbsoluteWindowPosition(); sl@0: TEST(pos3==(animWinPt+tl)); sl@0: sl@0: SetScreenMode(0,pixelsAndRotation); sl@0: return EWait; sl@0: } sl@0: sl@0: //REQUIREMENT: CR PHAR-5SJGAM, PREQ673 sl@0: //Tests that DSA works correctly in screen modes with non-zero screen mode origin and different rotations sl@0: TestState CTDirect::DSAWithScreenModeOffset2L() sl@0: { sl@0: iCurrentMode=0; sl@0: TTimeIntervalMicroSeconds32 timeBetweenScreenModeChange=3200000; sl@0: iCallBackWin->WinTreeNode()->SetOrdinalPosition(0); sl@0: iCallBackWin->SetVisible(ETrue); //Used to forsce screen into Color256 so that it will rotate sl@0: iChangeScreenModeTimer=CPeriodic::NewL(0); sl@0: iChangeScreenModeTimer->Start(0,timeBetweenScreenModeChange,TCallBack(ChangeScreenModeL,this)); sl@0: return EWait; sl@0: } sl@0: sl@0: void CTDirect::SetScreenMode(TInt aMode,TPixelsAndRotation& aPixelsAndRotation) sl@0: { sl@0: TheClient->iScreen->SetScreenMode(aMode); sl@0: TheClient->iScreen->SetScreenModeEnforcement(ESizeEnforcementNone); sl@0: TheClient->iScreen->GetDefaultScreenSizeAndRotation(aPixelsAndRotation); sl@0: TheClient->iScreen->SetScreenSizeAndRotation(aPixelsAndRotation); sl@0: TheClient->Flush(); sl@0: } sl@0: sl@0: TestState CTDirect::DefectFix_KAA_5J3BLW_L() sl@0: { sl@0: TInt numProcessHandles; sl@0: RThread().HandleCount(numProcessHandles,iNumThreadHandles); sl@0: const TSize screenSize(TheClient->iScreen->SizeInPixels()); sl@0: const TRect dsaRect(0,0,screenSize.iWidth>>2,screenSize.iHeight>>2); sl@0: iAnim=CBugFixColorAnimation::NewL(iTest->iScreenNumber, 1, *this, *TheClient->iGroup, dsaRect,ETrue); sl@0: return EWait; sl@0: } sl@0: sl@0: TestState CTDirect::RegionTrackingOnlyNotificationsL(TUint aId) sl@0: { sl@0: TInt numProcessHandles; sl@0: RThread().HandleCount(numProcessHandles,iNumThreadHandles); sl@0: const TSize screenSize(TheClient->iScreen->SizeInPixels()); sl@0: const TRect dsaRect(0,0,screenSize.iWidth>>2,screenSize.iHeight>>2); sl@0: TBool isWindowOpenedInFrontOfDsa = (aId == KRegionTrackingOnlyDsaWaitingForAbortSignal); sl@0: iAnim=CRegionTrackingOnly::NewL(iTest->iScreenNumber, aId, *this, *TheClient->iGroup, dsaRect,ETrue,isWindowOpenedInFrontOfDsa); sl@0: return EWait; sl@0: } sl@0: sl@0: // Tests the new function of getting the window's absolute position sl@0: TestState CTDirect::WindowPoistionRelativeToScreenL() sl@0: { sl@0: //.. delete screen mode timer sl@0: delete iChangeScreenModeTimer; sl@0: iChangeScreenModeTimer=NULL; sl@0: sl@0: TInt numProcessHandles; sl@0: RThread().HandleCount(numProcessHandles,iNumThreadHandles); sl@0: TSize screenSize(TheClient->iScreen->SizeInPixels()); sl@0: TRect rect(0,0,screenSize.iWidth>>1,screenSize.iHeight); sl@0: rect.Shrink(10,10); sl@0: // First animation is for showing that child window is within the visible part of the parent window and within the visible screen area sl@0: iAnims[0]=new(ELeave) CColorAnimation(iTest->iScreenNumber,15,*this); sl@0: iAnims[0]->ConstructL(*TheClient->iGroup,rect,KDrawingDsa,1); sl@0: iAnims[0]->StartL(ETrue); sl@0: // First animation is for showing that child window is to the side of visible part of parent window sl@0: rect.Move(screenSize.iWidth>>1,0); sl@0: iAnims[1]=new(ELeave) CColorAnimation(iTest->iScreenNumber,16,*this); sl@0: iAnims[1]->ConstructL(*TheClient->iGroup,rect,KDrawingDsa,2); sl@0: iAnims[1]->StartL(ETrue); sl@0: return EWait; sl@0: } sl@0: sl@0: TestState CTDirect::MultipleDSAsOnSameWindowL() sl@0: { sl@0: TInt numProcessHandles; sl@0: RThread().HandleCount(numProcessHandles,iNumThreadHandles); sl@0: iCallBackWin->SetVisible(ETrue); sl@0: iCallBackWin->WinTreeNode()->SetOrdinalPosition(0); sl@0: iAnims[0]=new(ELeave) CColorAnimation(iTest->iScreenNumber,20,*this); sl@0: iAnims[0]->ConstructL(*TheClient->iGroup,TRect(),KDrawingDsa,0,1); sl@0: iAnims[0]->StartL(); sl@0: iAnims[1]=new(ELeave) CColorAnimation(iTest->iScreenNumber,21,*this); sl@0: iAnims[1]->ConstructL(*TheClient->iGroup,TRect(),KDrawingDsa,0,2); sl@0: iAnims[1]->StartL(); sl@0: _LIT(ThreadName,"MoveWin"); sl@0: MoveInterval=100000; sl@0: ModeInterval=0; sl@0: FlipInterval=0; sl@0: ImmediateModeSwitch=EFalse; sl@0: iFirstFunction=TThreadStartUp(CMoveWindow::StartLC,(TAny*)iTest->iScreenNumber); sl@0: iMoveWin=CProcess::NewThreadL(ThreadName,&iFirstFunction); sl@0: return EWait; sl@0: } sl@0: sl@0: TestState CTDirect::KillAnimationL() sl@0: { sl@0: TInt numProcessHandles; sl@0: RThread().HandleCount(numProcessHandles,iNumThreadHandles); sl@0: iAnim=CColorAnimation::NewL(iTest->iScreenNumber,12,*this,*TheClient->iGroup,TRect(15,15,625,225),ETrue); sl@0: return EWait; sl@0: } sl@0: sl@0: TestState CTDirect::TemporaryDeadlockL() sl@0: { sl@0: sl@0: if (iTestJustCompleted) sl@0: { sl@0: if (iTestJustFailed) sl@0: { sl@0: Fail(); sl@0: } sl@0: iState++; sl@0: return ENext; sl@0: } sl@0: sl@0: //make sure this code isn't called a second time sl@0: __ASSERT_ALWAYS(iAnim==NULL,AutoPanic(EAutoPanicDirect)); sl@0: sl@0: TSize screenSize(TheClient->iScreen->SizeInPixels()); sl@0: TRect rect(0,0,screenSize.iWidth>>1,screenSize.iHeight); sl@0: rect.Shrink(10,10); sl@0: iAnim=new(ELeave) CColorAnimation(iTest->iScreenNumber,24,*this); sl@0: iAnim->ConstructL(*TheClient->iGroup,rect,KDrawingDsa,1); sl@0: iAnim->StartL(ETrue); sl@0: return EWait; sl@0: } sl@0: sl@0: void CTDirect::CheckForTemporaryDeadlock() sl@0: { sl@0: sl@0: TBool result=ETrue; sl@0: TInt error; sl@0: sl@0: sl@0: //Create a window for placing on top sl@0: TTime beforeTime; sl@0: beforeTime.HomeTime(); sl@0: sl@0: RWindow window(TheClient->iWs); sl@0: sl@0: error=window.Construct(*TheClient->iGroup->GroupWin(), reinterpret_cast(&window)); sl@0: if (error==KErrNone) sl@0: { sl@0: window.SetOrdinalPosition(0); sl@0: window.SetExtent(TPoint(30,30),TSize(10,10)); sl@0: window.SetBackgroundColor(TRgb(255,0,255)); sl@0: sl@0: //make sure the basewin is towards the back sl@0: iCallBackWin->BaseWin()->SetOrdinalPosition(5); sl@0: sl@0: window.SetRequiredDisplayMode(EColor256); sl@0: window.Activate(); sl@0: TheClient->iWs.Flush(); sl@0: //need code similar to below, but the status of the active object we sl@0: //really want is too private sl@0: //if (!iAnim->IsReadyToAbort()) sl@0: // { sl@0: // result=EFalse; sl@0: // } sl@0: window.Close(); sl@0: } sl@0: else sl@0: { sl@0: result = EFalse; sl@0: } sl@0: sl@0: TTime afterTime; sl@0: afterTime.HomeTime(); sl@0: TTimeIntervalMicroSeconds difference = afterTime.MicroSecondsFrom(beforeTime); sl@0: sl@0: //make time difference 350ms, since the two timers to be checked are 400ms and 500ms sl@0: if (difference>TTimeIntervalMicroSeconds(1000*350)) sl@0: { sl@0: result=EFalse; sl@0: } sl@0: sl@0: iTestJustCompleted = ETrue; sl@0: if (result==EFalse) sl@0: { sl@0: iTestJustFailed=ETrue; sl@0: } sl@0: } sl@0: sl@0: void CTDirect::RunTestCaseL(TInt /*aCurTestCase*/) sl@0: { sl@0: _LIT(Animation1,"Animating"); sl@0: _LIT(Animation2,"Animating Dies"); sl@0: _LIT(Animation3,"Packaging Class"); sl@0: _LIT(Animation4,"Many Animations"); sl@0: _LIT(Animation5,"Fail Codes"); sl@0: _LIT(Animation6,"Cancel The Other"); sl@0: _LIT(Animation7,"'R' Class API"); sl@0: _LIT(Animation8,"Switch Clear Type"); sl@0: _LIT(Animation9,"SizeMode Change"); sl@0: _LIT(Animation10,"Soak Testing"); sl@0: _LIT(Animation11,"Kill Animation"); sl@0: _LIT(Animation12,"Defect-Fix: KAA-5J3BLW"); sl@0: _LIT(Animation13,"Screen Mode Positioning DSA Test 1"); sl@0: _LIT(Animation14,"Screen Mode Positioning DSA Test 2"); sl@0: _LIT(Animation15,"Position Relative to Screen"); sl@0: _LIT(Animation16,"Screen mode Scaling DSA Test 1"); sl@0: _LIT(Animation17,"Screen mode Scaling DSA Test 2"); sl@0: _LIT(Animation18,"Multiple DSAs on same window"); sl@0: _LIT(Animation19,"DSA and windows temporary deadlock"); sl@0: _LIT(Animation25,"RegionTrackingOnly DSA, window opened in front"); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: _LIT(Animation26,"RegionTrackingOnly DSA, window opened behind"); sl@0: _LIT(Animation27,"Mixed DSAs, RegionTrackingOnly DSA last to exit"); sl@0: _LIT(Animation28,"Mixed DSAs, drawing DSA last to exit"); sl@0: _LIT(Animation29,"Trying all the screen supported modes"); sl@0: #endif sl@0: TestState ret=ENext; sl@0: sl@0: if (iTimerRunning && !iPackagingFinished) sl@0: { sl@0: // Prevent test harness from repeatedly running the test case too quickly. sl@0: User::After(SHORT_DELAY); sl@0: } sl@0: sl@0: //if (iState==0) iState=18; sl@0: iTest->iState=iState; sl@0: ((CTDirectStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); sl@0: switch(iState) sl@0: { sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0158 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Create seven seperate animations and run them to completion sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Create animations and start them running. Run until the animations finish. sl@0: sl@0: @SYMTestExpectedResults The animation run to completion without error sl@0: */ sl@0: case 0: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158")); sl@0: if (iNextFrameFinished) sl@0: InitialiseAnimationL(); sl@0: case 1: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158")); sl@0: case 2: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158")); sl@0: case 3: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158")); sl@0: case 4: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158")); sl@0: case 5: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158")); sl@0: case 6: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158")); sl@0: if (iNextFrameFinished) sl@0: { sl@0: iTest->LogSubTest(Animation1); sl@0: ret=AnimateWindowL(); sl@0: iNextFrameFinished=EFalse; sl@0: } sl@0: else sl@0: { sl@0: // Prevent test harness from repeatedly running the test case too quickly. sl@0: User::After(SHORT_DELAY); sl@0: } sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0159 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Check animation dies correctly when run in a thread sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Create animation and run in from a thread that dies. Once the thread sl@0: has died check the animation has been dealt with correctly. sl@0: sl@0: @SYMTestExpectedResults The animation dies correctly sl@0: */ sl@0: case 7: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0159")); sl@0: iTest->LogSubTest(Animation2); sl@0: ret=AnimationDiesL(); sl@0: ++iState; sl@0: DestroyAnimation(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0160 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Check animation runs correctly in blank window sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Create an animation and run it in a blank window sl@0: sl@0: @SYMTestExpectedResults The animation runs to completion without error sl@0: */ sl@0: case 8: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0160")); sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation3); sl@0: ret=PackagingClassL(); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0161 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Check many animations can be run in the same window sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Create multiple animations in a window and run them all sl@0: until completion sl@0: sl@0: @SYMTestExpectedResults The animations run without error sl@0: */ sl@0: case 9: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0161")); sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation4); sl@0: ret=MultipleL(); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0162 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Direct screen access out of memory test sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Direct screen access out of memory test sl@0: sl@0: @SYMTestExpectedResults The out of memory error is handled correctly sl@0: */ sl@0: case 10: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0162")); sl@0: iTest->LogSubTest(Animation5); sl@0: ret=FailCodesL(); sl@0: iState++; sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0163 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Two animations, one scrolling text sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Create two animations, one which scrolls text across the screen and sl@0: run them to completion sl@0: sl@0: @SYMTestExpectedResults The animations run without error sl@0: */ sl@0: case 11: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0163")); sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation6); sl@0: ret=ScrolingText1L(); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0164 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test direct screen access panic messages sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Call the direct screen access panic's and check they are handled sl@0: correctly sl@0: sl@0: @SYMTestExpectedResults The panic's are handled correctly sl@0: */ sl@0: case 12: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0164")); sl@0: iTest->LogSubTest(Animation7); sl@0: ret=RClassL(); sl@0: iTest->CloseAllPanicWindows(); sl@0: iState++; sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0165 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Two animations, one scrolling text sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Create two animations, one which scrolls text across the screen and sl@0: run them to completion sl@0: sl@0: @SYMTestExpectedResults The animations run without error sl@0: */ sl@0: case 13: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0165")); sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation8); sl@0: ret=ScrolingText2L(); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0166 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Two animations, one scrolling text. Change the screen mode an run. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Create two animations, one which scrolls text across the screen and sl@0: run them to completion while changing the screen mode sl@0: sl@0: @SYMTestExpectedResults The animations run without error sl@0: */ sl@0: sl@0: case 14: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0166")); sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation9); sl@0: ret=ScrolingText3L(); sl@0: if (ret == ENext) sl@0: iPackagingFinished = ETrue; sl@0: else sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: FlipInterval = 0; // Stops the tests (erroneously) flipping for the rest of the run sl@0: } sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0167 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Start an animation then kill it sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Start an animation running then kill it. Check the animation dies correctly sl@0: sl@0: @SYMTestExpectedResults The animations dies correctly sl@0: */ sl@0: case 15: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0167")); sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation11); sl@0: ret=KillAnimationL(); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: break; sl@0: case 16: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0167")); sl@0: iTest->LogSubTest(Animation10); //This test is designed to be left running for at least several hours sl@0: //ret=ScrolingText4L(); sl@0: iState++; sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0168 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc CBugFixColorAnimation sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions This class is used for reproducing a defect found on 6.1: KAA-5J3BLW "Unnecessary Wserv's DSA abort". sl@0: The problem was that a direct screen access client was getting an unnecessary abort notification sl@0: when a new window (or window group) was created but not visible. sl@0: This class will simulate the direct screen access client and it will check whether the first DSA abort sl@0: is not caused by just creating a window. sl@0: sl@0: @SYMTestExpectedResults Abort is not caused when creatung a window sl@0: */ sl@0: case 17: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0168")); sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation12); sl@0: ret=DefectFix_KAA_5J3BLW_L(); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0169 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Direct screen access in screen modes with non-zero screen mode origin sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Tests that DSA works correctly in screen modes with non-zero screen mode origin sl@0: sl@0: @SYMTestExpectedResults The DSA works correctly sl@0: */ sl@0: case 18: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0169")); sl@0: if (!CheckNonZeroOriginsSupportedOrNot()) sl@0: { sl@0: INFO_PRINTF1(_L("Non Zero Origins not supported\n")); sl@0: iState++; sl@0: } sl@0: else sl@0: { sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation13); sl@0: ret=DSAWithScreenModeOffset1L(); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: } sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0170 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Direct screen access in screen modes with non-zero screen mode origin sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Tests that DSA works correctly in screen modes with non-zero screen mode origin and different rotations sl@0: sl@0: @SYMTestExpectedResults The DSA works correctly sl@0: */ sl@0: case 19: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0170")); sl@0: if (!CheckNonZeroOriginsSupportedOrNot()) sl@0: { sl@0: INFO_PRINTF1(_L("Non Zero Origins not supported\n")); sl@0: iState++; sl@0: } sl@0: else sl@0: { sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation14); sl@0: ret=DSAWithScreenModeOffset2L(); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: } sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0171 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Window absolute position sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Tests the new function of getting the window's absolute position sl@0: sl@0: @SYMTestExpectedResults Function works correctly sl@0: */ sl@0: case 20: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0171")); sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation15); sl@0: ret=WindowPoistionRelativeToScreenL(); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0172 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test direct screen access restart sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Creates a DSA for screen mode 0. After DSA has displayed 2 or 3 frames screen mode sl@0: scale is changed with a timer. The DSA aborts and restarts once again sl@0: and completes itself in different screen mode. sl@0: sl@0: @SYMTestExpectedResults DSA restarts and completes correctly sl@0: */ sl@0: case 21: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0172")); sl@0: if (iIsScalingSupported) sl@0: { sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation16); sl@0: ret=ScreenModeTestForScalingL(); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: break; sl@0: } sl@0: iState++; sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0173 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test direct screen access scaling sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Creates a DSA for screen mode 0, tests API AbsoluteWindowPosition() sl@0: Then sets screen mode to last(test) screen mode, here it does the same thing as sl@0: done for screenmode 0, but with diffrerent scale (2,2) (2,3) (3,2) (3,3) and sl@0: with different origin (20,30) (30,20) (20,20). sl@0: Lastly copy back the test screen mode values. sl@0: sl@0: @SYMTestExpectedResults DSA scales correctly sl@0: */ sl@0: case 22: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0173")); sl@0: if (iIsScalingSupported) sl@0: { sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation17); sl@0: ret=ScreenModeScalingTestL(); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: break; sl@0: } sl@0: iState++; sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0174 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test multiple direct screen access elements on the same window sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Create a number of direct screen access elements on the same window and sl@0: check that they work correctly sl@0: sl@0: @SYMTestExpectedResults DSAs work correctly sl@0: */ sl@0: case 23: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0174")); sl@0: if (iIsScalingSupported) sl@0: { sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation18); sl@0: ret=MultipleDSAsOnSameWindowL(); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: break; sl@0: } sl@0: iState++; sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0175 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Create a temporary deadlock on a DSA and resolve it sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Resolve a temporary deadlock on a DSA sl@0: sl@0: @SYMTestExpectedResults DSA resolves the deadlock sl@0: */ sl@0: case 24: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0175")); sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation19); sl@0: ret=TemporaryDeadlockL();//for INC072887 - removing a 0.5s delay in wserv. sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: iState++; sl@0: } sl@0: break; sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: case 25: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0533 sl@0: */ sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0533")); sl@0: if (!iTimerRunning) sl@0: { sl@0: FlipInterval=0; sl@0: iTest->LogSubTest(Animation25); sl@0: //Opens a window in front of a region tracking only DSA sl@0: ret=RegionTrackingOnlyNotificationsL(KRegionTrackingOnlyDsaWaitingForAbortSignal); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: break; sl@0: case 26: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0534 sl@0: */ sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0534")); sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation26); sl@0: //Opens a window behind a region tracking only DSA sl@0: ret=RegionTrackingOnlyNotificationsL(KRegionTrackingOnlyDsaNoAbortSignal); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: break; sl@0: case 27: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0535 sl@0: */ sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0535")); sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation27); sl@0: ret=MixDsaAndRegionTrackingOnlyL(KRegionTrackingOnlyDsaExistLast); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: break; sl@0: case 28: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0536 sl@0: */ sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0536")); sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation28); sl@0: ret=MixDsaAndRegionTrackingOnlyL(KDrawingDsaExistLast); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: break; sl@0: case 29: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0537 sl@0: */ sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0537")); sl@0: if (!iTimerRunning) sl@0: { sl@0: iTest->LogSubTest(Animation29); sl@0: ret=TryDifferentSupportedModesL(); sl@0: iTimerRunning = ETrue; sl@0: } sl@0: if (iPackagingFinished) sl@0: { sl@0: iPackagingFinished = EFalse; sl@0: iTimerRunning = EFalse; sl@0: } sl@0: break; sl@0: #else sl@0: //NON NGA negative test for RegionTrackingOnly DSA sl@0: case 25: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0575 sl@0: */ sl@0: ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0575")); sl@0: if (!iTimerRunning) sl@0: { sl@0: FlipInterval=0; sl@0: iTest->LogSubTest(Animation25); sl@0: CColorAnimation* temp = NULL; sl@0: //Attempt to create a RegionTrackingOnly DSA in non NGA code sl@0: TRAPD(err,temp = CColorAnimation::NewL(iTest->iScreenNumber,1,*this,*TheClient->iGroup,TRect(10,10,630,230),ETrue,KRegionTrackingOnly)); sl@0: if(err!=KErrNotSupported) sl@0: { sl@0: _LIT(KCTDirectNonNgaError,"Attempt to creat a RegionTrackingOnly DSA did not return KErrNotSupported on non-NGA"); sl@0: LOG_MESSAGE(KCTDirectNonNgaError); sl@0: if(temp) sl@0: { sl@0: delete temp; sl@0: } sl@0: Fail(); sl@0: } sl@0: else sl@0: { sl@0: _LIT(KCTDirectNonNgaSuccess,"RegionTrackingOnly DSA not supported on non-NGA as expected"); sl@0: LOG_MESSAGE(KCTDirectNonNgaSuccess); sl@0: } sl@0: iState++; sl@0: } sl@0: break; sl@0: #endif sl@0: default: sl@0: ((CTDirectStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: ((CTDirectStep*)iStep)->CloseTMSGraphicsStep(); sl@0: TestComplete(); sl@0: break; sl@0: } sl@0: ((CTDirectStep*)iStep)->RecordTestResultL(); sl@0: } sl@0: sl@0: CRegionTrackingOnly* CRegionTrackingOnly::NewL(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack,CTWindowGroup& aParent,TRect aExtent,TBool aStart,TBool aOpenWindowInFrontDsa) sl@0: { sl@0: CRegionTrackingOnly* self=new(ELeave) CRegionTrackingOnly(aScreenNumber, aId,aCallBack); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aParent,aExtent,aOpenWindowInFrontDsa); sl@0: if (aStart) sl@0: { sl@0: self->StartL(); sl@0: self->Started(); sl@0: } sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CRegionTrackingOnly::CRegionTrackingOnly(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack) sl@0: : CColorAnimation(aScreenNumber, aId, aCallBack) sl@0: { sl@0: iThreadParam.iScreenNumber = aScreenNumber; sl@0: } sl@0: sl@0: void CRegionTrackingOnly::ConstructL(CTWindowGroup& aParent,TRect aExtent,TBool aOpenWindowInFrontDsa) sl@0: { sl@0: iExpectedToAbort = aOpenWindowInFrontDsa; sl@0: CColorAnimation::ConstructL(aParent, aExtent, KRegionTrackingOnly); sl@0: _LIT(ThreadName,"Create new Window"); sl@0: sl@0: TInt error=iSem.CreateGlobal(KSem_DefectFix_KAA_5J3BLW_Name, 0); sl@0: if (error==KErrNone) sl@0: { sl@0: iAnimRect=aExtent; sl@0: iThreadParam.iRect = iAnimRect; sl@0: iThreadParam.iIsInFront = aOpenWindowInFrontDsa; sl@0: TThreadStartUp function=TThreadStartUp(CreateNewWindowGroup, &iThreadParam); sl@0: TRequestStatus status; sl@0: iThread=CProcess::NewThreadRendezvousL(ThreadName,&function,status); sl@0: User::WaitForRequest(status); sl@0: if (status != KErrNone) sl@0: { sl@0: RDebug::Printf("the request status is returned to be non KErrNone: %d", status.Int()); sl@0: TestFailed(this); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: TestFailed(this); sl@0: } sl@0: } sl@0: sl@0: TBool CColorAnimation::TestGcAndScreenDeviceValues() sl@0: { sl@0: TBool succeeded = ETrue; sl@0: _LIT(KErrorLogGraphicContext,"GraphicsContext not NULL when using the region tracking feature only"); sl@0: _LIT(KErrorLogScreenDevice,"ScreenDevice not NULL when using the region tracking feature only"); sl@0: if(iRegionTrackingOnly && iDrawer->Gc() != NULL) sl@0: { sl@0: CallBack().Log((TText8*)__FILE__,__LINE__, ESevrErr,KErrorLogGraphicContext); sl@0: succeeded = EFalse; sl@0: } sl@0: if(iRegionTrackingOnly && iDrawer->ScreenDevice() != NULL) sl@0: { sl@0: CallBack().Log((TText8*)__FILE__,__LINE__, ESevrErr,KErrorLogScreenDevice); sl@0: succeeded = EFalse; sl@0: } sl@0: return succeeded; sl@0: } sl@0: sl@0: void CRegionTrackingOnly::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/) sl@0: { sl@0: Stop(); sl@0: } sl@0: sl@0: void CRegionTrackingOnly::Restart(RDirectScreenAccess::TTerminationReasons/* aReason*/) sl@0: { sl@0: if(!TestGcAndScreenDeviceValues()) sl@0: { sl@0: CallBack().Fail(); sl@0: } sl@0: if (iExpectedToAbort) sl@0: { sl@0: _LIT(KExpected,"DSA got an abort signal as expected"); sl@0: CallBack().Log((TText8*)__FILE__,__LINE__,ESevrInfo,KExpected); sl@0: } sl@0: else sl@0: { sl@0: _LIT(KError,"DSA got an abort signal even though the window was opened behind it"); sl@0: CallBack().Log((TText8*)__FILE__,__LINE__,ESevrErr,KError); sl@0: CallBack().Fail(); sl@0: } sl@0: FinishTest(); sl@0: } sl@0: sl@0: CRegionTrackingOnly::~CRegionTrackingOnly() sl@0: { sl@0: iSem.Close(); sl@0: if(iThread) sl@0: { sl@0: TRequestStatus status; sl@0: iThread->Logon(status); sl@0: if (iThread->StillAlive()) sl@0: { sl@0: iThread->Terminate(KErrNone); sl@0: User::WaitForRequest(status); sl@0: } sl@0: delete iThread; sl@0: } sl@0: } sl@0: sl@0: __WS_CONSTRUCT_STEP__(Direct)