First public contribution.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Test the Wserv heart beat switch on and off
21 @internalComponent - Internal Symbian test code
24 #include "THeartBeat.h"
27 CTHeartBeatTest::CTHeartBeatTest(CTestStep* aStep) :
28 CTWsGraphicsBase(aStep)
32 CTHeartBeatTest::~CTHeartBeatTest()
38 void CTHeartBeatTest::ConstructL()
40 TSize screenSize=TheClient->iGroup->Size();
41 TInt winWidth=(screenSize.iWidth/3)-10;
42 TInt winHeight=screenSize.iHeight-10;
43 iHbTestWin=new(ELeave) CAnimWindow(EFalse, CAnimWindow::ERedraw);
44 iHbTestWin->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight));
45 iAnimDll=RAnimDll(TheClient->iWs);
46 User::LeaveIfError(iAnimDll.Load(KAnimDLLName));
49 void CTHeartBeatTest::SetCursor(const TPoint& aPos,const TSize& aSize, TUint aFlags/*=0*/)
50 { // Default aFlags=0 gives a flashing cursor
52 tc.iType=TTextCursor::ETypeRectangle;
53 tc.iHeight=aSize.iHeight;
54 tc.iAscent=aSize.iHeight*4/5;
55 tc.iWidth=aSize.iWidth;
58 TheClient->iGroup->GroupWin()->SetTextCursor(*iHbTestWin->BaseWin(),TPoint(aPos.iX,aPos.iY+tc.iAscent),tc);
61 TBool CTHeartBeatTest::SetAutoHeartBeatPauseState(TBool aState) const
63 return(TheClient->iWs.DebugInfo(EWsDebugSetAutoHeartBeatPauseState,aState));
66 TBool CTHeartBeatTest::GetHeartBeatTimerState() const
68 return(TheClient->iWs.DebugInfo(EWsDebugHeartBeatState));
71 void CTHeartBeatTest::CancelTextCursor()
73 TheClient->iGroup->GroupWin()->CancelTextCursor();
76 void CTHeartBeatTest::TestTextCursorTimerL()
78 TEST(!GetHeartBeatTimerState());
79 SetCursor(TPoint(0,0),TSize(10,10));
80 TEST(GetHeartBeatTimerState());
82 TEST(!GetHeartBeatTimerState());
85 TSize testCursorSize(10,10);
86 SetCursor(testCursorPos,testCursorSize);
87 TEST(GetHeartBeatTimerState());
88 iHbTestWin->BaseWin()->SetVisible(EFalse);
89 TEST(!GetHeartBeatTimerState());
90 iHbTestWin->BaseWin()->SetVisible(ETrue);
91 TEST(GetHeartBeatTimerState());
93 // Cover the cursor and check heartbeat disabled
94 RWindow coverCursor(TheClient->iWs);
95 CleanupClosePushL(coverCursor);
96 User::LeaveIfError(coverCursor.Construct(*iHbTestWin->BaseWin(), 0xBADBAD));
97 coverCursor.SetExtent(testCursorPos,testCursorSize);
98 coverCursor.Activate();
99 TEST(!GetHeartBeatTimerState());
100 // Now fractionally expose the cursor and check heartbeat re-enabled
101 coverCursor.SetExtent(testCursorPos+TPoint(1,1),testCursorSize);
102 TEST(GetHeartBeatTimerState());
104 coverCursor.SetExtent(testCursorPos,testCursorSize);
105 TEST(!GetHeartBeatTimerState());
106 // Enlarge cursor to expose itself then check heartbeat
107 SetCursor(testCursorPos,TSize(testCursorSize.iWidth+1,testCursorSize.iHeight));
108 TEST(GetHeartBeatTimerState());
109 // Shrink cursor then check heartbeat
110 SetCursor(testCursorPos,testCursorSize);
111 TEST(!GetHeartBeatTimerState());
112 // Turn off auto heart beat pausing, should turn timer back on
113 SetAutoHeartBeatPauseState(EFalse);
114 TEST(GetHeartBeatTimerState());
115 // With auto pausing enabled covering/uncovering the cursor should have no effect,
116 // timer will always be on
117 coverCursor.SetVisible(EFalse);
118 TEST(GetHeartBeatTimerState());
119 coverCursor.SetVisible(ETrue);
120 TEST(GetHeartBeatTimerState());
121 // Re-enable auto-pause should turn timer back off
122 SetAutoHeartBeatPauseState(ETrue);
123 TEST(!GetHeartBeatTimerState());
124 // Destroy covering window and check heartbeat re-enabled
125 CleanupStack::PopAndDestroy(&coverCursor);
126 TEST(GetHeartBeatTimerState());
127 // Check using no flash flag turns timer off
128 SetCursor(testCursorPos,testCursorSize,TTextCursor::EFlagNoFlash);
129 TEST(!GetHeartBeatTimerState());
130 // and turning no flash flag off turns timer back on
131 SetCursor(testCursorPos,testCursorSize);
132 TEST(GetHeartBeatTimerState());
133 // Preparing for switch off should disable the heartbeat until another event is received
134 TheClient->iWs.PrepareForSwitchOff();
135 TEST(!GetHeartBeatTimerState());
136 // Any event should wake the hearbeat back up again
138 rawEvent.Set(TRawEvent::EPointerMove,0,0);
139 TheClient->iWs.SimulateRawEvent(rawEvent);
140 TEST(GetHeartBeatTimerState());
143 TEST(!GetHeartBeatTimerState());
144 // Check heartbeat still off as expected
145 TheClient->iWs.PrepareForSwitchOff();
146 TEST(!GetHeartBeatTimerState());
147 // Check when hearbeat not required that it's not turned back when coming out of PrepareForSwitchOff() mode.
148 TheClient->iWs.SimulateRawEvent(rawEvent);
150 TEST(!GetHeartBeatTimerState());
153 void CTHeartBeatTest::doTestActiveInactiveEvents(TBool aCursorOn, TBool aAutoPauseOn)
155 SetAutoHeartBeatPauseState(aAutoPauseOn);
157 SetCursor(TPoint(0,0),TSize(10,10));
158 // Should disable timer, regardless of other states
160 event.Set(TRawEvent::EInactive);
161 UserSvr::AddEvent(event);
162 TEST(!GetHeartBeatTimerState());
163 // ...and switch it back on
164 event.Set(TRawEvent::EActive);
165 UserSvr::AddEvent(event);
166 TBool testResult1=EFalse;
168 testResult1=aCursorOn; // Only on if cursor is on without auto pause enabled
170 testResult1=ETrue; // Always on if auto pause disabled
171 TBool hbState=GetHeartBeatTimerState();
172 if ((!hbState)!=(!testResult1))
174 _LIT(KLog,"Fail in TestActiveInactiveEvents(%d.%d) HBState=%d result=%d");
175 LOG_MESSAGE5(KLog,aCursorOn,aAutoPauseOn,hbState,testResult1);
177 TEST((!GetHeartBeatTimerState())==(!testResult1)); //Works with any positive value for True
183 void CTHeartBeatTest::TestActiveInactiveEvents()
185 doTestActiveInactiveEvents(EFalse,EFalse);
186 doTestActiveInactiveEvents(ETrue,EFalse);
187 doTestActiveInactiveEvents(EFalse,ETrue);
188 doTestActiveInactiveEvents(ETrue,ETrue);
191 void CTHeartBeatTest::FailCursorHbTest(const TDesC& aErrorBase, const TDesC* aExtraText, TBool aHbState, TBool aHbCheckState)
193 TBuf<256> error(aErrorBase);
196 error.Append(*aExtraText);
198 _LIT(KHbErrorAppendFmt," HB=%d (Testing for %d)");
199 error.AppendFormat(KHbErrorAppendFmt,aHbState,aHbCheckState);
204 TBool CTHeartBeatTest::ChangeTransAndCheckHeartBeat(TInt aTestMode, RWindow& aTransWin, const TRect& aGraphicRect, TInt aExtraWinTestMode, const TDesC* aErrorMsg, TBool aSetVisibleAfterTransUpdate)
206 TRect cursorRect(aGraphicRect);
207 cursorRect.Move(iHbTestWin->BaseWin()->InquireOffset(aTransWin));
208 TRect winRect(aTransWin.Size());
209 __ASSERT_ALWAYS(winRect.Contains(cursorRect.iTl) && winRect.Contains(cursorRect.iBr),AutoPanic(EAutoPanicHeartBeatCursorRect));
211 TRegionFix<8> transRegion;
212 TBool heartBeatCheck=EFalse;
215 case ECursorTransWinTestModeFullTrans:
216 transRegion.AddRect(winRect);
217 heartBeatCheck=ETrue;
219 case ECursorTransWinTestNoTrans:
221 case ECursorTransWinTestPartialTransCoveringCursor:
222 transRegion.AddRect(winRect);
223 transRegion.SubRect(cursorRect);
225 case ECursorTransWinTestPartialTransExposingCursor:
226 transRegion.AddRect(cursorRect);
227 heartBeatCheck=ETrue;
232 TBool invisHeartBeatCheck=ETrue;
233 switch(aExtraWinTestMode)
235 case ECursorTransWinTestNoTrans:
236 case ECursorTransWinTestPartialTransCoveringCursor:
237 heartBeatCheck=EFalse;
238 invisHeartBeatCheck=EFalse;
244 ASSERT(!transRegion.CheckError());
245 if (aSetVisibleAfterTransUpdate)
246 aTransWin.SetVisible(EFalse);
247 aTransWin.SetTransparentRegion(transRegion);
248 if (aSetVisibleAfterTransUpdate)
249 aTransWin.SetVisible(ETrue);
251 TBool testSuccess=ETrue;
252 TBool heartBeatState=GetHeartBeatTimerState();
253 TBool failed1stTest=EFalse;
254 if ((!heartBeatState)!=(!heartBeatCheck)) //Works with any positive value for True
257 _LIT(KFailedHbTest,"Failed ");
258 FailCursorHbTest(KFailedHbTest,aErrorMsg,heartBeatState,heartBeatCheck);
262 aTransWin.SetVisible(EFalse);
263 heartBeatState=GetHeartBeatTimerState();
264 _LIT(KGoingInvisAfterTestAppend," after %S");
265 TBuf<256> errorExtra;
268 errorExtra.Format(KGoingInvisAfterTestAppend,aErrorMsg);
270 if ((!heartBeatState)!=(!invisHeartBeatCheck)) //Works with any positive value for True
272 _LIT(KFailedGoingInvis,"Failed setting trans win invisible");
273 FailCursorHbTest(KFailedGoingInvis,&errorExtra,heartBeatState,invisHeartBeatCheck);
277 aTransWin.SetVisible(ETrue);
278 heartBeatState=GetHeartBeatTimerState();
279 if (!failed1stTest && (!heartBeatState)!=(!heartBeatCheck)) //Works with any positive value for True
281 _LIT(KFailedResettingVis,"Failed re-setting trans win visible");
282 FailCursorHbTest(KFailedResettingVis,&errorExtra,heartBeatState,heartBeatCheck);
288 void CTHeartBeatTest::LoopThroughTransWinTestModes(RWindow& aTransWin, const TRect& aGraphicRect, TInt aExtraWinTestMode)
291 for(TInt setVisMode=0;setVisMode<2;setVisMode++)
294 continue; // zzz setinvis/makevis needed to flush out changes it seems
295 const TBool setVisibleAfterTransUpdate=setVisMode>0;
296 for(TInt startTestMode=0;startTestMode<ENumCursorTransWinTestModes;startTestMode++)
298 if (startTestMode==ECursorTransWinTestNoTrans)
299 continue;// zzz bugged trans win problem
300 _LIT(KTcHbModeSetFail,"setting test mode %d (vis mode %d)");
301 error.Format(KTcHbModeSetFail,startTestMode,setVisibleAfterTransUpdate);
302 for(TInt switchToTestMode=0;switchToTestMode<ENumCursorTransWinTestModes;switchToTestMode++)
304 if (switchToTestMode==ECursorTransWinTestNoTrans)
305 continue;// zzz bugged trans win problem
306 if (startTestMode==switchToTestMode)
308 if (ChangeTransAndCheckHeartBeat(startTestMode, aTransWin, aGraphicRect, aExtraWinTestMode, &error, setVisibleAfterTransUpdate))
310 _LIT(KTcHbModeSwitchFail,"switching from test mode %d to %d (vis mode %d)");
311 error.Format(KTcHbModeSwitchFail, startTestMode, switchToTestMode, setVisibleAfterTransUpdate);
312 ChangeTransAndCheckHeartBeat(switchToTestMode, aTransWin, aGraphicRect, aExtraWinTestMode, &error, setVisibleAfterTransUpdate);
316 ChangeTransAndCheckHeartBeat(0, aTransWin, aGraphicRect, aExtraWinTestMode, NULL, setVisibleAfterTransUpdate);
320 void CTHeartBeatTest::RunTransWinTestsL(const TRect& aGraphicRect)
322 // Test a variety of patterns of changing the layout of transparent windows over the cursor
323 // cause the heartbeat state to be modified accordingly.
325 // Each transparent window has four specific states to test:
326 // i) Transparency area is the whole window
327 // ii) Partial transparency that exposes the cursor
328 // iii) Partial transparency that covers the cursor
329 // iv) Empty transparent region, i.e. totally opaque
331 // We need to test various transitions between these states, first on a single window, then
332 // in a various layouts with transparent windows layered over each other.
334 RWindow transWin1(TheClient->iWs);
335 User::LeaveIfError(transWin1.Construct(*TheClient->iGroup->GroupWin(),0xDEADBAD1));
336 CleanupClosePushL(transWin1);
337 if (transWin1.SetTransparencyFactor(TRgb::Gray256(128))!=KErrNone)
338 { // Transparency not enabled, skip tests
339 CleanupStack::PopAndDestroy(&transWin1);
342 transWin1.Activate();
343 TEST(GetHeartBeatTimerState());
344 // First simply check activating default full screen transparent window doesn't disable the heartbeat
345 _LIT(KBasicTransCursorTests,"Running basic transparent window cursor heartbeat tests");
346 LOG_MESSAGE(KBasicTransCursorTests);
347 LoopThroughTransWinTestModes(transWin1, aGraphicRect, ECursorTransWinTestNA);
349 // Lots of test code disabled due to bugs in handling of transparent window regions
350 // See DEF110677, hopefully when the issues in there are addressed the rest of the
351 // test code here can be enabled
352 // See sections marked with zzz for places where certain tests are disabled, once DEF110677
353 // is marked as fixed these sections should be re-enabled and if problems still occur they
354 // need to be investigated.
357 // Now check more complex modes with two transparent windows over the test window
358 RWindow transWin2(TheClient->iWs);
359 User::LeaveIfError(transWin2.Construct(*TheClient->iGroup->GroupWin(),0xDEADBAD2));
360 CleanupClosePushL(transWin2);
361 User::LeaveIfError(transWin2.SetTransparencyFactor(TRgb::Gray256(128)));
362 TSize screenSize=TheClient->iGroup->Size();
363 screenSize.iWidth-=10;
364 transWin1.SetExtent(TPoint(0,0),screenSize);
365 transWin2.SetExtent(TPoint(10,0),screenSize);
366 transWin2.Activate();
367 for(TInt win1OrdPos=0;win1OrdPos<2;win1OrdPos++)
369 transWin1.SetOrdinalPosition(win1OrdPos);
370 _LIT(KOrdinalTransCursorTests,"Running tests with transwin1 ordinal pos=%d");
371 LOG_MESSAGE2(KOrdinalTransCursorTests,win1OrdPos);
372 for(TInt topWinTestMode=0;topWinTestMode<ENumCursorTransWinTestModes;topWinTestMode++)
374 if (topWinTestMode==ECursorTransWinTestNoTrans)
375 continue;// zzz bugged transparent window problem
376 if (topWinTestMode==ECursorTransWinTestPartialTransCoveringCursor)
377 continue;// zzz bugged transparent window problem
378 _LIT(KTopTransWinCursorTest,"Setting top trans win mode %d");
380 msg.Format(KTopTransWinCursorTest,topWinTestMode);
382 ChangeTransAndCheckHeartBeat(0, transWin2, aGraphicRect, topWinTestMode, NULL, ETrue);
383 LoopThroughTransWinTestModes(transWin1, aGraphicRect, topWinTestMode);
386 ChangeTransAndCheckHeartBeat(0, transWin2, aGraphicRect, 0, NULL, ETrue);
387 CleanupStack::PopAndDestroy(&transWin2);
388 TEST(GetHeartBeatTimerState());
390 CleanupStack::PopAndDestroy(&transWin1);
391 TEST(GetHeartBeatTimerState());
394 void CTHeartBeatTest::TestTextCursorTimerTransL()
396 TSize testWinSize(iHbTestWin->BaseWin()->Size());
397 TRect cursorRect(testWinSize.iWidth/4,testWinSize.iHeight/3,testWinSize.iWidth*3/4,testWinSize.iHeight*2/3);
398 TEST(!GetHeartBeatTimerState());
399 SetCursor(cursorRect.iTl,cursorRect.Size());
400 TEST(GetHeartBeatTimerState());
401 RunTransWinTestsL(cursorRect);
403 TEST(!GetHeartBeatTimerState());
406 void CTHeartBeatTest::TestHeartBeatStopStart(TBool aHeartbeatStateOff,TBool aHeartbeatStateOn,const TDesC& aOffText,const TDesC& aOnText)
408 TEST(!aHeartbeatStateOff);
409 if (aHeartbeatStateOff)
410 LOG_MESSAGE2(_L("%S failed to disable heartbeat timer"),&aOffText);
411 TEST(aHeartbeatStateOn);
412 if (!aHeartbeatStateOn)
413 LOG_MESSAGE2(_L("%S failed to re-enable heartbeat timer"),&aOnText);
416 void CTHeartBeatTest::TestAnimDllL(TBool aSpriteMode, TUint aSpriteFlags)
418 RTestAnim anim(iAnimDll);
419 TEST(!GetHeartBeatTimerState());
420 TSize testWinSize(iHbTestWin->BaseWin()->Size());
421 TRect animRect(1,1,testWinSize.iWidth/3,testWinSize.iWidth/5);
422 TPckgC<TRect> rectPckg(animRect);
423 RWsSprite sprite(TheClient->iWs);
424 CleanupClosePushL(sprite);
427 sprite.Construct(*iHbTestWin->BaseWin(),TPoint(),aSpriteFlags);
428 CFbsBitmap* bitmap1=new(ELeave) CFbsBitmap();
429 CleanupStack::PushL(bitmap1);
430 CFbsBitmap* bitmap2=new(ELeave) CFbsBitmap();
431 CleanupStack::PushL(bitmap2);
432 CFbsBitmap* bitmap3=new(ELeave) CFbsBitmap();
433 CleanupStack::PushL(bitmap3);
434 TSize animSize(animRect.Size());
435 User::LeaveIfError(bitmap1->Create(TSize(animSize.iWidth/2,animSize.iHeight/2),EGray4));
436 User::LeaveIfError(bitmap2->Create(TSize(animSize.iWidth,animSize.iHeight/3),EGray4));
437 User::LeaveIfError(bitmap3->Create(TSize(animSize.iWidth/3,animSize.iHeight),EGray4));
439 TSpriteMember member1;
440 member1.iMaskBitmap=NULL;
441 member1.iInvertMask=EFalse;
442 member1.iDrawMode=CGraphicsContext::EDrawModePEN;
443 member1.iOffset=TPoint();
444 member1.iInterval=TTimeIntervalMicroSeconds32(1);
445 member1.iBitmap=bitmap1;
446 member1.iMaskBitmap=bitmap1;
447 sprite.AppendMember(member1);
449 TSpriteMember member2;
450 member2.iInvertMask=EFalse;
451 member2.iDrawMode=CGraphicsContext::EDrawModeXOR;
452 member2.iOffset=TPoint(1,2);
453 member2.iInterval=TTimeIntervalMicroSeconds32(2);
454 member2.iBitmap=bitmap2;
455 member2.iMaskBitmap=bitmap2;
456 sprite.AppendMember(member2);
458 TSpriteMember member3;
459 member3.iInvertMask=ETrue;
460 member3.iDrawMode=CGraphicsContext::EDrawModeOR;
461 member3.iOffset=TPoint(3,4);
462 member3.iInterval=TTimeIntervalMicroSeconds32(3);
463 member3.iBitmap=bitmap3;
464 member3.iMaskBitmap=bitmap3;
465 sprite.AppendMember(member3);
467 User::LeaveIfError(anim.Construct(sprite,EAnimTypeSprite,rectPckg));
468 CleanupStack::PopAndDestroy(3,bitmap1);
472 User::LeaveIfError(anim.Construct(*iHbTestWin->BaseWin(),EAnimTypeTest3,rectPckg));
474 CleanupClosePushL(anim);
475 TEST(GetHeartBeatTimerState());
477 // Cover up the window with the animation and check this disables the heartbeat timer.
478 RBlankWindow blankwin1(TheClient->iWs);
479 User::LeaveIfError(blankwin1.Construct(*TheClient->iGroup->GroupWin(),123));
480 TPoint winOffset(iHbTestWin->BaseWin()->InquireOffset(*TheClient->iGroup->GroupWin()));
482 blankwin1.SetExtent(winOffset,testWinSize);
484 blankwin1.SetExtent(winOffset+animRect.iTl,animRect.Size());
485 blankwin1.Activate();
486 TBool heartbeatStateOff=GetHeartBeatTimerState();
487 TEST(!heartbeatStateOff);
488 if (heartbeatStateOff)
490 LOG_MESSAGE(_L("Covering window failed to disable heartbeat timer"));
492 TBool heartbeatStateOn;
495 // Resize the anim so it becomes visible, then shrink back down again
497 anim.Command(EADllSetRect,rectPckg);
498 heartbeatStateOn=GetHeartBeatTimerState();
500 anim.Command(EADllSetRect,rectPckg);
501 heartbeatStateOff=GetHeartBeatTimerState();
502 TestHeartBeatStopStart(heartbeatStateOff,heartbeatStateOn,_L("Shrinking anim"),_L("Growing anim"));
506 heartbeatStateOn=GetHeartBeatTimerState();
507 TEST(heartbeatStateOn);
508 if (!heartbeatStateOn)
510 LOG_MESSAGE(_L("Un-covering window failed to disable heartbeat timer"));
513 // Put a transparent window over the animation and check the heartbeat timer is not disabled
514 RWindow transWin(TheClient->iWs);
515 User::LeaveIfError(transWin.Construct(*TheClient->iGroup->GroupWin(),123));
516 if (transWin.SetTransparencyFactor(TRgb::Gray256(128))==KErrNone)
519 heartbeatStateOn=GetHeartBeatTimerState();
520 TEST(heartbeatStateOn);
521 if (!heartbeatStateOn)
522 LOG_MESSAGE(_L("Transparent window caused heartbeat timer to be disabled"));
523 TRegionFix<1> emptyRegion;
524 transWin.SetTransparentRegion(emptyRegion);
525 heartbeatStateOff=GetHeartBeatTimerState();
526 TRegionFix<1> fullRegion(transWin.Size());
527 transWin.SetTransparentRegion(fullRegion);
528 heartbeatStateOn=GetHeartBeatTimerState();
529 TestHeartBeatStopStart(heartbeatStateOff,heartbeatStateOn,_L("Making covering window opaque"),_L("Making covering window transparent"));
532 RBlankWindow blankwin2(TheClient->iWs);
533 User::LeaveIfError(blankwin2.Construct(*iHbTestWin->BaseWin(),1234));
534 blankwin2.Activate();
535 heartbeatStateOn=GetHeartBeatTimerState();
536 // With ESpriteNoChildClip the heartbeat should still be on as the sprite will still be visible
537 // Without it blankwin2 will cover up the sprite and cancel the heartbeat
538 TBool heartBeatCheck=aSpriteFlags&ESpriteNoChildClip;
539 TEST((!heartbeatStateOn)==(!heartBeatCheck)); //Works with any positive value for True
542 transWin.SetTransparentRegion(emptyRegion);
543 heartbeatStateOff=GetHeartBeatTimerState();
545 heartbeatStateOn=GetHeartBeatTimerState();
546 TestHeartBeatStopStart(heartbeatStateOff,heartbeatStateOn,_L("Making covering window opaque"),_L("Un-covering window"));
551 // Make the window with the animation invisible and check this disables the heartbeat timer.
552 iHbTestWin->BaseWin()->SetVisible(EFalse);
553 heartbeatStateOff=GetHeartBeatTimerState();
554 iHbTestWin->BaseWin()->SetVisible(ETrue);
555 heartbeatStateOn=GetHeartBeatTimerState();
556 TestHeartBeatStopStart(heartbeatStateOff,heartbeatStateOn,_L("Making window invisible"),_L("Making window visible"));
558 // Move the window with the animation off screen and check this disables the heartbeat timer.
559 TSize screenSize=TheClient->iGroup->Size();
560 TPoint oldPos(iHbTestWin->BaseWin()->Position());
561 iHbTestWin->BaseWin()->SetPosition(screenSize.AsPoint());
562 heartbeatStateOff=GetHeartBeatTimerState();
563 iHbTestWin->BaseWin()->SetPosition(oldPos);
564 heartbeatStateOn=GetHeartBeatTimerState();
565 TestHeartBeatStopStart(heartbeatStateOff,heartbeatStateOn,_L("Moving window offscreen"),_L("Moving window back onscreen"));
566 TEST(GetHeartBeatTimerState());
567 CleanupStack::PopAndDestroy(&anim);
568 TEST(!GetHeartBeatTimerState());
569 CleanupStack::PopAndDestroy(&sprite);
572 void CTHeartBeatTest::TestAnimDllTransL()
574 RTestAnim anim(iAnimDll);
575 TSize testWinSize(iHbTestWin->BaseWin()->Size());
576 TRect animRect(testWinSize.iWidth/4,testWinSize.iHeight/3,testWinSize.iWidth*3/4,testWinSize.iHeight*2/3);
577 TPckgBuf<TRect> rectPckg;
579 TEST(!GetHeartBeatTimerState());
580 User::LeaveIfError(anim.Construct(*iHbTestWin->BaseWin(),EAnimTypeTest3,rectPckg));
581 CleanupClosePushL(anim);
582 TEST(GetHeartBeatTimerState());
584 RunTransWinTestsL(animRect);
586 CleanupStack::PopAndDestroy(&anim);
587 TEST(!GetHeartBeatTimerState());
590 void CTHeartBeatTest::RunTestCaseL(TInt /*aCurTestCase*/)
593 switch(++iTest->iState)
597 @SYMTestCaseID GRAPHICS-WSERV-0568
599 ((CTHeartBeatTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0568"));
600 _LIT(KTestTextCursorTimer,"Basic heartbeat timer test");
601 iTest->LogSubTest(KTestTextCursorTimer);
602 TestTextCursorTimerL();
606 @SYMTestCaseID GRAPHICS-WSERV-0569
608 ((CTHeartBeatTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0569"));
609 _LIT(KTestTextCursorTimerTrans,"Heartbeat timer test with transparent windows");
610 iTest->LogSubTest(KTestTextCursorTimerTrans);
611 TestTextCursorTimerTransL();
615 @SYMTestCaseID GRAPHICS-WSERV-0570
617 ((CTHeartBeatTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0570"));
618 _LIT(KTestAnimDll1,"Anim DLL Heartbeat check (Win)");
619 iTest->LogSubTest(KTestAnimDll1);
620 TestAnimDllL(EFalse,0);
624 @SYMTestCaseID GRAPHICS-WSERV-0571
626 ((CTHeartBeatTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0571"));
627 _LIT(KTestAnimDll2,"Anim DLL Heartbeat check (Sprite)");
628 iTest->LogSubTest(KTestAnimDll2);
629 TestAnimDllL(ETrue,0);
630 TestAnimDllL(ETrue,ESpriteNoChildClip);
634 @SYMTestCaseID GRAPHICS-WSERV-0572
636 ((CTHeartBeatTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0572"));
637 _LIT(KTestAnimDllTrans,"Anim DLL Heartbeat check with transparent windows");
638 iTest->LogSubTest(KTestAnimDllTrans);
643 @SYMTestCaseID GRAPHICS-WSERV-0573
645 ((CTHeartBeatTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0573"));
646 _LIT(KTestActiveInactiveEvents,"Handling of TRawEvent::EInactive and EActive");
647 iTest->LogSubTest(KTestActiveInactiveEvents);
648 TestActiveInactiveEvents();
651 ((CTHeartBeatTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
652 ((CTHeartBeatTestStep*)iStep)->CloseTMSGraphicsStep();
656 ((CTHeartBeatTestStep*)iStep)->RecordTestResultL();
659 __WS_CONSTRUCT_STEP__(HeartBeatTest)