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: // Client side of AUTODLL test code sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent - Internal Symbian test code sl@0: */ sl@0: sl@0: #include "TAUTODLL.H" sl@0: #include "TEVENT.H" sl@0: sl@0: //#define LOGGING sl@0: sl@0: // sl@0: sl@0: sl@0: CGraphicsContext::TDrawMode CAnimWindow::iEllipseDrawMode; sl@0: sl@0: CTAnimDll::CTAnimDll(CTestStep* aStep) : CTWsGraphicsBase(aStep) sl@0: { sl@0: } sl@0: sl@0: RTestAnim::RTestAnim() : RAnim() sl@0: { sl@0: } sl@0: sl@0: RTestAnim::RTestAnim(RAnimDll &aDll) : RAnim(aDll) sl@0: { sl@0: } sl@0: sl@0: LOCAL_C TInt DoPanicTest(TInt aInt, TAny *aScreenNumber) sl@0: { sl@0: RWsSession ws; sl@0: User::LeaveIfError(ws.Connect()); sl@0: sl@0: // assign to the correct screen sl@0: CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws); sl@0: User::LeaveIfError(screen->Construct((TInt)aScreenNumber)); sl@0: sl@0: RWindowGroup group(ws); sl@0: User::LeaveIfError(group.Construct(333)); sl@0: group.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close sl@0: RAnimDll animDll=RAnimDll(ws); sl@0: User::LeaveIfError(animDll.Load(KAnimDLLName)); sl@0: RTestAnim panic(animDll); sl@0: RWindow window(ws); sl@0: RBlankWindow blankwin(ws); sl@0: if (aInt==16 || aInt==17) // Use a blank window for this one sl@0: { sl@0: User::LeaveIfError(blankwin.Construct(group,123)); sl@0: blankwin.SetSize(TSize(10,10)); sl@0: blankwin.Activate(); sl@0: User::LeaveIfError(panic.Construct(blankwin,EAnimTypeTest1,TPtrC8())); sl@0: } sl@0: else sl@0: { sl@0: User::LeaveIfError(window.Construct(group,123)); sl@0: window.SetSize(TSize(10,10)); sl@0: window.Activate(); sl@0: window.BeginRedraw(); sl@0: window.EndRedraw(); sl@0: if (aInt==0) sl@0: User::LeaveIfError(panic.Construct(window,EAnimTypeTest2,TPtrC8())); sl@0: User::LeaveIfError(panic.Construct(window,EAnimTypeTest1,TPtrC8())); sl@0: } sl@0: TPckgBuf dummyParam; sl@0: switch(aInt) sl@0: { sl@0: case 1: sl@0: panic.Command(EADllPanicCallPanic); sl@0: break; sl@0: case 2: sl@0: panic.Command(EADllPanicCallPanic,dummyParam); sl@0: break; sl@0: case 3: sl@0: panic.CommandReply(EADllPanicCallPanic); sl@0: break; sl@0: case 4: sl@0: panic.CommandReply(EADllPanicCallPanic,dummyParam); sl@0: break; sl@0: case 5: sl@0: panic.Command(EADllPanicSetInterval); sl@0: break; sl@0: case 6: sl@0: panic.Command(EADllPanicSetNextInterval); sl@0: break; sl@0: case 7: sl@0: panic.CommandReply(EADllPanicBadFont); sl@0: break; sl@0: case 8: sl@0: panic.CommandReply(EADllPanicBadBitmap); sl@0: break; sl@0: case 9: sl@0: panic.Command(EADllPanicLeave); sl@0: break; sl@0: case 10: sl@0: panic.Command(EADllPanicDoubleActivateGC); sl@0: break; sl@0: case 11: sl@0: panic.Command(EADllPanicDrawRectWithNoGc); sl@0: break; sl@0: case 12: sl@0: panic.Command(EADllPanicDrawTextWithNoFont); sl@0: break; sl@0: case 13: sl@0: panic.Command(EADllPanicLeaveInAnimate); sl@0: ws.Finish(); sl@0: panic.CommandReply(EADllBlankOpCode); sl@0: break; sl@0: case 14: sl@0: panic.Command(EADllPanicLeaveInRedraw); sl@0: window.BeginRedraw(); sl@0: window.EndRedraw(); sl@0: ws.Finish(); sl@0: panic.CommandReply(EADllBlankOpCode); sl@0: break; sl@0: case 15: sl@0: ws.TestWrite(animDll.WsHandle(),999,NULL,0); sl@0: break; sl@0: case 16: sl@0: panic.Command(EADllPanicSetVisWithGcActive); sl@0: break; sl@0: case 17: sl@0: panic.CommandReply(EADllPanicSetVisWithGcActiveReply); sl@0: break; sl@0: case 18: sl@0: panic.Command(EADllPanicLeaveInActiveCallback); sl@0: ws.Flush(); sl@0: User::After(2000000); sl@0: panic.CommandReply(EADllBlankOpCode); sl@0: break; sl@0: case 19: sl@0: panic.Command(EADllPanicSetClippingRectWithNoGc); sl@0: break; sl@0: case 20: sl@0: panic.CommandReply(EADllPanicSetClippingRegionWithNoGc); sl@0: break; sl@0: case 21: sl@0: panic.Command(EADllPanicCancelClippingRegionWithNoGc); sl@0: break; sl@0: case 22: sl@0: panic.Command(EADllPanicCancelClippingRectWithNoGc); sl@0: break; sl@0: case 23: sl@0: panic.Command(EADllPanicSetDrawModeWithNoGc); sl@0: break; sl@0: case 24: sl@0: panic.Command(EADllPanicUseFontWithNoGc); sl@0: break; sl@0: case 25: sl@0: panic.Command(EADllPanicDiscardFontWithNoGc); sl@0: break; sl@0: case 26: sl@0: panic.Command(EADllPanicSetUnderlineStyleWithNoGc); sl@0: break; sl@0: case 27: sl@0: panic.Command(EADllPanicSetStrikeThoughStyleWithNoGc); sl@0: break; sl@0: case 28: sl@0: panic.Command(EADllPanicSetWordJustificationWithNoGc); sl@0: break; sl@0: case 29: sl@0: panic.Command(EADllPanicSetCharJustificationWithNoGc); sl@0: break; sl@0: case 30: sl@0: panic.Command(EADllPanicSetPenColorWithNoGc); sl@0: break; sl@0: case 31: sl@0: panic.Command(EADllPanicSetPenStyleWithNoGc); sl@0: break; sl@0: case 32: sl@0: panic.Command(EADllPanicSetPenSizeWithNoGc); sl@0: break; sl@0: case 33: sl@0: panic.Command(EADllPanicSetBrushColorWithNoGc); sl@0: break; sl@0: case 34: sl@0: panic.Command(EADllPanicSetBrushStyleWithNoGc); sl@0: break; sl@0: case 35: sl@0: panic.Command(EADllPanicSetBrushOriginWithNoGc); sl@0: break; sl@0: case 36: sl@0: panic.Command(EADllPanicUseBrushPatterWithNoGc); sl@0: break; sl@0: case 37: sl@0: panic.Command(EADllPanicDiscardBrushPatternWithNoGc); sl@0: break; sl@0: case 38: sl@0: panic.Command(EADllPanicSetFadedWithNoGc); sl@0: break; sl@0: case 39: sl@0: panic.Command(EADllPanicSetFadingParametersWithNoGc); sl@0: break; sl@0: case 40: sl@0: panic.Command(EADllPanicDrawArcWithNoGc); sl@0: break; sl@0: case 41: sl@0: panic.Command(EADllPanicDrawPieWithNoGc); sl@0: break; sl@0: case 42: sl@0: panic.Command(EADllPanicDrawLineWithNoGc); sl@0: break; sl@0: case 43: sl@0: panic.Command(EADllPanicDrawLineToWithNoGc); sl@0: break; sl@0: case 44: sl@0: panic.Command(EADllPanicDrawLineByWithNoGc); sl@0: break; sl@0: case 45: sl@0: panic.Command(EADllPanicDrawEllipseWithNoGc); sl@0: break; sl@0: case 46: sl@0: panic.Command(EADllPanicDrawRoundedRecWithNoGc); sl@0: break; sl@0: case 47: sl@0: panic.Command(EADllPanicClearWithRectWithNoGc); sl@0: break; sl@0: case 48: sl@0: panic.Command(EADllPanicClearWithNoGc); sl@0: break; sl@0: case 49: sl@0: panic.Command(EADllPanicBitBltWithNoGc); sl@0: break; sl@0: case 50: sl@0: panic.Command(EADllPanicBitBltWithRectWithNoGc); sl@0: break; sl@0: case 51: sl@0: panic.Command(EADllPanicBitBltMaskedWithNoGc); sl@0: break; sl@0: case 52: sl@0: panic.Command(EADllPanicDrawBitmapPointWithNoGc); sl@0: break; sl@0: case 53: sl@0: panic.Command(EADllPanicDrawBitmapWithNoGc); sl@0: break; sl@0: case 54: sl@0: panic.Command(EADllPanicDrawBitmapRectWithNoGc); sl@0: break; sl@0: case 55: sl@0: panic.Command(EADllPanicDrawBitmapMaskedFbsBitmapWithNoGc); sl@0: break; sl@0: case 56: sl@0: panic.Command(EADllPanicDrawBitmapMaskedWsBitmapWithNoGc); sl@0: break; sl@0: case 57: sl@0: panic.Command(EADllPanicDrawPolyLinePointsWithNoGc); sl@0: break; sl@0: case 58: sl@0: panic.Command(EADllPanicDrawPolyLineArrayWithNoGc); sl@0: break; sl@0: case 59: sl@0: panic.CommandReply(EADllPanicDrawPolygonPointsWithNoGc); sl@0: break; sl@0: case 60: sl@0: panic.CommandReply(EADllPanicDrawPolygonArrayWithNoGc); sl@0: break; sl@0: case 61: sl@0: panic.Command(EADllPanicMoveToWithNoGc); sl@0: break; sl@0: case 62: sl@0: panic.Command(EADllPanicMoveByWithNoGc); sl@0: break; sl@0: case 63: sl@0: panic.Command(EADllPanicPlotWithNoGc); sl@0: break; sl@0: case 64: sl@0: panic.Command(EADllPanicSetOriginWithNoGc); sl@0: break; sl@0: case 65: sl@0: panic.Command(EADllPanicCopyRectWithNoGc); sl@0: break; sl@0: case 66: sl@0: panic.Command(EADllPanicResetWithNoGc); sl@0: break; sl@0: case 67: sl@0: panic.CommandReply(EADllPanicAlphaBlendingBitmapsFbsBitmapWithNoGc); sl@0: break; sl@0: case 68: sl@0: panic.Command(EADllPanicMapColorsWithNoGc); sl@0: break; sl@0: case 69: sl@0: panic.Command(EADllPanicDrawTextWithRectWithNoFont); sl@0: break; sl@0: case 70: sl@0: panic.Command(EADllPanicDrawTextVerticalWithNoFont); sl@0: break; sl@0: case 71: sl@0: panic.Command(EADllPanicDrawTextVerticalWithRectWithNoFont); sl@0: break; sl@0: case 72: sl@0: panic.CommandReply(EADllPanicDevice); sl@0: break; sl@0: case 73: sl@0: panic.Command(EADllPanicInvalidFocusScreenTooBig); sl@0: break; sl@0: case 74: sl@0: panic.Command(EADllPanicInvalidFocusScreenNegative); sl@0: break; sl@0: default: sl@0: return(EWsExitReasonFinished); sl@0: } sl@0: sl@0: ws.Flush(); sl@0: return(EWsExitReasonBad); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0125 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Panic tests sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions The test creates an animation and animation's client threads. sl@0: Each thread calls some sl@0: command of the animation which is expected to panic on certain reason. sl@0: The test checks that those client threads will panic returning sl@0: a proper panic code. Client threads are created and tested for sl@0: the following actions: sl@0: 1. A Command() call to an animation which executes sl@0: iFunctions->Panic() method. Client thread must panic with sl@0: code EWservPanicAnimDll. sl@0: 2. A Command() call with dummy parameter to an animation which sl@0: executes iFunctions->Panic() method. Client thread must panic sl@0: with code EWservPanicAnimDll. sl@0: 3. A CommandReply() call to an animation which executes sl@0: iFunctions->Panic() method. Client thread must panic with code sl@0: EWservPanicAnimDll. sl@0: 4. A CommandReply() call with dummy parameter to an animation sl@0: which executes iFunctions->Panic() method. Client thread must sl@0: panic with code EWservPanicAnimDll. sl@0: 5. A command that calls MAnimGeneralFunctions::SetInterval() when sl@0: the synchronisation mode is not TAnimSync::ESyncNone. Client sl@0: thread must panic with code EWservPanicAnimDll. sl@0: 6. A command that calls MAnimGeneralFunctions::SetNextInterval() sl@0: when the synchronisation mode is not TAnimSync::ESyncNone. Client sl@0: thread must panic with code EWservPanicAnimDll. sl@0: 7. A command that calls MAnimGeneralFunctions::DuplicateFontL() to sl@0: duplicate undefined font. Client thread must panic with code sl@0: EWservPanicFont. sl@0: 8. A command that calls MAnimGeneralFunctions::DuplicateBitmapL() sl@0: to duplicate undefined bitmap. Client thread must panic with code sl@0: EWservPanicBitmap. sl@0: 9. A command that calls User::Leave(KErrGeneral). Client thread sl@0: must panic with code EWservPanicAnimLeave. sl@0: 10. A command that activates window animation's graphical context sl@0: twice. Client thread must panic with code EWservPanicAnimDll. sl@0: 11. A command that tries to draw a rectangle while graphical sl@0: context is not defined yet. Client thread must panic with code sl@0: EWservPanicAnimLeave. sl@0: 12. A command that tries to draw a text whihout a font defined yet. sl@0: Client thread must panic with code EWservPanicNoFont. sl@0: 13. A command that causes an animation to leave during execution sl@0: of CAnim::Animate() method; and a new command call 4 seconds after sl@0: that. Client thread must panic with code EWservPanicAnimLeave. sl@0: 14. A command that causes an animation to leave during execution sl@0: of CAnim::Redraw() method. The client thread initiates it's window sl@0: redraw after that. Client thread must panic with code sl@0: EWservPanicAnimLeave. sl@0: 15. The client thread calls RWsSession::TestWrite() on animation sl@0: DLL server-side handle with opcode 999. Client thread must panic with code sl@0: EWservPanicOpcode. sl@0: 16. A command that activates graphical context and sets the sl@0: window to invisible and then to visible. Client thread must panic sl@0: with code EWservPanicAnimDll. sl@0: sl@0: sl@0: @SYMTestExpectedResults See test actions. sl@0: */ sl@0: void CTAnimDll::TestPanicsL() sl@0: { sl@0: TInt index=0; sl@0: TBool finishTests=EFalse; sl@0: do sl@0: { sl@0: sl@0: sl@0: TClientPanic panicCode=EWservPanicAnimDll; sl@0: switch(index) sl@0: { sl@0: // panic the server with a KERN-4. When server fixed these this can be removed. sl@0: case 19: sl@0: case 20: sl@0: case 22: sl@0: case 24: sl@0: goto bypasstest; sl@0: sl@0: case 0: sl@0: case 1: sl@0: case 2: sl@0: case 3: sl@0: case 4: sl@0: case 5: sl@0: case 6: sl@0: case 10: sl@0: case 16: sl@0: case 17: sl@0: case 18: sl@0: case 73: sl@0: case 74: sl@0: panicCode=EWservPanicAnimDll; sl@0: break; sl@0: case 7: sl@0: panicCode=EWservPanicFont; sl@0: break; sl@0: case 8: sl@0: panicCode=EWservPanicBitmap; sl@0: break; sl@0: case 12: sl@0: case 69: sl@0: case 70: sl@0: case 71: sl@0: panicCode=EWservPanicNoFont; sl@0: break; sl@0: case 15: sl@0: panicCode=EWservPanicOpcode; sl@0: break; sl@0: case 9: sl@0: case 11: sl@0: case 13: sl@0: case 14: sl@0: case 72: sl@0: default: // cases 19 - 68 sl@0: panicCode=EWservPanicAnimLeave; sl@0: break; sl@0: } sl@0: sl@0: TEST(iTest->TestWsPanicL(&DoPanicTest,panicCode,index,(TAny*)iTest->iScreenNumber,&finishTests)); sl@0: bypasstest: sl@0: if (iTest->iScreenNumber == 0) sl@0: iTest->CloseAllPanicWindows(); sl@0: index++; sl@0: } while(!finishTests); sl@0: } sl@0: sl@0: void CTAnimDll::TestSyncModes(MAnimGeneralFunctions::TAnimSync aSyncMode) sl@0: { sl@0: RTestAnim anim=RTestAnim(iAnimDll); sl@0: User::LeaveIfError(anim.Construct(*iTestWin->BaseWin(),EAnimTypeTest1,TPtrC8())); sl@0: CleanupClosePushL(anim); sl@0: sl@0: TPckgBuf params; sl@0: TRequestStatus status(KRequestPending); sl@0: params().status=&status; sl@0: params().syncMode=aSyncMode; sl@0: anim.CommandReply(EADllSyncTests,params); sl@0: User::WaitForRequest(status); sl@0: TEST(status==KErrNone); sl@0: sl@0: CleanupStack::PopAndDestroy(&anim); sl@0: } sl@0: sl@0: void CTAnimDll::TestTimeChange() sl@0: { sl@0: RTestAnim anim=RTestAnim(iAnimDll); sl@0: User::LeaveIfError(anim.Construct(*iTestWin->BaseWin(),EAnimTypeTest1,TPtrC8())); sl@0: CleanupClosePushL(anim); sl@0: sl@0: TPckgBuf params; sl@0: TRequestStatus status(KRequestPending); sl@0: TRequestStatus status2(KRequestPending); sl@0: params().status=&status; sl@0: params().status2=&status2; sl@0: anim.CommandReply(EADllTimeChangedTest,params); sl@0: User::WaitForRequest(status); sl@0: TTime time; sl@0: time.HomeTime(); sl@0: time+=TTimeIntervalHours(1); sl@0: User::SetHomeTime(time); sl@0: User::WaitForRequest(status2); sl@0: time.HomeTime(); sl@0: time-=TTimeIntervalHours(1); sl@0: User::SetHomeTime(time); sl@0: TEST(status2==KErrNone); sl@0: sl@0: CleanupStack::PopAndDestroy(&anim); sl@0: } sl@0: sl@0: void CTAnimDll::ConstructL() sl@0: { sl@0: TheClient->iGroup->WinTreeNode()->SetOrdinalPosition(0); sl@0: iRedrawWin=new(ELeave) CAnimWindow(EFalse, CAnimWindow::ERedraw); sl@0: iBackedUpTestWin=new(ELeave) CAnimWindow(EFalse, CAnimWindow::EBackedUp); sl@0: iBlankTestWin=new(ELeave) CAnimWindow(EFalse, CAnimWindow::EBlank); sl@0: iBaseWin=new(ELeave) CAnimWindow(ETrue, CAnimWindow::ERedraw); sl@0: sl@0: // sl@0: TSize screenSize=TheClient->iGroup->Size(); sl@0: TInt winWidth=(screenSize.iWidth/3)-10; sl@0: TInt winHeight=screenSize.iHeight-10; sl@0: iBaseWin->ConstructL(TPoint(screenSize.iWidth/3+5,5),TSize(winWidth,winHeight)); sl@0: iBlankTestWin->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight)); sl@0: ((RBlankWindow *)iBlankTestWin->BaseWin())->SetColor(TRgb::Gray4(2)); sl@0: iBackedUpTestWin->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight)); sl@0: iRedrawWin->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight)); sl@0: // sl@0: iTestWin=iRedrawWin; sl@0: // sl@0: iAnimDll=RAnimDll(TheClient->iWs); sl@0: TInt retVal = iAnimDll.Load(KAnimDLLName); sl@0: TEST(retVal==KErrNone); sl@0: if (retVal!=KErrNone) sl@0: INFO_PRINTF3(_L("iAnimDll.Load(KAnimDLLName) return value - Expected: %d , Actual: %d"), KErrNone, retVal); sl@0: } sl@0: sl@0: CTAnimDll::~CTAnimDll() sl@0: { sl@0: iAnimDll.Close(); sl@0: delete iBackedUpTestWin; sl@0: delete iBlankTestWin; sl@0: delete iRedrawWin; sl@0: delete iBaseWin; sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0126 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Miscellaneous animation tests. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Tests window animation's window funtions like WindowSize(), sl@0: IsHidden(), SetVisible(). sl@0: Tests RAnimDll's constructor, Close(), Load() and copy-constructor. sl@0: sl@0: @SYMTestExpectedResults Expects window funtions and RAnimDll's methods work properly. sl@0: */ sl@0: void CTAnimDll::Misc() sl@0: { sl@0: RTestAnim anim=RTestAnim(iAnimDll); sl@0: User::LeaveIfError(anim.Construct(*iTestWin->BaseWin(),EAnimTypeTest1,TPtrC8())); sl@0: CleanupClosePushL(anim); sl@0: sl@0: TPckgBuf params; sl@0: params()=iTestWin->Size(); sl@0: TBool retBool = anim.CommandReply(EADllTestWindowSize,params); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllTestWindowSize,params) return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: TheClient->iWs.Finish(); sl@0: retBool = anim.CommandReply(EADllTestSetVisible); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllTestSetVisible) return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: CleanupStack::PopAndDestroy(&anim); sl@0: sl@0: RAnimDll closeme(TheClient->iWs); sl@0: closeme.Close(); sl@0: RAnimDll animdll(TheClient->iWs); sl@0: TInt retVal = animdll.Load(KAnimDLLName); sl@0: TEST(retVal==KErrNone); sl@0: if (retVal!=KErrNone) sl@0: INFO_PRINTF3(_L("animdll.Load(KAnimDLLName) return value - Expected: %d , Actual: %d"), KErrNone, retVal); sl@0: sl@0: RTestAnim anim2(animdll); sl@0: anim2.Close(); sl@0: animdll.Close(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0127 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test animation's command call with reply sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Puts an array containing a sequnce of numbers into a command argument. sl@0: Performs command call to server, assuming that the server-side sl@0: should return a sum of the numbers in sequence. sl@0: sl@0: @SYMTestExpectedResults Checks that server returns the correct sum. sl@0: */ sl@0: void CTAnimDll::RemoteBuffer() sl@0: { sl@0: RTestAnim anim=RTestAnim(iAnimDll); sl@0: User::LeaveIfError(anim.Construct(*iTestWin->BaseWin(),EAnimTypeTest1,TPtrC8())); sl@0: CleanupClosePushL(anim); sl@0: sl@0: TBuf buf(ERemoteBufSize); sl@0: TInt total=0; sl@0: for (TInt8 index=0;indexiWs); sl@0: TInt retVal = extraCopy.Load(KAnimDLLName); sl@0: TEST(retVal==KErrNone); sl@0: if (retVal!=KErrNone) sl@0: INFO_PRINTF3(_L("extraCopy.Load(KAnimDLLName) return value - Expected: %d , Actual: %d"), KErrNone, retVal); sl@0: sl@0: extraCopy.Close(); sl@0: } sl@0: // sl@0: void CTAnimDll::SyncMode1() sl@0: { sl@0: TestSyncModes(MAnimGeneralFunctions::ESyncSecond); sl@0: } sl@0: sl@0: void CTAnimDll::CheckWindows() sl@0: { sl@0: CheckRect(iBaseWin->CtBaseWin(),iTestWin->CtBaseWin(),TRect(iBaseWin->Size()),_L("CTAnimDll::CheckWindows() failed")); sl@0: } sl@0: sl@0: void CTAnimDll::InvalidatePauseAndRedraw(const TRect &aRect,TTimeIntervalMicroSeconds32 aInterval) sl@0: { sl@0: iTestWin->Invalidate(aRect); sl@0: TheClient->iWs.Flush(); sl@0: User::After(aInterval); sl@0: __ASSERT_DEBUG(iTestWin->iWinType==CAnimWindow::ERedraw,AutoPanic(EAutoPanicWindowType)); sl@0: RWindow *win=(RWindow *)iTestWin->BaseWin(); sl@0: win->BeginRedraw(); sl@0: iTestWin->DoDraw(); sl@0: win->EndRedraw(); sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CTAnimDll::RedrawAndCheckWindows(TBool aBlankIt) sl@0: { sl@0: if (iTestWin->iWinType==CAnimWindow::ERedraw) sl@0: { sl@0: RWindow *win=(RWindow *)iTestWin->BaseWin(); sl@0: win->BeginRedraw(); sl@0: iTestWin->DoDraw(aBlankIt); sl@0: win->EndRedraw(); sl@0: } sl@0: RWindow *win=(RWindow *)iBaseWin->BaseWin(); sl@0: win->BeginRedraw(); sl@0: iBaseWin->DoDraw(aBlankIt); sl@0: win->EndRedraw(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: CheckWindows(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0129 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Animation drawing test sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Performs animation drawing ontop of redrawable window, backed-up window and blank window. sl@0: Draws the same shapes using directly window graphics on an other window (base window). sl@0: The following shapes are drawn: sl@0: 1. An animation with a small ellipse drawn in XOR mode on top of redrawable sl@0: black-lined gray window. sl@0: 2. The same with a bigger ellipse but previously invalidating an sl@0: area which intersects the old ellipse and the new ellipse. sl@0: 3. Runs an animation that continuously moves a rectangle and shrinks another on top of sl@0: redrawable black-lined gray window and then cancels an animation. sl@0: The test checks that the window will be identical with the gray base window sl@0: that contains only black lines. sl@0: 4. An animation with a small ellipse drawn in XOR mode on top of backed-up sl@0: black-lined gray window. The test also calls Invalidate() method and performs sl@0: a check again to make sure that the test-window and base window are identical. sl@0: 5. An animation with a small ellipse drawn in XOR mode on top of the blank sl@0: gray window. The test also sends commands to the animation that call windows sl@0: SetVisible(EFalse) and SetVisible(ETrue) and checks that the sl@0: test-window and base window are identical. sl@0: sl@0: sl@0: @SYMTestExpectedResults Each time performs pixelwise comparisons of animated windows sl@0: and the base window expecting the windows to be identical. sl@0: */ sl@0: void CTAnimDll::DrawingTestL() sl@0: { sl@0: // draws a little circle on the base window using window graphics and using window animation on the test window. sl@0: RTestAnim drawAnim=RTestAnim(iAnimDll); sl@0: // sl@0: TRect rect; sl@0: TPckgBuf rectPckg; sl@0: TPckgBuf boolPckg; sl@0: sl@0: // sl@0: _LIT(KLog1,"Draw Ellipse Test1"); sl@0: LOG_MESSAGE(KLog1); sl@0: rect = TRect(10,10,50,50); sl@0: CAnimWindow::SetEllipseDrawMode(CGraphicsContext::EDrawModeXOR); sl@0: iTestWin->Invalidate(); sl@0: iTestWin->SetRect(rect); sl@0: iBaseWin->Invalidate(); sl@0: iBaseWin->SetRect(rect); sl@0: rectPckg()=rect; sl@0: User::LeaveIfError(drawAnim.Construct(*iTestWin->BaseWin(),EAnimTypeTest3,rectPckg)); sl@0: RedrawAndCheckWindows(); sl@0: // sl@0: _LIT(KLog2,"Draw Ellipse Test2"); sl@0: LOG_MESSAGE(KLog2); sl@0: iTestWin->Invalidate(TRect(20,20,100,40)); sl@0: iBaseWin->Invalidate(TRect(20,20,100,40)); sl@0: iBaseWin->DoDrawEllipse(); // Should clear old Ellipse (except invalid bits) sl@0: rect=TRect(30,30,200,100); sl@0: rectPckg()=rect; sl@0: iBaseWin->SetRect(rect); sl@0: iBaseWin->DoDrawEllipse(); // Should draw new Ellipse (except invalid bits) sl@0: drawAnim.Command(EADllSetRect,rectPckg); sl@0: RedrawAndCheckWindows(); sl@0: iBaseWin->DoDrawEllipse(); // Clear old ellipse sl@0: // sl@0: _LIT(KLog3,"Window Overlap Anim Test"); sl@0: LOG_MESSAGE(KLog3); sl@0: sl@0: iBaseWin->SetRect(TRect()); sl@0: iBaseWin->DoDraw(); sl@0: TheClient->iWs.Finish(); sl@0: sl@0: // create another window on top and check that animation beneath is not visible sl@0: TSize screenSize=TheClient->iGroup->Size(); sl@0: TInt winWidth=(screenSize.iWidth/3)-10; sl@0: TInt winHeight=screenSize.iHeight-10; sl@0: TSize size=iTestWin->Size(); sl@0: rectPckg()=TRect(size); sl@0: drawAnim.Command(EADllStartAnimate,rectPckg); sl@0: sl@0: CAnimWindow *topWindow = new (ELeave) CAnimWindow(ETrue, CAnimWindow::ERedraw); sl@0: CleanupStack::PushL(topWindow); sl@0: topWindow->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight)); sl@0: sl@0: RWindow *win=(RWindow *)iTestWin->BaseWin(); sl@0: win->BeginRedraw(); sl@0: topWindow->DoDraw(EFalse); sl@0: win->EndRedraw(); sl@0: sl@0: TheClient->iWs.Flush(); sl@0: for(TInt i=0;iWaitForRedrawsToFinish(); sl@0: CheckRect(iBaseWin->CtBaseWin(),iTestWin->CtBaseWin(),TRect(iBaseWin->Size())); sl@0: sl@0: win->BeginRedraw(rect); sl@0: drawAnim.Command(EADllCancelAnimate,rectPckg); sl@0: win->EndRedraw(); sl@0: sl@0: CleanupStack::PopAndDestroy(topWindow); sl@0: // sl@0: iTestWin->BaseWin()->SetVisible(EFalse); sl@0: drawAnim.Close(); sl@0: // sl@0: _LIT(KLog4,"Draw Ellipse Test4&5"); sl@0: LOG_MESSAGE(KLog4); sl@0: rect=TRect(20,20,50,50); sl@0: iBackedUpTestWin->SetRect(rect); sl@0: iBackedUpTestWin->DoDraw(); sl@0: iBaseWin->SetRect(rect); sl@0: win->BeginRedraw(); sl@0: iBaseWin->DoDraw(); sl@0: win->EndRedraw(); sl@0: TheClient->iWs.Finish(); sl@0: sl@0: rectPckg()=rect; sl@0: User::LeaveIfError(drawAnim.Construct(*iBackedUpTestWin->BaseWin(),EAnimTypeTest3,rectPckg)); sl@0: TheClient->iWs.Finish(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: CheckWindows(); sl@0: iBackedUpTestWin->Invalidate(); sl@0: TheClient->iWs.Flush(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: CheckWindows(); sl@0: iBackedUpTestWin->BaseWin()->SetVisible(EFalse); sl@0: // sl@0: _LIT(KLog5,"Draw Ellipse Test6&7"); sl@0: LOG_MESSAGE(KLog5); sl@0: rect=TRect(20,20,50,50); sl@0: TheClient->iWs.Flush(); sl@0: RWindow *winBase=(RWindow *)iBaseWin->BaseWin(); sl@0: winBase->BeginRedraw(); sl@0: iBaseWin->SetRect(rect); sl@0: iBaseWin->DoDraw(ETrue); sl@0: winBase->EndRedraw(); sl@0: rectPckg()=rect; sl@0: User::LeaveIfError(drawAnim.Construct(*iBlankTestWin->BaseWin(),EAnimTypeTest3,rectPckg)); sl@0: TheClient->iWs.Flush(); sl@0: iBlankTestWin->Invalidate(); sl@0: TheClient->iWs.Flush(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: CheckWindows(); sl@0: boolPckg()=EFalse; sl@0: drawAnim.Command(EADllSetVisible,boolPckg); sl@0: TheClient->iWs.Flush(); sl@0: boolPckg()=ETrue; sl@0: drawAnim.Command(EADllSetVisible,boolPckg); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: CheckWindows(); sl@0: sl@0: //This test does functional coverage by calling code that executes each of the sl@0: //server's class (CWsAnimGc) members in turn. sl@0: sl@0: sl@0: _LIT(KLog6,"Draw Primitives (Coverage) Test"); sl@0: LOG_MESSAGE(KLog6); sl@0: rect = TRect(10,10,150,150); sl@0: iBaseWin->BaseWin()->SetVisible(ETrue); sl@0: iBaseWin->SetRect(TRect(0,0,0,0)); sl@0: winBase->BeginRedraw(); sl@0: iBaseWin->DoDraw(); sl@0: iBaseWin->SetRect(rect); sl@0: iBaseWin->DoDrawCoverage(); sl@0: winBase->EndRedraw(); sl@0: sl@0: iTestWin->BaseWin()->SetVisible(ETrue); sl@0: iTestWin->SetRect(rect); sl@0: win->BeginRedraw(); sl@0: iTestWin->DoDraw(); sl@0: win->EndRedraw(); sl@0: sl@0: rectPckg()=rect; sl@0: User::LeaveIfError(drawAnim.Construct(*iTestWin->BaseWin(),EAnimTypeCoverage,rectPckg)); sl@0: sl@0: //set font sl@0: CFbsFont* font; sl@0: User::LeaveIfError(TheClient->iGc->Device()->GetNearestFontToDesignHeightInTwips((CFont*&)font, TFontSpec())); sl@0: TPckgBuf fontHandle; sl@0: fontHandle() = font->Handle(); sl@0: const TInt err = drawAnim.CommandReply(EADllSetFont, fontHandle); sl@0: TheClient->iGc->Device()->ReleaseFont(font); sl@0: User::LeaveIfError(err); sl@0: sl@0: //draw sl@0: User::LeaveIfError(drawAnim.CommandReply(EADllDrawNow)); sl@0: sl@0: TheClient->iWs.Finish(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: CheckWindows(); sl@0: drawAnim.Close(); sl@0: } sl@0: sl@0: void CTAnimDll::ShadowDrawingTestL() sl@0: { sl@0: // Create a blank window to cast a shadow over the animation sl@0: TSize scrSize(TheClient->iScreen->SizeInPixels()); sl@0: CTBlankWindow *blank=new(ELeave) CTBlankWindow(); sl@0: CleanupStack::PushL(blank); sl@0: blank->SetUpL(TPoint(0,10), TSize(scrSize.iWidth,scrSize.iHeight/3), TheClient->iGroup, *TheClient->iGc); sl@0: blank->BaseWin()->SetShadowHeight(2); sl@0: iBlankTestWin->BaseWin()->SetShadowHeight(0); sl@0: // sl@0: RTestAnim drawAnim=RTestAnim(iAnimDll); sl@0: TRect rect(10,scrSize.iHeight/3-20,50,scrSize.iHeight/3+40); sl@0: TPckgBuf rectPckg; sl@0: rectPckg()=rect; sl@0: User::LeaveIfError(drawAnim.Construct(*iBlankTestWin->BaseWin(),EAnimTypeTest3,rectPckg)); sl@0: drawAnim.Command(EADllSetShadowDrawMode); sl@0: CAnimWindow::SetEllipseDrawMode(CGraphicsContext::EDrawModePEN); sl@0: // sl@0: iBlankTestWin->Invalidate(); sl@0: iBlankTestWin->SetRect(rect); sl@0: iBaseWin->Invalidate(); sl@0: iBaseWin->SetRect(rect); sl@0: RedrawAndCheckWindows(ETrue); sl@0: // sl@0: for(TInt ypos=10;ypos>0;ypos-=4) sl@0: { sl@0: blank->SetPos(TPoint(0,ypos)); sl@0: TPckgBuf params; sl@0: TRequestStatus status(KRequestPending); sl@0: params().status=&status; sl@0: drawAnim.CommandReply(EADllShadowAnimTest,params); sl@0: User::WaitForRequest(status); sl@0: RedrawAndCheckWindows(ETrue); sl@0: } sl@0: // sl@0: CleanupStack::PopAndDestroy(blank); // Destroy the shadow window sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0130 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Complicated drawing test sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Performs complicated drawing both through the animation on sl@0: a blank window and through direct fbs drawing on the second sl@0: window. sl@0: sl@0: @SYMTestExpectedResults Expects the both windows to be are identical sl@0: */ sl@0: void CTAnimDll::GeneralDrawingTestL() sl@0: { sl@0: // This test has been removed as it is no longer relevant sl@0: // Anims are not allowed to draw immediately to the screen sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0131 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Animated window destruction test sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Creates a window and a child window inside it, runs an animation sl@0: in the child window in ESyncFlash mode, destroys windows. sl@0: sl@0: @SYMTestExpectedResults Expects the operations not to fail. sl@0: */ sl@0: void CTAnimDll::DestroyWindowTestL() sl@0: { sl@0: RWindow window(TheClient->iWs); sl@0: User::LeaveIfError(window.Construct(*TheClient->iGroup->GroupWin(),123)); sl@0: CleanupClosePushL(window); sl@0: window.SetSize(TSize(100,100)); sl@0: window.Activate(); sl@0: RWindow window2(TheClient->iWs); sl@0: CleanupClosePushL(window2); sl@0: User::LeaveIfError(window2.Construct(window,124)); sl@0: window2.Activate(); sl@0: window2.BeginRedraw(); // Validate it sl@0: window2.EndRedraw(); sl@0: // sl@0: RTestAnim drawAnim; sl@0: drawAnim=RTestAnim(iAnimDll); sl@0: TRect rect(10,10,50,50); sl@0: TPckgBuf rectPckg; sl@0: rectPckg()=rect; sl@0: User::LeaveIfError(drawAnim.Construct(window2,EAnimTypeTest3,rectPckg)); sl@0: drawAnim.Command(EADllStartAnimate,rectPckg); sl@0: CleanupStack::Pop(&window2); sl@0: CleanupStack::PopAndDestroy(&window); sl@0: TheClient->iWs.Flush(); sl@0: User::After(TTimeIntervalMicroSeconds32(2000000)); sl@0: window2.Close(); sl@0: drawAnim.Close(); sl@0: } sl@0: sl@0: void CTAnimDll::SetUpMember(TSpriteMember &aMember,TInt aType) sl@0: { sl@0: switch (aType) sl@0: { sl@0: case 1: sl@0: iTest->SetUpMember(aMember); sl@0: aMember.iOffset=TPoint(); sl@0: aMember.iInterval=TTimeIntervalMicroSeconds32(1); sl@0: break; sl@0: case 2: sl@0: aMember.iInvertMask=EFalse; sl@0: aMember.iDrawMode=CGraphicsContext::EDrawModeXOR; sl@0: aMember.iOffset=TPoint(1,2); sl@0: aMember.iInterval=TTimeIntervalMicroSeconds32(2); sl@0: break; sl@0: case 3: sl@0: aMember.iInvertMask=ETrue; sl@0: aMember.iDrawMode=CGraphicsContext::EDrawModeOR; sl@0: aMember.iOffset=TPoint(3,4); sl@0: aMember.iInterval=TTimeIntervalMicroSeconds32(3); sl@0: break; sl@0: default: sl@0: iTest->SetUpMember(aMember); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0132 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Sprite animation test sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Creates a sprite with three sprite members and a sprite animation sl@0: passing the sprite to it. The test updates sprite members' sl@0: properties in various ways verifying that the properties are changing sl@0: on the server-side as well. sl@0: sl@0: @SYMTestExpectedResults Expects that operations above do not fail and that client-side sl@0: changes to the sprite affect server-side properly. sl@0: */ sl@0: #define HALF_SEC 500000 sl@0: void CTAnimDll::SpriteAnimL() sl@0: { sl@0: // create a sprite, add 3 members to it sl@0: RWsSprite sprite(TheClient->iWs); sl@0: iRedrawWin->BaseWin()->SetVisible(ETrue); sl@0: sprite.Construct(*iRedrawWin->CtBaseWin()->BaseWin(),TPoint(),0); sl@0: CleanupClosePushL(sprite); sl@0: CFbsBitmap* bitmap1=new(ELeave) CFbsBitmap(); sl@0: CleanupStack::PushL(bitmap1); sl@0: CFbsBitmap* bitmap2=new(ELeave) CFbsBitmap(); sl@0: CleanupStack::PushL(bitmap2); sl@0: CFbsBitmap* bitmap3=new(ELeave) CFbsBitmap(); sl@0: CleanupStack::PushL(bitmap3); sl@0: User::LeaveIfError(bitmap1->Create(TSize(10,12),EGray4)); sl@0: User::LeaveIfError(bitmap2->Create(TSize(15,17),EGray4)); sl@0: User::LeaveIfError(bitmap3->Create(TSize(20,22),EGray4)); sl@0: TSpriteMember member1; sl@0: TSpriteMember member2; sl@0: TSpriteMember member3; sl@0: SetUpMember(member1,1); sl@0: member1.iBitmap=bitmap1; sl@0: member1.iMaskBitmap=bitmap1; sl@0: SetUpMember(member2,2); sl@0: member2.iBitmap=bitmap2; sl@0: member2.iMaskBitmap=bitmap2; sl@0: SetUpMember(member3,3); sl@0: member3.iBitmap=bitmap3; sl@0: member3.iMaskBitmap=bitmap3; sl@0: sprite.AppendMember(member1); sl@0: sprite.AppendMember(member2); sl@0: sprite.AppendMember(member3); sl@0: sl@0: // create a sprite animation for the sprite sl@0: RTestAnim spriteAnim(iAnimDll); sl@0: TPtrC8 des(NULL,0); sl@0: TPoint pos(1,2); sl@0: User::LeaveIfError(spriteAnim.Construct(sprite,EAnimTypeSprite,des)); sl@0: CleanupClosePushL(spriteAnim); sl@0: sl@0: // call EADllCheckMember-command to verify that sprite animation's members sl@0: // have the same properties as the sprite instance sl@0: TPckgBuf spriteInfo; sl@0: spriteInfo()=TSpriteMemberInfo(TPoint(),0,member1); sl@0: TBool retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: sprite.SetPosition(pos); sl@0: spriteInfo()=TSpriteMemberInfo(pos,1,member2); sl@0: retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: pos.SetXY(3,4); sl@0: sprite.SetPosition(pos); sl@0: spriteInfo()=TSpriteMemberInfo(pos,2,member3); sl@0: retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: // call commands to change sprite members' bitmaps and update members sl@0: spriteAnim.Command(EADllDraw1); sl@0: spriteAnim.Command(EADllDraw2); sl@0: spriteAnim.Command(EADllDraw3); sl@0: TheClient->iWs.Flush(); sl@0: User::After(HALF_SEC); sl@0: sl@0: // call commands to change sprite's position sl@0: TPckgBuf position; sl@0: position().SetXY(60,50); sl@0: spriteAnim.Command(EADllSetPos,position); sl@0: TheClient->iWs.Flush(); sl@0: User::After(HALF_SEC); sl@0: sl@0: // change 1st member's bitmap size and interval, update it and call command to check sl@0: // that the new properties are applied sl@0: User::LeaveIfError(bitmap1->Resize(TSize(30,32))); sl@0: member1.iMaskBitmap=NULL; sl@0: member1.iInterval=TTimeIntervalMicroSeconds32(25); sl@0: User::LeaveIfError(sprite.UpdateMember(0,member1)); sl@0: spriteInfo()=TSpriteMemberInfo(TPoint(),0,member1); sl@0: retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: User::After(HALF_SEC); sl@0: sl@0: // change 1st member's bitmap size and calls command that invokes sl@0: // MAnimSpriteFunctions::SizeChangedL(). Check that new property is applied sl@0: spriteAnim.CommandReply(EADllDeactivate); sl@0: User::LeaveIfError(bitmap1->Resize(TSize(35,37))); sl@0: spriteAnim.Command(EADllSizeChanged); sl@0: spriteAnim.CommandReply(EADllActivate); sl@0: spriteInfo()=TSpriteMemberInfo(TPoint(),0,member1); sl@0: retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: User::After(HALF_SEC); sl@0: sl@0: // call command that changes 1st member's bitmap image sl@0: spriteAnim.Command(EADllIncDraw); sl@0: TheClient->iWs.Flush(); sl@0: User::After(HALF_SEC); sl@0: sl@0: sl@0: CleanupStack::PopAndDestroy(5,&sprite); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0133 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Free timer animation test sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions The test creates a free timer window animation that animates sl@0: a shrinking filled rect which changes colour in a predefined way. sl@0: sl@0: @SYMTestExpectedResults The test verifies that the colour changes gets through to the the display. sl@0: */ sl@0: sl@0: #define NOT_TIMED_OUT timeWaitingForFrame < frametime<<4 sl@0: void CTAnimDll::FreeTimerL() sl@0: { sl@0: RTestAnim freeTimerAnim(iAnimDll); sl@0: User::LeaveIfError(freeTimerAnim.Construct(*iRedrawWin->BaseWin(),EAnimTypeFreeTimer,KNullDesC8)); sl@0: CleanupClosePushL(freeTimerAnim); sl@0: sl@0: const TInt frametime = 100000; // 100 ms sl@0: const TInt samplingtime = frametime>>1; // 50 ms sl@0: sl@0: TPckgC frametimeBuf(frametime); sl@0: freeTimerAnim.Command(ESetFrameTime, frametimeBuf); sl@0: freeTimerAnim.Command(EStartAnimation); sl@0: TheClient->iWs.Flush(); sl@0: TheClient->iWs.Finish(); sl@0: sl@0: TInt x = iRedrawWin->BaseWin()->AbsPosition().iX + (iRedrawWin->BaseWin()->Size().iWidth >> 1); sl@0: TInt y = iRedrawWin->BaseWin()->AbsPosition().iY + (iRedrawWin->BaseWin()->Size().iHeight >> 1); sl@0: TPoint middle(x,y); sl@0: sl@0: TRgb color = KRgbMagenta; sl@0: TBool foundRedFrame = EFalse; sl@0: TBool foundGreenFrame = EFalse; sl@0: TBool foundBlueFrame = EFalse; sl@0: TBool foundBlackFrame = EFalse; sl@0: sl@0: //The free-timer animates the colour in this predefined way. sl@0: //Test that the screen gets updated. sl@0: TInt timeWaitingForFrame = 0; sl@0: while(NOT_TIMED_OUT && !(foundRedFrame && foundGreenFrame && foundBlueFrame && foundBlackFrame)) //wait max 16*frametime=1280ms sl@0: { sl@0: //wait for the colour frame sl@0: color = PixelColour(middle); sl@0: sl@0: if(color == KRgbRed) sl@0: { sl@0: foundRedFrame = ETrue; sl@0: } sl@0: else if(color == KRgbGreen) sl@0: { sl@0: foundGreenFrame = ETrue; sl@0: } sl@0: else if(color == KRgbBlue) sl@0: { sl@0: foundBlueFrame = ETrue; sl@0: } sl@0: else if(color == KRgbBlack) sl@0: { sl@0: foundBlackFrame = ETrue; sl@0: } sl@0: sl@0: timeWaitingForFrame += samplingtime; sl@0: User::After(samplingtime); sl@0: } sl@0: sl@0: TEST(foundRedFrame); sl@0: TEST(foundGreenFrame); sl@0: TEST(foundBlueFrame); sl@0: TEST(foundBlackFrame); sl@0: sl@0: freeTimerAnim.Command(EStopAnimation); sl@0: CleanupStack::PopAndDestroy(&freeTimerAnim); sl@0: } sl@0: sl@0: TRgb CTAnimDll::PixelColour(const TPoint& aPoint) const sl@0: { sl@0: TRgb pixel; sl@0: TheClient->iScreen->GetPixel(pixel, aPoint); sl@0: return pixel; sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0134 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Animation's ESyncSecond sync-mode test sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Creates an animation in ESyncSecond sync-mode. sl@0: Checks that animation's Animate() method was called either 9, 10 or 11 sl@0: times during a 10-seconds-wait. sl@0: The test also checks that if RWsSession::PrepareForSwitchOff() sl@0: is called then the Animate() method will not be called until sl@0: TRawEvent::EActive event is simulated. sl@0: sl@0: @SYMTestExpectedResults See actions. sl@0: */ sl@0: static const TInt K1Second = 1000000; sl@0: static const TInt K3Seconds = 3000000; sl@0: static const TInt K9Seconds = 9500000; sl@0: void CTAnimDll::DisableTimerL() sl@0: { sl@0: //Defer start of timerAnim until the systen time are close to a full second sl@0: TTime now; sl@0: now.HomeTime(); sl@0: TInt deferTime = K1Second - now.DateTime().MicroSecond(); sl@0: User::After(deferTime); sl@0: sl@0: //Kick off timerAnim sl@0: RTestAnim timerAnim(iAnimDll); sl@0: User::LeaveIfError(timerAnim.Construct(*iRedrawWin->BaseWin(),EAnimTypeTimer,KNullDesC8)); sl@0: sl@0: User::After(K9Seconds); sl@0: TInt count=timerAnim.CommandReply(EADllCurrentCount); sl@0: sl@0: #if defined(LOGGING) sl@0: TLogMessageText buf; sl@0: _LIT(KLog,"Anim DisableTimer Count=%d"); sl@0: buf.Format(KLog,count); sl@0: TheClient->LogMessage(buf); sl@0: #endif sl@0: sl@0: TEST(count>=9 && count<=11); sl@0: if (count != 10) sl@0: INFO_PRINTF2(_L("count>=9 && count<=11 - Expected: 9,10 or 11 , Actual: %d"), count); sl@0: sl@0: #if defined(__WINS__) sl@0: TheClient->iWs.SimulateXyInputType(EXYInputNone); //Turn off pen in case it turns on the timer sl@0: #endif sl@0: sl@0: // reset timer's counter and call RWsSession::PrepareForSwitchOff(), sl@0: // check that 3 seconds after the counter = 0 sl@0: timerAnim.Command(EADllResetCount); sl@0: timerAnim.Command(EADllNoTimer); sl@0: TheClient->iWs.PrepareForSwitchOff(); sl@0: TheClient->iWs.Flush(); sl@0: User::After(K3Seconds); sl@0: count=timerAnim.CommandReply(EADllCurrentCount); sl@0: #if defined(LOGGING) sl@0: buf.Format(KLog,count); sl@0: TheClient->LogMessage(buf); sl@0: #endif sl@0: TEST(count==0); sl@0: if (count!=0) sl@0: INFO_PRINTF3(_L("count==0 - Expected: %d , Actual: %d"), 0, count); sl@0: sl@0: sl@0: // simulates TRawEvent::EActive event, sl@0: // check that the timer didn't ticked until the event were simulated sl@0: timerAnim.Command(EADllTimerStarted); sl@0: TRawEvent event; sl@0: event.Set(TRawEvent::EActive); sl@0: TheClient->iWs.SimulateRawEvent(event); sl@0: #if defined(__WINS__) sl@0: TheClient->iWs.SimulateXyInputType(EXYInputPointer); //Turn pen on again sl@0: #endif sl@0: TInt retVal = timerAnim.CommandReply(EADllFailed); sl@0: TEST(retVal==0); sl@0: if (retVal!=0) sl@0: INFO_PRINTF3(_L("timerAnim.CommandReply(EADllFailed) return value - Expected: %d , Actual: %d"), 0, retVal); sl@0: sl@0: timerAnim.Close(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0135 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Multiple animations test sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Creates multiple animations for a window. sl@0: sl@0: @SYMTestExpectedResults The test doesn't perform any specific validations. sl@0: */ sl@0: void CTAnimDll::MultipleAnimsL() sl@0: { sl@0: RTestAnim anim1(iAnimDll); sl@0: RTestAnim anim2(iAnimDll); sl@0: RTestAnim anim3(iAnimDll); sl@0: RTestAnim anim4(iAnimDll); sl@0: RTestAnim anim5(iAnimDll); sl@0: RTestAnim anim6(iAnimDll); sl@0: TPtrC8 des(NULL,0); sl@0: User::LeaveIfError(anim1.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des)); sl@0: CleanupClosePushL(anim1); sl@0: User::LeaveIfError(anim2.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des)); sl@0: CleanupClosePushL(anim2); sl@0: User::LeaveIfError(anim3.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des)); sl@0: CleanupClosePushL(anim3); sl@0: User::LeaveIfError(anim4.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des)); sl@0: CleanupClosePushL(anim4); sl@0: User::LeaveIfError(anim5.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des)); sl@0: CleanupClosePushL(anim5); sl@0: User::LeaveIfError(anim6.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des)); sl@0: anim6.Close(); sl@0: User::LeaveIfError(anim6.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des)); sl@0: anim6.Close(); sl@0: User::LeaveIfError(anim6.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des)); sl@0: CleanupStack::PopAndDestroy(&anim5); sl@0: anim6.Close(); sl@0: User::LeaveIfError(anim5.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des)); sl@0: CleanupClosePushL(anim5); sl@0: User::LeaveIfError(anim6.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des)); sl@0: CleanupStack::Pop(&anim5); sl@0: CleanupStack::PopAndDestroy(&anim4); sl@0: anim5.Close(); sl@0: anim6.Close(); sl@0: User::LeaveIfError(anim4.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des)); sl@0: CleanupStack::PopAndDestroy(&anim3); sl@0: anim4.Close(); sl@0: User::LeaveIfError(anim3.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des)); sl@0: CleanupStack::PopAndDestroy(&anim2); sl@0: anim3.Close(); sl@0: User::LeaveIfError(anim2.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des)); sl@0: CleanupStack::PopAndDestroy(&anim1); sl@0: anim2.Close(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0136 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Click plugin DLL test sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Created two handles for a click plugin dll (RSoundPlugIn instances). sl@0: Plays with Load(), Unload() methods to verify that they affect sl@0: IsLoaded() call result. sl@0: Checks that CommandReply() for different opcodes sl@0: returns RSoundPlugIn::ESoundWrongPlugIn value. sl@0: Plays with SetPenClick(), SetKeyClick() to verify that they affect sl@0: PenClickEnabled() and KeyClickEnabled() call result. sl@0: sl@0: sl@0: @SYMTestExpectedResults The test checks that RSoundPlugIn's methods work properly sl@0: and that both handles behave identically. sl@0: */ sl@0: void CTAnimDll::ClickPlugInL() sl@0: { sl@0: _LIT(KDllName,"CLICK"); sl@0: RWsSession ws; sl@0: User::LeaveIfError(ws.Connect()); sl@0: CleanupClosePushL(ws); sl@0: TBool retBool; sl@0: TInt retVal; sl@0: sl@0: // assign to the correct screen sl@0: CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws); sl@0: CleanupStack::PushL(screen); sl@0: User::LeaveIfError(screen->Construct(iTest->iScreenNumber)); sl@0: sl@0: RSoundPlugIn click1(ws); sl@0: RSoundPlugIn click2(TheClient->iWs); sl@0: User::LeaveIfError(click1.Construct()); sl@0: CleanupClosePushL(click1); sl@0: User::LeaveIfError(click2.Construct()); sl@0: CleanupClosePushL(click2); sl@0: TBool changeable1; sl@0: TBool changeable2; sl@0: TBool loaded=click1.IsLoaded(changeable1); sl@0: //test that either both are loaded or both are not loaded sl@0: TEST(!loaded==!click2.IsLoaded(changeable2)); sl@0: if (!loaded!=!click2.IsLoaded(changeable2)) sl@0: INFO_PRINTF3(_L("!loaded==!click2.IsLoaded(changeable2) - Expected: %d , Actual: %d"), !loaded, !click2.IsLoaded(changeable2)); sl@0: sl@0: //test that either both are changeable or both are not changeable sl@0: TEST(!changeable1==!changeable2); sl@0: if (!changeable1!=!changeable2) sl@0: INFO_PRINTF3(_L("!changeable1==!changeable2) - Expected: %d , Actual: %d"), !changeable1, !changeable2); sl@0: sl@0: if (loaded && changeable1) sl@0: { sl@0: // unload the first one sl@0: User::LeaveIfError(click1.Unload()); sl@0: // check that the second is not loaded and still changeable sl@0: retBool = !click2.IsLoaded(changeable2); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("!click2.IsLoaded(changeable2) return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: TEST(changeable2); sl@0: if (!changeable2) sl@0: INFO_PRINTF3(_L("changeable2 - Expected: %d , Actual: %d"), ETrue, changeable2); sl@0: sl@0: sl@0: // load the first one and check that the second became loaded and is changeable sl@0: User::LeaveIfError(click1.Load(KDllName)); sl@0: retBool = click2.IsLoaded(changeable2); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("click2.IsLoaded(changeable2) return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: TEST(changeable2); sl@0: if (!changeable2) sl@0: INFO_PRINTF3(_L("changeable2 - Expected: %d , Actual: %d"), ETrue, changeable2); sl@0: sl@0: // unload the second one sl@0: User::LeaveIfError(click2.Unload()); sl@0: // check that the first is not loaded and still changeable sl@0: retBool = !click1.IsLoaded(changeable1); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("!click1.IsLoaded(changeable1) return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: TEST(changeable1); sl@0: if (!changeable1) sl@0: INFO_PRINTF3(_L("changeable1 - Expected: %d , Actual: %d"), ETrue, changeable1); sl@0: sl@0: // load the second one and check that the first one became loaded and is changeable sl@0: User::LeaveIfError(click2.Load(KDllName)); sl@0: loaded=click1.IsLoaded(changeable1); sl@0: TEST(loaded); sl@0: if (!loaded) sl@0: INFO_PRINTF3(_L("loaded - Expected: %d , Actual: %d"), ETrue, loaded); sl@0: sl@0: TEST(changeable1); sl@0: if (!changeable1) sl@0: INFO_PRINTF3(_L("changeable1 - Expected: %d , Actual: %d"), ETrue, changeable1); sl@0: } sl@0: if (loaded) sl@0: { sl@0: TPtrC8 des(NULL,0); sl@0: retVal = click1.CommandReply(0,des); sl@0: TEST(RSoundPlugIn::ESoundWrongPlugIn==retVal); sl@0: if (RSoundPlugIn::ESoundWrongPlugIn!=retVal) sl@0: INFO_PRINTF3(_L("click1.CommandReply(0,des) return value - Expected: %d , Actual: %d"), RSoundPlugIn::ESoundWrongPlugIn, retVal); sl@0: sl@0: retVal = click1.CommandReply(1,des); sl@0: TEST(RSoundPlugIn::ESoundWrongPlugIn==retVal); sl@0: if (RSoundPlugIn::ESoundWrongPlugIn!=retVal) sl@0: INFO_PRINTF3(_L("click1.CommandReply(1,des) return value - Expected: %d , Actual: %d"), RSoundPlugIn::ESoundWrongPlugIn, retVal); sl@0: sl@0: retVal = click1.CommandReply(2,des); sl@0: TEST(RSoundPlugIn::ESoundWrongPlugIn==retVal); sl@0: if (RSoundPlugIn::ESoundWrongPlugIn!=retVal) sl@0: INFO_PRINTF3(_L("click1.CommandReply(2,des) return value - Expected: %d , Actual: %d"), RSoundPlugIn::ESoundWrongPlugIn, retVal); sl@0: sl@0: retVal = click1.CommandReply(-1,des); sl@0: TEST(RSoundPlugIn::ESoundWrongPlugIn==retVal); sl@0: if (RSoundPlugIn::ESoundWrongPlugIn!=retVal) sl@0: INFO_PRINTF3(_L("click1.CommandReply(-1,des) return value - Expected: %d , Actual: %d"), RSoundPlugIn::ESoundWrongPlugIn, retVal); sl@0: sl@0: retBool = click1.KeyClickEnabled(); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: retBool = click1.PenClickEnabled(); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: click1.SetPenClick(EFalse); sl@0: retBool = click1.KeyClickEnabled(); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: retBool = !click1.PenClickEnabled(); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("!click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: click1.SetKeyClick(EFalse); sl@0: sl@0: retBool = !click1.KeyClickEnabled(); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("!click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: retBool = !click1.PenClickEnabled(); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("!click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: click1.SetPenClick(ETrue); sl@0: retBool = !click1.KeyClickEnabled(); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("!click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: retBool = click1.PenClickEnabled(); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: click1.SetKeyClick(ETrue); sl@0: retBool = click1.KeyClickEnabled(); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: retBool = click1.PenClickEnabled(); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: /*RLibrary lib; sl@0: TInt err=lib.Load(KDllName); sl@0: if (err==KErrNone) sl@0: { sl@0: TPtrC8 des(NULL,0); sl@0: TEST(lib.Type()[2].iUid==click1.CommandReply(0,des)); sl@0: lib.Close(); sl@0: }*/ sl@0: } sl@0: CleanupStack::PopAndDestroy(4,&ws); sl@0: } sl@0: sl@0: void CTAnimDll::TestWindowInfo(RTestAnim& aAnim,TInt aScreen,TInt aPos,TInt aId) sl@0: { sl@0: TPckgBuf params; sl@0: params().iScreen=aScreen; sl@0: params().iOrdinalPosition=aPos; sl@0: TPckgBuf winGpInfo; sl@0: TIpcArgs ipcArgs; sl@0: ipcArgs.Set(KIpcSlot,&winGpInfo); sl@0: TBool retBool = aAnim.CommandReply(EADllWindowGroupInfo,params,ipcArgs); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("aAnim.CommandReply(EADllWindowGroupInfo,params,ipcArgs) return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo& info=winGpInfo(); sl@0: TEST(info.iId==aId); sl@0: if (info.iId!=aId) sl@0: INFO_PRINTF3(_L("winGpInfo() return value - Expected: %d , Actual: %d"), aId, info.iId); sl@0: sl@0: TInt retVal = TheClient->iWs.GetWindowGroupOrdinalPriority(aId); sl@0: TEST(info.iOrdinalPriority==retVal); sl@0: if (info.iOrdinalPriority!=retVal) sl@0: INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupOrdinalPriority(aId) return value - Expected: %d , Actual: %d"), info.iOrdinalPriority, retVal); sl@0: sl@0: TBuf<64> windowGroupNameS; sl@0: TBuf<64> windowGroupNameA; sl@0: TheClient->iWs.GetWindowGroupNameFromIdentifier(aId,windowGroupNameS); sl@0: retVal = windowGroupNameS.Length(); sl@0: TEST(info.iNameLength==retVal); sl@0: if (info.iNameLength!=retVal) sl@0: INFO_PRINTF3(_L("windowGroupNameS.Length() return value - Expected: %d , Actual: %d"), info.iNameLength, retVal); sl@0: sl@0: if (info.iNameLength<64) sl@0: { sl@0: ipcArgs.Set(KIpcSlot,&windowGroupNameA); sl@0: retBool = aAnim.CommandReply(EADllWindowGroupName,params,ipcArgs); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("aAnim.CommandReply(EADllWindowGroupName,params,ipcArgs) return value - Expected: %d , Actual: %d"), ETrue, retBool); sl@0: sl@0: if (info.iNameLength>0) sl@0: { sl@0: TEST(windowGroupNameA==windowGroupNameS); sl@0: } sl@0: else sl@0: { sl@0: TEST(windowGroupNameA.Length()==0); sl@0: if (windowGroupNameA.Length()!=0) sl@0: INFO_PRINTF3(_L("iwindowGroupNameA.Length()==0 - Expected: %d, Actual: %d"), 0, windowGroupNameA.Length()); sl@0: } sl@0: sl@0: } sl@0: TEST(info.iParentId>=-1); sl@0: if (info.iParentId<-1) sl@0: INFO_PRINTF3(_L("info.iParentId>=-1 - Expected: %d or greater, Actual: %d"), -1, info.iParentId); sl@0: sl@0: } sl@0: sl@0: void CTAnimDll::TestEventHandlerRemovalL() sl@0: { sl@0: RTestAnim anim(iAnimDll); sl@0: User::LeaveIfError(anim.Construct(*iRedrawWin->BaseWin(),EAnimTypeEventHandler,KNullDesC8)); sl@0: anim.Close(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0137 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Animation's extended window functions test sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions The test creates a window animation that has a couple of sl@0: commands that work with extended window functions encapsulated sl@0: into MAnimGeneralFunctionsWindowExtension class instance. sl@0: The test calls those commands to compare MAnimGeneralFunctionsWindowExtension's sl@0: methods' results with the results retuned by WSERV client classes. sl@0: MAnimGeneralFunctionsWindowExtension methods tested here: sl@0: Screens(), FocusScreens(), WindowGroups(), WindowGroupInfo(), sl@0: WindowGroupName() sl@0: sl@0: @SYMTestExpectedResults MAnimGeneralFunctionsWindowExtension methods must give the same results as sl@0: the corresponding WSERV client methods would. sl@0: */ sl@0: void CTAnimDll::WinFunctionsL() sl@0: { sl@0: RTestAnim anim(iAnimDll); sl@0: User::LeaveIfError(anim.Construct(*iRedrawWin->BaseWin(),EAnimTypeWindowFunctions,KNullDesC8)); sl@0: CleanupClosePushL(anim); sl@0: TInt screens=anim.CommandReply(EADllScreen); sl@0: TEST(screens>0); sl@0: if (screens<=0) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllScreen) return value - Expected: %d or greater, Actual: %d"), 1, screens); sl@0: sl@0: TInt focusScreen=anim.CommandReply(EADllFocusScreen); sl@0: TInt retVal = TheClient->iWs.GetFocusScreen(); sl@0: TEST(focusScreen==retVal && focusScreen<=screens); sl@0: if (focusScreen!=retVal || focusScreen>screens) sl@0: INFO_PRINTF4(_L("anim.CommandReply(EADllFocusScreen) return value - Expected: %d and less than or equal to %d, Actual: %d"), retVal, screens, focusScreen); sl@0: sl@0: TInt ii; sl@0: TPckgBuf screen; sl@0: CArrayPtrFlat* wins=new(ELeave) CArrayPtrFlat(screens); sl@0: CleanupStack::PushL(wins); sl@0: // create one window on each screen sl@0: for(ii=0;iiConstructL(); sl@0: wins->AppendL(win); sl@0: } sl@0: if (screens>1) sl@0: { sl@0: for (ii=screens-1;ii>=0;--ii) sl@0: { sl@0: TheClient->iWs.SetFocusScreen(ii); sl@0: retVal = anim.CommandReply(EADllFocusScreen); sl@0: TEST(retVal==ii); sl@0: if (retVal!=ii) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllFocusScreen) return value - Expected: %d, Actual: %d"), ii, retVal); sl@0: } sl@0: for (ii=screens-1;ii>=0;--ii) sl@0: { sl@0: screen()=ii; sl@0: anim.CommandReply(EADllSetFocusScreen,screen); sl@0: retVal = anim.CommandReply(EADllFocusScreen); sl@0: TEST(retVal==ii); sl@0: if (retVal!=ii) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllFocusScreen) return value - Expected: %d, Actual: %d"), ii, retVal); sl@0: } sl@0: } sl@0: TheClient->iWs.SetFocusScreen(focusScreen); sl@0: retVal = anim.CommandReply(EADllFocusScreen); sl@0: TEST(retVal==focusScreen); sl@0: if (retVal!=focusScreen) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllFocusScreen) return value - Expected: %d, Actual: %d"), focusScreen, retVal); sl@0: sl@0: TInt winGroupsAll=0; sl@0: for(ii=0;iiiWs.NumWindowGroups(); sl@0: TEST(winGroupsAll==winGroupsS); sl@0: if (winGroupsAll!=winGroupsS) sl@0: INFO_PRINTF3(_L("TheClient->iWs.NumWindowGroups() return value - Expected: %d, Actual: %d"), winGroupsS, winGroupsAll); sl@0: sl@0: // the remaining test will use winGroupsA and performed on current focus screen only sl@0: screen()=iTest->iScreenNumber; sl@0: TInt winGroupsA=anim.CommandReply(EADllWindowGroups,screen); sl@0: CArrayFixFlat* windowList=new(ELeave) CArrayFixFlat(3); sl@0: CleanupStack::PushL(windowList); sl@0: // wserv implementation returns window groups from current focus screen, followed by the rest sl@0: TheClient->iWs.WindowGroupList(windowList); sl@0: // only interested in window group from current focus screen sl@0: for (ii=0;iiiScreenNumber,ii,(*windowList)[ii]); sl@0: TPckgBuf winGpInfo; sl@0: TIpcArgs ipcArgs; sl@0: TPckgBuf params; sl@0: params().iScreen=iTest->iScreenNumber; sl@0: params().iOrdinalPosition=winGroupsA; sl@0: ipcArgs.Set(KIpcSlot,&winGpInfo); sl@0: TBuf<64> windowGroupName; sl@0: TBool retBool = !anim.CommandReply(EADllWindowGroupInfo,params,ipcArgs); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("!anim.CommandReply(EADllWindowGroupInfo,params,ipcArgs) return value - Expected: %d, Actual: %d"), ETrue, retBool); sl@0: sl@0: ipcArgs.Set(KIpcSlot,&windowGroupName); sl@0: retBool = !anim.CommandReply(EADllWindowGroupName,params,ipcArgs); sl@0: TEST(retBool); sl@0: if (!retBool) sl@0: INFO_PRINTF3(_L("!anim.CommandReply(EADllWindowGroupName,params,ipcArgs) return value - Expected: %d, Actual: %d"), ETrue, retBool); sl@0: sl@0: /*params().iOrdinalPosition=-1; //Behaviour for negative positions not defined - but as writtin this code will pass sl@0: ipcArgs.Set(KIpcSlot,&winGpInfo); sl@0: TEST(anim.CommandReply(EADllWindowGroupInfo,params,ipcArgs)); sl@0: ipcArgs.Set(KIpcSlot,&windowGroupNameA); sl@0: TEST(anim.CommandReply(EADllWindowGroupName,params,ipcArgs));*/ sl@0: RWindowGroup group(TheClient->iWs); sl@0: User::LeaveIfError(group.Construct(ENullWsHandle)); sl@0: CleanupClosePushL(group); sl@0: _LIT(KGroupName,"Testxyz1234"); sl@0: group.SetName(KGroupName); sl@0: group.SetOrdinalPosition(0,TheClient->iWs.GetWindowGroupOrdinalPriority((*windowList)[0])+1); sl@0: TInt groupId=group.Identifier(); sl@0: TestWindowInfo(anim,iTest->iScreenNumber,0,groupId); sl@0: group.SetOrdinalPosition(0,TheClient->iWs.GetWindowGroupOrdinalPriority((*windowList)[winGroupsA-1])-1); sl@0: TestWindowInfo(anim,iTest->iScreenNumber,winGroupsA,groupId); sl@0: CleanupStack::PopAndDestroy(screens+4,&anim); sl@0: // Restore us back to the front sl@0: TheClient->iGroup->GroupWin()->SetOrdinalPosition(0); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0138 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Animation's extended window functions test 2 sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions The test creates a window animation that has a command sl@0: for setting window's ordinal position and priority. sl@0: The test creates 4 window groups with the same priority and sl@0: checks that they have correct ordinal positions after the creation. sl@0: After that the test plays with updating ordinal positions and sl@0: priorities of the window groups using the animation's command. sl@0: sl@0: @SYMTestExpectedResults The test checks that the command was executed with no errors sl@0: and affected ordinal positions of the window groups properly. sl@0: */ sl@0: void CTAnimDll::WinFunctions2L() sl@0: { sl@0: RTestAnim anim(iAnimDll); sl@0: User::LeaveIfError(anim.Construct(*iRedrawWin->BaseWin(),EAnimTypeWindowFunctions,KNullDesC8)); sl@0: CleanupClosePushL(anim); sl@0: CArrayFixFlat* windowList=new(ELeave) CArrayFixFlat(3); sl@0: TheClient->iWs.WindowGroupList(windowList); sl@0: TInt priority=TheClient->iWs.GetWindowGroupOrdinalPriority((*windowList)[0])+2; sl@0: delete windowList; sl@0: RWindowGroup group1(TheClient->iWs); sl@0: User::LeaveIfError(group1.Construct(ENullWsHandle)); sl@0: CleanupClosePushL(group1); sl@0: group1.SetOrdinalPosition(0,priority); sl@0: RWindowGroup group2(TheClient->iWs); sl@0: User::LeaveIfError(group2.Construct(ENullWsHandle)); sl@0: CleanupClosePushL(group2); sl@0: group2.SetOrdinalPosition(0,priority); sl@0: RWindowGroup group3(TheClient->iWs); sl@0: User::LeaveIfError(group3.Construct(ENullWsHandle)); sl@0: CleanupClosePushL(group3); sl@0: group3.SetOrdinalPosition(0,priority); sl@0: RWindowGroup group4(TheClient->iWs); sl@0: User::LeaveIfError(group4.Construct(ENullWsHandle)); sl@0: CleanupClosePushL(group4); sl@0: group4.SetOrdinalPosition(0,priority); sl@0: sl@0: TInt retVal = group1.OrdinalPosition(); sl@0: TEST(retVal==3); sl@0: if (retVal!=3) sl@0: INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal); sl@0: sl@0: retVal = group2.OrdinalPosition(); sl@0: TEST(retVal==2); sl@0: if (retVal!=2) sl@0: INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal); sl@0: sl@0: retVal = group3.OrdinalPosition(); sl@0: TEST(retVal==1); sl@0: if (retVal!=1) sl@0: INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal); sl@0: sl@0: retVal = group4.OrdinalPosition(); sl@0: TEST(retVal==0); sl@0: if (retVal!=0) sl@0: INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal); sl@0: sl@0: TPckgBuf params; sl@0: params().iIdentifier=group4.Identifier(); sl@0: params().iOrdinalPriority=priority; sl@0: params().iOrdinalPosition=1; sl@0: retVal = anim.CommandReply(EADllSetOrdinalPosition,params); sl@0: TEST(retVal==KErrNone); sl@0: if (retVal!=KErrNone) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal); sl@0: sl@0: retVal = group3.OrdinalPosition(); sl@0: TEST(retVal==0); sl@0: if (retVal!=0) sl@0: INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal); sl@0: sl@0: retVal = group4.OrdinalPosition(); sl@0: TEST(retVal==1); sl@0: if (retVal!=1) sl@0: INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal); sl@0: sl@0: params().iOrdinalPosition=2; sl@0: retVal = anim.CommandReply(EADllSetOrdinalPosition,params); sl@0: TEST(retVal==KErrNone); sl@0: if (retVal!=KErrNone) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal); sl@0: sl@0: retVal = group2.OrdinalPosition(); sl@0: TEST(retVal==1); sl@0: if (retVal!=1) sl@0: INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal); sl@0: sl@0: retVal = group4.OrdinalPosition(); sl@0: TEST(retVal==2); sl@0: if (retVal!=2) sl@0: INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal); sl@0: sl@0: params().iOrdinalPosition=3; sl@0: retVal = anim.CommandReply(EADllSetOrdinalPosition,params); sl@0: TEST(retVal==KErrNone); sl@0: if (retVal!=KErrNone) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal); sl@0: sl@0: retVal = group1.OrdinalPosition(); sl@0: TEST(retVal==2); sl@0: if (retVal!=2) sl@0: INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal); sl@0: sl@0: retVal = group2.OrdinalPosition(); sl@0: TEST(retVal==1); sl@0: if (retVal!=1) sl@0: INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal); sl@0: sl@0: retVal = group3.OrdinalPosition(); sl@0: TEST(retVal==0); sl@0: if (retVal!=0) sl@0: INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal); sl@0: sl@0: retVal = group4.OrdinalPosition(); sl@0: TEST(retVal==3); sl@0: if (retVal!=3) sl@0: INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal); sl@0: sl@0: params().iOrdinalPriority=priority+1; sl@0: params().iOrdinalPosition=3; sl@0: retVal = anim.CommandReply(EADllSetOrdinalPosition,params); sl@0: TEST(retVal==KErrNone); sl@0: if (retVal!=KErrNone) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal); sl@0: sl@0: retVal = group4.OrdinalPosition(); sl@0: TEST(retVal==0); sl@0: if (retVal!=0) sl@0: INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal); sl@0: sl@0: params().iOrdinalPriority=priority; sl@0: params().iOrdinalPosition=-2; sl@0: retVal = anim.CommandReply(EADllSetOrdinalPosition,params); sl@0: TEST(retVal==KErrNone); sl@0: if (retVal!=KErrNone) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal); sl@0: sl@0: retVal = group4.OrdinalPosition(); sl@0: TEST(retVal==3); sl@0: if (retVal!=3) sl@0: INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal); sl@0: sl@0: params().iOrdinalPosition=0; sl@0: retVal = anim.CommandReply(EADllSetOrdinalPosition,params); sl@0: TEST(retVal==KErrNone); sl@0: if (retVal!=KErrNone) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal); sl@0: sl@0: retVal = group1.OrdinalPosition(); sl@0: TEST(retVal==3); sl@0: if (retVal!=3) sl@0: INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal); sl@0: sl@0: retVal = group2.OrdinalPosition(); sl@0: TEST(retVal==2); sl@0: if (retVal!=2) sl@0: INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal); sl@0: sl@0: retVal = group3.OrdinalPosition(); sl@0: TEST(retVal==1); sl@0: if (retVal!=1) sl@0: INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal); sl@0: sl@0: retVal = group4.OrdinalPosition(); sl@0: TEST(retVal==0); sl@0: if (retVal!=0) sl@0: INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal); sl@0: sl@0: params().iOrdinalPriority=priority-1; sl@0: params().iOrdinalPosition=2; sl@0: retVal = anim.CommandReply(EADllSetOrdinalPosition,params); sl@0: TEST(retVal==KErrNone); sl@0: if (retVal!=KErrNone) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal); sl@0: sl@0: retVal = group1.OrdinalPosition(); sl@0: TEST(retVal==2); sl@0: if (retVal!=2) sl@0: INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal); sl@0: sl@0: retVal = group2.OrdinalPosition(); sl@0: TEST(retVal==1); sl@0: if (retVal!=1) sl@0: INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal); sl@0: sl@0: retVal = group3.OrdinalPosition(); sl@0: TEST(retVal==0); sl@0: if (retVal!=0) sl@0: INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal); sl@0: sl@0: retVal = group4.OrdinalPosition(); sl@0: TEST(retVal==0); sl@0: if (retVal!=0) sl@0: INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal); sl@0: sl@0: sl@0: params().iOrdinalPriority=priority; sl@0: params().iOrdinalPosition=0; sl@0: retVal = anim.CommandReply(EADllSetOrdinalPosition,params); sl@0: TEST(retVal==KErrNone); sl@0: if (retVal!=KErrNone) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal); sl@0: sl@0: retVal = group1.OrdinalPosition(); sl@0: TEST(retVal==3); sl@0: if (retVal!=3) sl@0: INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal); sl@0: sl@0: retVal = group2.OrdinalPosition(); sl@0: TEST(retVal==2); sl@0: if (retVal!=2) sl@0: INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal); sl@0: sl@0: retVal = group3.OrdinalPosition(); sl@0: TEST(retVal==1); sl@0: if (retVal!=1) sl@0: INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal); sl@0: sl@0: retVal = group4.OrdinalPosition(); sl@0: TEST(retVal==0); sl@0: if (retVal!=0) sl@0: INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal); sl@0: sl@0: CleanupStack::PopAndDestroy(5,&anim); sl@0: /*TInt pos1=group1.OrdinalPosition(); sl@0: TInt pos2=group2.OrdinalPosition(); sl@0: TInt pos3=group3.OrdinalPosition(); sl@0: TInt pos4=group4.OrdinalPosition();*/ sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0139 sl@0: sl@0: @SYMDEF DEF081259, DEF122220 sl@0: sl@0: @SYMTestCaseDesc Animation's notifications test sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions The test works with two screens. An animation is created that keeps sl@0: track on all notifications about EDirectScreenAccess, EHeartbeatTimer, sl@0: EScreenDeviceChange events. sl@0: The test generates those events by performing operations on direct sl@0: screen access and simulating TRawEvent::EInactive and TRawEvent::EAactive sl@0: events. sl@0: sl@0: @SYMTestExpectedResults The test checks that the animation didn't miss any of EDirectScreenAccess sl@0: or EHeartbeatTimer notifications. (The test doesn't check EScreenDeviceChange sl@0: notifications however). sl@0: The test also makes sure that the animation didn't animate sl@0: during inactive state. sl@0: For DEF12220, the test will crash when a untidied notifier from a previous RTestAnim object sl@0: is accessed if the fix is not present. If the fix is present, the test should not crash. sl@0: */ sl@0: void CTAnimDll::TestNotificationsL() sl@0: { sl@0: RTestAnim anim(iAnimDll); sl@0: User::LeaveIfError(anim.Construct(*iRedrawWin->BaseWin(),EAnimTypeNotificationTest,KNullDesC8)); sl@0: CleanupClosePushL(anim); sl@0: sl@0: TPckgBuf screenNum; sl@0: sl@0: // initial state - test that we have no DSA on either screen sl@0: screenNum() = 0; sl@0: TInt dsa=anim.CommandReply(EADllQueryDSA, screenNum); sl@0: TEST(!dsa); sl@0: if (dsa) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa); sl@0: sl@0: screenNum() = 1; sl@0: dsa=anim.CommandReply(EADllQueryDSA, screenNum); sl@0: TEST(!dsa); sl@0: if (dsa) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa); sl@0: sl@0: // create first DSA, but don't start it - test that we have no DSA on either screen sl@0: CScrollText* dsa1 = CScrollText::NewL(iTest->iScreenNumber,1,*TheClient->iGroup,5,EFalse); sl@0: CleanupStack::PushL(dsa1); sl@0: screenNum() = 0; sl@0: dsa=anim.CommandReply(EADllQueryDSA, screenNum); sl@0: TEST(!dsa); sl@0: if (dsa) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa); sl@0: sl@0: screenNum() = 1; sl@0: dsa=anim.CommandReply(EADllQueryDSA, screenNum); sl@0: TEST(!dsa); sl@0: if (dsa) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa); sl@0: sl@0: // start first DSA - test that we have DSA on this screen but not other screen sl@0: dsa1->StartL(); sl@0: screenNum() = 0; sl@0: dsa=anim.CommandReply(EADllQueryDSA, screenNum); sl@0: TInt retVal = (screenNum() == iTest->iScreenNumber); sl@0: TEST(dsa == retVal); sl@0: if (dsa != retVal) sl@0: INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa); sl@0: sl@0: screenNum() = 1; sl@0: dsa=anim.CommandReply(EADllQueryDSA, screenNum); sl@0: retVal = (screenNum() == iTest->iScreenNumber); sl@0: TEST(dsa == retVal); sl@0: if (dsa != retVal) sl@0: INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa); sl@0: sl@0: // start second DSA sl@0: CScrollText* dsa2 = CScrollText::NewL(iTest->iScreenNumber,2,*TheClient->iGroup,5,EFalse); sl@0: CleanupStack::PushL(dsa2); sl@0: dsa2->StartL(); sl@0: screenNum() = 0; sl@0: dsa=anim.CommandReply(EADllQueryDSA, screenNum); sl@0: retVal = (screenNum() == iTest->iScreenNumber); sl@0: TEST(dsa == retVal); sl@0: if (dsa != retVal) sl@0: INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa); sl@0: sl@0: screenNum() = 1; sl@0: dsa=anim.CommandReply(EADllQueryDSA, screenNum); sl@0: retVal = (screenNum() == iTest->iScreenNumber); sl@0: TEST(dsa == retVal); sl@0: if (dsa != retVal) sl@0: INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa); sl@0: sl@0: // stop second DSA sl@0: dsa2->Stop(); sl@0: CleanupStack::PopAndDestroy(dsa2); sl@0: screenNum() = 0; sl@0: dsa=anim.CommandReply(EADllQueryDSA, screenNum); sl@0: retVal = (screenNum() == iTest->iScreenNumber); sl@0: TEST(dsa == retVal); sl@0: if (dsa != retVal) sl@0: INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa); sl@0: sl@0: screenNum() = 1; sl@0: dsa=anim.CommandReply(EADllQueryDSA, screenNum); sl@0: retVal = (screenNum() == iTest->iScreenNumber); sl@0: TEST(dsa == retVal); sl@0: if (dsa != retVal) sl@0: INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa); sl@0: sl@0: // stop first DSA sl@0: dsa1->Stop(); sl@0: CleanupStack::PopAndDestroy(dsa1); sl@0: screenNum() = 0; sl@0: dsa=anim.CommandReply(EADllQueryDSA, screenNum); sl@0: TEST(!dsa); sl@0: if (dsa) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa); sl@0: sl@0: screenNum() = 1; sl@0: dsa=anim.CommandReply(EADllQueryDSA, screenNum); sl@0: TEST(!dsa); sl@0: if (dsa) sl@0: INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa); sl@0: sl@0: // TEST heartbeat timer start\stop notifications - no longer relevant - has been removed sl@0: sl@0: CleanupStack::PopAndDestroy(&anim); sl@0: sl@0: // Create second RTestAnim for DEF12220 test sl@0: RTestAnim anim2(iAnimDll); sl@0: User::LeaveIfError(anim2.Construct(*iRedrawWin->BaseWin(),EAnimTypeNotificationTest,KNullDesC8)); sl@0: CleanupClosePushL(anim2); sl@0: sl@0: // Create third dsa sl@0: CScrollText* dsa3 = CScrollText::NewL(iTest->iScreenNumber,1,*TheClient->iGroup,5,EFalse); sl@0: CleanupStack::PushL(dsa3); sl@0: // If the fix for DEF12220 is not present, starting dsa3 will cause a crash. sl@0: dsa3->StartL(); sl@0: dsa3->Stop(); sl@0: CleanupStack::PopAndDestroy(dsa3); sl@0: CleanupStack::PopAndDestroy(&anim2); sl@0: } sl@0: sl@0: /** sl@0: A minimal dsa call to a window with a child window, for running coverage on sl@0: ClipWindows member funcion. sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0410 sl@0: sl@0: @SYMPREQ PREQ1841 sl@0: sl@0: @SYMTestExpectedResults Nothing visible, the CWsClientWindow::ClipWindows sl@0: should be partially covered. sl@0: */ sl@0: void CTAnimDll::TestCoverageL() sl@0: { sl@0: // create first DSA, but don't start it - test that we have no DSA on either screen sl@0: CWindowWithChild* dsa1 = CWindowWithChild::NewL(iTest->iScreenNumber, *TheClient->iGroup, EFalse); sl@0: CleanupStack::PushL(dsa1); sl@0: sl@0: // start first DSA - test that we have DSA on this screen but not other screen sl@0: dsa1->StartL(); sl@0: dsa1->PerformCoverageCalls(); sl@0: dsa1->Stop(); sl@0: sl@0: // cover another trivial case for a non-visible window sl@0: RWindow* cwin = dsa1->ChildWindow(); sl@0: sl@0: cwin->SetTransparencyAlphaChannel(); sl@0: dsa1->ContinueL(); sl@0: sl@0: //ClipWindows with visible and invisible branches sl@0: cwin->SetVisible(EFalse); sl@0: sl@0: //cover CWsWindow::StatusDump (visible and invisible branch) sl@0: TheClient->iWs.LogCommand(RWsSession::ELoggingStatusDump); sl@0: sl@0: dsa1->Stop(); sl@0: dsa1->StartL(); sl@0: cwin->SetVisible(ETrue); sl@0: dsa1->Stop(); sl@0: sl@0: CleanupStack::PopAndDestroy(dsa1); sl@0: } sl@0: sl@0: /** sl@0: Executes a Panic coverage test for a given test-number. sl@0: Most of the first lines copied from DoPanicTest. sl@0: CWsWindow is tested through CommandL (case 0-3) and other API funcs sl@0: */ sl@0: LOCAL_C TInt DoPanicTestCoverage(TInt aTestNum, TAny *aScreenNumber) sl@0: { sl@0: RWsSession ws; sl@0: User::LeaveIfError(ws.Connect()); sl@0: sl@0: // assign to the correct screen sl@0: CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws); sl@0: User::LeaveIfError(screen->Construct(reinterpret_cast(aScreenNumber))); sl@0: sl@0: RWindowGroup group(ws); sl@0: User::LeaveIfError(group.Construct(333)); sl@0: group.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close sl@0: RAnimDll animDll=RAnimDll(ws); sl@0: User::LeaveIfError(animDll.Load(KAnimDLLName)); sl@0: sl@0: RWindow window(ws); sl@0: User::LeaveIfError(window.Construct(group,123)); sl@0: window.SetSize(TSize(10,10)); sl@0: window.Activate(); sl@0: window.BeginRedraw(); sl@0: window.EndRedraw(); sl@0: sl@0: switch (aTestNum) sl@0: { sl@0: case 0: //non translucent window sl@0: //EWsWinOpSetTransparentRegion -> EWservPanicTransparencyObjNotCreated sl@0: { sl@0: RRegion r; sl@0: window.SetTransparentRegion(r); sl@0: break; sl@0: } sl@0: case 1: sl@0: //EWsWinOpSetTransparencyPolicy -> EWservPanicTransparencyObjNotCreated sl@0: window.SetTransparencyPolicy(ETransparencyDefault); sl@0: break; sl@0: case 2: sl@0: // -> EWservPanicWindowActive sl@0: window.Activate(); sl@0: break; sl@0: case 3: sl@0: // -> EWservPanicCornerParams sl@0: window.SetCornerType(EWindowCornerSquare, ECornerTypeMask); sl@0: break; sl@0: case 4: sl@0: // -> EWservPanicCornerParams sl@0: window.SetCornerType(ECornerTypeMask, 0); sl@0: break; sl@0: default: sl@0: return EWsExitReasonFinished; sl@0: } sl@0: ws.Flush(); sl@0: sl@0: return(EWsExitReasonBad); // Should never get here, but it's baaddd if it does sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0411 sl@0: sl@0: @SYMPREQ PREQ1841 sl@0: sl@0: @SYMTestCaseDesc Does functional coverage for code that Panics sl@0: sl@0: */ sl@0: void CTAnimDll::TestPanicCoverageL() sl@0: { sl@0: TClientPanic expectedPanicCode[] = sl@0: { sl@0: EWservPanicTransparencyObjNotCreated, //0 sl@0: EWservPanicTransparencyObjNotCreated, //1 sl@0: EWservPanicWindowActive, //2 sl@0: EWservPanicCornerParams, //3 sl@0: EWservPanicCornerParams, //4 sl@0: }; sl@0: for (TInt i=0; iTestWsPanicL( sl@0: DoPanicTestCoverage, //aFunction sl@0: expectedPanicCode[i], //aExitReason sl@0: i, //aInt sl@0: (TAny*)iTest->iScreenNumber, //aPtr sl@0: NULL)); //&finishTests //aTestFinished sl@0: iTest->CloseAllPanicWindows(); sl@0: } sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-CODEBASE-WSERV-0056-0001 sl@0: sl@0: @SYMPREQ PGM027 sl@0: sl@0: @SYMTestCaseDesc Tests RAnimDll::Load (by passing invalid file name) sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Call RAnimDll::Load() by passing invalid file name\n sl@0: sl@0: @SYMTestExpectedResults Should return with appropiate error message. KErrNotFound sl@0: */ sl@0: void CTAnimDll::TestLoadApiL() sl@0: { sl@0: RAnimDll* animDll=new(ELeave) RAnimDll(TheClient->iWs); sl@0: CleanupStack::PushL(animDll); sl@0: TInt ret=0; sl@0: _LIT(KAnimFile,"Nothing.dll"); sl@0: _LIT(KEmpty,""); sl@0: ret=animDll->Load(KAnimFile); sl@0: TEST(ret==KErrNotFound); sl@0: ret=animDll->Load(KEmpty); sl@0: TEST(ret==KErrNotFound); sl@0: CleanupStack::PopAndDestroy(animDll); sl@0: } sl@0: sl@0: TInt CTAnimDll::CheckError(TInt aError,TInt aExpected) sl@0: { sl@0: if (aError!=0) sl@0: { sl@0: if (aError>0) sl@0: { sl@0: _LIT(KLog,"The event at position %d did not match, total number of events=%d"); sl@0: LOG_MESSAGE3(KLog,aError,aExpected); sl@0: } sl@0: else sl@0: { sl@0: _LIT(KLog,"Only recieved %d events, expecting %d events"); sl@0: LOG_MESSAGE3(KLog,-aError,aExpected); sl@0: } sl@0: return EFalse; sl@0: } sl@0: return ETrue; sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0448 sl@0: sl@0: @SYMCR CR1164 sl@0: sl@0: @SYMTestCaseDesc Test events get to Anims at a higher priorty than commands sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Create a 2nd thread that sends events via kernal, send also commands from client to an Anim sl@0: sl@0: @SYMTestExpectedResults Check that events intersperse commands from client sl@0: */ sl@0: void CTAnimDll::KeyClickPriorityL() sl@0: { sl@0: _LIT(KFailedAdd,"Device Driver Failed to Add an Event, error=%d"); sl@0: REventAnim* anim=REventAnim::NewL(iTestWin->BaseWin(),&iAnimDll); sl@0: TPckgBuf events; sl@0: TInt err=anim->CommandReply(EADllLoadDeviceDriver); sl@0: if (err!=KErrNone) sl@0: { sl@0: _LIT(KLog,"Failed to load Device Driver for sending Events"); sl@0: TEST(EFalse); sl@0: LOG_MESSAGE(KLog); sl@0: } sl@0: TInt error; sl@0: TInt ii; sl@0: for (ii=1;ii<5;++ii) sl@0: { sl@0: events()=ii; sl@0: error=anim->CommandReply(EADllSendEvent,events); sl@0: if (error!=KErrNone) sl@0: LOG_MESSAGE2(KFailedAdd,error); sl@0: anim->Command(EADllAfterEvent); sl@0: TheClient->Flush(); sl@0: error=anim->TestFail(ii); sl@0: TEST(CheckError(error,ii)); sl@0: } sl@0: const TInt iterations=15; sl@0: const TInt eventsPerIteration=2; sl@0: const TInt totalEvents=iterations*eventsPerIteration; sl@0: events()=eventsPerIteration; sl@0: for (ii=iterations;ii>0;--ii) sl@0: { sl@0: error=anim->CommandReply(EADllSendEvent,events); sl@0: if (error!=KErrNone) sl@0: LOG_MESSAGE2(KFailedAdd,error); sl@0: anim->Command(EADllAfterEvent); sl@0: } sl@0: TheClient->Flush(); sl@0: error=anim->TestFail(totalEvents); sl@0: TEST(CheckError(error,totalEvents)); sl@0: anim->CommandReply(EADllUnloadDeviceDriver); sl@0: delete anim; sl@0: } sl@0: sl@0: /** sl@0: @SYMDEF INC117828 sl@0: sl@0: @SYMTestCaseDesc Tests Window Rect returned by CWsAnim::Parameters sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions This test creates a new window which overlaps the screen edge sl@0: and creates an animation on this window. An additional sl@0: CommandReplyL() option has been added to the AnimDLL to compare sl@0: the expected value of this rect with the actual value. sl@0: sl@0: sl@0: @SYMTestExpectedResults The result of the EADllTestParameterRect CommandReplyL call will equal ETrue sl@0: if the passed Rect matches, EFalse otherwise. sl@0: */ sl@0: void CTAnimDll::ParameterValueTestL() sl@0: { sl@0: //Window Location & Dimension sl@0: TPoint winOrigin(-1,15); sl@0: TSize winSize(250,65); sl@0: sl@0: //Create a new window to perform the test; window needs to overlap the left edge of the screen. sl@0: CAnimWindow* paramTestWin = new(ELeave) CAnimWindow(EFalse, CAnimWindow::ERedraw); sl@0: CleanupStack::PushL(paramTestWin); sl@0: paramTestWin->ConstructL(winOrigin, winSize); sl@0: sl@0: RTestAnim anim = RTestAnim(iAnimDll); sl@0: sl@0: TPckgBuf rectPckg; sl@0: TRect winRect(winOrigin, winSize); sl@0: rectPckg() = winRect; sl@0: sl@0: anim.Construct(*(paramTestWin->BaseWin()), EAnimTypeTest3, rectPckg); sl@0: anim.Command(EADllStartAnimate, rectPckg); sl@0: sl@0: TPckgBuf boolPckg; sl@0: boolPckg() = ETrue; sl@0: anim.Command(EADllSetVisible, boolPckg); sl@0: sl@0: TEST(anim.CommandReply(EADllParameterRectValueTest, rectPckg)); sl@0: sl@0: boolPckg() = EFalse; sl@0: anim.Command(EADllSetVisible, boolPckg); sl@0: anim.Command(EADllCancelAnimate); sl@0: anim.Close(); sl@0: CleanupStack::PopAndDestroy(paramTestWin); sl@0: } sl@0: sl@0: /** sl@0: @SYMDEF DEF122176 sl@0: sl@0: @SYMTestCaseDesc Test the operation of SetInterval with both negative and positive intervals sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions This test uses the test anim CAutoAnim3 in mode 3 which alternates sl@0: between drawing a large and a small ellipse at each interval. sl@0: The large ellipse is drawn first. sl@0: Note that the anims are redrawn at the rate of 2 intervals per second, so sl@0: setting an interval of 2 will mean that the anim is redrawn every second. sl@0: Step 1: The interval is set to be -2 and the test then waits for 0.9 sl@0: seconds (to make sure one interval has passed) then checks that sl@0: only the large ellipse has been drawn. sl@0: Step 2: The interval is set to be 2 (redraw every second) and the test then sl@0: waits for 1.2 seconds (to make sure two intervals have passed) and sl@0: checks that the small ellipse has been drawn. sl@0: sl@0: @SYMTestExpectedResults sl@0: After Step 1 a large ellipse will be drawn on both windows. sl@0: After Step 1 a small ellipse will be drawn on both windows. sl@0: sl@0: */ sl@0: void CTAnimDll::TestSetIntervalL() sl@0: { sl@0: RWsSession ws; sl@0: User::LeaveIfError(ws.Connect()); sl@0: sl@0: // draws a little circle on the base window using window graphics and using window animation on the test window. sl@0: RTestAnim drawAnim=RTestAnim(iAnimDll); sl@0: sl@0: _LIT(KLog1,"SetInterval Test"); sl@0: LOG_MESSAGE(KLog1); sl@0: TRect rect(10,10,110,110); sl@0: CAnimWindow::SetEllipseDrawMode(CGraphicsContext::EDrawModePEN); sl@0: iTestWin->Invalidate(); sl@0: iTestWin->SetRect(rect); sl@0: iBaseWin->Invalidate(); sl@0: iBaseWin->SetRect(rect); sl@0: TPckgBuf rectPckg; sl@0: rectPckg()=rect; sl@0: User::LeaveIfError(drawAnim.Construct(*iTestWin->BaseWin(),EAnimTypeTest3,rectPckg)); sl@0: sl@0: TPckgBuf intPckg; sl@0: intPckg() = 3; // mode 3 for this anim flips between drawing a large and a small ellipse sl@0: drawAnim.Command(EADllSetMode, intPckg); sl@0: sl@0: intPckg() = MAnimGeneralFunctions::ESyncNone; sl@0: drawAnim.CommandReply(EADllDoSetSync, intPckg); sl@0: sl@0: // Set an interval of -2 then wait 0.9 seconds, after which only the large ellipse should be visible sl@0: intPckg() = -2; sl@0: drawAnim.CommandReply(EADllSetInterval, intPckg); sl@0: // Draw the large ellipse on the base window to match what the anim should be drawing sl@0: iBaseWin->SetRect(rect); sl@0: iBaseWin->DoDraw(); sl@0: ws.Finish(); sl@0: // Check Step 1 completed successfully sl@0: RedrawAndCheckWindows(); sl@0: sl@0: // Set an interval of 2 and wait 0.9 seconds, after which the small ellipse should be visible sl@0: intPckg() = 2; sl@0: drawAnim.CommandReply(EADllSetInterval, intPckg); sl@0: // Draw the small ellipse on the base window to match what the anim should be drawing sl@0: iBaseWin->SetRect(TRect(40,40,80,80)); sl@0: iBaseWin->DoDraw(); sl@0: ws.Finish(); sl@0: // Check Step 2 completed successfully sl@0: RedrawAndCheckWindows(); sl@0: sl@0: // clean up sl@0: drawAnim.Close(); sl@0: ws.Close(); sl@0: } sl@0: sl@0: void CTAnimDll::RunTestCaseL(TInt /*aCurTestCase*/) sl@0: { sl@0: _LIT(KTest0,"RemoteBuffer"); sl@0: _LIT(KTest1,"ExtraCopyTest"); sl@0: _LIT(KTest2,"Misc"); sl@0: _LIT(KTest3,"SyncMode1"); sl@0: _LIT(KTest4,"Anim Dll Panics"); sl@0: _LIT(KTest5,"Drawing test"); sl@0: _LIT(KTest6,"Shadow drawing test"); sl@0: _LIT(KTest7,"General drawing test"); sl@0: _LIT(KTest8,"Destroy window test"); sl@0: _LIT(KTest9,"Sprite Anim test"); sl@0: _LIT(KTest10,"Free Timer test"); sl@0: _LIT(KTest11,"Disable Timer test"); sl@0: _LIT(KTest12,"Multiple Anims"); sl@0: _LIT(KTest13,"ReLoad Click PlugIn"); sl@0: _LIT(KTest14,"Window Functions"); sl@0: _LIT(KTest15,"Window Functions 2"); sl@0: _LIT(KTest16,"Notifications"); sl@0: _LIT(KTest17,"Event Handler removal"); sl@0: _LIT(KTest18,"Anim dll - Load Api Negative Test"); sl@0: _LIT(KTest19,"Key Click Priority Test"); sl@0: _LIT(KTest20,"CWsAnim::Parameters() WindowRect Value Test"); sl@0: _LIT(KTest21,"SetInterval test"); sl@0: _LIT(KTest22,"Client Window Coverage"); sl@0: _LIT(KTest23,"Client Window Panic Coverage"); sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); sl@0: sl@0: // if (iTest->iState==0) iTest->iState=22; //Use this line to start running tests from a particular test sl@0: switch(++iTest->iState) sl@0: { sl@0: case 1: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0127")); sl@0: iTest->LogSubTest(KTest0); sl@0: RemoteBuffer(); sl@0: break; sl@0: case 2: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0128")); sl@0: iTest->LogSubTest(KTest1); sl@0: ExtraCopyTest(); sl@0: break; sl@0: case 3: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0126")); sl@0: iTest->LogSubTest(KTest2); sl@0: Misc(); sl@0: break; sl@0: case 4: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0503 sl@0: */ sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0503")); sl@0: iTest->LogSubTest(KTest3); sl@0: // Disabled temporarily (process isolation/ RThread::RequestComplete issue) to allow WSERV test to continue sl@0: break; sl@0: case 5: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0125")); sl@0: iTest->LogSubTest(KTest4); sl@0: TestPanicsL(); sl@0: if (iTest->iScreenNumber == 1) sl@0: iTest->CloseAllPanicWindows(); sl@0: break; sl@0: case 6: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0129")); sl@0: iTest->LogSubTest(KTest5); sl@0: DrawingTestL(); sl@0: break; sl@0: case 7: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0504 sl@0: */ sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0504")); sl@0: iTest->LogSubTest(KTest6); sl@0: // Disabled temporarily (process isolation/ RThread::RequestComplete issue) to allow WSERV test to continue sl@0: break; sl@0: case 8: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0130")); sl@0: iTest->LogSubTest(KTest7); sl@0: GeneralDrawingTestL(); sl@0: break; sl@0: case 9: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0131")); sl@0: iTest->LogSubTest(KTest8); sl@0: DestroyWindowTestL(); sl@0: break; sl@0: case 10: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0132")); sl@0: iTest->LogSubTest(KTest9); sl@0: SpriteAnimL(); sl@0: break; sl@0: case 11: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0133")); sl@0: iTest->LogSubTest(KTest10); sl@0: FreeTimerL(); sl@0: break; sl@0: case 12: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0134")); sl@0: iTest->LogSubTest(KTest11); sl@0: DisableTimerL(); sl@0: break; sl@0: case 13: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0135")); sl@0: iTest->LogSubTest(KTest12); sl@0: MultipleAnimsL(); sl@0: break; sl@0: case 14: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0136")); sl@0: iTest->LogSubTest(KTest13); sl@0: ClickPlugInL(); sl@0: break; sl@0: case 15: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0137")); sl@0: iTest->LogSubTest(KTest14); sl@0: WinFunctionsL(); sl@0: break; sl@0: case 16: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0138")); sl@0: iTest->LogSubTest(KTest15); sl@0: WinFunctions2L(); sl@0: break; sl@0: case 17: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0139")); sl@0: iTest->LogSubTest(KTest16); sl@0: TestNotificationsL(); sl@0: break; sl@0: case 18: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0137")); sl@0: iTest->LogSubTest(KTest17); sl@0: TestEventHandlerRemovalL(); sl@0: break; sl@0: case 19: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-CODEBASE-WSERV-0056-0001")); sl@0: iTest->LogSubTest(KTest18); sl@0: TestLoadApiL(); sl@0: break; sl@0: case 20: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0448")); sl@0: iTest->LogSubTest(KTest19); sl@0: KeyClickPriorityL(); sl@0: break; sl@0: case 21: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0505 sl@0: */ sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0505")); sl@0: iTest->LogSubTest(KTest20); sl@0: ParameterValueTestL(); sl@0: break; sl@0: case 22: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0506 sl@0: */ sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0506")); sl@0: iTest->LogSubTest(KTest21); sl@0: TestSetIntervalL(); sl@0: case 23: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0410")); sl@0: iTest->LogSubTest(KTest22); sl@0: TestCoverageL(); sl@0: break; sl@0: case 24: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0411")); sl@0: iTest->LogSubTest(KTest23); sl@0: TestPanicCoverageL(); sl@0: default: sl@0: ((CTAnimDllStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: ((CTAnimDllStep*)iStep)->CloseTMSGraphicsStep(); sl@0: TestComplete(); sl@0: } sl@0: User::Check(); sl@0: ((CTAnimDllStep*)iStep)->RecordTestResultL(); sl@0: } sl@0: sl@0: // sl@0: sl@0: CAnimRedrawWindow::CAnimRedrawWindow(CAnimWindow *aAnimWindow, TBool aIsBase) : CTWin(), sl@0: iAnimWindow(aAnimWindow), sl@0: iIsBase(aIsBase) sl@0: { sl@0: } sl@0: sl@0: CAnimRedrawWindow::~CAnimRedrawWindow() sl@0: { sl@0: } sl@0: sl@0: void CAnimRedrawWindow::Draw() sl@0: { sl@0: CAnimWindow::Draw(Gc(),Size(),iIsBase,iAnimWindow->iRect,EFalse); sl@0: } sl@0: sl@0: // sl@0: sl@0: CAnimWindow::CAnimWindow(TBool aIsBase, TWinType aWinType) : iWinType(aWinType), iIsBase(aIsBase) sl@0: { sl@0: } sl@0: sl@0: sl@0: CAnimWindow::~CAnimWindow() sl@0: { sl@0: delete iCtWin; sl@0: } sl@0: sl@0: void CAnimWindow::ConstructL(const TPoint &aPos, const TSize &aSize) sl@0: { sl@0: switch(iWinType) sl@0: { sl@0: case ERedraw: sl@0: iCtWin=new(ELeave) CAnimRedrawWindow(this, iIsBase); sl@0: break; sl@0: case EBlank: sl@0: iCtWin=new(ELeave) CTBlankWindow(); sl@0: break; sl@0: case EBackedUp: sl@0: iCtWin=new(ELeave) CTBackedUpWin(EGray4); sl@0: break; sl@0: } sl@0: iCtWin->SetUpL(aPos, aSize, TheClient->iGroup, *TheClient->iGc); sl@0: if (iWinType==ERedraw) sl@0: { sl@0: static_cast(iCtWin)->Win()->EnableRedrawStore(EFalse); sl@0: } sl@0: } sl@0: sl@0: void CAnimWindow::SetEllipseDrawMode(CGraphicsContext::TDrawMode aEllipseDrawMode) sl@0: { sl@0: iEllipseDrawMode=aEllipseDrawMode; sl@0: } sl@0: sl@0: void CAnimWindow::SetRect(const TRect &aRect) sl@0: { sl@0: iRect=aRect; sl@0: } sl@0: sl@0: void CAnimWindow::DrawEllipse(CBitmapContext *aGc, const TRect &aRect) sl@0: { sl@0: aGc->SetDrawMode(iEllipseDrawMode); sl@0: aGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: aGc->SetBrushColor(TRgb(85,85,85)); sl@0: aGc->SetPenColor(TRgb(170,170,170)); sl@0: aGc->DrawEllipse(aRect); sl@0: } sl@0: sl@0: void CAnimWindow::Draw(CBitmapContext *aGc, const TSize &aSize, TBool aIsBase, const TRect &aRect, TBool aBlankIt) sl@0: { sl@0: aGc->SetBrushColor(TRgb::Gray4(2)); sl@0: aGc->Clear(); sl@0: if (!aBlankIt) sl@0: for(TInt i=0;iDrawLine(TPoint(i,0),TPoint(i+10,aSize.iHeight)); sl@0: if (aIsBase) sl@0: DrawEllipse(aGc, aRect); sl@0: } sl@0: sl@0: void CAnimWindow::DoDraw(TBool aBlankIt) sl@0: { sl@0: __ASSERT_ALWAYS(iWinType!=EBlank,AutoPanic(EAutoPanicWindowType)); sl@0: iCtWin->Gc()->Activate(*(RDrawableWindow *)BaseWin()); sl@0: Draw(iCtWin->Gc(),Size(),iIsBase,iRect,aBlankIt); sl@0: iCtWin->Gc()->Deactivate(); sl@0: } sl@0: sl@0: void CAnimWindow::DoDrawEllipse() sl@0: { sl@0: __ASSERT_ALWAYS(iWinType!=EBlank,AutoPanic(EAutoPanicWindowType)); sl@0: iCtWin->Gc()->Activate(*(RDrawableWindow *)BaseWin()); sl@0: DrawEllipse(iCtWin->Gc(),iRect); sl@0: iCtWin->Gc()->Deactivate(); sl@0: } sl@0: sl@0: void CAnimWindow::DoDrawCoverage() sl@0: { sl@0: __ASSERT_ALWAYS(iWinType!=EBlank,AutoPanic(EAutoPanicWindowType)); sl@0: CWindowGc *gc = iCtWin->Gc(); sl@0: gc->Activate(*(RDrawableWindow *)BaseWin()); sl@0: sl@0: gc->SetClippingRect(iRect); sl@0: gc->Clear(); sl@0: gc->Clear(iRect); sl@0: sl@0: gc->SetDrawMode(CGraphicsContext::EDrawModeAND); sl@0: gc->SetBrushStyle(CGraphicsContext::ENullBrush); sl@0: gc->SetBrushColor(TRgb::Gray256(85)); sl@0: gc->SetBrushOrigin(TPoint(0,0)); sl@0: gc->SetPenColor(TRgb::Gray256(170)); sl@0: sl@0: //primitive method calls sl@0: gc->SetFaded(ETrue); sl@0: gc->SetFadingParameters(1, 1); sl@0: sl@0: gc->SetPenStyle(CGraphicsContext::ESolidPen); sl@0: gc->SetStrikethroughStyle(EStrikethroughOff); sl@0: gc->SetUnderlineStyle(EUnderlineOff); sl@0: gc->SetWordJustification(2, 1); sl@0: sl@0: CFbsFont* font; sl@0: gc->Device()->GetNearestFontInTwips((CFont*&)font, TFontSpec()); sl@0: sl@0: gc->UseFont(font); sl@0: sl@0: gc->DrawArc(iRect, sl@0: TPoint(iRect.Center().iX, iRect.iTl.iY), sl@0: TPoint(iRect.iBr.iX, iRect.Center().iY)); sl@0: gc->DrawLine(iRect.iTl,iRect.Center()); sl@0: gc->DrawLineTo(TPoint(iRect.iBr.iX, iRect.iTl.iY)); sl@0: sl@0: gc->DrawLineBy(TPoint(iRect.iTl.iX, iRect.iBr.iY)); sl@0: gc->MoveBy(iRect.iTl + TPoint(1,1)); sl@0: gc->MoveTo(iRect.iTl + TPoint(0,0)); sl@0: gc->SetPenSize(TSize(10,10)); sl@0: gc->Plot(iRect.iTl + TPoint(2,2)); sl@0: gc->SetPenSize(TSize(1,1)); sl@0: sl@0: CArrayFixFlat* polyPoints = new(ELeave) CArrayFixFlat(3); //CArrayFixFlat sl@0: CleanupStack::PushL(polyPoints); sl@0: polyPoints->AppendL(iRect.iTl); sl@0: polyPoints->AppendL(iRect.Center()); sl@0: polyPoints->AppendL(TPoint(iRect.iBr.iX, iRect.iTl.iY)); sl@0: sl@0: gc->DrawPolyLine(polyPoints); sl@0: gc->DrawPolyLine(&polyPoints->At(0), 3); sl@0: gc->DrawPolygon(polyPoints, CGraphicsContext::EWinding); sl@0: gc->DrawPolygon(&polyPoints->At(0), 3, CGraphicsContext::EAlternate); sl@0: sl@0: gc->DrawPie(iRect, TPoint(iRect.Center().iX, iRect.iTl.iY), TPoint(iRect.iBr.iX, iRect.Center().iY)); sl@0: gc->DrawEllipse(iRect); sl@0: gc->DrawRect(iRect); sl@0: gc->DrawRoundRect(iRect, TSize(iRect.Width()/8, iRect.Height()/8)); sl@0: sl@0: CleanupStack::PopAndDestroy(polyPoints); sl@0: sl@0: gc->CopyRect(TPoint(10, 10), iRect); sl@0: sl@0: CFbsBitmap* bitmap = new(ELeave) CFbsBitmap(); sl@0: CleanupStack::PushL(bitmap); sl@0: User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4)); sl@0: sl@0: gc->UseBrushPattern(bitmap); sl@0: gc->DrawBitmap(iRect.iTl, bitmap); sl@0: gc->DrawBitmap(iRect, bitmap); sl@0: gc->DrawBitmap(iRect, bitmap, TRect(0, 0, 16, 16)); sl@0: gc->DrawBitmapMasked(iRect, bitmap, TRect(0, 0, 16, 16), bitmap, ETrue); sl@0: sl@0: gc->BitBlt(TPoint(0, 0), bitmap); sl@0: gc->BitBlt(TPoint(0, 0), bitmap, iRect); sl@0: gc->BitBltMasked(TPoint(0, 0), bitmap, iRect, bitmap, ETrue); sl@0: gc->AlphaBlendBitmaps(TPoint(0, 0), bitmap, iRect, bitmap, TPoint(0,0)); sl@0: sl@0: CleanupStack::PopAndDestroy(bitmap); sl@0: sl@0: _LIT(KHelloWorld,"Hello World"); sl@0: gc->SetCharJustification(1,1); sl@0: gc->SetClippingRect(iRect); sl@0: gc->DrawText(*&KHelloWorld, iRect.iTl); sl@0: gc->DrawText(*&KHelloWorld, iRect, 0, CGraphicsContext::ELeft, 0); sl@0: gc->DrawTextVertical(*&KHelloWorld, iRect.iBr, ETrue); sl@0: gc->DrawTextVertical(*&KHelloWorld, iRect, 0, ETrue, CGraphicsContext::ELeft, 0); sl@0: sl@0: TRgb rgbs[2]; sl@0: gc->MapColors(iRect, rgbs, 1, ETrue); sl@0: gc->DiscardBrushPattern(); sl@0: sl@0: gc->DiscardFont(); sl@0: gc->Device()->ReleaseFont(font); sl@0: sl@0: gc->Deactivate(); sl@0: } sl@0: sl@0: TSize CAnimWindow::Size() sl@0: { sl@0: return(iCtWin->Size()); sl@0: } sl@0: sl@0: RWindowBase *CAnimWindow::BaseWin() const sl@0: { sl@0: return(iCtWin->BaseWin()); sl@0: } sl@0: sl@0: CTBaseWin *CAnimWindow::CtBaseWin() sl@0: { sl@0: return(iCtWin); sl@0: } sl@0: sl@0: void CAnimWindow::Invalidate() sl@0: { sl@0: CTUser::Splat(TheClient,TRect(iCtWin->Position(),iCtWin->Size()),TRgb::Gray256(0)); sl@0: } sl@0: sl@0: void CAnimWindow::Invalidate(const TRect &aRect) sl@0: { sl@0: TRect rect(aRect); sl@0: rect.Move(iCtWin->Position()); sl@0: CTUser::Splat(TheClient,rect,TRgb::Gray256(0)); sl@0: } sl@0: sl@0: void CAnimWindow::DrawTestScreen(CFbsBitmap *aBitmap, CFbsBitmap *aMaskBitmap, CFbsFont *aFont) sl@0: { sl@0: iCtWin->Gc()->Activate(*(RDrawableWindow *)BaseWin()); sl@0: CBitmapContext *gc=iCtWin->Gc(); sl@0: TSize size(Size()); sl@0: TBool aExtraDrawBitMap=ETrue; sl@0: // sl@0: #include "DLLDRAW.H" sl@0: // sl@0: iCtWin->Gc()->Deactivate(); sl@0: } sl@0: sl@0: sl@0: __WS_CONSTRUCT_STEP__(AnimDll)