First public contribution.
1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Client side of AUTODLL test code
21 @internalComponent - Internal Symbian test code
32 CGraphicsContext::TDrawMode CAnimWindow::iEllipseDrawMode;
34 CTAnimDll::CTAnimDll(CTestStep* aStep) : CTWsGraphicsBase(aStep)
38 RTestAnim::RTestAnim() : RAnim()
42 RTestAnim::RTestAnim(RAnimDll &aDll) : RAnim(aDll)
46 LOCAL_C TInt DoPanicTest(TInt aInt, TAny *aScreenNumber)
49 User::LeaveIfError(ws.Connect());
51 // assign to the correct screen
52 CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
53 User::LeaveIfError(screen->Construct((TInt)aScreenNumber));
55 RWindowGroup group(ws);
56 User::LeaveIfError(group.Construct(333));
57 group.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close
58 RAnimDll animDll=RAnimDll(ws);
59 User::LeaveIfError(animDll.Load(KAnimDLLName));
60 RTestAnim panic(animDll);
62 RBlankWindow blankwin(ws);
63 if (aInt==16 || aInt==17) // Use a blank window for this one
65 User::LeaveIfError(blankwin.Construct(group,123));
66 blankwin.SetSize(TSize(10,10));
68 User::LeaveIfError(panic.Construct(blankwin,EAnimTypeTest1,TPtrC8()));
72 User::LeaveIfError(window.Construct(group,123));
73 window.SetSize(TSize(10,10));
78 User::LeaveIfError(panic.Construct(window,EAnimTypeTest2,TPtrC8()));
79 User::LeaveIfError(panic.Construct(window,EAnimTypeTest1,TPtrC8()));
81 TPckgBuf<TPoint> dummyParam;
85 panic.Command(EADllPanicCallPanic);
88 panic.Command(EADllPanicCallPanic,dummyParam);
91 panic.CommandReply(EADllPanicCallPanic);
94 panic.CommandReply(EADllPanicCallPanic,dummyParam);
97 panic.Command(EADllPanicSetInterval);
100 panic.Command(EADllPanicSetNextInterval);
103 panic.CommandReply(EADllPanicBadFont);
106 panic.CommandReply(EADllPanicBadBitmap);
109 panic.Command(EADllPanicLeave);
112 panic.Command(EADllPanicDoubleActivateGC);
115 panic.Command(EADllPanicDrawRectWithNoGc);
118 panic.Command(EADllPanicDrawTextWithNoFont);
121 panic.Command(EADllPanicLeaveInAnimate);
123 panic.CommandReply(EADllBlankOpCode);
126 panic.Command(EADllPanicLeaveInRedraw);
127 window.BeginRedraw();
130 panic.CommandReply(EADllBlankOpCode);
133 ws.TestWrite(animDll.WsHandle(),999,NULL,0);
136 panic.Command(EADllPanicSetVisWithGcActive);
139 panic.CommandReply(EADllPanicSetVisWithGcActiveReply);
142 panic.Command(EADllPanicLeaveInActiveCallback);
144 User::After(2000000);
145 panic.CommandReply(EADllBlankOpCode);
148 panic.Command(EADllPanicSetClippingRectWithNoGc);
151 panic.CommandReply(EADllPanicSetClippingRegionWithNoGc);
154 panic.Command(EADllPanicCancelClippingRegionWithNoGc);
157 panic.Command(EADllPanicCancelClippingRectWithNoGc);
160 panic.Command(EADllPanicSetDrawModeWithNoGc);
163 panic.Command(EADllPanicUseFontWithNoGc);
166 panic.Command(EADllPanicDiscardFontWithNoGc);
169 panic.Command(EADllPanicSetUnderlineStyleWithNoGc);
172 panic.Command(EADllPanicSetStrikeThoughStyleWithNoGc);
175 panic.Command(EADllPanicSetWordJustificationWithNoGc);
178 panic.Command(EADllPanicSetCharJustificationWithNoGc);
181 panic.Command(EADllPanicSetPenColorWithNoGc);
184 panic.Command(EADllPanicSetPenStyleWithNoGc);
187 panic.Command(EADllPanicSetPenSizeWithNoGc);
190 panic.Command(EADllPanicSetBrushColorWithNoGc);
193 panic.Command(EADllPanicSetBrushStyleWithNoGc);
196 panic.Command(EADllPanicSetBrushOriginWithNoGc);
199 panic.Command(EADllPanicUseBrushPatterWithNoGc);
202 panic.Command(EADllPanicDiscardBrushPatternWithNoGc);
205 panic.Command(EADllPanicSetFadedWithNoGc);
208 panic.Command(EADllPanicSetFadingParametersWithNoGc);
211 panic.Command(EADllPanicDrawArcWithNoGc);
214 panic.Command(EADllPanicDrawPieWithNoGc);
217 panic.Command(EADllPanicDrawLineWithNoGc);
220 panic.Command(EADllPanicDrawLineToWithNoGc);
223 panic.Command(EADllPanicDrawLineByWithNoGc);
226 panic.Command(EADllPanicDrawEllipseWithNoGc);
229 panic.Command(EADllPanicDrawRoundedRecWithNoGc);
232 panic.Command(EADllPanicClearWithRectWithNoGc);
235 panic.Command(EADllPanicClearWithNoGc);
238 panic.Command(EADllPanicBitBltWithNoGc);
241 panic.Command(EADllPanicBitBltWithRectWithNoGc);
244 panic.Command(EADllPanicBitBltMaskedWithNoGc);
247 panic.Command(EADllPanicDrawBitmapPointWithNoGc);
250 panic.Command(EADllPanicDrawBitmapWithNoGc);
253 panic.Command(EADllPanicDrawBitmapRectWithNoGc);
256 panic.Command(EADllPanicDrawBitmapMaskedFbsBitmapWithNoGc);
259 panic.Command(EADllPanicDrawBitmapMaskedWsBitmapWithNoGc);
262 panic.Command(EADllPanicDrawPolyLinePointsWithNoGc);
265 panic.Command(EADllPanicDrawPolyLineArrayWithNoGc);
268 panic.CommandReply(EADllPanicDrawPolygonPointsWithNoGc);
271 panic.CommandReply(EADllPanicDrawPolygonArrayWithNoGc);
274 panic.Command(EADllPanicMoveToWithNoGc);
277 panic.Command(EADllPanicMoveByWithNoGc);
280 panic.Command(EADllPanicPlotWithNoGc);
283 panic.Command(EADllPanicSetOriginWithNoGc);
286 panic.Command(EADllPanicCopyRectWithNoGc);
289 panic.Command(EADllPanicResetWithNoGc);
292 panic.CommandReply(EADllPanicAlphaBlendingBitmapsFbsBitmapWithNoGc);
295 panic.Command(EADllPanicMapColorsWithNoGc);
298 panic.Command(EADllPanicDrawTextWithRectWithNoFont);
301 panic.Command(EADllPanicDrawTextVerticalWithNoFont);
304 panic.Command(EADllPanicDrawTextVerticalWithRectWithNoFont);
307 panic.CommandReply(EADllPanicDevice);
310 panic.Command(EADllPanicInvalidFocusScreenTooBig);
313 panic.Command(EADllPanicInvalidFocusScreenNegative);
316 return(EWsExitReasonFinished);
320 return(EWsExitReasonBad);
324 @SYMTestCaseID GRAPHICS-WSERV-0125
328 @SYMTestCaseDesc Panic tests
330 @SYMTestPriority High
332 @SYMTestStatus Implemented
334 @SYMTestActions The test creates an animation and animation's client threads.
335 Each thread calls some
336 command of the animation which is expected to panic on certain reason.
337 The test checks that those client threads will panic returning
338 a proper panic code. Client threads are created and tested for
339 the following actions:
340 1. A Command() call to an animation which executes
341 iFunctions->Panic() method. Client thread must panic with
342 code EWservPanicAnimDll.
343 2. A Command() call with dummy parameter to an animation which
344 executes iFunctions->Panic() method. Client thread must panic
345 with code EWservPanicAnimDll.
346 3. A CommandReply() call to an animation which executes
347 iFunctions->Panic() method. Client thread must panic with code
349 4. A CommandReply() call with dummy parameter to an animation
350 which executes iFunctions->Panic() method. Client thread must
351 panic with code EWservPanicAnimDll.
352 5. A command that calls MAnimGeneralFunctions::SetInterval() when
353 the synchronisation mode is not TAnimSync::ESyncNone. Client
354 thread must panic with code EWservPanicAnimDll.
355 6. A command that calls MAnimGeneralFunctions::SetNextInterval()
356 when the synchronisation mode is not TAnimSync::ESyncNone. Client
357 thread must panic with code EWservPanicAnimDll.
358 7. A command that calls MAnimGeneralFunctions::DuplicateFontL() to
359 duplicate undefined font. Client thread must panic with code
361 8. A command that calls MAnimGeneralFunctions::DuplicateBitmapL()
362 to duplicate undefined bitmap. Client thread must panic with code
364 9. A command that calls User::Leave(KErrGeneral). Client thread
365 must panic with code EWservPanicAnimLeave.
366 10. A command that activates window animation's graphical context
367 twice. Client thread must panic with code EWservPanicAnimDll.
368 11. A command that tries to draw a rectangle while graphical
369 context is not defined yet. Client thread must panic with code
370 EWservPanicAnimLeave.
371 12. A command that tries to draw a text whihout a font defined yet.
372 Client thread must panic with code EWservPanicNoFont.
373 13. A command that causes an animation to leave during execution
374 of CAnim::Animate() method; and a new command call 4 seconds after
375 that. Client thread must panic with code EWservPanicAnimLeave.
376 14. A command that causes an animation to leave during execution
377 of CAnim::Redraw() method. The client thread initiates it's window
378 redraw after that. Client thread must panic with code
379 EWservPanicAnimLeave.
380 15. The client thread calls RWsSession::TestWrite() on animation
381 DLL server-side handle with opcode 999. Client thread must panic with code
383 16. A command that activates graphical context and sets the
384 window to invisible and then to visible. Client thread must panic
385 with code EWservPanicAnimDll.
388 @SYMTestExpectedResults See test actions.
390 void CTAnimDll::TestPanicsL()
393 TBool finishTests=EFalse;
398 TClientPanic panicCode=EWservPanicAnimDll;
401 // panic the server with a KERN-4. When server fixed these this can be removed.
421 panicCode=EWservPanicAnimDll;
424 panicCode=EWservPanicFont;
427 panicCode=EWservPanicBitmap;
433 panicCode=EWservPanicNoFont;
436 panicCode=EWservPanicOpcode;
443 default: // cases 19 - 68
444 panicCode=EWservPanicAnimLeave;
448 TEST(iTest->TestWsPanicL(&DoPanicTest,panicCode,index,(TAny*)iTest->iScreenNumber,&finishTests));
450 if (iTest->iScreenNumber == 0)
451 iTest->CloseAllPanicWindows();
453 } while(!finishTests);
456 void CTAnimDll::TestSyncModes(MAnimGeneralFunctions::TAnimSync aSyncMode)
458 RTestAnim anim=RTestAnim(iAnimDll);
459 User::LeaveIfError(anim.Construct(*iTestWin->BaseWin(),EAnimTypeTest1,TPtrC8()));
460 CleanupClosePushL(anim);
462 TPckgBuf<TSyncTests> params;
463 TRequestStatus status(KRequestPending);
464 params().status=&status;
465 params().syncMode=aSyncMode;
466 anim.CommandReply(EADllSyncTests,params);
467 User::WaitForRequest(status);
468 TEST(status==KErrNone);
470 CleanupStack::PopAndDestroy(&anim);
473 void CTAnimDll::TestTimeChange()
475 RTestAnim anim=RTestAnim(iAnimDll);
476 User::LeaveIfError(anim.Construct(*iTestWin->BaseWin(),EAnimTypeTest1,TPtrC8()));
477 CleanupClosePushL(anim);
479 TPckgBuf<TTimeChangeTest> params;
480 TRequestStatus status(KRequestPending);
481 TRequestStatus status2(KRequestPending);
482 params().status=&status;
483 params().status2=&status2;
484 anim.CommandReply(EADllTimeChangedTest,params);
485 User::WaitForRequest(status);
488 time+=TTimeIntervalHours(1);
489 User::SetHomeTime(time);
490 User::WaitForRequest(status2);
492 time-=TTimeIntervalHours(1);
493 User::SetHomeTime(time);
494 TEST(status2==KErrNone);
496 CleanupStack::PopAndDestroy(&anim);
499 void CTAnimDll::ConstructL()
501 TheClient->iGroup->WinTreeNode()->SetOrdinalPosition(0);
502 iRedrawWin=new(ELeave) CAnimWindow(EFalse, CAnimWindow::ERedraw);
503 iBackedUpTestWin=new(ELeave) CAnimWindow(EFalse, CAnimWindow::EBackedUp);
504 iBlankTestWin=new(ELeave) CAnimWindow(EFalse, CAnimWindow::EBlank);
505 iBaseWin=new(ELeave) CAnimWindow(ETrue, CAnimWindow::ERedraw);
508 TSize screenSize=TheClient->iGroup->Size();
509 TInt winWidth=(screenSize.iWidth/3)-10;
510 TInt winHeight=screenSize.iHeight-10;
511 iBaseWin->ConstructL(TPoint(screenSize.iWidth/3+5,5),TSize(winWidth,winHeight));
512 iBlankTestWin->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight));
513 ((RBlankWindow *)iBlankTestWin->BaseWin())->SetColor(TRgb::Gray4(2));
514 iBackedUpTestWin->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight));
515 iRedrawWin->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight));
519 iAnimDll=RAnimDll(TheClient->iWs);
520 TInt retVal = iAnimDll.Load(KAnimDLLName);
521 TEST(retVal==KErrNone);
522 if (retVal!=KErrNone)
523 INFO_PRINTF3(_L("iAnimDll.Load(KAnimDLLName) return value - Expected: %d , Actual: %d"), KErrNone, retVal);
526 CTAnimDll::~CTAnimDll()
529 delete iBackedUpTestWin;
530 delete iBlankTestWin;
536 @SYMTestCaseID GRAPHICS-WSERV-0126
540 @SYMTestCaseDesc Miscellaneous animation tests.
542 @SYMTestPriority High
544 @SYMTestStatus Implemented
546 @SYMTestActions Tests window animation's window funtions like WindowSize(),
547 IsHidden(), SetVisible().
548 Tests RAnimDll's constructor, Close(), Load() and copy-constructor.
550 @SYMTestExpectedResults Expects window funtions and RAnimDll's methods work properly.
552 void CTAnimDll::Misc()
554 RTestAnim anim=RTestAnim(iAnimDll);
555 User::LeaveIfError(anim.Construct(*iTestWin->BaseWin(),EAnimTypeTest1,TPtrC8()));
556 CleanupClosePushL(anim);
558 TPckgBuf<TSize> params;
559 params()=iTestWin->Size();
560 TBool retBool = anim.CommandReply(EADllTestWindowSize,params);
563 INFO_PRINTF3(_L("anim.CommandReply(EADllTestWindowSize,params) return value - Expected: %d , Actual: %d"), ETrue, retBool);
564 TheClient->iWs.Finish();
565 retBool = anim.CommandReply(EADllTestSetVisible);
568 INFO_PRINTF3(_L("anim.CommandReply(EADllTestSetVisible) return value - Expected: %d , Actual: %d"), ETrue, retBool);
569 CleanupStack::PopAndDestroy(&anim);
571 RAnimDll closeme(TheClient->iWs);
573 RAnimDll animdll(TheClient->iWs);
574 TInt retVal = animdll.Load(KAnimDLLName);
575 TEST(retVal==KErrNone);
576 if (retVal!=KErrNone)
577 INFO_PRINTF3(_L("animdll.Load(KAnimDLLName) return value - Expected: %d , Actual: %d"), KErrNone, retVal);
579 RTestAnim anim2(animdll);
585 @SYMTestCaseID GRAPHICS-WSERV-0127
589 @SYMTestCaseDesc Test animation's command call with reply
591 @SYMTestPriority High
593 @SYMTestStatus Implemented
595 @SYMTestActions Puts an array containing a sequnce of numbers into a command argument.
596 Performs command call to server, assuming that the server-side
597 should return a sum of the numbers in sequence.
599 @SYMTestExpectedResults Checks that server returns the correct sum.
601 void CTAnimDll::RemoteBuffer()
603 RTestAnim anim=RTestAnim(iAnimDll);
604 User::LeaveIfError(anim.Construct(*iTestWin->BaseWin(),EAnimTypeTest1,TPtrC8()));
605 CleanupClosePushL(anim);
607 TBuf<ERemoteBufSize> buf(ERemoteBufSize);
609 for (TInt8 index=0;index<ERemoteBufSize;index++)
615 ipcArgs.Set(KIpcSlot,&buf);
616 TInt retVal = anim.CommandReply(EADllReadRemoteDescriptor,KNullDesC8,ipcArgs);
619 INFO_PRINTF3(_L("anim.CommandReply(EADllReadRemoteDescriptor,KNullDesC8,ipcArgs) return value - Expected: %d , Actual: %d"), total, retVal);
621 CleanupStack::PopAndDestroy(&anim);
625 @SYMTestCaseID GRAPHICS-WSERV-0128
629 @SYMTestCaseDesc RAnimDll extracopy test
631 @SYMTestPriority High
633 @SYMTestStatus Implemented
635 @SYMTestActions Creates another RAnimDll instance for a dll that already has a client-side interface.
637 @SYMTestExpectedResults Expects that operation completes without errors.
639 void CTAnimDll::ExtraCopyTest()
641 RAnimDll extraCopy(TheClient->iWs);
642 TInt retVal = extraCopy.Load(KAnimDLLName);
643 TEST(retVal==KErrNone);
644 if (retVal!=KErrNone)
645 INFO_PRINTF3(_L("extraCopy.Load(KAnimDLLName) return value - Expected: %d , Actual: %d"), KErrNone, retVal);
650 void CTAnimDll::SyncMode1()
652 TestSyncModes(MAnimGeneralFunctions::ESyncSecond);
655 void CTAnimDll::CheckWindows()
657 CheckRect(iBaseWin->CtBaseWin(),iTestWin->CtBaseWin(),TRect(iBaseWin->Size()),_L("CTAnimDll::CheckWindows() failed"));
660 void CTAnimDll::InvalidatePauseAndRedraw(const TRect &aRect,TTimeIntervalMicroSeconds32 aInterval)
662 iTestWin->Invalidate(aRect);
663 TheClient->iWs.Flush();
664 User::After(aInterval);
665 __ASSERT_DEBUG(iTestWin->iWinType==CAnimWindow::ERedraw,AutoPanic(EAutoPanicWindowType));
666 RWindow *win=(RWindow *)iTestWin->BaseWin();
670 TheClient->iWs.Flush();
673 void CTAnimDll::RedrawAndCheckWindows(TBool aBlankIt)
675 if (iTestWin->iWinType==CAnimWindow::ERedraw)
677 RWindow *win=(RWindow *)iTestWin->BaseWin();
679 iTestWin->DoDraw(aBlankIt);
682 RWindow *win=(RWindow *)iBaseWin->BaseWin();
684 iBaseWin->DoDraw(aBlankIt);
686 TheClient->WaitForRedrawsToFinish();
691 @SYMTestCaseID GRAPHICS-WSERV-0129
695 @SYMTestCaseDesc Animation drawing test
697 @SYMTestPriority High
699 @SYMTestStatus Implemented
701 @SYMTestActions Performs animation drawing ontop of redrawable window, backed-up window and blank window.
702 Draws the same shapes using directly window graphics on an other window (base window).
703 The following shapes are drawn:
704 1. An animation with a small ellipse drawn in XOR mode on top of redrawable
705 black-lined gray window.
706 2. The same with a bigger ellipse but previously invalidating an
707 area which intersects the old ellipse and the new ellipse.
708 3. Runs an animation that continuously moves a rectangle and shrinks another on top of
709 redrawable black-lined gray window and then cancels an animation.
710 The test checks that the window will be identical with the gray base window
711 that contains only black lines.
712 4. An animation with a small ellipse drawn in XOR mode on top of backed-up
713 black-lined gray window. The test also calls Invalidate() method and performs
714 a check again to make sure that the test-window and base window are identical.
715 5. An animation with a small ellipse drawn in XOR mode on top of the blank
716 gray window. The test also sends commands to the animation that call windows
717 SetVisible(EFalse) and SetVisible(ETrue) and checks that the
718 test-window and base window are identical.
721 @SYMTestExpectedResults Each time performs pixelwise comparisons of animated windows
722 and the base window expecting the windows to be identical.
724 void CTAnimDll::DrawingTestL()
726 // draws a little circle on the base window using window graphics and using window animation on the test window.
727 RTestAnim drawAnim=RTestAnim(iAnimDll);
730 TPckgBuf<TRect> rectPckg;
731 TPckgBuf<TBool> boolPckg;
734 _LIT(KLog1,"Draw Ellipse Test1");
736 rect = TRect(10,10,50,50);
737 CAnimWindow::SetEllipseDrawMode(CGraphicsContext::EDrawModeXOR);
738 iTestWin->Invalidate();
739 iTestWin->SetRect(rect);
740 iBaseWin->Invalidate();
741 iBaseWin->SetRect(rect);
743 User::LeaveIfError(drawAnim.Construct(*iTestWin->BaseWin(),EAnimTypeTest3,rectPckg));
744 RedrawAndCheckWindows();
746 _LIT(KLog2,"Draw Ellipse Test2");
748 iTestWin->Invalidate(TRect(20,20,100,40));
749 iBaseWin->Invalidate(TRect(20,20,100,40));
750 iBaseWin->DoDrawEllipse(); // Should clear old Ellipse (except invalid bits)
751 rect=TRect(30,30,200,100);
753 iBaseWin->SetRect(rect);
754 iBaseWin->DoDrawEllipse(); // Should draw new Ellipse (except invalid bits)
755 drawAnim.Command(EADllSetRect,rectPckg);
756 RedrawAndCheckWindows();
757 iBaseWin->DoDrawEllipse(); // Clear old ellipse
759 _LIT(KLog3,"Window Overlap Anim Test");
762 iBaseWin->SetRect(TRect());
764 TheClient->iWs.Finish();
766 // create another window on top and check that animation beneath is not visible
767 TSize screenSize=TheClient->iGroup->Size();
768 TInt winWidth=(screenSize.iWidth/3)-10;
769 TInt winHeight=screenSize.iHeight-10;
770 TSize size=iTestWin->Size();
771 rectPckg()=TRect(size);
772 drawAnim.Command(EADllStartAnimate,rectPckg);
774 CAnimWindow *topWindow = new (ELeave) CAnimWindow(ETrue, CAnimWindow::ERedraw);
775 CleanupStack::PushL(topWindow);
776 topWindow->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight));
778 RWindow *win=(RWindow *)iTestWin->BaseWin();
780 topWindow->DoDraw(EFalse);
783 TheClient->iWs.Flush();
784 for(TInt i=0;i<size.iWidth/2;i+=5)
785 InvalidatePauseAndRedraw(TRect(i,size.iHeight-i-i,i+i,size.iHeight-i),TTimeIntervalMicroSeconds32(400000));
787 TheClient->WaitForRedrawsToFinish();
788 CheckRect(iBaseWin->CtBaseWin(),iTestWin->CtBaseWin(),TRect(iBaseWin->Size()));
790 win->BeginRedraw(rect);
791 drawAnim.Command(EADllCancelAnimate,rectPckg);
794 CleanupStack::PopAndDestroy(topWindow);
796 iTestWin->BaseWin()->SetVisible(EFalse);
799 _LIT(KLog4,"Draw Ellipse Test4&5");
801 rect=TRect(20,20,50,50);
802 iBackedUpTestWin->SetRect(rect);
803 iBackedUpTestWin->DoDraw();
804 iBaseWin->SetRect(rect);
808 TheClient->iWs.Finish();
811 User::LeaveIfError(drawAnim.Construct(*iBackedUpTestWin->BaseWin(),EAnimTypeTest3,rectPckg));
812 TheClient->iWs.Finish();
813 TheClient->WaitForRedrawsToFinish();
815 iBackedUpTestWin->Invalidate();
816 TheClient->iWs.Flush();
817 TheClient->WaitForRedrawsToFinish();
819 iBackedUpTestWin->BaseWin()->SetVisible(EFalse);
821 _LIT(KLog5,"Draw Ellipse Test6&7");
823 rect=TRect(20,20,50,50);
824 TheClient->iWs.Flush();
825 RWindow *winBase=(RWindow *)iBaseWin->BaseWin();
826 winBase->BeginRedraw();
827 iBaseWin->SetRect(rect);
828 iBaseWin->DoDraw(ETrue);
829 winBase->EndRedraw();
831 User::LeaveIfError(drawAnim.Construct(*iBlankTestWin->BaseWin(),EAnimTypeTest3,rectPckg));
832 TheClient->iWs.Flush();
833 iBlankTestWin->Invalidate();
834 TheClient->iWs.Flush();
835 TheClient->WaitForRedrawsToFinish();
838 drawAnim.Command(EADllSetVisible,boolPckg);
839 TheClient->iWs.Flush();
841 drawAnim.Command(EADllSetVisible,boolPckg);
842 TheClient->WaitForRedrawsToFinish();
845 //This test does functional coverage by calling code that executes each of the
846 //server's class (CWsAnimGc) members in turn.
849 _LIT(KLog6,"Draw Primitives (Coverage) Test");
851 rect = TRect(10,10,150,150);
852 iBaseWin->BaseWin()->SetVisible(ETrue);
853 iBaseWin->SetRect(TRect(0,0,0,0));
854 winBase->BeginRedraw();
856 iBaseWin->SetRect(rect);
857 iBaseWin->DoDrawCoverage();
858 winBase->EndRedraw();
860 iTestWin->BaseWin()->SetVisible(ETrue);
861 iTestWin->SetRect(rect);
867 User::LeaveIfError(drawAnim.Construct(*iTestWin->BaseWin(),EAnimTypeCoverage,rectPckg));
871 User::LeaveIfError(TheClient->iGc->Device()->GetNearestFontToDesignHeightInTwips((CFont*&)font, TFontSpec()));
872 TPckgBuf<TInt> fontHandle;
873 fontHandle() = font->Handle();
874 const TInt err = drawAnim.CommandReply(EADllSetFont, fontHandle);
875 TheClient->iGc->Device()->ReleaseFont(font);
876 User::LeaveIfError(err);
879 User::LeaveIfError(drawAnim.CommandReply(EADllDrawNow));
881 TheClient->iWs.Finish();
882 TheClient->WaitForRedrawsToFinish();
887 void CTAnimDll::ShadowDrawingTestL()
889 // Create a blank window to cast a shadow over the animation
890 TSize scrSize(TheClient->iScreen->SizeInPixels());
891 CTBlankWindow *blank=new(ELeave) CTBlankWindow();
892 CleanupStack::PushL(blank);
893 blank->SetUpL(TPoint(0,10), TSize(scrSize.iWidth,scrSize.iHeight/3), TheClient->iGroup, *TheClient->iGc);
894 blank->BaseWin()->SetShadowHeight(2);
895 iBlankTestWin->BaseWin()->SetShadowHeight(0);
897 RTestAnim drawAnim=RTestAnim(iAnimDll);
898 TRect rect(10,scrSize.iHeight/3-20,50,scrSize.iHeight/3+40);
899 TPckgBuf<TRect> rectPckg;
901 User::LeaveIfError(drawAnim.Construct(*iBlankTestWin->BaseWin(),EAnimTypeTest3,rectPckg));
902 drawAnim.Command(EADllSetShadowDrawMode);
903 CAnimWindow::SetEllipseDrawMode(CGraphicsContext::EDrawModePEN);
905 iBlankTestWin->Invalidate();
906 iBlankTestWin->SetRect(rect);
907 iBaseWin->Invalidate();
908 iBaseWin->SetRect(rect);
909 RedrawAndCheckWindows(ETrue);
911 for(TInt ypos=10;ypos>0;ypos-=4)
913 blank->SetPos(TPoint(0,ypos));
914 TPckgBuf<TShadowDrawTest> params;
915 TRequestStatus status(KRequestPending);
916 params().status=&status;
917 drawAnim.CommandReply(EADllShadowAnimTest,params);
918 User::WaitForRequest(status);
919 RedrawAndCheckWindows(ETrue);
922 CleanupStack::PopAndDestroy(blank); // Destroy the shadow window
926 @SYMTestCaseID GRAPHICS-WSERV-0130
930 @SYMTestCaseDesc Complicated drawing test
932 @SYMTestPriority High
934 @SYMTestStatus Implemented
936 @SYMTestActions Performs complicated drawing both through the animation on
937 a blank window and through direct fbs drawing on the second
940 @SYMTestExpectedResults Expects the both windows to be are identical
942 void CTAnimDll::GeneralDrawingTestL()
944 // This test has been removed as it is no longer relevant
945 // Anims are not allowed to draw immediately to the screen
949 @SYMTestCaseID GRAPHICS-WSERV-0131
953 @SYMTestCaseDesc Animated window destruction test
955 @SYMTestPriority High
957 @SYMTestStatus Implemented
959 @SYMTestActions Creates a window and a child window inside it, runs an animation
960 in the child window in ESyncFlash mode, destroys windows.
962 @SYMTestExpectedResults Expects the operations not to fail.
964 void CTAnimDll::DestroyWindowTestL()
966 RWindow window(TheClient->iWs);
967 User::LeaveIfError(window.Construct(*TheClient->iGroup->GroupWin(),123));
968 CleanupClosePushL(window);
969 window.SetSize(TSize(100,100));
971 RWindow window2(TheClient->iWs);
972 CleanupClosePushL(window2);
973 User::LeaveIfError(window2.Construct(window,124));
975 window2.BeginRedraw(); // Validate it
979 drawAnim=RTestAnim(iAnimDll);
980 TRect rect(10,10,50,50);
981 TPckgBuf<TRect> rectPckg;
983 User::LeaveIfError(drawAnim.Construct(window2,EAnimTypeTest3,rectPckg));
984 drawAnim.Command(EADllStartAnimate,rectPckg);
985 CleanupStack::Pop(&window2);
986 CleanupStack::PopAndDestroy(&window);
987 TheClient->iWs.Flush();
988 User::After(TTimeIntervalMicroSeconds32(2000000));
993 void CTAnimDll::SetUpMember(TSpriteMember &aMember,TInt aType)
998 iTest->SetUpMember(aMember);
999 aMember.iOffset=TPoint();
1000 aMember.iInterval=TTimeIntervalMicroSeconds32(1);
1003 aMember.iInvertMask=EFalse;
1004 aMember.iDrawMode=CGraphicsContext::EDrawModeXOR;
1005 aMember.iOffset=TPoint(1,2);
1006 aMember.iInterval=TTimeIntervalMicroSeconds32(2);
1009 aMember.iInvertMask=ETrue;
1010 aMember.iDrawMode=CGraphicsContext::EDrawModeOR;
1011 aMember.iOffset=TPoint(3,4);
1012 aMember.iInterval=TTimeIntervalMicroSeconds32(3);
1015 iTest->SetUpMember(aMember);
1020 @SYMTestCaseID GRAPHICS-WSERV-0132
1024 @SYMTestCaseDesc Sprite animation test
1026 @SYMTestPriority High
1028 @SYMTestStatus Implemented
1030 @SYMTestActions Creates a sprite with three sprite members and a sprite animation
1031 passing the sprite to it. The test updates sprite members'
1032 properties in various ways verifying that the properties are changing
1033 on the server-side as well.
1035 @SYMTestExpectedResults Expects that operations above do not fail and that client-side
1036 changes to the sprite affect server-side properly.
1038 #define HALF_SEC 500000
1039 void CTAnimDll::SpriteAnimL()
1041 // create a sprite, add 3 members to it
1042 RWsSprite sprite(TheClient->iWs);
1043 iRedrawWin->BaseWin()->SetVisible(ETrue);
1044 sprite.Construct(*iRedrawWin->CtBaseWin()->BaseWin(),TPoint(),0);
1045 CleanupClosePushL(sprite);
1046 CFbsBitmap* bitmap1=new(ELeave) CFbsBitmap();
1047 CleanupStack::PushL(bitmap1);
1048 CFbsBitmap* bitmap2=new(ELeave) CFbsBitmap();
1049 CleanupStack::PushL(bitmap2);
1050 CFbsBitmap* bitmap3=new(ELeave) CFbsBitmap();
1051 CleanupStack::PushL(bitmap3);
1052 User::LeaveIfError(bitmap1->Create(TSize(10,12),EGray4));
1053 User::LeaveIfError(bitmap2->Create(TSize(15,17),EGray4));
1054 User::LeaveIfError(bitmap3->Create(TSize(20,22),EGray4));
1055 TSpriteMember member1;
1056 TSpriteMember member2;
1057 TSpriteMember member3;
1058 SetUpMember(member1,1);
1059 member1.iBitmap=bitmap1;
1060 member1.iMaskBitmap=bitmap1;
1061 SetUpMember(member2,2);
1062 member2.iBitmap=bitmap2;
1063 member2.iMaskBitmap=bitmap2;
1064 SetUpMember(member3,3);
1065 member3.iBitmap=bitmap3;
1066 member3.iMaskBitmap=bitmap3;
1067 sprite.AppendMember(member1);
1068 sprite.AppendMember(member2);
1069 sprite.AppendMember(member3);
1071 // create a sprite animation for the sprite
1072 RTestAnim spriteAnim(iAnimDll);
1075 User::LeaveIfError(spriteAnim.Construct(sprite,EAnimTypeSprite,des));
1076 CleanupClosePushL(spriteAnim);
1078 // call EADllCheckMember-command to verify that sprite animation's members
1079 // have the same properties as the sprite instance
1080 TPckgBuf<TSpriteMemberInfo> spriteInfo;
1081 spriteInfo()=TSpriteMemberInfo(TPoint(),0,member1);
1082 TBool retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo);
1085 INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool);
1087 sprite.SetPosition(pos);
1088 spriteInfo()=TSpriteMemberInfo(pos,1,member2);
1089 retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo);
1092 INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool);
1095 sprite.SetPosition(pos);
1096 spriteInfo()=TSpriteMemberInfo(pos,2,member3);
1097 retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo);
1100 INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool);
1102 // call commands to change sprite members' bitmaps and update members
1103 spriteAnim.Command(EADllDraw1);
1104 spriteAnim.Command(EADllDraw2);
1105 spriteAnim.Command(EADllDraw3);
1106 TheClient->iWs.Flush();
1107 User::After(HALF_SEC);
1109 // call commands to change sprite's position
1110 TPckgBuf<TPoint> position;
1111 position().SetXY(60,50);
1112 spriteAnim.Command(EADllSetPos,position);
1113 TheClient->iWs.Flush();
1114 User::After(HALF_SEC);
1116 // change 1st member's bitmap size and interval, update it and call command to check
1117 // that the new properties are applied
1118 User::LeaveIfError(bitmap1->Resize(TSize(30,32)));
1119 member1.iMaskBitmap=NULL;
1120 member1.iInterval=TTimeIntervalMicroSeconds32(25);
1121 User::LeaveIfError(sprite.UpdateMember(0,member1));
1122 spriteInfo()=TSpriteMemberInfo(TPoint(),0,member1);
1123 retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo);
1126 INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool);
1128 User::After(HALF_SEC);
1130 // change 1st member's bitmap size and calls command that invokes
1131 // MAnimSpriteFunctions::SizeChangedL(). Check that new property is applied
1132 spriteAnim.CommandReply(EADllDeactivate);
1133 User::LeaveIfError(bitmap1->Resize(TSize(35,37)));
1134 spriteAnim.Command(EADllSizeChanged);
1135 spriteAnim.CommandReply(EADllActivate);
1136 spriteInfo()=TSpriteMemberInfo(TPoint(),0,member1);
1137 retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo);
1140 INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool);
1142 User::After(HALF_SEC);
1144 // call command that changes 1st member's bitmap image
1145 spriteAnim.Command(EADllIncDraw);
1146 TheClient->iWs.Flush();
1147 User::After(HALF_SEC);
1150 CleanupStack::PopAndDestroy(5,&sprite);
1154 @SYMTestCaseID GRAPHICS-WSERV-0133
1158 @SYMTestCaseDesc Free timer animation test
1160 @SYMTestPriority High
1162 @SYMTestStatus Implemented
1164 @SYMTestActions The test creates a free timer window animation that animates
1165 a shrinking filled rect which changes colour in a predefined way.
1167 @SYMTestExpectedResults The test verifies that the colour changes gets through to the the display.
1170 #define NOT_TIMED_OUT timeWaitingForFrame < frametime<<4
1171 void CTAnimDll::FreeTimerL()
1173 RTestAnim freeTimerAnim(iAnimDll);
1174 User::LeaveIfError(freeTimerAnim.Construct(*iRedrawWin->BaseWin(),EAnimTypeFreeTimer,KNullDesC8));
1175 CleanupClosePushL(freeTimerAnim);
1177 const TInt frametime = 100000; // 100 ms
1178 const TInt samplingtime = frametime>>1; // 50 ms
1180 TPckgC<TInt> frametimeBuf(frametime);
1181 freeTimerAnim.Command(ESetFrameTime, frametimeBuf);
1182 freeTimerAnim.Command(EStartAnimation);
1183 TheClient->iWs.Flush();
1184 TheClient->iWs.Finish();
1186 TInt x = iRedrawWin->BaseWin()->AbsPosition().iX + (iRedrawWin->BaseWin()->Size().iWidth >> 1);
1187 TInt y = iRedrawWin->BaseWin()->AbsPosition().iY + (iRedrawWin->BaseWin()->Size().iHeight >> 1);
1190 TRgb color = KRgbMagenta;
1191 TBool foundRedFrame = EFalse;
1192 TBool foundGreenFrame = EFalse;
1193 TBool foundBlueFrame = EFalse;
1194 TBool foundBlackFrame = EFalse;
1196 //The free-timer animates the colour in this predefined way.
1197 //Test that the screen gets updated.
1198 TInt timeWaitingForFrame = 0;
1199 while(NOT_TIMED_OUT && !(foundRedFrame && foundGreenFrame && foundBlueFrame && foundBlackFrame)) //wait max 16*frametime=1280ms
1201 //wait for the colour frame
1202 color = PixelColour(middle);
1204 if(color == KRgbRed)
1206 foundRedFrame = ETrue;
1208 else if(color == KRgbGreen)
1210 foundGreenFrame = ETrue;
1212 else if(color == KRgbBlue)
1214 foundBlueFrame = ETrue;
1216 else if(color == KRgbBlack)
1218 foundBlackFrame = ETrue;
1221 timeWaitingForFrame += samplingtime;
1222 User::After(samplingtime);
1225 TEST(foundRedFrame);
1226 TEST(foundGreenFrame);
1227 TEST(foundBlueFrame);
1228 TEST(foundBlackFrame);
1230 freeTimerAnim.Command(EStopAnimation);
1231 CleanupStack::PopAndDestroy(&freeTimerAnim);
1234 TRgb CTAnimDll::PixelColour(const TPoint& aPoint) const
1237 TheClient->iScreen->GetPixel(pixel, aPoint);
1242 @SYMTestCaseID GRAPHICS-WSERV-0134
1246 @SYMTestCaseDesc Animation's ESyncSecond sync-mode test
1248 @SYMTestPriority High
1250 @SYMTestStatus Implemented
1252 @SYMTestActions Creates an animation in ESyncSecond sync-mode.
1253 Checks that animation's Animate() method was called either 9, 10 or 11
1254 times during a 10-seconds-wait.
1255 The test also checks that if RWsSession::PrepareForSwitchOff()
1256 is called then the Animate() method will not be called until
1257 TRawEvent::EActive event is simulated.
1259 @SYMTestExpectedResults See actions.
1261 static const TInt K1Second = 1000000;
1262 static const TInt K3Seconds = 3000000;
1263 static const TInt K9Seconds = 9500000;
1264 void CTAnimDll::DisableTimerL()
1266 //Defer start of timerAnim until the systen time are close to a full second
1269 TInt deferTime = K1Second - now.DateTime().MicroSecond();
1270 User::After(deferTime);
1272 //Kick off timerAnim
1273 RTestAnim timerAnim(iAnimDll);
1274 User::LeaveIfError(timerAnim.Construct(*iRedrawWin->BaseWin(),EAnimTypeTimer,KNullDesC8));
1276 User::After(K9Seconds);
1277 TInt count=timerAnim.CommandReply(EADllCurrentCount);
1279 #if defined(LOGGING)
1280 TLogMessageText buf;
1281 _LIT(KLog,"Anim DisableTimer Count=%d");
1282 buf.Format(KLog,count);
1283 TheClient->LogMessage(buf);
1286 TEST(count>=9 && count<=11);
1288 INFO_PRINTF2(_L("count>=9 && count<=11 - Expected: 9,10 or 11 , Actual: %d"), count);
1290 #if defined(__WINS__)
1291 TheClient->iWs.SimulateXyInputType(EXYInputNone); //Turn off pen in case it turns on the timer
1294 // reset timer's counter and call RWsSession::PrepareForSwitchOff(),
1295 // check that 3 seconds after the counter = 0
1296 timerAnim.Command(EADllResetCount);
1297 timerAnim.Command(EADllNoTimer);
1298 TheClient->iWs.PrepareForSwitchOff();
1299 TheClient->iWs.Flush();
1300 User::After(K3Seconds);
1301 count=timerAnim.CommandReply(EADllCurrentCount);
1302 #if defined(LOGGING)
1303 buf.Format(KLog,count);
1304 TheClient->LogMessage(buf);
1308 INFO_PRINTF3(_L("count==0 - Expected: %d , Actual: %d"), 0, count);
1311 // simulates TRawEvent::EActive event,
1312 // check that the timer didn't ticked until the event were simulated
1313 timerAnim.Command(EADllTimerStarted);
1315 event.Set(TRawEvent::EActive);
1316 TheClient->iWs.SimulateRawEvent(event);
1317 #if defined(__WINS__)
1318 TheClient->iWs.SimulateXyInputType(EXYInputPointer); //Turn pen on again
1320 TInt retVal = timerAnim.CommandReply(EADllFailed);
1323 INFO_PRINTF3(_L("timerAnim.CommandReply(EADllFailed) return value - Expected: %d , Actual: %d"), 0, retVal);
1330 @SYMTestCaseID GRAPHICS-WSERV-0135
1334 @SYMTestCaseDesc Multiple animations test
1336 @SYMTestPriority High
1338 @SYMTestStatus Implemented
1340 @SYMTestActions Creates multiple animations for a window.
1342 @SYMTestExpectedResults The test doesn't perform any specific validations.
1344 void CTAnimDll::MultipleAnimsL()
1346 RTestAnim anim1(iAnimDll);
1347 RTestAnim anim2(iAnimDll);
1348 RTestAnim anim3(iAnimDll);
1349 RTestAnim anim4(iAnimDll);
1350 RTestAnim anim5(iAnimDll);
1351 RTestAnim anim6(iAnimDll);
1353 User::LeaveIfError(anim1.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
1354 CleanupClosePushL(anim1);
1355 User::LeaveIfError(anim2.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
1356 CleanupClosePushL(anim2);
1357 User::LeaveIfError(anim3.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
1358 CleanupClosePushL(anim3);
1359 User::LeaveIfError(anim4.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
1360 CleanupClosePushL(anim4);
1361 User::LeaveIfError(anim5.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
1362 CleanupClosePushL(anim5);
1363 User::LeaveIfError(anim6.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
1365 User::LeaveIfError(anim6.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
1367 User::LeaveIfError(anim6.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
1368 CleanupStack::PopAndDestroy(&anim5);
1370 User::LeaveIfError(anim5.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
1371 CleanupClosePushL(anim5);
1372 User::LeaveIfError(anim6.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
1373 CleanupStack::Pop(&anim5);
1374 CleanupStack::PopAndDestroy(&anim4);
1377 User::LeaveIfError(anim4.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
1378 CleanupStack::PopAndDestroy(&anim3);
1380 User::LeaveIfError(anim3.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
1381 CleanupStack::PopAndDestroy(&anim2);
1383 User::LeaveIfError(anim2.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
1384 CleanupStack::PopAndDestroy(&anim1);
1389 @SYMTestCaseID GRAPHICS-WSERV-0136
1393 @SYMTestCaseDesc Click plugin DLL test
1395 @SYMTestPriority High
1397 @SYMTestStatus Implemented
1399 @SYMTestActions Created two handles for a click plugin dll (RSoundPlugIn instances).
1400 Plays with Load(), Unload() methods to verify that they affect
1401 IsLoaded() call result.
1402 Checks that CommandReply() for different opcodes
1403 returns RSoundPlugIn::ESoundWrongPlugIn value.
1404 Plays with SetPenClick(), SetKeyClick() to verify that they affect
1405 PenClickEnabled() and KeyClickEnabled() call result.
1408 @SYMTestExpectedResults The test checks that RSoundPlugIn's methods work properly
1409 and that both handles behave identically.
1411 void CTAnimDll::ClickPlugInL()
1413 _LIT(KDllName,"CLICK");
1415 User::LeaveIfError(ws.Connect());
1416 CleanupClosePushL(ws);
1420 // assign to the correct screen
1421 CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
1422 CleanupStack::PushL(screen);
1423 User::LeaveIfError(screen->Construct(iTest->iScreenNumber));
1425 RSoundPlugIn click1(ws);
1426 RSoundPlugIn click2(TheClient->iWs);
1427 User::LeaveIfError(click1.Construct());
1428 CleanupClosePushL(click1);
1429 User::LeaveIfError(click2.Construct());
1430 CleanupClosePushL(click2);
1433 TBool loaded=click1.IsLoaded(changeable1);
1434 //test that either both are loaded or both are not loaded
1435 TEST(!loaded==!click2.IsLoaded(changeable2));
1436 if (!loaded!=!click2.IsLoaded(changeable2))
1437 INFO_PRINTF3(_L("!loaded==!click2.IsLoaded(changeable2) - Expected: %d , Actual: %d"), !loaded, !click2.IsLoaded(changeable2));
1439 //test that either both are changeable or both are not changeable
1440 TEST(!changeable1==!changeable2);
1441 if (!changeable1!=!changeable2)
1442 INFO_PRINTF3(_L("!changeable1==!changeable2) - Expected: %d , Actual: %d"), !changeable1, !changeable2);
1444 if (loaded && changeable1)
1446 // unload the first one
1447 User::LeaveIfError(click1.Unload());
1448 // check that the second is not loaded and still changeable
1449 retBool = !click2.IsLoaded(changeable2);
1452 INFO_PRINTF3(_L("!click2.IsLoaded(changeable2) return value - Expected: %d , Actual: %d"), ETrue, retBool);
1456 INFO_PRINTF3(_L("changeable2 - Expected: %d , Actual: %d"), ETrue, changeable2);
1459 // load the first one and check that the second became loaded and is changeable
1460 User::LeaveIfError(click1.Load(KDllName));
1461 retBool = click2.IsLoaded(changeable2);
1464 INFO_PRINTF3(_L("click2.IsLoaded(changeable2) return value - Expected: %d , Actual: %d"), ETrue, retBool);
1468 INFO_PRINTF3(_L("changeable2 - Expected: %d , Actual: %d"), ETrue, changeable2);
1470 // unload the second one
1471 User::LeaveIfError(click2.Unload());
1472 // check that the first is not loaded and still changeable
1473 retBool = !click1.IsLoaded(changeable1);
1476 INFO_PRINTF3(_L("!click1.IsLoaded(changeable1) return value - Expected: %d , Actual: %d"), ETrue, retBool);
1480 INFO_PRINTF3(_L("changeable1 - Expected: %d , Actual: %d"), ETrue, changeable1);
1482 // load the second one and check that the first one became loaded and is changeable
1483 User::LeaveIfError(click2.Load(KDllName));
1484 loaded=click1.IsLoaded(changeable1);
1487 INFO_PRINTF3(_L("loaded - Expected: %d , Actual: %d"), ETrue, loaded);
1491 INFO_PRINTF3(_L("changeable1 - Expected: %d , Actual: %d"), ETrue, changeable1);
1496 retVal = click1.CommandReply(0,des);
1497 TEST(RSoundPlugIn::ESoundWrongPlugIn==retVal);
1498 if (RSoundPlugIn::ESoundWrongPlugIn!=retVal)
1499 INFO_PRINTF3(_L("click1.CommandReply(0,des) return value - Expected: %d , Actual: %d"), RSoundPlugIn::ESoundWrongPlugIn, retVal);
1501 retVal = click1.CommandReply(1,des);
1502 TEST(RSoundPlugIn::ESoundWrongPlugIn==retVal);
1503 if (RSoundPlugIn::ESoundWrongPlugIn!=retVal)
1504 INFO_PRINTF3(_L("click1.CommandReply(1,des) return value - Expected: %d , Actual: %d"), RSoundPlugIn::ESoundWrongPlugIn, retVal);
1506 retVal = click1.CommandReply(2,des);
1507 TEST(RSoundPlugIn::ESoundWrongPlugIn==retVal);
1508 if (RSoundPlugIn::ESoundWrongPlugIn!=retVal)
1509 INFO_PRINTF3(_L("click1.CommandReply(2,des) return value - Expected: %d , Actual: %d"), RSoundPlugIn::ESoundWrongPlugIn, retVal);
1511 retVal = click1.CommandReply(-1,des);
1512 TEST(RSoundPlugIn::ESoundWrongPlugIn==retVal);
1513 if (RSoundPlugIn::ESoundWrongPlugIn!=retVal)
1514 INFO_PRINTF3(_L("click1.CommandReply(-1,des) return value - Expected: %d , Actual: %d"), RSoundPlugIn::ESoundWrongPlugIn, retVal);
1516 retBool = click1.KeyClickEnabled();
1519 INFO_PRINTF3(_L("click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool);
1521 retBool = click1.PenClickEnabled();
1524 INFO_PRINTF3(_L("click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool);
1526 click1.SetPenClick(EFalse);
1527 retBool = click1.KeyClickEnabled();
1530 INFO_PRINTF3(_L("click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool);
1532 retBool = !click1.PenClickEnabled();
1535 INFO_PRINTF3(_L("!click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool);
1537 click1.SetKeyClick(EFalse);
1539 retBool = !click1.KeyClickEnabled();
1542 INFO_PRINTF3(_L("!click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool);
1544 retBool = !click1.PenClickEnabled();
1547 INFO_PRINTF3(_L("!click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool);
1549 click1.SetPenClick(ETrue);
1550 retBool = !click1.KeyClickEnabled();
1553 INFO_PRINTF3(_L("!click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool);
1555 retBool = click1.PenClickEnabled();
1558 INFO_PRINTF3(_L("click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool);
1560 click1.SetKeyClick(ETrue);
1561 retBool = click1.KeyClickEnabled();
1564 INFO_PRINTF3(_L("click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool);
1566 retBool = click1.PenClickEnabled();
1569 INFO_PRINTF3(_L("click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue, retBool);
1572 TInt err=lib.Load(KDllName);
1576 TEST(lib.Type()[2].iUid==click1.CommandReply(0,des));
1580 CleanupStack::PopAndDestroy(4,&ws);
1583 void CTAnimDll::TestWindowInfo(RTestAnim& aAnim,TInt aScreen,TInt aPos,TInt aId)
1585 TPckgBuf<TWindowGroupInfoParms> params;
1586 params().iScreen=aScreen;
1587 params().iOrdinalPosition=aPos;
1588 TPckgBuf<MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo> winGpInfo;
1590 ipcArgs.Set(KIpcSlot,&winGpInfo);
1591 TBool retBool = aAnim.CommandReply(EADllWindowGroupInfo,params,ipcArgs);
1594 INFO_PRINTF3(_L("aAnim.CommandReply(EADllWindowGroupInfo,params,ipcArgs) return value - Expected: %d , Actual: %d"), ETrue, retBool);
1596 MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo& info=winGpInfo();
1597 TEST(info.iId==aId);
1599 INFO_PRINTF3(_L("winGpInfo() return value - Expected: %d , Actual: %d"), aId, info.iId);
1601 TInt retVal = TheClient->iWs.GetWindowGroupOrdinalPriority(aId);
1602 TEST(info.iOrdinalPriority==retVal);
1603 if (info.iOrdinalPriority!=retVal)
1604 INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupOrdinalPriority(aId) return value - Expected: %d , Actual: %d"), info.iOrdinalPriority, retVal);
1606 TBuf<64> windowGroupNameS;
1607 TBuf<64> windowGroupNameA;
1608 TheClient->iWs.GetWindowGroupNameFromIdentifier(aId,windowGroupNameS);
1609 retVal = windowGroupNameS.Length();
1610 TEST(info.iNameLength==retVal);
1611 if (info.iNameLength!=retVal)
1612 INFO_PRINTF3(_L("windowGroupNameS.Length() return value - Expected: %d , Actual: %d"), info.iNameLength, retVal);
1614 if (info.iNameLength<64)
1616 ipcArgs.Set(KIpcSlot,&windowGroupNameA);
1617 retBool = aAnim.CommandReply(EADllWindowGroupName,params,ipcArgs);
1620 INFO_PRINTF3(_L("aAnim.CommandReply(EADllWindowGroupName,params,ipcArgs) return value - Expected: %d , Actual: %d"), ETrue, retBool);
1622 if (info.iNameLength>0)
1624 TEST(windowGroupNameA==windowGroupNameS);
1628 TEST(windowGroupNameA.Length()==0);
1629 if (windowGroupNameA.Length()!=0)
1630 INFO_PRINTF3(_L("iwindowGroupNameA.Length()==0 - Expected: %d, Actual: %d"), 0, windowGroupNameA.Length());
1634 TEST(info.iParentId>=-1);
1635 if (info.iParentId<-1)
1636 INFO_PRINTF3(_L("info.iParentId>=-1 - Expected: %d or greater, Actual: %d"), -1, info.iParentId);
1640 void CTAnimDll::TestEventHandlerRemovalL()
1642 RTestAnim anim(iAnimDll);
1643 User::LeaveIfError(anim.Construct(*iRedrawWin->BaseWin(),EAnimTypeEventHandler,KNullDesC8));
1648 @SYMTestCaseID GRAPHICS-WSERV-0137
1652 @SYMTestCaseDesc Animation's extended window functions test
1654 @SYMTestPriority High
1656 @SYMTestStatus Implemented
1658 @SYMTestActions The test creates a window animation that has a couple of
1659 commands that work with extended window functions encapsulated
1660 into MAnimGeneralFunctionsWindowExtension class instance.
1661 The test calls those commands to compare MAnimGeneralFunctionsWindowExtension's
1662 methods' results with the results retuned by WSERV client classes.
1663 MAnimGeneralFunctionsWindowExtension methods tested here:
1664 Screens(), FocusScreens(), WindowGroups(), WindowGroupInfo(),
1667 @SYMTestExpectedResults MAnimGeneralFunctionsWindowExtension methods must give the same results as
1668 the corresponding WSERV client methods would.
1670 void CTAnimDll::WinFunctionsL()
1672 RTestAnim anim(iAnimDll);
1673 User::LeaveIfError(anim.Construct(*iRedrawWin->BaseWin(),EAnimTypeWindowFunctions,KNullDesC8));
1674 CleanupClosePushL(anim);
1675 TInt screens=anim.CommandReply(EADllScreen);
1678 INFO_PRINTF3(_L("anim.CommandReply(EADllScreen) return value - Expected: %d or greater, Actual: %d"), 1, screens);
1680 TInt focusScreen=anim.CommandReply(EADllFocusScreen);
1681 TInt retVal = TheClient->iWs.GetFocusScreen();
1682 TEST(focusScreen==retVal && focusScreen<=screens);
1683 if (focusScreen!=retVal || focusScreen>screens)
1684 INFO_PRINTF4(_L("anim.CommandReply(EADllFocusScreen) return value - Expected: %d and less than or equal to %d, Actual: %d"), retVal, screens, focusScreen);
1687 TPckgBuf<TInt> screen;
1688 CArrayPtrFlat<CMinWin>* wins=new(ELeave) CArrayPtrFlat<CMinWin>(screens);
1689 CleanupStack::PushL(wins);
1690 // create one window on each screen
1691 for(ii=0;ii<screens;++ii)
1693 CMinWin* win=new(ELeave) CMinWin(ii);
1694 CleanupStack::PushL(win);
1700 for (ii=screens-1;ii>=0;--ii)
1702 TheClient->iWs.SetFocusScreen(ii);
1703 retVal = anim.CommandReply(EADllFocusScreen);
1706 INFO_PRINTF3(_L("anim.CommandReply(EADllFocusScreen) return value - Expected: %d, Actual: %d"), ii, retVal);
1708 for (ii=screens-1;ii>=0;--ii)
1711 anim.CommandReply(EADllSetFocusScreen,screen);
1712 retVal = anim.CommandReply(EADllFocusScreen);
1715 INFO_PRINTF3(_L("anim.CommandReply(EADllFocusScreen) return value - Expected: %d, Actual: %d"), ii, retVal);
1718 TheClient->iWs.SetFocusScreen(focusScreen);
1719 retVal = anim.CommandReply(EADllFocusScreen);
1720 TEST(retVal==focusScreen);
1721 if (retVal!=focusScreen)
1722 INFO_PRINTF3(_L("anim.CommandReply(EADllFocusScreen) return value - Expected: %d, Actual: %d"), focusScreen, retVal);
1724 TInt winGroupsAll=0;
1725 for(ii=0;ii<screens;++ii)
1728 winGroupsAll+=anim.CommandReply(EADllWindowGroups,screen);
1730 TInt winGroupsS=TheClient->iWs.NumWindowGroups();
1731 TEST(winGroupsAll==winGroupsS);
1732 if (winGroupsAll!=winGroupsS)
1733 INFO_PRINTF3(_L("TheClient->iWs.NumWindowGroups() return value - Expected: %d, Actual: %d"), winGroupsS, winGroupsAll);
1735 // the remaining test will use winGroupsA and performed on current focus screen only
1736 screen()=iTest->iScreenNumber;
1737 TInt winGroupsA=anim.CommandReply(EADllWindowGroups,screen);
1738 CArrayFixFlat<TInt>* windowList=new(ELeave) CArrayFixFlat<TInt>(3);
1739 CleanupStack::PushL(windowList);
1740 // wserv implementation returns window groups from current focus screen, followed by the rest
1741 TheClient->iWs.WindowGroupList(windowList);
1742 // only interested in window group from current focus screen
1743 for (ii=0;ii<winGroupsA;++ii)
1744 TestWindowInfo(anim,iTest->iScreenNumber,ii,(*windowList)[ii]);
1745 TPckgBuf<MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo> winGpInfo;
1747 TPckgBuf<TWindowGroupInfoParms> params;
1748 params().iScreen=iTest->iScreenNumber;
1749 params().iOrdinalPosition=winGroupsA;
1750 ipcArgs.Set(KIpcSlot,&winGpInfo);
1751 TBuf<64> windowGroupName;
1752 TBool retBool = !anim.CommandReply(EADllWindowGroupInfo,params,ipcArgs);
1755 INFO_PRINTF3(_L("!anim.CommandReply(EADllWindowGroupInfo,params,ipcArgs) return value - Expected: %d, Actual: %d"), ETrue, retBool);
1757 ipcArgs.Set(KIpcSlot,&windowGroupName);
1758 retBool = !anim.CommandReply(EADllWindowGroupName,params,ipcArgs);
1761 INFO_PRINTF3(_L("!anim.CommandReply(EADllWindowGroupName,params,ipcArgs) return value - Expected: %d, Actual: %d"), ETrue, retBool);
1763 /*params().iOrdinalPosition=-1; //Behaviour for negative positions not defined - but as writtin this code will pass
1764 ipcArgs.Set(KIpcSlot,&winGpInfo);
1765 TEST(anim.CommandReply(EADllWindowGroupInfo,params,ipcArgs));
1766 ipcArgs.Set(KIpcSlot,&windowGroupNameA);
1767 TEST(anim.CommandReply(EADllWindowGroupName,params,ipcArgs));*/
1768 RWindowGroup group(TheClient->iWs);
1769 User::LeaveIfError(group.Construct(ENullWsHandle));
1770 CleanupClosePushL(group);
1771 _LIT(KGroupName,"Testxyz1234");
1772 group.SetName(KGroupName);
1773 group.SetOrdinalPosition(0,TheClient->iWs.GetWindowGroupOrdinalPriority((*windowList)[0])+1);
1774 TInt groupId=group.Identifier();
1775 TestWindowInfo(anim,iTest->iScreenNumber,0,groupId);
1776 group.SetOrdinalPosition(0,TheClient->iWs.GetWindowGroupOrdinalPriority((*windowList)[winGroupsA-1])-1);
1777 TestWindowInfo(anim,iTest->iScreenNumber,winGroupsA,groupId);
1778 CleanupStack::PopAndDestroy(screens+4,&anim);
1779 // Restore us back to the front
1780 TheClient->iGroup->GroupWin()->SetOrdinalPosition(0);
1784 @SYMTestCaseID GRAPHICS-WSERV-0138
1788 @SYMTestCaseDesc Animation's extended window functions test 2
1790 @SYMTestPriority High
1792 @SYMTestStatus Implemented
1794 @SYMTestActions The test creates a window animation that has a command
1795 for setting window's ordinal position and priority.
1796 The test creates 4 window groups with the same priority and
1797 checks that they have correct ordinal positions after the creation.
1798 After that the test plays with updating ordinal positions and
1799 priorities of the window groups using the animation's command.
1801 @SYMTestExpectedResults The test checks that the command was executed with no errors
1802 and affected ordinal positions of the window groups properly.
1804 void CTAnimDll::WinFunctions2L()
1806 RTestAnim anim(iAnimDll);
1807 User::LeaveIfError(anim.Construct(*iRedrawWin->BaseWin(),EAnimTypeWindowFunctions,KNullDesC8));
1808 CleanupClosePushL(anim);
1809 CArrayFixFlat<TInt>* windowList=new(ELeave) CArrayFixFlat<TInt>(3);
1810 TheClient->iWs.WindowGroupList(windowList);
1811 TInt priority=TheClient->iWs.GetWindowGroupOrdinalPriority((*windowList)[0])+2;
1813 RWindowGroup group1(TheClient->iWs);
1814 User::LeaveIfError(group1.Construct(ENullWsHandle));
1815 CleanupClosePushL(group1);
1816 group1.SetOrdinalPosition(0,priority);
1817 RWindowGroup group2(TheClient->iWs);
1818 User::LeaveIfError(group2.Construct(ENullWsHandle));
1819 CleanupClosePushL(group2);
1820 group2.SetOrdinalPosition(0,priority);
1821 RWindowGroup group3(TheClient->iWs);
1822 User::LeaveIfError(group3.Construct(ENullWsHandle));
1823 CleanupClosePushL(group3);
1824 group3.SetOrdinalPosition(0,priority);
1825 RWindowGroup group4(TheClient->iWs);
1826 User::LeaveIfError(group4.Construct(ENullWsHandle));
1827 CleanupClosePushL(group4);
1828 group4.SetOrdinalPosition(0,priority);
1830 TInt retVal = group1.OrdinalPosition();
1833 INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal);
1835 retVal = group2.OrdinalPosition();
1838 INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
1840 retVal = group3.OrdinalPosition();
1843 INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
1845 retVal = group4.OrdinalPosition();
1848 INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
1850 TPckgBuf<TSetOrdinalParms> params;
1851 params().iIdentifier=group4.Identifier();
1852 params().iOrdinalPriority=priority;
1853 params().iOrdinalPosition=1;
1854 retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
1855 TEST(retVal==KErrNone);
1856 if (retVal!=KErrNone)
1857 INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1859 retVal = group3.OrdinalPosition();
1862 INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
1864 retVal = group4.OrdinalPosition();
1867 INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
1869 params().iOrdinalPosition=2;
1870 retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
1871 TEST(retVal==KErrNone);
1872 if (retVal!=KErrNone)
1873 INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1875 retVal = group2.OrdinalPosition();
1878 INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
1880 retVal = group4.OrdinalPosition();
1883 INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
1885 params().iOrdinalPosition=3;
1886 retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
1887 TEST(retVal==KErrNone);
1888 if (retVal!=KErrNone)
1889 INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1891 retVal = group1.OrdinalPosition();
1894 INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
1896 retVal = group2.OrdinalPosition();
1899 INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
1901 retVal = group3.OrdinalPosition();
1904 INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
1906 retVal = group4.OrdinalPosition();
1909 INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal);
1911 params().iOrdinalPriority=priority+1;
1912 params().iOrdinalPosition=3;
1913 retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
1914 TEST(retVal==KErrNone);
1915 if (retVal!=KErrNone)
1916 INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1918 retVal = group4.OrdinalPosition();
1921 INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
1923 params().iOrdinalPriority=priority;
1924 params().iOrdinalPosition=-2;
1925 retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
1926 TEST(retVal==KErrNone);
1927 if (retVal!=KErrNone)
1928 INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1930 retVal = group4.OrdinalPosition();
1933 INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal);
1935 params().iOrdinalPosition=0;
1936 retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
1937 TEST(retVal==KErrNone);
1938 if (retVal!=KErrNone)
1939 INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1941 retVal = group1.OrdinalPosition();
1944 INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal);
1946 retVal = group2.OrdinalPosition();
1949 INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
1951 retVal = group3.OrdinalPosition();
1954 INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
1956 retVal = group4.OrdinalPosition();
1959 INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
1961 params().iOrdinalPriority=priority-1;
1962 params().iOrdinalPosition=2;
1963 retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
1964 TEST(retVal==KErrNone);
1965 if (retVal!=KErrNone)
1966 INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1968 retVal = group1.OrdinalPosition();
1971 INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
1973 retVal = group2.OrdinalPosition();
1976 INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
1978 retVal = group3.OrdinalPosition();
1981 INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
1983 retVal = group4.OrdinalPosition();
1986 INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
1989 params().iOrdinalPriority=priority;
1990 params().iOrdinalPosition=0;
1991 retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
1992 TEST(retVal==KErrNone);
1993 if (retVal!=KErrNone)
1994 INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1996 retVal = group1.OrdinalPosition();
1999 INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal);
2001 retVal = group2.OrdinalPosition();
2004 INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
2006 retVal = group3.OrdinalPosition();
2009 INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
2011 retVal = group4.OrdinalPosition();
2014 INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
2016 CleanupStack::PopAndDestroy(5,&anim);
2017 /*TInt pos1=group1.OrdinalPosition();
2018 TInt pos2=group2.OrdinalPosition();
2019 TInt pos3=group3.OrdinalPosition();
2020 TInt pos4=group4.OrdinalPosition();*/
2025 @SYMTestCaseID GRAPHICS-WSERV-0139
2027 @SYMDEF DEF081259, DEF122220
2029 @SYMTestCaseDesc Animation's notifications test
2031 @SYMTestPriority High
2033 @SYMTestStatus Implemented
2035 @SYMTestActions The test works with two screens. An animation is created that keeps
2036 track on all notifications about EDirectScreenAccess, EHeartbeatTimer,
2037 EScreenDeviceChange events.
2038 The test generates those events by performing operations on direct
2039 screen access and simulating TRawEvent::EInactive and TRawEvent::EAactive
2042 @SYMTestExpectedResults The test checks that the animation didn't miss any of EDirectScreenAccess
2043 or EHeartbeatTimer notifications. (The test doesn't check EScreenDeviceChange
2044 notifications however).
2045 The test also makes sure that the animation didn't animate
2046 during inactive state.
2047 For DEF12220, the test will crash when a untidied notifier from a previous RTestAnim object
2048 is accessed if the fix is not present. If the fix is present, the test should not crash.
2050 void CTAnimDll::TestNotificationsL()
2052 RTestAnim anim(iAnimDll);
2053 User::LeaveIfError(anim.Construct(*iRedrawWin->BaseWin(),EAnimTypeNotificationTest,KNullDesC8));
2054 CleanupClosePushL(anim);
2056 TPckgBuf<TInt> screenNum;
2058 // initial state - test that we have no DSA on either screen
2060 TInt dsa=anim.CommandReply(EADllQueryDSA, screenNum);
2063 INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
2066 dsa=anim.CommandReply(EADllQueryDSA, screenNum);
2069 INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
2071 // create first DSA, but don't start it - test that we have no DSA on either screen
2072 CScrollText* dsa1 = CScrollText::NewL(iTest->iScreenNumber,1,*TheClient->iGroup,5,EFalse);
2073 CleanupStack::PushL(dsa1);
2075 dsa=anim.CommandReply(EADllQueryDSA, screenNum);
2078 INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
2081 dsa=anim.CommandReply(EADllQueryDSA, screenNum);
2084 INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
2086 // start first DSA - test that we have DSA on this screen but not other screen
2089 dsa=anim.CommandReply(EADllQueryDSA, screenNum);
2090 TInt retVal = (screenNum() == iTest->iScreenNumber);
2091 TEST(dsa == retVal);
2093 INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
2096 dsa=anim.CommandReply(EADllQueryDSA, screenNum);
2097 retVal = (screenNum() == iTest->iScreenNumber);
2098 TEST(dsa == retVal);
2100 INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
2103 CScrollText* dsa2 = CScrollText::NewL(iTest->iScreenNumber,2,*TheClient->iGroup,5,EFalse);
2104 CleanupStack::PushL(dsa2);
2107 dsa=anim.CommandReply(EADllQueryDSA, screenNum);
2108 retVal = (screenNum() == iTest->iScreenNumber);
2109 TEST(dsa == retVal);
2111 INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
2114 dsa=anim.CommandReply(EADllQueryDSA, screenNum);
2115 retVal = (screenNum() == iTest->iScreenNumber);
2116 TEST(dsa == retVal);
2118 INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
2122 CleanupStack::PopAndDestroy(dsa2);
2124 dsa=anim.CommandReply(EADllQueryDSA, screenNum);
2125 retVal = (screenNum() == iTest->iScreenNumber);
2126 TEST(dsa == retVal);
2128 INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
2131 dsa=anim.CommandReply(EADllQueryDSA, screenNum);
2132 retVal = (screenNum() == iTest->iScreenNumber);
2133 TEST(dsa == retVal);
2135 INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
2139 CleanupStack::PopAndDestroy(dsa1);
2141 dsa=anim.CommandReply(EADllQueryDSA, screenNum);
2144 INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
2147 dsa=anim.CommandReply(EADllQueryDSA, screenNum);
2150 INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
2152 // TEST heartbeat timer start\stop notifications - no longer relevant - has been removed
2154 CleanupStack::PopAndDestroy(&anim);
2156 // Create second RTestAnim for DEF12220 test
2157 RTestAnim anim2(iAnimDll);
2158 User::LeaveIfError(anim2.Construct(*iRedrawWin->BaseWin(),EAnimTypeNotificationTest,KNullDesC8));
2159 CleanupClosePushL(anim2);
2162 CScrollText* dsa3 = CScrollText::NewL(iTest->iScreenNumber,1,*TheClient->iGroup,5,EFalse);
2163 CleanupStack::PushL(dsa3);
2164 // If the fix for DEF12220 is not present, starting dsa3 will cause a crash.
2167 CleanupStack::PopAndDestroy(dsa3);
2168 CleanupStack::PopAndDestroy(&anim2);
2172 A minimal dsa call to a window with a child window, for running coverage on
2173 ClipWindows member funcion.
2175 @SYMTestCaseID GRAPHICS-WSERV-0410
2179 @SYMTestExpectedResults Nothing visible, the CWsClientWindow::ClipWindows
2180 should be partially covered.
2182 void CTAnimDll::TestCoverageL()
2184 // create first DSA, but don't start it - test that we have no DSA on either screen
2185 CWindowWithChild* dsa1 = CWindowWithChild::NewL(iTest->iScreenNumber, *TheClient->iGroup, EFalse);
2186 CleanupStack::PushL(dsa1);
2188 // start first DSA - test that we have DSA on this screen but not other screen
2190 dsa1->PerformCoverageCalls();
2193 // cover another trivial case for a non-visible window
2194 RWindow* cwin = dsa1->ChildWindow();
2196 cwin->SetTransparencyAlphaChannel();
2199 //ClipWindows with visible and invisible branches
2200 cwin->SetVisible(EFalse);
2202 //cover CWsWindow::StatusDump (visible and invisible branch)
2203 TheClient->iWs.LogCommand(RWsSession::ELoggingStatusDump);
2207 cwin->SetVisible(ETrue);
2210 CleanupStack::PopAndDestroy(dsa1);
2214 Executes a Panic coverage test for a given test-number.
2215 Most of the first lines copied from DoPanicTest.
2216 CWsWindow is tested through CommandL (case 0-3) and other API funcs
2218 LOCAL_C TInt DoPanicTestCoverage(TInt aTestNum, TAny *aScreenNumber)
2221 User::LeaveIfError(ws.Connect());
2223 // assign to the correct screen
2224 CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
2225 User::LeaveIfError(screen->Construct(reinterpret_cast<TInt>(aScreenNumber)));
2227 RWindowGroup group(ws);
2228 User::LeaveIfError(group.Construct(333));
2229 group.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close
2230 RAnimDll animDll=RAnimDll(ws);
2231 User::LeaveIfError(animDll.Load(KAnimDLLName));
2234 User::LeaveIfError(window.Construct(group,123));
2235 window.SetSize(TSize(10,10));
2237 window.BeginRedraw();
2242 case 0: //non translucent window
2243 //EWsWinOpSetTransparentRegion -> EWservPanicTransparencyObjNotCreated
2246 window.SetTransparentRegion(r);
2250 //EWsWinOpSetTransparencyPolicy -> EWservPanicTransparencyObjNotCreated
2251 window.SetTransparencyPolicy(ETransparencyDefault);
2254 // -> EWservPanicWindowActive
2258 // -> EWservPanicCornerParams
2259 window.SetCornerType(EWindowCornerSquare, ECornerTypeMask);
2262 // -> EWservPanicCornerParams
2263 window.SetCornerType(ECornerTypeMask, 0);
2266 return EWsExitReasonFinished;
2270 return(EWsExitReasonBad); // Should never get here, but it's baaddd if it does
2274 @SYMTestCaseID GRAPHICS-WSERV-0411
2278 @SYMTestCaseDesc Does functional coverage for code that Panics
2281 void CTAnimDll::TestPanicCoverageL()
2283 TClientPanic expectedPanicCode[] =
2285 EWservPanicTransparencyObjNotCreated, //0
2286 EWservPanicTransparencyObjNotCreated, //1
2287 EWservPanicWindowActive, //2
2288 EWservPanicCornerParams, //3
2289 EWservPanicCornerParams, //4
2291 for (TInt i=0; i<sizeof(expectedPanicCode)/sizeof(TClientPanic); i++)
2293 TEST(iTest->TestWsPanicL(
2294 DoPanicTestCoverage, //aFunction
2295 expectedPanicCode[i], //aExitReason
2297 (TAny*)iTest->iScreenNumber, //aPtr
2298 NULL)); //&finishTests //aTestFinished
2299 iTest->CloseAllPanicWindows();
2305 @SYMTestCaseID GRAPHICS-CODEBASE-WSERV-0056-0001
2309 @SYMTestCaseDesc Tests RAnimDll::Load (by passing invalid file name)
2313 @SYMTestStatus Implemented
2315 @SYMTestActions Call RAnimDll::Load() by passing invalid file name\n
2317 @SYMTestExpectedResults Should return with appropiate error message. KErrNotFound
2319 void CTAnimDll::TestLoadApiL()
2321 RAnimDll* animDll=new(ELeave) RAnimDll(TheClient->iWs);
2322 CleanupStack::PushL(animDll);
2324 _LIT(KAnimFile,"Nothing.dll");
2326 ret=animDll->Load(KAnimFile);
2327 TEST(ret==KErrNotFound);
2328 ret=animDll->Load(KEmpty);
2329 TEST(ret==KErrNotFound);
2330 CleanupStack::PopAndDestroy(animDll);
2333 TInt CTAnimDll::CheckError(TInt aError,TInt aExpected)
2339 _LIT(KLog,"The event at position %d did not match, total number of events=%d");
2340 LOG_MESSAGE3(KLog,aError,aExpected);
2344 _LIT(KLog,"Only recieved %d events, expecting %d events");
2345 LOG_MESSAGE3(KLog,-aError,aExpected);
2353 @SYMTestCaseID GRAPHICS-WSERV-0448
2357 @SYMTestCaseDesc Test events get to Anims at a higher priorty than commands
2359 @SYMTestPriority High
2361 @SYMTestStatus Implemented
2363 @SYMTestActions Create a 2nd thread that sends events via kernal, send also commands from client to an Anim
2365 @SYMTestExpectedResults Check that events intersperse commands from client
2367 void CTAnimDll::KeyClickPriorityL()
2369 _LIT(KFailedAdd,"Device Driver Failed to Add an Event, error=%d");
2370 REventAnim* anim=REventAnim::NewL(iTestWin->BaseWin(),&iAnimDll);
2371 TPckgBuf<TInt> events;
2372 TInt err=anim->CommandReply(EADllLoadDeviceDriver);
2375 _LIT(KLog,"Failed to load Device Driver for sending Events");
2381 for (ii=1;ii<5;++ii)
2384 error=anim->CommandReply(EADllSendEvent,events);
2385 if (error!=KErrNone)
2386 LOG_MESSAGE2(KFailedAdd,error);
2387 anim->Command(EADllAfterEvent);
2389 error=anim->TestFail(ii);
2390 TEST(CheckError(error,ii));
2392 const TInt iterations=15;
2393 const TInt eventsPerIteration=2;
2394 const TInt totalEvents=iterations*eventsPerIteration;
2395 events()=eventsPerIteration;
2396 for (ii=iterations;ii>0;--ii)
2398 error=anim->CommandReply(EADllSendEvent,events);
2399 if (error!=KErrNone)
2400 LOG_MESSAGE2(KFailedAdd,error);
2401 anim->Command(EADllAfterEvent);
2404 error=anim->TestFail(totalEvents);
2405 TEST(CheckError(error,totalEvents));
2406 anim->CommandReply(EADllUnloadDeviceDriver);
2413 @SYMTestCaseDesc Tests Window Rect returned by CWsAnim::Parameters
2415 @SYMTestPriority High
2417 @SYMTestStatus Implemented
2419 @SYMTestActions This test creates a new window which overlaps the screen edge
2420 and creates an animation on this window. An additional
2421 CommandReplyL() option has been added to the AnimDLL to compare
2422 the expected value of this rect with the actual value.
2425 @SYMTestExpectedResults The result of the EADllTestParameterRect CommandReplyL call will equal ETrue
2426 if the passed Rect matches, EFalse otherwise.
2428 void CTAnimDll::ParameterValueTestL()
2430 //Window Location & Dimension
2431 TPoint winOrigin(-1,15);
2432 TSize winSize(250,65);
2434 //Create a new window to perform the test; window needs to overlap the left edge of the screen.
2435 CAnimWindow* paramTestWin = new(ELeave) CAnimWindow(EFalse, CAnimWindow::ERedraw);
2436 CleanupStack::PushL(paramTestWin);
2437 paramTestWin->ConstructL(winOrigin, winSize);
2439 RTestAnim anim = RTestAnim(iAnimDll);
2441 TPckgBuf<TRect> rectPckg;
2442 TRect winRect(winOrigin, winSize);
2443 rectPckg() = winRect;
2445 anim.Construct(*(paramTestWin->BaseWin()), EAnimTypeTest3, rectPckg);
2446 anim.Command(EADllStartAnimate, rectPckg);
2448 TPckgBuf<TBool> boolPckg;
2450 anim.Command(EADllSetVisible, boolPckg);
2452 TEST(anim.CommandReply(EADllParameterRectValueTest, rectPckg));
2454 boolPckg() = EFalse;
2455 anim.Command(EADllSetVisible, boolPckg);
2456 anim.Command(EADllCancelAnimate);
2458 CleanupStack::PopAndDestroy(paramTestWin);
2464 @SYMTestCaseDesc Test the operation of SetInterval with both negative and positive intervals
2466 @SYMTestPriority High
2468 @SYMTestStatus Implemented
2470 @SYMTestActions This test uses the test anim CAutoAnim3 in mode 3 which alternates
2471 between drawing a large and a small ellipse at each interval.
2472 The large ellipse is drawn first.
2473 Note that the anims are redrawn at the rate of 2 intervals per second, so
2474 setting an interval of 2 will mean that the anim is redrawn every second.
2475 Step 1: The interval is set to be -2 and the test then waits for 0.9
2476 seconds (to make sure one interval has passed) then checks that
2477 only the large ellipse has been drawn.
2478 Step 2: The interval is set to be 2 (redraw every second) and the test then
2479 waits for 1.2 seconds (to make sure two intervals have passed) and
2480 checks that the small ellipse has been drawn.
2482 @SYMTestExpectedResults
2483 After Step 1 a large ellipse will be drawn on both windows.
2484 After Step 1 a small ellipse will be drawn on both windows.
2487 void CTAnimDll::TestSetIntervalL()
2490 User::LeaveIfError(ws.Connect());
2492 // draws a little circle on the base window using window graphics and using window animation on the test window.
2493 RTestAnim drawAnim=RTestAnim(iAnimDll);
2495 _LIT(KLog1,"SetInterval Test");
2497 TRect rect(10,10,110,110);
2498 CAnimWindow::SetEllipseDrawMode(CGraphicsContext::EDrawModePEN);
2499 iTestWin->Invalidate();
2500 iTestWin->SetRect(rect);
2501 iBaseWin->Invalidate();
2502 iBaseWin->SetRect(rect);
2503 TPckgBuf<TRect> rectPckg;
2505 User::LeaveIfError(drawAnim.Construct(*iTestWin->BaseWin(),EAnimTypeTest3,rectPckg));
2507 TPckgBuf<TInt> intPckg;
2508 intPckg() = 3; // mode 3 for this anim flips between drawing a large and a small ellipse
2509 drawAnim.Command(EADllSetMode, intPckg);
2511 intPckg() = MAnimGeneralFunctions::ESyncNone;
2512 drawAnim.CommandReply(EADllDoSetSync, intPckg);
2514 // Set an interval of -2 then wait 0.9 seconds, after which only the large ellipse should be visible
2516 drawAnim.CommandReply(EADllSetInterval, intPckg);
2517 // Draw the large ellipse on the base window to match what the anim should be drawing
2518 iBaseWin->SetRect(rect);
2521 // Check Step 1 completed successfully
2522 RedrawAndCheckWindows();
2524 // Set an interval of 2 and wait 0.9 seconds, after which the small ellipse should be visible
2526 drawAnim.CommandReply(EADllSetInterval, intPckg);
2527 // Draw the small ellipse on the base window to match what the anim should be drawing
2528 iBaseWin->SetRect(TRect(40,40,80,80));
2531 // Check Step 2 completed successfully
2532 RedrawAndCheckWindows();
2539 void CTAnimDll::RunTestCaseL(TInt /*aCurTestCase*/)
2541 _LIT(KTest0,"RemoteBuffer");
2542 _LIT(KTest1,"ExtraCopyTest");
2543 _LIT(KTest2,"Misc");
2544 _LIT(KTest3,"SyncMode1");
2545 _LIT(KTest4,"Anim Dll Panics");
2546 _LIT(KTest5,"Drawing test");
2547 _LIT(KTest6,"Shadow drawing test");
2548 _LIT(KTest7,"General drawing test");
2549 _LIT(KTest8,"Destroy window test");
2550 _LIT(KTest9,"Sprite Anim test");
2551 _LIT(KTest10,"Free Timer test");
2552 _LIT(KTest11,"Disable Timer test");
2553 _LIT(KTest12,"Multiple Anims");
2554 _LIT(KTest13,"ReLoad Click PlugIn");
2555 _LIT(KTest14,"Window Functions");
2556 _LIT(KTest15,"Window Functions 2");
2557 _LIT(KTest16,"Notifications");
2558 _LIT(KTest17,"Event Handler removal");
2559 _LIT(KTest18,"Anim dll - Load Api Negative Test");
2560 _LIT(KTest19,"Key Click Priority Test");
2561 _LIT(KTest20,"CWsAnim::Parameters() WindowRect Value Test");
2562 _LIT(KTest21,"SetInterval test");
2563 _LIT(KTest22,"Client Window Coverage");
2564 _LIT(KTest23,"Client Window Panic Coverage");
2565 ((CTAnimDllStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
2567 // if (iTest->iState==0) iTest->iState=22; //Use this line to start running tests from a particular test
2568 switch(++iTest->iState)
2571 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0127"));
2572 iTest->LogSubTest(KTest0);
2576 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0128"));
2577 iTest->LogSubTest(KTest1);
2581 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0126"));
2582 iTest->LogSubTest(KTest2);
2587 @SYMTestCaseID GRAPHICS-WSERV-0503
2589 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0503"));
2590 iTest->LogSubTest(KTest3);
2591 // Disabled temporarily (process isolation/ RThread::RequestComplete issue) to allow WSERV test to continue
2594 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0125"));
2595 iTest->LogSubTest(KTest4);
2597 if (iTest->iScreenNumber == 1)
2598 iTest->CloseAllPanicWindows();
2601 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0129"));
2602 iTest->LogSubTest(KTest5);
2607 @SYMTestCaseID GRAPHICS-WSERV-0504
2609 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0504"));
2610 iTest->LogSubTest(KTest6);
2611 // Disabled temporarily (process isolation/ RThread::RequestComplete issue) to allow WSERV test to continue
2614 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0130"));
2615 iTest->LogSubTest(KTest7);
2616 GeneralDrawingTestL();
2619 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0131"));
2620 iTest->LogSubTest(KTest8);
2621 DestroyWindowTestL();
2624 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0132"));
2625 iTest->LogSubTest(KTest9);
2629 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0133"));
2630 iTest->LogSubTest(KTest10);
2634 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0134"));
2635 iTest->LogSubTest(KTest11);
2639 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0135"));
2640 iTest->LogSubTest(KTest12);
2644 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0136"));
2645 iTest->LogSubTest(KTest13);
2649 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0137"));
2650 iTest->LogSubTest(KTest14);
2654 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0138"));
2655 iTest->LogSubTest(KTest15);
2659 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0139"));
2660 iTest->LogSubTest(KTest16);
2661 TestNotificationsL();
2664 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0137"));
2665 iTest->LogSubTest(KTest17);
2666 TestEventHandlerRemovalL();
2669 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-CODEBASE-WSERV-0056-0001"));
2670 iTest->LogSubTest(KTest18);
2674 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0448"));
2675 iTest->LogSubTest(KTest19);
2676 KeyClickPriorityL();
2680 @SYMTestCaseID GRAPHICS-WSERV-0505
2682 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0505"));
2683 iTest->LogSubTest(KTest20);
2684 ParameterValueTestL();
2688 @SYMTestCaseID GRAPHICS-WSERV-0506
2690 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0506"));
2691 iTest->LogSubTest(KTest21);
2694 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0410"));
2695 iTest->LogSubTest(KTest22);
2699 ((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0411"));
2700 iTest->LogSubTest(KTest23);
2701 TestPanicCoverageL();
2703 ((CTAnimDllStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
2704 ((CTAnimDllStep*)iStep)->CloseTMSGraphicsStep();
2708 ((CTAnimDllStep*)iStep)->RecordTestResultL();
2713 CAnimRedrawWindow::CAnimRedrawWindow(CAnimWindow *aAnimWindow, TBool aIsBase) : CTWin(),
2714 iAnimWindow(aAnimWindow),
2719 CAnimRedrawWindow::~CAnimRedrawWindow()
2723 void CAnimRedrawWindow::Draw()
2725 CAnimWindow::Draw(Gc(),Size(),iIsBase,iAnimWindow->iRect,EFalse);
2730 CAnimWindow::CAnimWindow(TBool aIsBase, TWinType aWinType) : iWinType(aWinType), iIsBase(aIsBase)
2735 CAnimWindow::~CAnimWindow()
2740 void CAnimWindow::ConstructL(const TPoint &aPos, const TSize &aSize)
2745 iCtWin=new(ELeave) CAnimRedrawWindow(this, iIsBase);
2748 iCtWin=new(ELeave) CTBlankWindow();
2751 iCtWin=new(ELeave) CTBackedUpWin(EGray4);
2754 iCtWin->SetUpL(aPos, aSize, TheClient->iGroup, *TheClient->iGc);
2755 if (iWinType==ERedraw)
2757 static_cast<CTWin*>(iCtWin)->Win()->EnableRedrawStore(EFalse);
2761 void CAnimWindow::SetEllipseDrawMode(CGraphicsContext::TDrawMode aEllipseDrawMode)
2763 iEllipseDrawMode=aEllipseDrawMode;
2766 void CAnimWindow::SetRect(const TRect &aRect)
2771 void CAnimWindow::DrawEllipse(CBitmapContext *aGc, const TRect &aRect)
2773 aGc->SetDrawMode(iEllipseDrawMode);
2774 aGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
2775 aGc->SetBrushColor(TRgb(85,85,85));
2776 aGc->SetPenColor(TRgb(170,170,170));
2777 aGc->DrawEllipse(aRect);
2780 void CAnimWindow::Draw(CBitmapContext *aGc, const TSize &aSize, TBool aIsBase, const TRect &aRect, TBool aBlankIt)
2782 aGc->SetBrushColor(TRgb::Gray4(2));
2785 for(TInt i=0;i<aSize.iWidth;i+=10)
2786 aGc->DrawLine(TPoint(i,0),TPoint(i+10,aSize.iHeight));
2788 DrawEllipse(aGc, aRect);
2791 void CAnimWindow::DoDraw(TBool aBlankIt)
2793 __ASSERT_ALWAYS(iWinType!=EBlank,AutoPanic(EAutoPanicWindowType));
2794 iCtWin->Gc()->Activate(*(RDrawableWindow *)BaseWin());
2795 Draw(iCtWin->Gc(),Size(),iIsBase,iRect,aBlankIt);
2796 iCtWin->Gc()->Deactivate();
2799 void CAnimWindow::DoDrawEllipse()
2801 __ASSERT_ALWAYS(iWinType!=EBlank,AutoPanic(EAutoPanicWindowType));
2802 iCtWin->Gc()->Activate(*(RDrawableWindow *)BaseWin());
2803 DrawEllipse(iCtWin->Gc(),iRect);
2804 iCtWin->Gc()->Deactivate();
2807 void CAnimWindow::DoDrawCoverage()
2809 __ASSERT_ALWAYS(iWinType!=EBlank,AutoPanic(EAutoPanicWindowType));
2810 CWindowGc *gc = iCtWin->Gc();
2811 gc->Activate(*(RDrawableWindow *)BaseWin());
2813 gc->SetClippingRect(iRect);
2817 gc->SetDrawMode(CGraphicsContext::EDrawModeAND);
2818 gc->SetBrushStyle(CGraphicsContext::ENullBrush);
2819 gc->SetBrushColor(TRgb::Gray256(85));
2820 gc->SetBrushOrigin(TPoint(0,0));
2821 gc->SetPenColor(TRgb::Gray256(170));
2823 //primitive method calls
2824 gc->SetFaded(ETrue);
2825 gc->SetFadingParameters(1, 1);
2827 gc->SetPenStyle(CGraphicsContext::ESolidPen);
2828 gc->SetStrikethroughStyle(EStrikethroughOff);
2829 gc->SetUnderlineStyle(EUnderlineOff);
2830 gc->SetWordJustification(2, 1);
2833 gc->Device()->GetNearestFontInTwips((CFont*&)font, TFontSpec());
2838 TPoint(iRect.Center().iX, iRect.iTl.iY),
2839 TPoint(iRect.iBr.iX, iRect.Center().iY));
2840 gc->DrawLine(iRect.iTl,iRect.Center());
2841 gc->DrawLineTo(TPoint(iRect.iBr.iX, iRect.iTl.iY));
2843 gc->DrawLineBy(TPoint(iRect.iTl.iX, iRect.iBr.iY));
2844 gc->MoveBy(iRect.iTl + TPoint(1,1));
2845 gc->MoveTo(iRect.iTl + TPoint(0,0));
2846 gc->SetPenSize(TSize(10,10));
2847 gc->Plot(iRect.iTl + TPoint(2,2));
2848 gc->SetPenSize(TSize(1,1));
2850 CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
2851 CleanupStack::PushL(polyPoints);
2852 polyPoints->AppendL(iRect.iTl);
2853 polyPoints->AppendL(iRect.Center());
2854 polyPoints->AppendL(TPoint(iRect.iBr.iX, iRect.iTl.iY));
2856 gc->DrawPolyLine(polyPoints);
2857 gc->DrawPolyLine(&polyPoints->At(0), 3);
2858 gc->DrawPolygon(polyPoints, CGraphicsContext::EWinding);
2859 gc->DrawPolygon(&polyPoints->At(0), 3, CGraphicsContext::EAlternate);
2861 gc->DrawPie(iRect, TPoint(iRect.Center().iX, iRect.iTl.iY), TPoint(iRect.iBr.iX, iRect.Center().iY));
2862 gc->DrawEllipse(iRect);
2863 gc->DrawRect(iRect);
2864 gc->DrawRoundRect(iRect, TSize(iRect.Width()/8, iRect.Height()/8));
2866 CleanupStack::PopAndDestroy(polyPoints);
2868 gc->CopyRect(TPoint(10, 10), iRect);
2870 CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
2871 CleanupStack::PushL(bitmap);
2872 User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
2874 gc->UseBrushPattern(bitmap);
2875 gc->DrawBitmap(iRect.iTl, bitmap);
2876 gc->DrawBitmap(iRect, bitmap);
2877 gc->DrawBitmap(iRect, bitmap, TRect(0, 0, 16, 16));
2878 gc->DrawBitmapMasked(iRect, bitmap, TRect(0, 0, 16, 16), bitmap, ETrue);
2880 gc->BitBlt(TPoint(0, 0), bitmap);
2881 gc->BitBlt(TPoint(0, 0), bitmap, iRect);
2882 gc->BitBltMasked(TPoint(0, 0), bitmap, iRect, bitmap, ETrue);
2883 gc->AlphaBlendBitmaps(TPoint(0, 0), bitmap, iRect, bitmap, TPoint(0,0));
2885 CleanupStack::PopAndDestroy(bitmap);
2887 _LIT(KHelloWorld,"Hello World");
2888 gc->SetCharJustification(1,1);
2889 gc->SetClippingRect(iRect);
2890 gc->DrawText(*&KHelloWorld, iRect.iTl);
2891 gc->DrawText(*&KHelloWorld, iRect, 0, CGraphicsContext::ELeft, 0);
2892 gc->DrawTextVertical(*&KHelloWorld, iRect.iBr, ETrue);
2893 gc->DrawTextVertical(*&KHelloWorld, iRect, 0, ETrue, CGraphicsContext::ELeft, 0);
2896 gc->MapColors(iRect, rgbs, 1, ETrue);
2897 gc->DiscardBrushPattern();
2900 gc->Device()->ReleaseFont(font);
2905 TSize CAnimWindow::Size()
2907 return(iCtWin->Size());
2910 RWindowBase *CAnimWindow::BaseWin() const
2912 return(iCtWin->BaseWin());
2915 CTBaseWin *CAnimWindow::CtBaseWin()
2920 void CAnimWindow::Invalidate()
2922 CTUser::Splat(TheClient,TRect(iCtWin->Position(),iCtWin->Size()),TRgb::Gray256(0));
2925 void CAnimWindow::Invalidate(const TRect &aRect)
2928 rect.Move(iCtWin->Position());
2929 CTUser::Splat(TheClient,rect,TRgb::Gray256(0));
2932 void CAnimWindow::DrawTestScreen(CFbsBitmap *aBitmap, CFbsBitmap *aMaskBitmap, CFbsFont *aFont)
2934 iCtWin->Gc()->Activate(*(RDrawableWindow *)BaseWin());
2935 CBitmapContext *gc=iCtWin->Gc();
2937 TBool aExtraDrawBitMap=ETrue;
2939 #include "DLLDRAW.H"
2941 iCtWin->Gc()->Deactivate();
2945 __WS_CONSTRUCT_STEP__(AnimDll)