sl@0: // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // This test step contains a series of tests cases to validate the correct behaviour of PREQ1246 implementation. sl@0: // In order to create these test cases, basic implementations of the objects involved in this PREQ will be created, sl@0: // .i.e. CWsGraphic-derived objects (generically named CWsGraphicTest) and CWsGraphicDrawer-derived objects sl@0: // (generically named CWsGraphicDrawerTest). sl@0: // Actual construction is performed by a UI-specific entity such as a theme manager. The test code shall replace sl@0: // that theme manager functionality, in terms of being the test code who owns a collection of CWsGraphicTest sl@0: // objects. sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent - Internal Symbian test code sl@0: */ sl@0: sl@0: #include "TWSGRAPHS.H" sl@0: #include "../inc/WSGRAPHICDRAWERARRAY.H" sl@0: #include "../../nga/graphicdrawer/panics.h" sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: #include "wsbufferdrawer.h" sl@0: #endif sl@0: sl@0: _LIT(KTestExe, "TWSGRAPHICTEST.exe"); sl@0: _LIT(KSpace, " "); sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: const TInt KCustomTextCursorId = TTextCursor::ETypeLastBasic + 57; // 57 is arbitrary sl@0: #endif sl@0: sl@0: CCrWin* CCrWin::NewL(TInt aScreenId, TBool aDraw) sl@0: { sl@0: CCrWin* win = new(ELeave) CCrWin; sl@0: CleanupStack::PushL(win); sl@0: win->ConstructL(aScreenId, aDraw); sl@0: CleanupStack::Pop(win); sl@0: return win; sl@0: } sl@0: sl@0: CCrWin::~CCrWin() sl@0: { sl@0: iWin.Close(); sl@0: iGroup.Close(); sl@0: delete iGc; sl@0: delete iScr; sl@0: iWs.Close(); sl@0: } sl@0: sl@0: void CCrWin::ConstructL(TInt aScreenId, TBool aDraw) sl@0: { sl@0: User::LeaveIfError(iWs.Connect()); sl@0: iScr = new(ELeave) CWsScreenDevice(iWs); sl@0: User::LeaveIfError(iScr->Construct(aScreenId)); sl@0: User::LeaveIfError(iScr->CreateContext(iGc)); sl@0: iGroup = RWindowGroup(iWs); sl@0: User::LeaveIfError(iGroup.Construct(0xbadbabe,ETrue)); sl@0: iGroup.SetOrdinalPosition(0,100); sl@0: iWin = RWindow(iWs); sl@0: User::LeaveIfError(iWin.Construct(iGroup,0xbadcafe)); sl@0: iWin.SetRequiredDisplayMode(EColor64K); sl@0: iWin.Activate(); sl@0: iWs.Flush(); sl@0: if (aDraw) sl@0: Draw(); sl@0: } sl@0: sl@0: void CCrWin::Draw() sl@0: { sl@0: iWin.BeginRedraw(); sl@0: iGc->Activate(iWin); sl@0: iGc->SetBrushColor(KRgbRed); sl@0: iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TRect rect(iScr->SizeInPixels()); sl@0: iGc->DrawRect(rect); sl@0: iGc->SetBrushColor(KRgbBlue); sl@0: iGc->DrawEllipse(TRect(rect.iTl.iX,rect.iTl.iY,rect.iBr.iX/2,rect.iBr.iY)); sl@0: iGc->DrawEllipse(TRect(rect.iBr.iX/2,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY)); sl@0: iGc->Deactivate(); sl@0: iWin.EndRedraw(); sl@0: iWs.Flush(); sl@0: } sl@0: sl@0: sl@0: void CCrWin::DrawFirstHalf() sl@0: { sl@0: iWin.BeginRedraw(); sl@0: iGc->Activate(iWin); sl@0: iGc->SetBrushColor(KRgbRed); sl@0: iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TRect rect(TPoint(0,0),TSize(iScr->SizeInPixels().iWidth/2,iScr->SizeInPixels().iHeight)); sl@0: iGc->DrawRect(rect); sl@0: iWs.Flush(); sl@0: } sl@0: sl@0: void CCrWin::DrawSecondHalf() sl@0: { sl@0: TRect rect(TPoint(iScr->SizeInPixels().iWidth/2,0),TSize(iScr->SizeInPixels().iWidth/2,iScr->SizeInPixels().iHeight)); sl@0: iGc->DrawRect(rect); sl@0: iGc->Deactivate(); sl@0: iWin.EndRedraw(); sl@0: iWs.Flush(); sl@0: } sl@0: sl@0: /** sl@0: The objective of this function is, two animations should run independently sl@0: with respective frame rate in the given time interval. sl@0: The time delay allows to draw animations freely and the plug-in sl@0: calculates number of times DoDraw() function called during this interval. sl@0: sl@0: @param TInt Wsgrphic test plug-in id. sl@0: */ sl@0: void CCrWin::DrawGraphic(TInt aWsId) sl@0: { sl@0: // draw the animation in two positions sl@0: const TSize screenSize = iScr->SizeInPixels(); sl@0: const TRect position(0,0,screenSize.iWidth/2,screenSize.iHeight); sl@0: const TRect position2((screenSize.iWidth/2)+1,0,screenSize.iWidth,screenSize.iHeight); sl@0: //PeterI if CWsGraphic animation areas overlap then when one redraws the other will as well. sl@0: //2 separate positions are needed otherwise the framerates will be identical. sl@0: sl@0: iWin.BeginRedraw(); sl@0: iGc->Activate(iWin); sl@0: const TUint8 animid1=0; sl@0: const TUint8 fps1=20; sl@0: TBuf8<2> animData1; sl@0: animData1.Append(animid1); //animId1 sl@0: animData1.Append(fps1); //20fps sl@0: iGc->DrawWsGraphic(aWsId,position,animData1); sl@0: iWs.Flush(); sl@0: User::After(200000); sl@0: const TUint8 animid2=1; sl@0: const TUint8 fps2=60; sl@0: TBuf8<2> animData2; sl@0: animData2.Append(animid2); //animId2 sl@0: animData2.Append(fps2); //60fps sl@0: iGc->DrawWsGraphic(aWsId,position2,animData2); sl@0: iWs.Flush(); sl@0: User::After(200000); sl@0: iGc->Deactivate(); sl@0: iWin.EndRedraw(); sl@0: iWs.Flush(); sl@0: } sl@0: sl@0: /** sl@0: * Set a standard text cursor on this window. sl@0: * @see RWindowGroup::SetTextCursor() sl@0: */ sl@0: void CCrWin::SetTextCursor(const TPoint &aPos, const TTextCursor &aCursor) sl@0: { sl@0: iGroup.SetTextCursor(iWin, aPos, aCursor); sl@0: } sl@0: sl@0: /** sl@0: * Cancel a text cursor from this window. sl@0: * @see RWindowGroup::CancelTextCursor() sl@0: */ sl@0: void CCrWin::CancelTextCursor() sl@0: { sl@0: iGroup.CancelTextCursor(); sl@0: } sl@0: sl@0: CCrAlphaWin* CCrAlphaWin::NewL(TInt aScreenId) sl@0: { sl@0: CCrAlphaWin* win = new(ELeave) CCrAlphaWin; sl@0: CleanupStack::PushL(win); sl@0: win->ConstructL(aScreenId); sl@0: CleanupStack::Pop(win); sl@0: return win; sl@0: } sl@0: sl@0: CCrAlphaWin::~CCrAlphaWin() sl@0: { sl@0: iWin.Close(); sl@0: iGroup.Close(); sl@0: delete iScr; sl@0: iWs.Close(); sl@0: } sl@0: sl@0: void CCrAlphaWin::ConstructL(TInt aScreenId) sl@0: { sl@0: User::LeaveIfError(iWs.Connect()); sl@0: iScr = new(ELeave) CWsScreenDevice(iWs); sl@0: User::LeaveIfError(iScr->Construct(aScreenId)); sl@0: iGroup = RWindowGroup(iWs); sl@0: User::LeaveIfError(iGroup.Construct(0xbadc0de,ETrue)); sl@0: iGroup.SetOrdinalPosition(0,100); sl@0: iWin = RWindow(iWs); sl@0: User::LeaveIfError(iWin.Construct(iGroup,0xbadbeef)); sl@0: iWin.SetRequiredDisplayMode(EColor64K); sl@0: iWin.SetTransparencyAlphaChannel(); sl@0: iWin.SetBackgroundColor(TRgb(0xff,0xff,0,0x80)); sl@0: iWin.Activate(); sl@0: iWs.Flush(); sl@0: } sl@0: sl@0: sl@0: // sl@0: // CTWsGraphs sl@0: // sl@0: sl@0: CTWsGraphs::CTWsGraphs(CTestStep* aStep): sl@0: CTWsGraphicsBase(aStep) sl@0: { sl@0: } sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: LOCAL_D void DeleteSpriteMember(TAny* aSpriteMember) sl@0: { sl@0: TSpriteMember* member=reinterpret_cast(aSpriteMember); sl@0: delete member->iBitmap; sl@0: member->iBitmap=NULL; sl@0: delete member->iMaskBitmap; sl@0: member->iMaskBitmap=NULL; sl@0: } sl@0: #endif sl@0: sl@0: CTWsGraphs::~CTWsGraphs() sl@0: { sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: DeleteSpriteMember(&iSpriteMemberArray[0]); sl@0: iSpriteMemberArray.Close(); sl@0: #endif sl@0: delete iGdCoverage; sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: delete iAfter; sl@0: delete iBefore; sl@0: delete iBackCopy; sl@0: delete iFrontCopy; sl@0: #endif sl@0: delete iListen; sl@0: delete iNotify2; sl@0: delete iNotify1; sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: delete iRedir; sl@0: #endif sl@0: } sl@0: sl@0: void CTWsGraphs::ConstructL() sl@0: { sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: iRedir = CWsRedir::NewL(iTest->iScreenNumber,ETrue); sl@0: iRedir->SetCallBack(TCallBack(CTWsGraphs::PluginCallBack,this)); sl@0: #endif sl@0: iNotify1 = CWsNotify::NewL(EFalse); sl@0: iNotify2 = CWsNotify::NewL(ETrue); sl@0: iListen = CWsListen::NewL(ETrue); sl@0: iListen->SetCallBack(TCallBack(CTWsGraphs::PluginCallBack,this)); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: iFrontCopy = new(ELeave) CFbsBitmap; sl@0: iBackCopy = new(ELeave) CFbsBitmap; sl@0: iBefore = new(ELeave) CFbsBitmap; sl@0: User::LeaveIfError(iBefore->Create(TheClient->iScreen->SizeInPixels(), EColor64K)); sl@0: iAfter = new(ELeave) CFbsBitmap; sl@0: User::LeaveIfError(iAfter->Create(TheClient->iScreen->SizeInPixels(), EColor64K)); sl@0: #endif sl@0: iGdCoverage = CWsGdCoverage::NewL(); sl@0: iGdCoverage->SetCallBack(TCallBack(CTWsGraphs::PluginCallBack,this)); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: TSpriteMember spriteMember; sl@0: spriteMember.iBitmap = NULL; sl@0: spriteMember.iMaskBitmap = NULL; sl@0: spriteMember.iInvertMask =EFalse; sl@0: spriteMember.iDrawMode = CGraphicsContext::EDrawModePEN; sl@0: spriteMember.iOffset = TPoint(); sl@0: spriteMember.iInterval = TTimeIntervalMicroSeconds32(0); sl@0: CleanupStack::PushL(TCleanupItem(DeleteSpriteMember, &spriteMember)); sl@0: spriteMember.iBitmap = new (ELeave) CFbsBitmap; sl@0: User::LeaveIfError(spriteMember.iBitmap->Load(TEST_BITMAP_NAME, EMbmWsautotestBmp1)); sl@0: spriteMember.iMaskBitmap = new (ELeave) CFbsBitmap; sl@0: User::LeaveIfError(spriteMember.iMaskBitmap->Load(TEST_BITMAP_NAME, EMbmWsautotestBmp1mask)); sl@0: User::LeaveIfError(iSpriteMemberArray.Append(spriteMember)); sl@0: CleanupStack::Pop(&spriteMember); sl@0: #endif sl@0: } sl@0: sl@0: void CTWsGraphs::LaunchNewProcess(const TDesC& aExecutable) sl@0: { sl@0: TBuf<128> args; sl@0: args.Append(KSpace); sl@0: args.AppendNum(iTest->iScreenNumber); sl@0: RProcess pr; sl@0: TInt err = pr.Create(aExecutable,args); sl@0: if (err == KErrNone) sl@0: { sl@0: TRequestStatus status; sl@0: pr.Logon(status); sl@0: pr.Resume(); sl@0: User::WaitForRequest(status); sl@0: err = pr.ExitReason(); sl@0: pr.Close(); sl@0: if (err != KErrNone) sl@0: { sl@0: _LIT(KLog,"%S returned error: %d. Check RDebug output."); sl@0: LOG_MESSAGE3(KLog, &aExecutable, err); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: _LIT(KLog,"Can't create the process (%S), err=%d"); sl@0: LOG_MESSAGE3(KLog, &aExecutable, err); sl@0: } sl@0: TEST(err == KErrNone); sl@0: // Restore main test group to foreground. sl@0: TheClient->iGroup->GroupWin()->SetOrdinalPosition(0); sl@0: } sl@0: sl@0: TInt CTWsGraphs::PluginCallBack(TAny* /*aArg*/) sl@0: { sl@0: return (TInt)EWait; sl@0: } sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0371 sl@0: @SYMREQ GT247-CR0714 sl@0: @SYMTestCaseDesc Test interface extension sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Retrieves object interfaces from Content Rendering Plugin (plugin). sl@0: Actions step: sl@0: -Create plugin sl@0: -Query interfaces obtained from plugin side sl@0: @SYMTestExpectedResults Supported interfaces should return non null sl@0: */ sl@0: TestState CTWsGraphs::TestInterfaceExtensionL() sl@0: { sl@0: if (iSubState==0) sl@0: { sl@0: _LIT(KTestInterfaceExtension, "TestInterfaceExtension"); sl@0: INFO_PRINTF1(KTestInterfaceExtension); sl@0: sl@0: ++iSubState; sl@0: Mem::FillZ(&iRedirInfo, sizeof(TRedirectorInfo)); sl@0: iRedir->QueryPlugin(iRedirInfo); sl@0: return EWait; sl@0: } sl@0: TEST(iRedirInfo.iScreenConfigInterface!=NULL); sl@0: TEST(iRedirInfo.iFrontBufferInterface!=NULL); sl@0: TEST(iRedirInfo.iScreenBitmapHandle!=0); sl@0: iFrontCopy->Duplicate(iRedirInfo.iScreenBitmapHandle); sl@0: sl@0: if (TransparencySupportedL()!=KErrNotSupported) sl@0: { sl@0: TEST(iRedirInfo.iBackBufferInterface!=NULL); sl@0: TEST(iRedirInfo.iFlickerBitmapHandle!=0); sl@0: iBackCopy->Duplicate(iRedirInfo.iFlickerBitmapHandle); sl@0: } sl@0: sl@0: ++(iTest->iState); sl@0: iSubState = 0; sl@0: return ENext; sl@0: } sl@0: sl@0: #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: sl@0: void CTWsGraphs::CreateWindowL(TBool aDraw) sl@0: { sl@0: iWin = CCrWin::NewL(iTest->iScreenNumber, aDraw); sl@0: } sl@0: sl@0: void CTWsGraphs::DestroyWindowL() sl@0: { sl@0: delete iWin; sl@0: iWin = NULL; sl@0: } sl@0: sl@0: void CTWsGraphs::CreateAlphaWindowL() sl@0: { sl@0: iAlpha = CCrAlphaWin::NewL(iTest->iScreenNumber); sl@0: } sl@0: sl@0: void CTWsGraphs::DestroyAlphaWindowL() sl@0: { sl@0: delete iAlpha; sl@0: iAlpha = NULL; sl@0: } sl@0: sl@0: TBool CTWsGraphs::CompareBitmapArea16Bpp(CFbsBitmap* aBmp1, const TPoint& aPos1, CFbsBitmap* aBmp2, const TPoint& aPos2, const TSize& aSize) sl@0: { sl@0: const TDisplayMode dispmode = aBmp1->DisplayMode(); sl@0: if (dispmode!=aBmp2->DisplayMode()) sl@0: return EFalse; sl@0: const TInt stride1 = aBmp1->DataStride(); sl@0: const TInt stride2 = aBmp2->DataStride(); sl@0: const TInt linebytes = aSize.iWidth * 2; sl@0: const TInt pixelbytes = 2; sl@0: aBmp1->LockHeap(); sl@0: const TUint8* p1 = ((const TUint8*)aBmp1->DataAddress())+aPos1.iY*stride1+aPos1.iX*pixelbytes; sl@0: const TUint8* p2 = ((const TUint8*)aBmp2->DataAddress())+aPos2.iY*stride2+aPos2.iX*pixelbytes; sl@0: for (TInt y=0; yUnlockHeap(); sl@0: return EFalse; sl@0: } sl@0: } sl@0: aBmp1->UnlockHeap(); sl@0: return ETrue; sl@0: } sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: TestState CTWsGraphs::TestScreenRedirectionL() sl@0: { sl@0: if (iSubState==0) sl@0: { sl@0: _LIT(KTestScreenRedirection, "TestScreenRedirection"); sl@0: INFO_PRINTF1(KTestScreenRedirection); sl@0: sl@0: ++iSubState; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0372 sl@0: @SYMREQ GT247-CR0714 sl@0: @SYMTestCaseDesc Redirect wserv screen drawing to custom graphics context sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Redirects wserv screen drawing to bitmap context owned by plugin. sl@0: Actions step: sl@0: -Draw opaque window. sl@0: -Save screen content to a bitmap sl@0: -Instruct plugin to redirect wserv screen drawing to a bitmap device sl@0: -Draw the same window again sl@0: -Retrieve plugin bitmap and compare against the saved bitmap sl@0: @SYMTestExpectedResults Bitmap content match sl@0: */ sl@0: CreateWindowL(); sl@0: TheClient->iScreen->CopyScreenToBitmap(iBefore); sl@0: DestroyWindowL(); sl@0: iRedir->Redirect(CWsRedir::EFrontBuffer, ETrue); sl@0: return EWait; sl@0: } sl@0: sl@0: if (iSubState==1) sl@0: { sl@0: ++iSubState; sl@0: CreateWindowL(); sl@0: TSize sz = iBefore->SizeInPixels(); sl@0: TInt bytes = sz.iWidth*sz.iHeight*2; // EColor64K sl@0: iBefore->LockHeap(); sl@0: TEST(Mem::Compare((const TUint8*)iFrontCopy->DataAddress(),bytes,(const TUint8*)iBefore->DataAddress(),bytes)==0); sl@0: iBefore->UnlockHeap(); sl@0: sl@0: Mem::FillZ(&iRedirInfo, sizeof(TRedirectorInfo)); sl@0: iRedir->QueryPlugin(iRedirInfo); sl@0: return EWait; sl@0: } sl@0: sl@0: if (iSubState==2) sl@0: { sl@0: ++iSubState; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0047 sl@0: @SYMTestCaseDesc Screen update event sl@0: @SYMTestPriority Medium sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Check plugin receive screen update event during redirection sl@0: @SYMTestExpectedResults Counter is non-zero sl@0: */ sl@0: TEST(iRedirInfo.iUpdateCounter>0); sl@0: sl@0: DestroyWindowL(); sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0373 sl@0: @SYMREQ GT247-CR0714 sl@0: @SYMTestCaseDesc Stop wserv screen drawing redirection sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Stop wserv screen drawing redirection. sl@0: Actions step: sl@0: -Instruct plugin to stop wserv screen drawing redirection sl@0: -Draw the same window again sl@0: -Save screen content to another bitmap sl@0: -Compare the saved bitmap against newly saved bitmap sl@0: @SYMTestExpectedResults Bitmap content match sl@0: */ sl@0: iRedir->Redirect(CWsRedir::EFrontBuffer, EFalse); sl@0: return EWait; sl@0: } sl@0: sl@0: if (iSubState==3) sl@0: { sl@0: ++iSubState; sl@0: CreateWindowL(); sl@0: TheClient->iScreen->CopyScreenToBitmap(iAfter); sl@0: TSize sz = iBefore->SizeInPixels(); sl@0: TInt bytes = sz.iWidth*sz.iHeight*2; // EColor64K sl@0: iAfter->LockHeap(); sl@0: TEST(Mem::Compare((const TUint8*)iAfter->DataAddress(),bytes,(const TUint8*)iBefore->DataAddress(),bytes)==0); sl@0: iAfter->UnlockHeap(); sl@0: DestroyWindowL(); sl@0: sl@0: Mem::FillZ(&iRedirInfo, sizeof(TRedirectorInfo)); sl@0: iRedir->QueryPlugin(iRedirInfo); sl@0: return EWait; sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0374 sl@0: @SYMTestCaseDesc Screen update event sl@0: @SYMTestPriority Medium sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Check plugin receive no screen update event when redirection is terminated sl@0: @SYMTestExpectedResults Counter is zero sl@0: */ sl@0: TEST(iRedirInfo.iUpdateCounter==0); sl@0: sl@0: ++(iTest->iState); sl@0: iSubState = 0; sl@0: sl@0: return ENext; sl@0: } sl@0: sl@0: TestState CTWsGraphs::TestTextCursorUnderRedirectionL(TTestCursorType aCursorType) sl@0: { sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0363 sl@0: @SYMTestCaseDesc Text Cursor when drawing redirected sl@0: @SYMTestPriority Medium sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Action steps: sl@0: - Draw the text cursor in the left side of the screen sl@0: - Re-direct the Front Buffer sl@0: - Move the text cursor to the right side of the screen sl@0: - Pause 0.5 seconds because this amount of time is needed sl@0: to change from the flash ON phase to the flash OFF phase sl@0: - Stop re-directing sl@0: - See if when we exit re-direction in a different place in sl@0: the phase of the text cursor flashing, whether we get sl@0: non-text cursor drawing artefacts in the old location sl@0: where the text cursor used to be sl@0: @SYMTestExpectedResults Left side of the screen does not show a Text Cursor sl@0: */ sl@0: sl@0: ASSERT(aCursorType == ETestStandardTextCursor || aCursorType == ETestCustomTextCursor); sl@0: sl@0: // Cursor Flash Period is 1 second (comprising two phases; ON and OFF) sl@0: const TInt KCursorFlashPeriod = 1000000; sl@0: const TInt KWaitForNextFlashPhase = KCursorFlashPeriod / 2; sl@0: sl@0: // Size of the cursor; it may be either a standard or custom text cursor sl@0: TSize cursorSize = (aCursorType == ETestStandardTextCursor) ? TSize(15, 20) : TSize(80, 80); sl@0: sl@0: // Original Text Cursor position in the left part of the screen sl@0: const TPoint originalCursorPos(45, 40); sl@0: sl@0: // New Text Cursor position in the right half of the screen sl@0: const TPoint newCursorPos((TheClient->iScreen->SizeInPixels().iWidth/2) + 45, 40); sl@0: sl@0: // Clean area of the screen which never had a text cursor sl@0: const TPoint cleanReferencePos(45, 40 + 80); sl@0: sl@0: /* Initial setup to get a window with a standard flashing text cursor */ sl@0: if (iSubState == 0) sl@0: { sl@0: ++iSubState; sl@0: CreateWindowL(ETrue); sl@0: sl@0: if (aCursorType == ETestStandardTextCursor) sl@0: { sl@0: _LIT(KTestTextCursorUnderRedirection, "TestTextCursorUnderRedirection(Standard Cursor)"); sl@0: INFO_PRINTF1(KTestTextCursorUnderRedirection); sl@0: iTextCursor.iType=TTextCursor::ETypeRectangle; sl@0: iTextCursor.iHeight=cursorSize.iHeight; sl@0: iTextCursor.iAscent=0; sl@0: iTextCursor.iWidth=cursorSize.iWidth; sl@0: iTextCursor.iFlags=0; // means flash the cursor sl@0: iTextCursor.iColor=KRgbGreen; sl@0: iWin->SetTextCursor(originalCursorPos, iTextCursor); sl@0: } sl@0: else if (aCursorType == ETestCustomTextCursor) sl@0: { sl@0: _LIT(KTestTextCursorUnderRedirection, "TestTextCursorUnderRedirection(Custom Cursor)"); sl@0: INFO_PRINTF1(KTestTextCursorUnderRedirection); sl@0: sl@0: TInt err = TheClient->iWs.SetCustomTextCursor( sl@0: KCustomTextCursorId, sl@0: iSpriteMemberArray.Array(), sl@0: ESpriteFlash, sl@0: RWsSession::ECustomTextCursorAlignTop sl@0: ); sl@0: iTextCursor.iType=KCustomTextCursorId; sl@0: iTextCursor.iHeight=cursorSize.iHeight; sl@0: iTextCursor.iAscent=0; sl@0: iTextCursor.iWidth=cursorSize.iWidth; sl@0: iTextCursor.iFlags=TTextCursor::EFlagClipHorizontal; // means flash the cursor and clip the sprite sl@0: iTextCursor.iColor=KRgbCyan; sl@0: iWin->SetTextCursor(originalCursorPos, iTextCursor); sl@0: } sl@0: else sl@0: { sl@0: // unknown type of test being requested sl@0: ASSERT(0); sl@0: } sl@0: iWin->DrawFirstHalf(); sl@0: return EWait; sl@0: } sl@0: /* sl@0: * Re-direct drawing to another Front Buffer. Whilst re-directed, change the sl@0: * position of the text cursor. Then pause 0.5 seconds because this is how sl@0: * long it will take to enter the next phase in the flashing cycle. Finally sl@0: * stop re-directing. We exit the re-direction in a different point in the sl@0: * phase of the text cursor from when we entered it. sl@0: * This is key to testing for faulty behaviour. sl@0: */ sl@0: if (iSubState==1) sl@0: { sl@0: ++iSubState; sl@0: User::After(KCursorFlashPeriod * 2); // so its easy to visually review progress sl@0: iRedir->Redirect(CWsRedir::EFrontBuffer, ETrue); sl@0: iWin->SetTextCursor(newCursorPos, iTextCursor); sl@0: User::After(KWaitForNextFlashPhase); sl@0: iRedir->Redirect(CWsRedir::EFrontBuffer, EFalse); sl@0: return EWait; sl@0: } sl@0: /* sl@0: * Paint the right hand side of the screen which should now have a text cursor. sl@0: */ sl@0: if (iSubState==2) sl@0: { sl@0: ++iSubState; sl@0: iWin->DrawSecondHalf(); sl@0: return EWait; sl@0: } sl@0: /* sl@0: * Let the cursor flash a few times, as it assists manual viewing of the progress sl@0: * of the test. sl@0: */ sl@0: if (iSubState==3) sl@0: { sl@0: ++iSubState; sl@0: User::After(KCursorFlashPeriod * 3); sl@0: return EWait; sl@0: } sl@0: /* sl@0: * Check to see if the text cursor did move to the right of the screen. sl@0: */ sl@0: if (iSubState==4) sl@0: { sl@0: ++iSubState; sl@0: sl@0: /* When we do a screen comparison, we supply flag 0, which means sl@0: * don't include the text cursor. We do this because we are interested sl@0: * in screen artefacts. sl@0: */ sl@0: TEST(TheClient->iScreen->RectCompare( sl@0: TRect(originalCursorPos, cursorSize), sl@0: TRect(cleanReferencePos, cursorSize), sl@0: 0)); // must not supply CWsScreenDevice::EIncludeTextCursor sl@0: sl@0: return EWait; sl@0: } sl@0: /* Clean up */ sl@0: if (iSubState==5) sl@0: { sl@0: ++iSubState; sl@0: iWin->CancelTextCursor(); sl@0: DestroyWindowL(); sl@0: } sl@0: sl@0: iSubState = 0; sl@0: sl@0: return ENext; sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0375 sl@0: @SYMREQ GT247-CR0714 sl@0: @SYMTestCaseDesc Redirect wserv flickerfree drawing to custom graphics context sl@0: @SYMTestPriority Medium sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Redirect wserv flickerfree buffer drawing. sl@0: Action step: sl@0: -Draw opaque window (as background) and transparent window sl@0: -Save screen content to a bitmap sl@0: -Instruct plugin to redirect wserv flickerfree buffer drawing sl@0: -Draw the same opaque window and transparent window again sl@0: -Retrieve plugin bitmap and compare against the saved bitmap sl@0: @SYMTestExpectedResults Bitmap content match sl@0: */ sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0376 sl@0: @SYMREQ GT247-CR0714 sl@0: @SYMTestCaseDesc Stop wserv flickerfree drawing redirection sl@0: @SYMTestPriority Medium sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Stop wserv flickerfree buffer drawing redirection. sl@0: Action step: sl@0: -Instruct plugin to stop wserv filckerfree drawing redirection sl@0: -Draw the same opaque and transparent window sl@0: -Save screen content to another bitmap sl@0: -Compare saved bitmap against newly saved bitmap sl@0: @SYMTestExpectedResults Bitmap content match sl@0: */ sl@0: sl@0: TestState CTWsGraphs::TestFlickerRedirectionL() sl@0: { sl@0: if (TransparencySupportedL()==KErrNotSupported) sl@0: { sl@0: ++(iTest->iState); sl@0: return ENext; sl@0: } sl@0: sl@0: // flush transparent window destruction created in TransparencySupportedL before sl@0: // proceeding with the test sl@0: sl@0: TheClient->iWs.Flush(); sl@0: sl@0: if (iSubState==0) sl@0: { sl@0: _LIT(KTestFlickerRedirection, "TestFlickerRedirection"); sl@0: INFO_PRINTF1(KTestFlickerRedirection); sl@0: sl@0: ++iSubState; sl@0: sl@0: CreateWindowL(); sl@0: CreateAlphaWindowL(); sl@0: TheClient->iScreen->CopyScreenToBitmap(iBefore); sl@0: DestroyAlphaWindowL(); sl@0: DestroyWindowL(); sl@0: iRedir->Redirect(CWsRedir::EBackBuffer, ETrue); sl@0: return EWait; sl@0: } sl@0: sl@0: if (iSubState==1) sl@0: { sl@0: ++iSubState; sl@0: CreateWindowL(); sl@0: CreateAlphaWindowL(); sl@0: TSize sz = iBefore->SizeInPixels(); sl@0: TInt bytes = sz.iWidth*sz.iHeight*2; // EColor64K sl@0: iBefore->LockHeap(); sl@0: TInt ret=Mem::Compare((const TUint8*)iBackCopy->DataAddress(),bytes,(const TUint8*)iBefore->DataAddress(),bytes); sl@0: TEST(ret==0); sl@0: if (ret!=0) sl@0: { sl@0: _LIT(KLog,"The memory of two bitmaps doesn't match"); sl@0: LOG_MESSAGE(KLog); sl@0: } sl@0: iBefore->UnlockHeap(); sl@0: DestroyAlphaWindowL(); sl@0: DestroyWindowL(); sl@0: iRedir->Redirect(CWsRedir::EBackBuffer, EFalse); sl@0: return EWait; sl@0: } sl@0: sl@0: CreateWindowL(); sl@0: CreateAlphaWindowL(); sl@0: TheClient->iScreen->CopyScreenToBitmap(iAfter); sl@0: TSize sz = iBefore->SizeInPixels(); sl@0: TInt bytes = sz.iWidth*sz.iHeight*2; // EColor64K sl@0: iAfter->LockHeap(); sl@0: TEST(Mem::Compare((const TUint8*)iAfter->DataAddress(),bytes,(const TUint8*)iBefore->DataAddress(),bytes)==0); sl@0: iAfter->UnlockHeap(); sl@0: DestroyAlphaWindowL(); sl@0: DestroyWindowL(); sl@0: sl@0: ++(iTest->iState); sl@0: iSubState = 0; sl@0: return ENext; sl@0: } sl@0: sl@0: #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0377 sl@0: @SYMREQ GT247-CR0714 sl@0: @SYMTestCaseDesc Enable event notification sl@0: @SYMTestPriority Medium sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Enable plugin to register to event notification. sl@0: Action step: sl@0: -Instruct plugin to register event handler sl@0: -Draw fullscreen window (plugin will receive window visibility changed event) sl@0: -Query visibility region from plugin side sl@0: -Compare window visible region against value obtained by plugin sl@0: @SYMTestExpectedResults Visible region match sl@0: */ sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0378 sl@0: @SYMREQ GT247-CR0714 sl@0: @SYMTestCaseDesc Disable event notification sl@0: @SYMTestPriority Medium sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Disable plugin to register to event notification. sl@0: Action step: sl@0: -Instruct plugin to unregister event handler sl@0: -Destroy fullscreen window (plugin will not receive window visibility changed event) sl@0: -Query visibility region from plugin side sl@0: sl@0: @SYMTestExpectedResults Plugin does not receive events notification sl@0: */ sl@0: TestState CTWsGraphs::TestEventNotificationL() sl@0: { sl@0: if (iSubState==0) sl@0: { sl@0: _LIT(KTestEventNotification, "TestEventNotification"); sl@0: INFO_PRINTF1(KTestEventNotification); sl@0: sl@0: ++iSubState; sl@0: iListen->Enable(ETrue); sl@0: CreateWindowL(); sl@0: Mem::FillZ(&iListenInfo, sizeof(TListenerInfo)); sl@0: TheClient->iWs.Finish(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: iListen->QueryPlugin(iListenInfo); sl@0: return EWait; sl@0: } sl@0: sl@0: if (iSubState==1) sl@0: { sl@0: ++iSubState; sl@0: iListen->Enable(EFalse); sl@0: TEST(iListenInfo.iNumRect==1); sl@0: TEST(iListenInfo.iRect==TRect(TPoint(0,0),TheClient->iScreen->SizeInPixels())); sl@0: DestroyWindowL(); sl@0: Mem::FillZ(&iListenInfo, sizeof(TListenerInfo)); sl@0: iListen->QueryPlugin(iListenInfo); sl@0: iListen->Enable(EFalse); sl@0: DestroyWindowL(); sl@0: return EWait; sl@0: } sl@0: sl@0: TEST(iListenInfo.iNumRect==0); sl@0: sl@0: ++(iTest->iState); sl@0: iSubState = 0; sl@0: return ENext; sl@0: } sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: sl@0: TestState CTWsGraphs::TestRedirectionUsingWsBackBufferL() sl@0: { sl@0: if (TransparencySupportedL()==KErrNotSupported) sl@0: { sl@0: ++(iTest->iState); sl@0: return ENext; sl@0: } sl@0: sl@0: // flush transparent window destruction created in TransparencySupportedL before sl@0: // proceeding with the test sl@0: sl@0: TheClient->iWs.Flush(); sl@0: sl@0: if (iSubState==0) sl@0: { sl@0: _LIT(KTestRedirectionWsBack, "TestRedirectionUsingWsBackBuffer"); sl@0: INFO_PRINTF1(KTestRedirectionWsBack); sl@0: sl@0: ++iSubState; sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0379 sl@0: @SYMTestCaseDesc Redirect wserv flickerfree to MWsBackBuffer object sl@0: @SYMTestPriority Medium sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions -Draw opaque window (as background) and transparent window sl@0: -Save screen content to a bitmap sl@0: -Instruct plugin to redirect flickerfree buffer to MWsBackBuffer object sl@0: -Draw the same opaque window and transparent window again sl@0: -Retrieve plugin bitmap and compare against the saved bitmap sl@0: @SYMTestExpectedResults Bitmap content match sl@0: */ sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0379")); sl@0: CreateWindowL(); sl@0: CreateAlphaWindowL(); sl@0: TheClient->iScreen->CopyScreenToBitmap(iBefore); sl@0: DestroyAlphaWindowL(); sl@0: DestroyWindowL(); sl@0: iRedir->RedirectUsingWsBackBuffer(ETrue); sl@0: return EWait; sl@0: } sl@0: sl@0: if (iSubState==1) sl@0: { sl@0: ++iSubState; sl@0: CreateWindowL(); sl@0: CreateAlphaWindowL(); sl@0: TSize sz = iBefore->SizeInPixels(); sl@0: TInt bytes = sz.iWidth*sz.iHeight*2; // EColor64K sl@0: iBefore->LockHeap(); sl@0: TInt ret=Mem::Compare((const TUint8*)iBackCopy->DataAddress(),bytes,(const TUint8*)iBefore->DataAddress(),bytes); sl@0: TEST(ret==0); sl@0: if (ret!=0) sl@0: { sl@0: _LIT(KLog,"The memory of two bitmaps doesn't match"); sl@0: LOG_MESSAGE(KLog); sl@0: } sl@0: iBefore->UnlockHeap(); sl@0: DestroyAlphaWindowL(); sl@0: DestroyWindowL(); sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0380 sl@0: @SYMTestCaseDesc Restore wserv flickerfree redirection from MWsBackBuffer object sl@0: @SYMTestPriority Medium sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions -Instruct plugin to stop wserv filckerfree drawing redirection sl@0: -Draw the same opaque and transparent window sl@0: -Save screen content to another bitmap sl@0: -Compare saved bitmap against newly saved bitmap sl@0: @SYMTestExpectedResults Bitmap content match sl@0: */ sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0380")); sl@0: iRedir->RedirectUsingWsBackBuffer(EFalse); sl@0: return EWait; sl@0: } sl@0: sl@0: CreateWindowL(); sl@0: CreateAlphaWindowL(); sl@0: TheClient->iScreen->CopyScreenToBitmap(iAfter); sl@0: TSize sz = iBefore->SizeInPixels(); sl@0: TInt bytes = sz.iWidth*sz.iHeight*2; // EColor64K sl@0: iAfter->LockHeap(); sl@0: TEST(Mem::Compare((const TUint8*)iAfter->DataAddress(),bytes,(const TUint8*)iBefore->DataAddress(),bytes)==0); sl@0: iAfter->UnlockHeap(); sl@0: DestroyAlphaWindowL(); sl@0: DestroyWindowL(); sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0527 sl@0: */ sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0527")); sl@0: ++(iTest->iState); sl@0: iSubState = 0; sl@0: return ENext; sl@0: } sl@0: sl@0: #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: sl@0: //A call to do coverage through a plugin. sl@0: //This can serve as a basis for future coverage to objects exposed by the sl@0: //plugin. For now a single simple test is implmeneted. sl@0: TestState CTWsGraphs::TestGraphicDrawerCoverage() sl@0: { sl@0: __ASSERT_ALWAYS(iGdCoverage->RunTest(1)==KErrNone||KErrNotReady, User::Invariant()); sl@0: return ENext; sl@0: } sl@0: sl@0: //Simplified non-functional class to create a few dummy CWsGraphicDrawer instances. sl@0: //This code is intended to test the Array class, not the Drawer. sl@0: //Note that this object is not at all functional! The only guaranteed method is Id(). sl@0: //WsGraphicDrawer is declared as a friend and is actually intended to be the factory class for CWsGraphicDrawer sl@0: class WsGraphicDrawer:public CWsGraphicDrawer sl@0: { sl@0: public: sl@0: WsGraphicDrawer() sl@0: { sl@0: } sl@0: //stub for virtual construction. Most members are ignored sl@0: virtual void ConstructL(MWsGraphicDrawerEnvironment& ,const TGraphicDrawerId& id,MWsClient& ,const TDesC8& ) sl@0: { sl@0: ConstructL(id); sl@0: } sl@0: //simplified custom construction sl@0: void ConstructL(const TGraphicDrawerId& id) sl@0: { sl@0: MWsGraphicDrawerEnvironment* nullEnv=NULL; sl@0: MWsGraphicDrawerEnvironment& aEnv=*nullEnv; sl@0: MWsClient* nullClient=NULL; sl@0: MWsClient& aOwner=*nullClient; sl@0: this->BaseConstructL(aEnv,id,aOwner); sl@0: this->iDtor_ID_Key=TUid::Null(); sl@0: sl@0: } sl@0: //stubs for pure virtual methods sl@0: virtual void HandleMessage(const TDesC8& ) sl@0: {} sl@0: virtual void DoDraw(MWsGc& ,const TRect& ,const TDesC8& ) const sl@0: {} sl@0: sl@0: }; sl@0: //Class to allow me to pre-allocate the CWsGraphicDrawerArray so it doesn't pop up a false-positive memory allocation! sl@0: class DummyCleanup:public TCleanupItem sl@0: { sl@0: public: sl@0: static void CleanUp(TAny*) {} sl@0: DummyCleanup(): TCleanupItem(CleanUp,this) {} sl@0: operator DummyCleanup*() { return this; } sl@0: sl@0: }; sl@0: sl@0: //Helper function to explain test fails. Most other tests are against KErrNone sl@0: void CTWsGraphs::ReportNegativeResultfail(TInt aLine,TInt aResult,TInt aExpectedResult) sl@0: { sl@0: testBooleanTrue((aResult==aExpectedResult), (TText8*)__FILE__, aLine); sl@0: if (aResult!=aExpectedResult) sl@0: { sl@0: INFO_PRINTF3(_L("Expected return code %i, got %i"),aExpectedResult,aResult); sl@0: } sl@0: sl@0: } sl@0: sl@0: //This is an attempt to use wserv test's pre-existing Panic handler to perform some negative tests. sl@0: //At present this handler appears to be broken: sl@0: // 1) It doesn't write to the correct html log file sl@0: // 2) It no longer writes to the WSERV.LOG file it was writing to a few versions ago sl@0: // 3) It doesn't close the panic window so subsequent tests that check the display output fail. sl@0: //That was a waste of effort. sl@0: struct CTWsGraphs::WrapTestCall sl@0: { sl@0: CTWsGraphs* thisThis; sl@0: TUint testCount; sl@0: TBool continueTests; sl@0: TUint testFailedLine; sl@0: //This field was intended to allow threaded panicing tests to report other errors sl@0: //As I can't get threaded panicing tests to operate correctly, I have not implemented support for the field. sl@0: //TBuf<1024> errorMessages; sl@0: sl@0: WrapTestCall ( CTWsGraphs* thisThis, TUint testCount): sl@0: thisThis(thisThis), testCount(testCount) sl@0: { continueTests=false;testFailedLine=0; } sl@0: }; sl@0: sl@0: TInt CTWsGraphs::DoNegTestCall(TInt /*aInt*/, TAny *aPtr) sl@0: { sl@0: CTWsGraphs::WrapTestCall* aWrap=static_cast(aPtr); sl@0: aWrap->continueTests=aWrap->thisThis->NegTestAddSwapGDArrayL(aWrap->testCount,aWrap); sl@0: return 0; sl@0: } sl@0: sl@0: TBool CTWsGraphs::LaunchNegTestCall(TUint aTestCount,TUint PanicCode,const TDesC &aPanicCategory) sl@0: { sl@0: WrapTestCall wt(this,aTestCount); sl@0: (void)PanicCode; sl@0: (void)aPanicCategory; sl@0: //I have disabled the panicing tests because they don't output diagnostics sl@0: //and the open panic window causes subsequent screen bitmap comparrisson tests to fail. sl@0: // iTest->TestPanicL(DoNegTestCall,aPanicCode,3,&wt,aPanicCategory); sl@0: return wt.continueTests; sl@0: } sl@0: sl@0: /** sl@0: Loops through all the positive and negative tests associated with the GraphicDrawerArray. sl@0: The aim is to perform isolated testing of these classes as some are not currently being used. sl@0: sl@0: **/ sl@0: void CTWsGraphs::TestAddSwapGDArrayL() sl@0: { sl@0: sl@0: sl@0: INFO_PRINTF1(_L("Positive tests for GraphicDrawerArray")); sl@0: for (TInt i=0;PosTestAddSwapGDArrayL(i);i++) sl@0: {} sl@0: sl@0: sl@0: sl@0: INFO_PRINTF1(_L("Verifying that negative tests for GraphicDrawerArray don't actually panic")); sl@0: for (TInt i=1;NegTestAddSwapGDArrayL(i);i++) sl@0: {} sl@0: } sl@0: /** sl@0: Resets and deallocates the GDA withoud deleting the objects. sl@0: @param testArray the array to reset sl@0: @return true if the array was already empty. sl@0: **/ sl@0: static bool ResetArray(CWsGraphicDrawerArray& testArray) sl@0: { sl@0: bool rv=(testArray.IsEmpty()); sl@0: MWsClient* nullClient=NULL; sl@0: testArray.RemoveAll(*nullClient); sl@0: testArray.ResetAndDestroy(); sl@0: return rv; sl@0: } sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-AddSwapGDArray-0001 sl@0: @SYMDEF DEF093926 sl@0: sl@0: @SYMTestCaseDesc DEF093926: Check for stability of Add and Swap unwind methods in isolation. sl@0: Note that this code is testing the functionality of a class internal to CWindowServer. sl@0: At present CWindowServer presents just a simple shim on this class, sl@0: but if that implementation of CWindowServer changes than this test will be redudant. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions sl@0: The sequence for each of these positive test sections is pretty much the same: sl@0: Add one record with id 1234(test for errors) sl@0: Add one record with id Badf00d sl@0: Swap with another record with id Badf00d sl@0: Remove 2 records sl@0: result=no leaks sl@0: sl@0: Add/Swap: no Cleanup item - no leaks after Remove the added items sl@0: AddTLC/SwapTLC: Cleanup item requires Commit - check for no leaks after Remove. sl@0: AddTLC/SwapTLC: Cleanup item gets executed by forced Leave - check for no leaks after. sl@0: AddTLC, SwapTLC in allocation failure scenarios. Add/Swap don't allocate anything! sl@0: obsoleted AddLC/SwapLC to ensure correct function when forced Leave - check for no leaks after sl@0: obsoleted AddLC/SwapLC to ensure correct function. These will always leak in good case. sl@0: @SYMTestExpectedResults sl@0: no exceptions or panics within this fn. sl@0: only the old AddLC and SwapLC should leak as indicated. sl@0: */ sl@0: TBool CTWsGraphs::PosTestAddSwapGDArrayL(TInt testcase) sl@0: { sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-AddSwapGDArray-0001")); sl@0: CWsGraphicDrawerArray testArray; sl@0: //Represents the memory cached in the array once it has been used even when it is then resized to zero sl@0: #if defined(_DEBUG) sl@0: const TInt KArrayMemUseBaseline=1; sl@0: #endif sl@0: //Use testArray.IsEmpty() to prove the array is clear when it should be! sl@0: TGraphicDrawerId id1234= { 1234, EFalse }; sl@0: TGraphicDrawerId idBADF00D= { 0xBADF00D, EFalse }; sl@0: WsGraphicDrawer dg1234; sl@0: dg1234.ConstructL(id1234); sl@0: WsGraphicDrawer dgBADF00D; sl@0: dgBADF00D.ConstructL(idBADF00D); sl@0: WsGraphicDrawer dgBADF00D_2; sl@0: dgBADF00D_2.ConstructL(idBADF00D); sl@0: CWsGraphicDrawerArray::XRollBackBase* rollBack1; sl@0: TInt errCode=KErrAbort; sl@0: TInt leaveCode=KErrNone; sl@0: DummyCleanup markerCleanup; sl@0: CleanupStack::PushL(markerCleanup); //This allows me to check the stack is clear! sl@0: //expected result of this fn: no exceptions or panics. sl@0: //Put as much as you like in here, so long as it shouldn't fail. sl@0: sl@0: __UHEAP_MARK; sl@0: __UHEAP_CHECK(0); sl@0: TUint expectedLeakCount=0; sl@0: TBool returnCode=ETrue; sl@0: switch (testcase) sl@0: { sl@0: case 0: sl@0: sl@0: INFO_PRINTF1(_L("Sub test P0: AddL/Swap: no Cleanup item")); sl@0: TEST(testArray.IsEmpty()); sl@0: TRAP(leaveCode,errCode=testArray.Add(&dg1234)); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: TEST(!testArray.IsEmpty()); sl@0: TRAP(leaveCode,errCode=testArray.Add(&dgBADF00D)); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: TRAP(leaveCode,errCode=testArray.Swap(&dgBADF00D_2)); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: TRAP(leaveCode,errCode=testArray.Remove(dg1234.Id())); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: //Note that it is the ID that matters here... dgBADF00D & dgBADF00D_2 have same id. sl@0: TRAP(leaveCode,errCode=testArray.Remove(dgBADF00D_2.Id())); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: TEST(testArray.IsEmpty()); sl@0: break; sl@0: // sl@0: case 1: sl@0: INFO_PRINTF1(_L("Sub test P1: AddTLC/SwapTLC: Cleanup item requires Commit.")); sl@0: sl@0: rollBack1=NULL; sl@0: TEST(testArray.IsEmpty()); sl@0: TRAP(leaveCode, sl@0: rollBack1=testArray.AddTLC(&dg1234); sl@0: CleanupStack::Check(rollBack1); sl@0: testArray.CommitP(rollBack1); sl@0: ) sl@0: TEST(rollBack1!=NULL); sl@0: TEST(leaveCode==KErrNone); sl@0: TEST(!testArray.IsEmpty()); sl@0: rollBack1=NULL; sl@0: TRAP(leaveCode, sl@0: rollBack1=testArray.AddTLC(&dgBADF00D); sl@0: CleanupStack::Check(rollBack1); sl@0: testArray.CommitP(rollBack1); sl@0: ) sl@0: TEST(rollBack1!=NULL); sl@0: TEST(leaveCode==KErrNone); sl@0: rollBack1=NULL; sl@0: TRAP(leaveCode, sl@0: rollBack1=testArray.SwapTLC(&dgBADF00D_2); sl@0: CleanupStack::Check(rollBack1); sl@0: testArray.CommitP(rollBack1); sl@0: ) sl@0: TEST(rollBack1!=NULL); sl@0: TEST(leaveCode==KErrNone); sl@0: rollBack1=NULL; sl@0: TRAP(leaveCode, sl@0: rollBack1=testArray.RemoveTLC(dg1234.Id()); sl@0: CleanupStack::Check(rollBack1); sl@0: testArray.CommitP(rollBack1); sl@0: ) sl@0: TEST(rollBack1!=NULL); sl@0: TEST(leaveCode==KErrNone); sl@0: rollBack1=NULL; sl@0: TRAP(leaveCode, sl@0: rollBack1=testArray.RemoveTLC(dgBADF00D_2.Id()); sl@0: CleanupStack::Check(rollBack1); sl@0: testArray.CommitP(rollBack1); sl@0: ) sl@0: TEST(rollBack1!=NULL); sl@0: TEST(leaveCode==KErrNone); sl@0: rollBack1=NULL; sl@0: TEST(testArray.IsEmpty()); sl@0: break; sl@0: // sl@0: case 2: sl@0: INFO_PRINTF1(_L("Sub test P2: AddTLC/SwapTLC: Cleanup item gets executed.")); sl@0: sl@0: rollBack1=NULL; sl@0: TEST(testArray.IsEmpty()); sl@0: TRAP(leaveCode, sl@0: rollBack1=testArray.AddTLC(&dg1234); sl@0: User::Leave(1234); sl@0: ); sl@0: TEST(rollBack1!=NULL); sl@0: TEST(leaveCode==1234); sl@0: TEST(testArray.IsEmpty()); sl@0: rollBack1=NULL; sl@0: CleanupStack::Check(markerCleanup); sl@0: __UHEAP_CHECK(KArrayMemUseBaseline); sl@0: sl@0: TRAP(leaveCode, errCode=testArray.Add(&dgBADF00D)); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: rollBack1=NULL; sl@0: TRAP(leaveCode, sl@0: rollBack1=testArray.SwapTLC(&dgBADF00D_2); sl@0: User::Leave(1234); sl@0: ); sl@0: TEST(rollBack1!=NULL); sl@0: TEST(leaveCode==1234); sl@0: TEST(!testArray.IsEmpty()); sl@0: rollBack1=NULL; sl@0: TRAP(leaveCode, sl@0: rollBack1=testArray.RemoveTLC(dgBADF00D_2.Id()); sl@0: TEST(testArray.IsEmpty()); sl@0: User::Leave(1234); sl@0: ); sl@0: TEST(rollBack1!=NULL); sl@0: TEST(leaveCode==1234); sl@0: TEST(!testArray.IsEmpty()); sl@0: sl@0: sl@0: TRAP(leaveCode,errCode=testArray.Remove(dgBADF00D_2.Id())); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: TEST(testArray.IsEmpty()); sl@0: rollBack1=NULL; sl@0: break; sl@0: // sl@0: case 3: sl@0: INFO_PRINTF1(_L("Sub test P3: AddLC/SwapLC: Cleanup item gets executed - doesn't leak")); sl@0: TEST(testArray.IsEmpty()); sl@0: TRAP(leaveCode, sl@0: testArray.AddLC(&dg1234); sl@0: User::Leave(1234); sl@0: ); sl@0: TEST(leaveCode==1234); sl@0: TEST(testArray.IsEmpty()); sl@0: rollBack1=NULL; sl@0: __UHEAP_CHECK(KArrayMemUseBaseline); //because it threw it didn't leak sl@0: sl@0: //use my new method to add the object to be swapped out so no leak sl@0: TRAP(leaveCode,errCode=testArray.Add(&dgBADF00D)); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: __UHEAP_CHECK(KArrayMemUseBaseline); //new method doesn't leak. sl@0: rollBack1=NULL; sl@0: TRAP(leaveCode, sl@0: errCode=testArray.SwapLC(&dgBADF00D_2); sl@0: User::Leave(1234); sl@0: ); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==1234); sl@0: TEST(!testArray.IsEmpty()); sl@0: sl@0: TRAP(leaveCode,errCode=testArray.Remove(dgBADF00D_2.Id())); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: TEST(testArray.IsEmpty()); sl@0: rollBack1=NULL; sl@0: break; sl@0: // sl@0: case 4: sl@0: sl@0: //I don't really care whether the individual calls succeed or fail, sl@0: //just whether it leaks overall, and that the error codes correspond to no-action sl@0: for (TInt faultRate=1;faultRate<5;faultRate++) sl@0: { sl@0: INFO_PRINTF2(_L("Sub test P4: Add/Swap: memory faulting %i"),faultRate); sl@0: __UHEAP_SETFAIL(RAllocator::EDeterministic,faultRate); sl@0: TInt err1=KErrNone; sl@0: rollBack1=NULL; sl@0: TRAP(leaveCode, sl@0: errCode=testArray.Add(&dg1234); sl@0: ) sl@0: err1=errCode; sl@0: __UHEAP_SETFAIL(RAllocator::ENone,0); sl@0: TRAP(leaveCode,errCode=testArray.Add(&dgBADF00D)); sl@0: __UHEAP_SETFAIL(RAllocator::EDeterministic,faultRate); sl@0: rollBack1=NULL; sl@0: TRAP(leaveCode, sl@0: errCode=testArray.Swap(&dgBADF00D_2); sl@0: ) sl@0: __UHEAP_SETFAIL(RAllocator::ENone,0); sl@0: //If the first Add fails then the object should not be removed sl@0: if (!err1) sl@0: { sl@0: TRAP(leaveCode,errCode=testArray.Remove(dg1234.Id())); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: } sl@0: //If the swap fails, then the add still needs to be removed sl@0: //Note that it is the ID that matters here... dgBADF00D & dgBADF00D_2 have same id. sl@0: TRAP(leaveCode,errCode=testArray.Remove(dgBADF00D_2.Id())); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: TEST(testArray.IsEmpty()); sl@0: ResetArray(testArray); sl@0: CleanupStack::Check(markerCleanup); sl@0: __UHEAP_CHECK(0); sl@0: } sl@0: break; sl@0: // sl@0: case 5: sl@0: sl@0: //I don't really care whether the individual calls succeed or fail, sl@0: //just whether it leaks overall, and that the error codes correspond to no-action sl@0: for (TInt faultRate=1;faultRate<5;faultRate++) sl@0: { sl@0: INFO_PRINTF2(_L("Sub test P5: AddTLC/SwapTLC: memory faulting %i"),faultRate); sl@0: __UHEAP_SETFAIL(RAllocator::EDeterministic,faultRate); sl@0: TInt err1=KErrNone,err2=KErrNone,err3=KErrNone; sl@0: rollBack1=NULL; sl@0: TRAP(leaveCode, sl@0: rollBack1=testArray.AddTLC(&dg1234); sl@0: CleanupStack::Check(rollBack1); sl@0: testArray.CommitP(rollBack1); sl@0: ) sl@0: err1=leaveCode; sl@0: __UHEAP_SETFAIL(RAllocator::ENone,0); sl@0: TRAP(leaveCode,errCode=testArray.Add(&dgBADF00D)); sl@0: __UHEAP_SETFAIL(RAllocator::EDeterministic,faultRate); sl@0: rollBack1=NULL; sl@0: TRAP(leaveCode, sl@0: rollBack1=testArray.SwapTLC(&dgBADF00D_2); sl@0: CleanupStack::Check(rollBack1); sl@0: testArray.CommitP(rollBack1); sl@0: ) sl@0: //If the first Add fails then the object should not be removed sl@0: if (!err1) sl@0: { sl@0: TRAP(leaveCode, sl@0: rollBack1=testArray.RemoveTLC(dg1234.Id()); sl@0: CleanupStack::Check(rollBack1); sl@0: testArray.CommitP(rollBack1); sl@0: ) sl@0: err2=leaveCode; sl@0: } sl@0: //If the swap fails, then the add still needs to be removed sl@0: //Note that it is the ID that matters here... dgBADF00D & dgBADF00D_2 have same id. sl@0: TRAP(leaveCode, sl@0: rollBack1=testArray.RemoveTLC(dgBADF00D_2.Id()); sl@0: CleanupStack::Check(rollBack1); sl@0: testArray.CommitP(rollBack1); sl@0: ) sl@0: err3=leaveCode; sl@0: sl@0: sl@0: __UHEAP_SETFAIL(RAllocator::ENone,0); sl@0: //If the Removes failed then the object should be removed again sl@0: if (err2) sl@0: { sl@0: TRAP(leaveCode,errCode=testArray.Remove(dg1234.Id())); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: } sl@0: if (err3) sl@0: { sl@0: TRAP(leaveCode,errCode=testArray.Remove(dgBADF00D_2.Id())); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: } sl@0: TEST(testArray.IsEmpty()); sl@0: ResetArray(testArray); sl@0: CleanupStack::Check(markerCleanup); sl@0: __UHEAP_CHECK(0); sl@0: } sl@0: sl@0: break; sl@0: // sl@0: case 6: sl@0: //this set does leak: sl@0: sl@0: INFO_PRINTF1(_L("Sub test P6: AddLC/SwapLC: Cleanup item gets popped - unfixable leaks")); sl@0: TEST(testArray.IsEmpty()); sl@0: TRAP(leaveCode, sl@0: testArray.AddLC(&dg1234); sl@0: CleanupStack::Pop(); sl@0: ); sl@0: TEST(leaveCode==KErrNone); sl@0: TEST(!testArray.IsEmpty()); sl@0: sl@0: CleanupStack::Check(markerCleanup); sl@0: __UHEAP_CHECK(KArrayMemUseBaseline+1); sl@0: sl@0: TRAP(leaveCode, sl@0: testArray.AddLC(&dgBADF00D); sl@0: CleanupStack::Pop(); sl@0: ) sl@0: TEST(leaveCode==KErrNone); sl@0: CleanupStack::Check(markerCleanup); sl@0: __UHEAP_CHECK(KArrayMemUseBaseline+2); sl@0: rollBack1=NULL; sl@0: TRAP(leaveCode, sl@0: errCode=testArray.SwapLC(&dgBADF00D_2); sl@0: CleanupStack::Pop(); sl@0: ); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: TEST(!testArray.IsEmpty()); sl@0: TRAP(leaveCode,errCode=testArray.Remove(dg1234.Id())); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: TRAP(leaveCode,errCode=testArray.Remove(dgBADF00D_2.Id())); sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: TEST(testArray.IsEmpty()); sl@0: rollBack1=NULL; sl@0: expectedLeakCount=3; sl@0: break; sl@0: // sl@0: case 7: sl@0: returnCode=EFalse; sl@0: break; sl@0: } sl@0: ResetArray(testArray); sl@0: CleanupStack::Check(markerCleanup); sl@0: __UHEAP_CHECK(expectedLeakCount); sl@0: __UHEAP_MARKENDC(expectedLeakCount); sl@0: if (expectedLeakCount!=0) sl@0: { //Ensure that the leaked items are no longer associated with this debug level. sl@0: //Note that __DbgSetAllocFail(FALSE,RAllocator::EReset,1) resets the debug level to 0, sl@0: //so levels can't be nested when using this call. sl@0: __UHEAP_MARK; sl@0: __UHEAP_TOTAL_RESET; sl@0: INFO_PRINTF2(_L("Anticipated %i leaks declassified"),expectedLeakCount); //can't get here if wrong sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(markerCleanup); sl@0: ((CTWsGraphsStep*)iStep)->RecordTestResultL(); sl@0: return returnCode; sl@0: } sl@0: sl@0: /** sl@0: @param failcase index to test to perform sl@0: @param aWrappedParams represents inter-thread information when test is run on a private thread sl@0: if aWrappedParams is NULL then the test is running on the main thread. sl@0: @return true if there are higher-numbered fail cases. sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-NegAddSwapGDArray-0001 sl@0: @SYMDEF DEF093926 sl@0: sl@0: @SYMTestCaseDesc DEF093926: Check for stability of Add and Swap unwind methods in isolation, sl@0: specifically checking that bad inputs are rejected gracefully. sl@0: Note that this code is testing the functionality of a class internal to CWindowServer. sl@0: At present CWindowServer presents just a simple shim on this class, sl@0: but if that implementation of CWindowServer changes than this test will be redudant. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions sl@0: sl@0: Add/Swap: no Cleanup item - no leaks after Remove the added items sl@0: AddTLC/SwapTLC: Cleanup item requires Commit - check for no leaks after Remove. sl@0: AddTLC/SwapTLC: Cleanup item gets executed by forced Leave - check for no leaks after. sl@0: AddTLC, SwapTLC in allocation failure scenarios. Add/Swap don't allocate anything! sl@0: obsoleted AddLC/SwapLC to ensure correct function when forced Leave - check for no leaks after sl@0: obsoleted AddLC/SwapLC to ensure correct function. These will always leak in good case. sl@0: Calls NegTestAddSwapGDArrayL. sl@0: case 1/2/3: Tests AddL, AddLC, AddTLC that a NULL input is rejected sl@0: case 4/5/6: Tests SwapL, SwapLC, SwapTLC that a NULL input is rejected sl@0: case 7/8/9: Tests AddL, AddLC, AddTLC that a repeat input is rejected sl@0: case 10/11/12: Tests SwapL, SwapLC, SwapTLC that a non-repeat input is rejected sl@0: @SYMTestExpectedResults sl@0: */ sl@0: TBool CTWsGraphs::NegTestAddSwapGDArrayL(TInt failcase,WrapTestCall*aWrappedParams) sl@0: { sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-NegAddSwapGDArray-0001")); sl@0: _LIT(KCategory,"WsGraphicDrawer"); sl@0: if (!aWrappedParams) sl@0: { sl@0: INFO_PRINTF2(_L("NegTestAddSwapGDArrayL Negative sub test %i"),failcase); sl@0: }; sl@0: CWsGraphicDrawerArray testArray; sl@0: TGraphicDrawerId id1234= { 1234, EFalse }; sl@0: TGraphicDrawerId idBADF00D= { 0xBADF00D, EFalse }; sl@0: WsGraphicDrawer dg1234; sl@0: dg1234.ConstructL(id1234); sl@0: WsGraphicDrawer dgBADF00D; sl@0: dgBADF00D.ConstructL(idBADF00D); sl@0: WsGraphicDrawer dgBADF00D_2; sl@0: dgBADF00D_2.ConstructL(idBADF00D); sl@0: CWsGraphicDrawerArray::XRollBackBase* rollBack1=NULL; sl@0: TInt errCode=KErrAbort; sl@0: TInt leaveCode=KErrNone; sl@0: TBool returnMoreTests=ETrue; sl@0: DummyCleanup markerCleanup; sl@0: TBool mayPanic=EFalse; sl@0: #ifdef __WINS__ sl@0: mayPanic=ETrue; sl@0: #endif sl@0: sl@0: CleanupStack::PushL(markerCleanup); //This allows me to check the stack is clear! sl@0: __UHEAP_MARK; sl@0: sl@0: switch (failcase) sl@0: { sl@0: case 1: //NULL arg: expected result: returns KErrArgument sl@0: TRAP(leaveCode, sl@0: errCode=testArray.Add(NULL); sl@0: ) sl@0: TEST(leaveCode==KErrNone); sl@0: ReportNegativeResultfail(__LINE__,errCode,KErrArgument); sl@0: break; sl@0: case 2: //NULL arg: expected result: throws KErrArgument sl@0: TRAP(leaveCode, sl@0: rollBack1=testArray.AddTLC(NULL); sl@0: TEST(EFalse); //Should never get here! sl@0: ) sl@0: TEST(rollBack1==NULL); sl@0: ReportNegativeResultfail(__LINE__,leaveCode,KErrArgument); sl@0: break; sl@0: case 3: //NULL arg: expected result: debug: panic. In release doesn't return any information! sl@0: if (!aWrappedParams && mayPanic) sl@0: { sl@0: LaunchNegTestCall(failcase,EWsGraphicDrawerPanicBadArgument,KCategory); sl@0: } sl@0: else sl@0: { sl@0: TRAP(leaveCode, sl@0: testArray.AddLC(NULL); sl@0: User::Leave(1234); //Panics before here in debug. No leak if cleanup is taken. sl@0: ); sl@0: TEST(leaveCode==1234); //Panics before here in debug sl@0: } sl@0: break; sl@0: // sl@0: case 4: //NULL arg: expected result: returns KErrArgument sl@0: TRAP(leaveCode, sl@0: errCode=testArray.Swap(NULL) sl@0: ) sl@0: TEST(leaveCode==KErrNone); sl@0: ReportNegativeResultfail(__LINE__,errCode,KErrArgument); sl@0: break; sl@0: case 5: //expected result: throws KErrArgument sl@0: TRAP(leaveCode, sl@0: rollBack1=testArray.SwapTLC(NULL); sl@0: testArray.CommitP(rollBack1); sl@0: ) sl@0: TEST(rollBack1==NULL); sl@0: ReportNegativeResultfail(__LINE__,leaveCode,KErrArgument); sl@0: break; sl@0: case 6: //NULL arg: expected result: debug: panic. In release doesn't return any information! sl@0: if (!aWrappedParams && mayPanic) sl@0: { sl@0: LaunchNegTestCall(failcase,EWsGraphicDrawerPanicBadArgument,KCategory); sl@0: } sl@0: else sl@0: { sl@0: TRAP(leaveCode, sl@0: errCode=testArray.SwapLC(NULL); sl@0: User::Leave(1234); //Panics before here in debug. No leak if cleanup is taken. sl@0: ); sl@0: TEST(leaveCode==1234); //Panics before here in debug sl@0: TEST(errCode==KErrNotFound); sl@0: } sl@0: break; sl@0: // sl@0: case 7: //Add overwrites: expected result: returns KErrAlreadyExists sl@0: TRAP(leaveCode, sl@0: errCode=testArray.Add(&dg1234); sl@0: ) sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: TRAP(leaveCode, sl@0: errCode=testArray.Add(&dg1234); //oops! Already added! sl@0: ) sl@0: TEST(leaveCode==KErrNone); sl@0: ReportNegativeResultfail(__LINE__,errCode,KErrAlreadyExists); sl@0: break; sl@0: case 8: //Add overwrites: expected result: throws KErrAlreadyExists sl@0: TRAP(leaveCode, sl@0: errCode=testArray.Add(&dg1234); sl@0: ) sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: TRAP(leaveCode, sl@0: rollBack1=testArray.AddTLC(&dg1234); //oops! Already added! sl@0: testArray.CommitP(rollBack1); sl@0: ) sl@0: TEST(rollBack1==NULL); sl@0: ReportNegativeResultfail(__LINE__,leaveCode,KErrAlreadyExists); sl@0: break; sl@0: case 9: //Add overwrites: expected result: debug: does not panic, but throws KErrAlreadyExists. sl@0: TRAP(leaveCode, sl@0: errCode=testArray.Add(&dg1234); sl@0: ) sl@0: TEST(errCode==KErrNone); sl@0: TEST(leaveCode==KErrNone); sl@0: TRAP(leaveCode, sl@0: testArray.AddLC(&dg1234); //oops! Already added! Should leave. sl@0: User::Leave(1234); //Should leave before here! No leak if cleanup is taken. sl@0: ); sl@0: ReportNegativeResultfail(__LINE__,leaveCode,KErrAlreadyExists); sl@0: break; sl@0: // sl@0: case 10: //Swap empty slot: expected result: returns KErrNotFound sl@0: TRAP(leaveCode, sl@0: errCode=testArray.Swap(&dg1234) //oops! Nothing to swap with! sl@0: ) sl@0: TEST(leaveCode==KErrNone); sl@0: ReportNegativeResultfail(__LINE__,errCode,KErrNotFound); sl@0: break; sl@0: case 11: //Swap empty slot: expected result: throws KErrNotFound sl@0: TRAP(leaveCode, sl@0: rollBack1=testArray.SwapTLC(&dg1234); //oops! Nothing to swap with! sl@0: testArray.CommitP(rollBack1); sl@0: ) sl@0: TEST(rollBack1==NULL); sl@0: ReportNegativeResultfail(__LINE__,leaveCode,KErrNotFound); sl@0: break; sl@0: case 12: //Swap empty slot: expected result: debug: panic. In release doesn't return any information! sl@0: if (!aWrappedParams && mayPanic) sl@0: { sl@0: LaunchNegTestCall(failcase,EWsGraphicDrawerPanicBadArgument,KCategory); sl@0: } sl@0: else sl@0: { sl@0: TRAP(leaveCode, sl@0: errCode=testArray.SwapLC(&dg1234); //oops! Nothing to swap with! sl@0: User::Leave(1234); //Panics before here in debug. No leak if cleanup is taken. sl@0: ); sl@0: TEST(leaveCode==1234); //Panics before here in debug sl@0: TEST(errCode==KErrNotFound); //Panics before here in debug sl@0: } sl@0: break; sl@0: sl@0: // sl@0: default: sl@0: returnMoreTests=EFalse; sl@0: } sl@0: ResetArray(testArray); sl@0: CleanupStack::Check(markerCleanup); sl@0: __UHEAP_CHECK(0); sl@0: __UHEAP_MARKENDC(0); sl@0: testArray.Close(); sl@0: // CWsGraphicDrawerArray::testArrayValidator::ResetArray(&testArray); sl@0: CleanupStack::PopAndDestroy(markerCleanup); sl@0: return returnMoreTests; sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-LeakInService-0001 sl@0: @SYMDEF DEF093926 sl@0: @SYMTestCaseDesc Check for leaks over repeated re-assignments. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions sl@0: Repeatedly create the same bitmap instance sl@0: After a few initial wobbles in the server-side HeapCount it should not increase sl@0: 5 calls are made without checking the level, then 5 more check the level. sl@0: Note that as we are testing the main server heap, sl@0: other threads may interrupt and perform operations that change the memory figures. sl@0: sl@0: @SYMTestExpectedResults The CWsGraphicBitmap objects are created and no leaks are reported. sl@0: */ sl@0: void CTWsGraphs::DoTestLeakInServiceL() sl@0: { sl@0: INFO_PRINTF1(_L("DoTestLeakInServiceL")); sl@0: const TInt prepCount=5; sl@0: const TInt testCount=5; sl@0: sl@0: sl@0: TUid uid1 = {0x10000001}; sl@0: TUid uid2 = {0x10000002}; sl@0: sl@0: TWsGraphicId twsGraphicId1(uid1); sl@0: TEST(twsGraphicId1.Uid()==uid1); sl@0: sl@0: TWsGraphicId twsGraphicId2(uid2); sl@0: TEST(twsGraphicId2.Uid()==uid2); sl@0: sl@0: TWsGraphicId twsGraphicId3(twsGraphicId2); sl@0: TEST(twsGraphicId3.Uid()==uid2); sl@0: sl@0: TWsGraphicId twsGraphicId4(1); sl@0: twsGraphicId4.Set(uid1); sl@0: TEST(twsGraphicId4.Uid()==uid1); sl@0: sl@0: TSize screenSize = TheClient->iScreen->SizeInPixels(); sl@0: sl@0: __UHEAP_RESET; sl@0: __UHEAP_MARK; sl@0: // Create local shared CWsGraphicBitmap sl@0: // Repeat operation for any sign of memory leak... sl@0: CFbsBitmap bitmap2; sl@0: CFbsBitmap mask2; sl@0: sl@0: bitmap2.Create(screenSize,TheClient->iScreen->DisplayMode()); sl@0: mask2.Create(bitmap2.SizeInPixels(),TheClient->iScreen->DisplayMode()); sl@0: sl@0: TInt c0=TheClient->iWs.HeapCount(); sl@0: CWsGraphicBitmap* bTestX = CWsGraphicBitmap::NewL(twsGraphicId2.Uid(), &bitmap2,&mask2); sl@0: for (TInt i=0;iiWs.HeapCount(); sl@0: delete bTestX; sl@0: //TInt c3=TheClient->iWs.HeapCount(); sl@0: bTestX = CWsGraphicBitmap::NewL(twsGraphicId2.Uid(), &bitmap2,&mask2); sl@0: //TInt c4=TheClient->iWs.HeapCount(); sl@0: } sl@0: // Give WSERV a chance to settle. sl@0: TheClient->iWs.Finish(); sl@0: User::After (1000000); //1s sl@0: sl@0: TInt c1=TheClient->iWs.HeapCount(); sl@0: TInt failures=0; sl@0: for (TInt i=0;iiWs.HeapCount(); sl@0: delete bTestX; sl@0: //TInt c3=TheClient->iWs.HeapCount(); sl@0: //The heap count doesn't go down after delete operation sl@0: //because the delete message is buffered by the server, because it does not have a return value. sl@0: //Aparrently, although CWsGraphicBitmap and TheClient terminate at the same server, sl@0: //and use the same general heap (I have tested this under debug), sl@0: //they do not share the same session, so flushing TheClient does not effect CWsGraphicBitmap sl@0: bTestX = CWsGraphicBitmap::NewL(twsGraphicId2.Uid(), &bitmap2,&mask2); sl@0: sl@0: // Give WSERV a chance to settle. sl@0: TheClient->iWs.Finish(); sl@0: User::After (1000000); //1s sl@0: sl@0: TInt c4=TheClient->iWs.HeapCount(); sl@0: //Can compare immediately after allocation as the server doesn't buffer the create command. sl@0: if (!(c2==c4)) sl@0: { sl@0: if (c4 > c2) // only fail the test if the count has increased sl@0: { sl@0: failures++; sl@0: } sl@0: INFO_PRINTF2(_L("Server Heap count change accross delete/new = %i"),c4-c2); sl@0: } sl@0: } sl@0: // Outside of main loop to avoid client/wserv interaction during test. sl@0: TEST(failures==0); sl@0: TInt c5=TheClient->iWs.HeapCount(); sl@0: TEST((c1-c5)/testCount==0); //If every call leaked. sl@0: if ((c1-c5)/testCount) sl@0: { sl@0: INFO_PRINTF3(_L("Server Heap count change accross %i delete/new cycles = %i"),testCount,c5-c1); sl@0: INFO_PRINTF3(_L("Before %i / After %i"),c1,c5); sl@0: } sl@0: sl@0: delete bTestX; sl@0: sl@0: __UHEAP_CHECK(0); sl@0: __UHEAP_MARKEND; sl@0: sl@0: } sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0381 sl@0: @SYMDEF DEF095063 sl@0: @SYMTestCaseDesc Test case for INC098114 CWsGraphicDrawer::SendMessage panics window server sl@0: @SYMTestPriority Medium sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Enable the test flag and reproduce the defect sl@0: Action step: sl@0: -Instruct plugin to register event handler sl@0: -Draw fullscreen window (plugin will receive window visibility changed event) sl@0: -Set the test flag sl@0: -Query visibility region from plugin side sl@0: -Instruct plugin to unregister event handler sl@0: -Destroy fullscreen window (plugin will not receive window visibility changed event) sl@0: sl@0: @SYMTestExpectedResults wserv should not panic with the fix sl@0: */ sl@0: sl@0: TestState CTWsGraphs::TestSuccessiveMessageL() sl@0: { sl@0: if (iSubState==0) sl@0: { sl@0: _LIT(KTestSuccessiveMessage, "TestSuccessiveMessage"); sl@0: INFO_PRINTF1(KTestSuccessiveMessage); sl@0: sl@0: ++iSubState; sl@0: iListen->Enable(ETrue); sl@0: CreateWindowL(); sl@0: Mem::FillZ(&iListenInfo, sizeof(TListenerInfo)); sl@0: //Set the test flag to enable the reproduction of defect sl@0: iListen->SetTestFlag(); sl@0: iListen->QueryPlugin(iListenInfo); sl@0: iListen->Enable(EFalse); sl@0: DestroyWindowL(); sl@0: return EWait; sl@0: } sl@0: sl@0: ++(iTest->iState); sl@0: iSubState = 0; sl@0: return ENext; sl@0: } sl@0: sl@0: TestState CTWsGraphs::TestWindowGroupChangeL() sl@0: { sl@0: if (iSubState==0) sl@0: { sl@0: _LIT(KTestWindowGroupChange, "TestWindowGroupChange"); sl@0: INFO_PRINTF1(KTestWindowGroupChange); sl@0: sl@0: ++iSubState; sl@0: iListen->Enable(ETrue); sl@0: CreateWindowL(); sl@0: Mem::FillZ(&iListenInfo, sizeof(TListenerInfo)); sl@0: iListen->QueryPlugin(iListenInfo); sl@0: return EWait; sl@0: } sl@0: sl@0: if (iSubState==1) sl@0: { sl@0: ++iSubState; sl@0: iOriginalWindowGroupId = iListenInfo.iWindowGroupId; sl@0: iNewWin = CCrWin::NewL(iTest->iScreenNumber, ETrue); sl@0: iListen->QueryPlugin(iListenInfo); sl@0: return EWait; sl@0: } sl@0: sl@0: TEST(iListenInfo.iWindowGroupId != iOriginalWindowGroupId); sl@0: sl@0: delete iNewWin; sl@0: iNewWin = NULL; sl@0: iListen->Enable(EFalse); sl@0: DestroyWindowL(); sl@0: ++(iTest->iState); sl@0: iSubState = 0; sl@0: return ENext; sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0382 sl@0: @SYMDEF INC085451 sl@0: @SYMTestCaseDesc Test Animation frame rate sl@0: @SYMTestPriority Medium sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Simulate an Animation artwork by calling DrawWsGraphic and DoDraw. sl@0: Action step: sl@0: -Calls DrawWsGraphic for two different animations with different frame rates sl@0: -Retrieve the frame count for two differnt frames per seconds sl@0: -Test the two frame rate shouldn't be same. sl@0: sl@0: @SYMTestExpectedResults Animation Frame rate should be different for different frames per second sl@0: */ sl@0: TestState CTWsGraphs::TestFrameRateL() sl@0: { sl@0: //Check for Transparency enabled in wsini.ini sl@0: if (TransparencySupportedL()==KErrNotSupported) sl@0: { sl@0: ++(iTest->iState); sl@0: return ENext; sl@0: } sl@0: sl@0: // flush transparent window destruction created in TransparencySupportedL before sl@0: // proceeding with the test sl@0: TheClient->iWs.Flush(); sl@0: sl@0: //Here iSubState is 0, when this functions executes first time sl@0: // iSubState is 1 means the call is from a callback function. sl@0: if(iSubState == 0) sl@0: { sl@0: _LIT(KTestFrameRate, "TestFrameRate"); sl@0: INFO_PRINTF1(KTestFrameRate); sl@0: sl@0: ++iSubState; sl@0: iTestframerate = CGraphicTestFrameRate::NewL(iTest->iScreenNumber); sl@0: sl@0: //Set the callback function sl@0: iTestframerate->SetCallBack(TCallBack(CTWsGraphs::PluginCallBack,this)); sl@0: sl@0: //Create the window and call the graphic animation sl@0: CreateWindowL(EFalse); sl@0: iWin->DrawGraphic(iTestframerate->Id().Id()); sl@0: return EWait; sl@0: } sl@0: sl@0: //PeterI wait a while for animations to redraw then query the plugin sl@0: User::After(2000000); sl@0: TheClient->iWs.Flush(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: TheClient->iWs.Finish(); sl@0: sl@0: //Invoke the plug-in and get the counter value sl@0: Mem::FillZ(&iAnimCount, sizeof(TAnimRate)); sl@0: sl@0: iTestframerate->QueryPlugin(iAnimCount); sl@0: TheClient->iWs.Flush(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: TheClient->iWs.Finish(); sl@0: sl@0: //Compare and test the total frame rate for two different frame counts.... sl@0: TEST((iAnimCount.iAnim1>0 && iAnimCount.iAnim2>0) && iAnimCount.iAnim1 !=iAnimCount.iAnim2); sl@0: if(iSubState == 1) sl@0: { sl@0: DestroyWindowL(); sl@0: delete iTestframerate; sl@0: } sl@0: ++(iTest->iState); sl@0: iSubState = 0; sl@0: return ENext; sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0438 sl@0: @SYMDEF INC103472 sl@0: @SYMTestCaseDesc CRedrawRegion::ContainsDrawers does not look for all drawers sl@0: @SYMTestPriority Medium sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Create ECom-plugins to enable the scenario, in which there is one simple and one container drawer. sl@0: In the container drawer, two other simple drawers are enabled. Each drawer draws a coloured ellipse. sl@0: In this case, when the contained drawer is requested to change the colour of the ellipse, the screen will not be updated sl@0: without the fix. sl@0: Action step: sl@0: -Create four CRP graphics. sl@0: -Call the simple drawer and container drawer to draw ellipses. The container drawer sl@0: also enables two other simple drawers to draw ellipses in different colors. sl@0: -Update the color of each ellipse in turn. sl@0: -Check that the screen display is as required. sl@0: @SYMTestExpectedResults The colour of each ellipse residing in the drawers is successfully updated. Those for the contained drawers wont be updated without the fix. sl@0: */ sl@0: void CTWsGraphs::TestNestedDrawerCRP() sl@0: { sl@0: _LIT(KTestContainDrawer, "Test INC103472: A Contained Drawer"); sl@0: INFO_PRINTF1(KTestContainDrawer); sl@0: sl@0: RWindow window1(TheClient->iWs); sl@0: CleanupClosePushL(window1); sl@0: User::LeaveIfError(window1.Construct(*TheClient->iGroup->GroupWin(), ENullWsHandle)); sl@0: sl@0: window1.EnableRedrawStore(ETrue); // Force to enable the redraw storing sl@0: window1.SetRequiredDisplayMode(EColor256); // Do not set window size here to avoid hardware test failure sl@0: window1.SetBackgroundColor(KRgbDarkGreen); sl@0: window1.Activate(); sl@0: sl@0: // A simple graphic sl@0: CWsSimpleGraphicBitmap* wsGraphic1 = CWsSimpleGraphicBitmap::NewL(KSimpleDrawerInterfaceId); sl@0: CleanupStack::PushL(wsGraphic1); sl@0: // A container graphic sl@0: CWsContainGraphicBitmap* wsGraphic2 = CWsContainGraphicBitmap::NewL(KContainDrawerInterfaceId); sl@0: CleanupStack::PushL(wsGraphic2); sl@0: // A contained graphic residing in the container graphic wsGraphic2 sl@0: CWsSimpleGraphicBitmap* wsGraphic3 = CWsInvisibleGraphicBitmap1::NewL(KInvisibleDrawerInterfaceId1); sl@0: CleanupStack::PushL(wsGraphic3); sl@0: // A contained graphic residing in the container graphic wsGraphic2 sl@0: CWsSimpleGraphicBitmap* wsGraphic4 = CWsInvisibleGraphicBitmap2::NewL(KInvisibleDrawerInterfaceId2); sl@0: CleanupStack::PushL(wsGraphic4); sl@0: sl@0: window1.Invalidate(); sl@0: window1.BeginRedraw(); sl@0: TheClient->iGc->Activate(window1); sl@0: TheClient->iGc->Clear(); sl@0: // Call CRP drawer to draw the coloured ellipses sl@0: TheClient->iGc->DrawWsGraphic(wsGraphic1->Id(),TRect(TPoint(20,20),TSize(300,100))); sl@0: TheClient->iGc->DrawWsGraphic(wsGraphic2->Id(),TRect(TPoint(20,100),TSize(300,100))); sl@0: sl@0: TheClient->iGc->Deactivate(); sl@0: window1.EndRedraw(); sl@0: TheClient->Flush(); sl@0: sl@0: // Update the colour of four ellipses residing in four CRP drawers. sl@0: TInt err = wsGraphic1->UpdateColor(KRgbRed); sl@0: TEST(KErrNone == err); sl@0: err = wsGraphic2->UpdateColor(KRgbDarkBlue); sl@0: TEST(KErrNone == err); sl@0: // If the fix is not inserted, the colour of the third and fourth ellipses residing in the contained drawers wont be updated sl@0: err = wsGraphic3->UpdateColor(KRgbDarkMagenta); sl@0: TEST(KErrNone == err); sl@0: err = wsGraphic4->UpdateColor(KRgbDarkCyan); //won't change the displayed color if there is a right place for flush() sl@0: TEST(KErrNone == err); sl@0: sl@0: TheClient->Flush(); sl@0: // Force some delays to wait until the color change sl@0: User::After(2000000); sl@0: // Test whether the screen content is changed as required sl@0: CheckResult(); sl@0: CleanupStack::PopAndDestroy(5,&window1); sl@0: } sl@0: sl@0: // Check the screen display with the reference bitmap to ensure the color to be updated correctly sl@0: void CTWsGraphs::CheckResult() sl@0: { sl@0: TSize size = TSize(320,200);//The maximum size of the screen content we are looking at sl@0: sl@0: // Create a reference bitmap sl@0: CFbsBitmap* bitmapRef = new(ELeave) CFbsBitmap; sl@0: CleanupStack::PushL(bitmapRef); sl@0: User::LeaveIfError(bitmapRef->Create(size, EColor256)); sl@0: CFbsBitGc* gc; sl@0: CFbsBitmapDevice* bitmapDev = CFbsBitmapDevice::NewL(bitmapRef); sl@0: TEST(bitmapDev!=NULL); sl@0: CleanupStack::PushL(bitmapDev); sl@0: User::LeaveIfError(bitmapDev->CreateContext(gc)); sl@0: CleanupStack::PushL(gc); sl@0: gc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: gc->SetBrushColor(KRgbDarkGreen); sl@0: gc->Clear(TRect(TPoint(0,0), size));//background dark green sl@0: gc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: gc->SetBrushColor(KRgbRed); sl@0: gc->DrawEllipse(TRect(TPoint(20,20),TSize(300,100))); //map to the simple drawer sl@0: gc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: gc->SetBrushColor(KRgbDarkBlue); sl@0: gc->DrawEllipse(TRect(TPoint(20,100),TSize(300,100))); //map to the container drawer sl@0: gc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: gc->SetBrushColor(KRgbDarkMagenta); sl@0: gc->DrawEllipse(TRect(TPoint(100,150),TSize(50,50))); //map to the contained drawer sl@0: gc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: gc->SetBrushColor(KRgbDarkCyan); sl@0: gc->DrawEllipse(TRect(TPoint(200,150),TSize(50,50))); //map to the contained drawer sl@0: TInt bitmapHeight = bitmapRef->SizeInPixels().iHeight; sl@0: TInt bitmapWidth = bitmapRef->SizeInPixels().iWidth; sl@0: sl@0: // Copy the screen content to bitmap sl@0: INFO_PRINTF1(_L("Capture screen content.")); sl@0: CFbsBitmap* screenBitmap = new(ELeave) CFbsBitmap(); sl@0: CleanupStack::PushL(screenBitmap); sl@0: User::LeaveIfError(screenBitmap->Create(size, TheClient->iScreen->DisplayMode())); sl@0: TRect rct = TRect(TPoint(0,0), size); sl@0: User::LeaveIfError(TheClient->iScreen->CopyScreenToBitmap(screenBitmap,rct)); sl@0: sl@0: // Compare the displayed bitmap against the reference one sl@0: INFO_PRINTF1(_L("Compare the displayed bitmap against the expected one.")); sl@0: TInt lineLength=bitmapRef->ScanLineLength(bitmapWidth, EColor256); sl@0: HBufC8* compareLineBuf=HBufC8::NewLC(lineLength); sl@0: TPtr8 compareLinePtr(compareLineBuf->Des()); sl@0: HBufC8* screenLineBuf=HBufC8::NewLC(lineLength); sl@0: TPtr8 screenLinePtr(screenLineBuf->Des()); sl@0: for (TInt index=0; indexGetScanLine(compareLinePtr, TPoint(0,index), bitmapWidth, EColor256); sl@0: screenBitmap->GetScanLine(screenLinePtr, TPoint(0,index),bitmapWidth, EColor256); sl@0: TInt compareResult=compareLinePtr.Compare(screenLinePtr); sl@0: if (compareResult!=0) sl@0: { sl@0: INFO_PRINTF2(_L("Scanline compare failed: %d"),index); sl@0: TEST(EFalse); sl@0: break; sl@0: } sl@0: } sl@0: CleanupStack::PopAndDestroy(6,bitmapRef); sl@0: sl@0: } sl@0: sl@0: void ResetScreenMode(TAny* aAny) sl@0: { sl@0: CWsScreenDevice* screen=static_cast(aAny); sl@0: screen->SetScreenMode(0); sl@0: screen->SetAppScreenMode(0); sl@0: } sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: sl@0: void CTWsGraphs::TestScreenModeChangeL() sl@0: { sl@0: _LIT(KLog,"Screen Doesn't match bitmap. Size=(%d,%d) winSizeMode=%d redrawMode=%d modeIndex=%d"); sl@0: // A simple CRP graphic to draw in the test sl@0: CWsSimpleGraphicBitmap* wsGraphic1=CWsSimpleGraphicBitmap::NewL(KSimpleDrawerInterfaceId); sl@0: CleanupStack::PushL(wsGraphic1); sl@0: RWindow testWin(TheClient->iWs); sl@0: CleanupClosePushL(testWin); sl@0: User::LeaveIfError(testWin.Construct(*TheClient->iGroup->GroupWin(),0xbadbad)); sl@0: testWin.SetRequiredDisplayMode(EColor64K); sl@0: testWin.Activate(); sl@0: // Cleanup display mode by setting back to 0 if we leave in the tests sl@0: CleanupStack::PushL(TCleanupItem(ResetScreenMode,TheClient->iScreen)); sl@0: TInt numScreenModes=TheClient->iScreenModes.Count(); sl@0: TBool match; sl@0: sl@0: for(TInt winSizeMode=0;winSizeMode<2;winSizeMode++) sl@0: { // Two size modes, fullScreen and non-full screen sl@0: for(TInt redrawMode=0;redrawMode<2;redrawMode++) sl@0: { // Two redraw modes to test drawing inside and outside of a redraw. sl@0: const TBool drawInsideRedraw=(redrawMode==0); sl@0: for(TInt modeIndex=0;modeIndexiScreenModes[modeIndex]; sl@0: const TPoint origin=TheClient->iScreen->GetScreenModeScaledOrigin(screenMode); sl@0: if (origin.iX!=0 || origin.iY!=0) sl@0: continue; sl@0: // Enable redirection before changing screen mode as this is what we are testing sl@0: iRedir->Redirect(CWsRedir::EFrontBuffer, ETrue); sl@0: TheClient->iScreen->SetAppScreenMode(screenMode); sl@0: TheClient->iScreen->SetScreenMode(screenMode); sl@0: sl@0: TPixelsAndRotation sizeAndRotation; sl@0: TheClient->iScreen->GetDefaultScreenSizeAndRotation(sizeAndRotation); sl@0: // sl@0: TSize screenSize(TheClient->iScreen->SizeInPixels()); sl@0: if(sizeAndRotation.iRotation == CFbsBitGc::EGraphicsOrientationRotated90 || sl@0: sizeAndRotation.iRotation == CFbsBitGc::EGraphicsOrientationRotated270) sl@0: { sl@0: screenSize.iWidth = Min(screenSize.iWidth, 240);//to make sure we won't exceed physical screen size sl@0: } sl@0: TSize winSize(screenSize); sl@0: TPoint winPos; sl@0: if (winSizeMode==1) sl@0: { sl@0: winSize.iWidth=winSize.iWidth*2/3; sl@0: winSize.iHeight=winSize.iHeight*3/4; sl@0: winPos.iX=(screenSize.iWidth-winSize.iWidth)/4; sl@0: winPos.iY=(screenSize.iHeight-winSize.iHeight)*3/4; sl@0: } sl@0: testWin.SetExtent(winPos,winSize); sl@0: TSize halfSize(winSize.iWidth/2,winSize.iHeight); sl@0: TRect leftHalf(halfSize); sl@0: TRect rightHalf(TPoint(halfSize.iWidth,0),halfSize); sl@0: TRect leftEllipse(leftHalf); sl@0: leftEllipse.Shrink(4,4); sl@0: TRect rightEllipse(rightHalf); sl@0: rightEllipse.Shrink(4,4); sl@0: // Draw half the screen with redirection on, should only go to redirection test bitmap sl@0: // Then draw again with redirection off, this time should go to the screen sl@0: // The two steps are drawn with the color of the left/right rectangles swapped. sl@0: for(TInt drawStep=0;drawStep<2;drawStep++) sl@0: { sl@0: TRgb leftColor; sl@0: TRgb rightColor; sl@0: if (drawStep==0) sl@0: { sl@0: leftColor=KRgbGreen; sl@0: rightColor=KRgbRed; sl@0: } sl@0: else sl@0: { // Turn re-direction off for second time around loop sl@0: iRedir->Redirect(CWsRedir::EFrontBuffer, EFalse); sl@0: leftColor=KRgbRed; sl@0: rightColor=KRgbGreen; sl@0: } sl@0: testWin.Invalidate(); sl@0: testWin.BeginRedraw(); sl@0: if (!drawInsideRedraw) sl@0: testWin.EndRedraw(); sl@0: CWindowGc* testWinGc=TheClient->iGc; sl@0: testWinGc->Activate(testWin); sl@0: testWinGc->SetBrushColor(leftColor); sl@0: testWinGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: testWinGc->DrawRect(leftHalf); sl@0: // Call CRP drawer to draw the coloured ellipses sl@0: TheClient->iGc->DrawWsGraphic(wsGraphic1->Id(),leftEllipse); sl@0: testWinGc->SetBrushColor(rightColor); sl@0: testWinGc->DrawRect(rightHalf); sl@0: TheClient->iGc->DrawWsGraphic(wsGraphic1->Id(),rightEllipse); sl@0: testWinGc->Deactivate(); sl@0: if (drawInsideRedraw) sl@0: testWin.EndRedraw(); sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: // We now check that the left rect of the re-directed drawing matches the right half sl@0: // of the on-screen drawing sl@0: CFbsBitmap* screenCopy=new(ELeave) CFbsBitmap; sl@0: CleanupStack::PushL(screenCopy); sl@0: User::LeaveIfError(screenCopy->Create(screenSize, EColor64K)); sl@0: TheClient->iScreen->CopyScreenToBitmap(screenCopy); sl@0: match=CompareBitmapArea16Bpp(iFrontCopy,winPos,screenCopy,TPoint(winPos.iX+rightHalf.iTl.iX,winPos.iY),halfSize); sl@0: TEST(match); sl@0: if (!match) sl@0: LOG_MESSAGE6(KLog,screenSize.iWidth,screenSize.iHeight,winSizeMode,redrawMode,modeIndex); sl@0: // As a double check also check the right half of the off-screen drawing matches the sl@0: // on-screen left half. sl@0: match=CompareBitmapArea16Bpp(iFrontCopy,TPoint(winPos.iX+rightHalf.iTl.iX,winPos.iY),screenCopy,winPos,halfSize); sl@0: TEST(match); sl@0: if (!match) sl@0: LOG_MESSAGE6(KLog,screenSize.iWidth,screenSize.iHeight,winSizeMode,redrawMode,modeIndex); sl@0: CleanupStack::PopAndDestroy(screenCopy); sl@0: } sl@0: } sl@0: } sl@0: CleanupStack::PopAndDestroy(3,wsGraphic1); sl@0: sl@0: TEST(iNotify1->iResult); sl@0: if(iNotify1->iResult==EFalse) sl@0: { sl@0: INFO_PRINTF1(iNotify1->iError); sl@0: } sl@0: TEST(iNotify2->iResult); sl@0: if(iNotify1->iResult==EFalse) sl@0: { sl@0: INFO_PRINTF1(iNotify2->iError); sl@0: } sl@0: } sl@0: sl@0: #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0443 sl@0: sl@0: @SYMDEF INC109263 sl@0: sl@0: @SYMTestCaseDesc TWindowServerEvent::NotifyDrawer can refer to a deleted array index causing a crash sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Cause an event that will generate the following behaviour through TWindowServerEvent::NotifyDrawer() sl@0: sl@0: The for loop performs the following: sl@0: 0) Drawer handler 1: Remove handle 1 ; Drawer handler 2: Do nothing sl@0: 1) Drawer handler 1: Remove handle 1,Add handle 1 ; Drawer handler 2: Do nothing sl@0: 2) Drawer handler 1: Add handle 1 ; Drawer handler 2: Do nothing sl@0: 3) Drawer handler 1: Remove handle 2 ; Drawer handler 2: Do nothing sl@0: 4) Drawer handler 1: Remove handle 2,Add handle 2 ; Drawer handler 2: Do nothing sl@0: 5) Drawer handler 1: Add handle 2 ; Drawer handler 2: Do nothing sl@0: 6) Drawer handler 1: Remove handle 1,Remove handle 2 ; Drawer handler 2: Do nothing sl@0: sl@0: Repeat with handlers 1 and 2 swapped sl@0: sl@0: @SYMTestExpectedResults Loops through TWindowServerEvent::NotifyDrawer() should complete without crashing wserv sl@0: */ sl@0: sl@0: void CTWsGraphs::TestNotifyRemoval() sl@0: { sl@0: _LIT(KTestEventNotification, "TestDrawerEventHandler"); sl@0: INFO_PRINTF1(KTestEventNotification); sl@0: ++iSubState; sl@0: sl@0: for (TInt ii = 0; iiSetBehaviour(ii); //Enable this plugin and set it to an event handling method sl@0: iNotify2->SetBehaviour(KNotifyDoNothing); //Add a second drawer handler which is enabled but does nothing sl@0: CreateWindowL(); //Change visibility activating the event handlers - Fails if wserv crashes! sl@0: iNotify1->SetBehaviour(KNotifyDisable); //Disable plugin if still enabled sl@0: iNotify2->SetBehaviour(KNotifyDisable); //Disable plugin if still enabled sl@0: DestroyWindowL(); sl@0: } sl@0: INFO_PRINTF1(_L("Swap handlers")); sl@0: for (TInt ii = 0; iiSetBehaviour(KNotifyDoNothing); //Add a first drawer handler which is enabled but does nothing sl@0: iNotify1->SetBehaviour(ii); //Enable this plugin and set it to an event handling method sl@0: CreateWindowL(); //Change visibility activating the event handlers - Fails if wserv crashes! sl@0: iNotify2->SetBehaviour(KNotifyDisable); //Disable plugin if still enabled sl@0: iNotify1->SetBehaviour(KNotifyDisable); //Disable plugin if still enabled sl@0: DestroyWindowL(); sl@0: } sl@0: sl@0: TEST(ETrue); // If the test has failed WServ will have paniced. sl@0: } sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0491 sl@0: @SYMPREQ PREQ39 sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc Draw using a ECom-plugin which has direct access to the screen/OSB buffer sl@0: @SYMTestActions Create the plugin sl@0: Draw using the plugin sl@0: Update the position of the white line to line 70 and test sl@0: Update the position of the white line to line 80 and test sl@0: @SYMTestExpectedResults White lines are drawn on the correct positions. sl@0: */ sl@0: void CTWsGraphs::TestMWsUiBufferL() sl@0: { sl@0: const TInt KWhiteLinePos = 70; sl@0: const TRect KBlueRect(TPoint(50,50),TSize(100,100)); sl@0: sl@0: // Construct and setup window to be drawn to sl@0: RWindow window1 = RWindow(TheClient->iWs); sl@0: CleanupClosePushL(window1); sl@0: User::LeaveIfError(window1.Construct(*TheClient->iGroup->GroupWin(),ENullWsHandle)); sl@0: TSize winSize=TSize(TheClient->iScreen->SizeInPixels()); sl@0: window1.SetExtent(TPoint(0,0),winSize); sl@0: window1.Activate(); sl@0: sl@0: CWsBufferGraphic* graphic = CWsBufferGraphic::NewL(); sl@0: CleanupStack::PushL(graphic); sl@0: sl@0: // Draw inital drawing with a Crp which is blue rect and a white line at line 0 sl@0: TheGc->Activate(window1); sl@0: TheGc->Clear(); sl@0: window1.BeginRedraw(); sl@0: TheGc->DrawWsGraphic(graphic->Id(),KBlueRect); sl@0: window1.EndRedraw(); sl@0: TheGc->Deactivate(); sl@0: sl@0: TheClient->iWs.Finish(); sl@0: User::After(2000000); sl@0: sl@0: // Update the position of the white line to line 70 sl@0: INFO_PRINTF1(_L("Update position of white line to line 70")); sl@0: graphic->UpdateWhiteLinePos(KWhiteLinePos); sl@0: TheClient->iWs.Finish(); sl@0: // Force some delays to wait until the line position changes sl@0: User::After(2000000); sl@0: //Test white line has been drawn and is in the correct postion sl@0: TBool res1 = IsWhiteLine(KWhiteLinePos); sl@0: TEST(res1); sl@0: sl@0: // Update the position of the white line to line 80 sl@0: INFO_PRINTF1(_L("Update position of white line to line 80")); sl@0: graphic->UpdateWhiteLinePos(KWhiteLinePos+10); sl@0: TheClient->iWs.Finish(); sl@0: // Force some delays to wait until the line position changes sl@0: User::After(2000000); sl@0: // Test white line has been drawn and is in the correct postion sl@0: TBool res2 = IsWhiteLine(KWhiteLinePos+10); sl@0: TEST(res2); sl@0: sl@0: graphic->Destroy(); sl@0: CleanupStack::PopAndDestroy(2, &window1); sl@0: } sl@0: sl@0: // Test whether a line is completely white sl@0: TBool CTWsGraphs::IsWhiteLine(TInt aWhiteLinePos) sl@0: { sl@0: TRgb color; sl@0: TPoint pixel; sl@0: sl@0: for(TInt xPos = 0; xPos < TheClient->iScreen->SizeInPixels().iWidth; xPos++) sl@0: { sl@0: pixel = TPoint(xPos,aWhiteLinePos); sl@0: TheClient->iScreen->GetPixel(color,pixel); sl@0: if(color.Red() != 255 && color.Blue() != 255 && color.Green() != 255) sl@0: { sl@0: return EFalse; sl@0: } sl@0: } sl@0: return ETrue; sl@0: } sl@0: #endif //TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: sl@0: /** sl@0: DoTestL() method, called by the WSERV Test Framework. sl@0: */ sl@0: void CTWsGraphs::RunTestCaseL(TInt /*aCurTestCase*/) sl@0: { sl@0: _LIT(KTest1,"DoTestWsGraphics"); sl@0: _LIT(KTest2,"DoTestOOMWsGraphics"); sl@0: _LIT(KTest3,"Interface Extension"); sl@0: _LIT(KTest4,"Screen Redirection"); sl@0: _LIT(KTest5,"TextCursor1"); sl@0: _LIT(KTest6,"TextCursor2"); sl@0: _LIT(KTest7,"Flicker Redirection"); sl@0: _LIT(KTest8,"Event Notification"); sl@0: _LIT(KTest9,"Successive Message"); sl@0: _LIT(KTest10,"Redirection Using WsBackBuffer"); sl@0: _LIT(KTest11,"Group Change"); sl@0: _LIT(KTest12,"Frame Rate"); sl@0: _LIT(KTest13,"Leak In Service"); sl@0: _LIT(KTest14,"Add/Swap GDArray"); sl@0: _LIT(KTest15,"Nested Drawer CRP"); sl@0: _LIT(KTest16,"Notify Removal"); sl@0: _LIT(KTest17,"Screen Mode Change"); sl@0: _LIT(KTest18,"UI Buffer"); sl@0: _LIT(KTest19,"Graphics Drawer Coverage"); sl@0: CFbsBitmap bitmap1; sl@0: CFbsBitmap mask1; sl@0: CWsGraphicBitmap* bTest=NULL; sl@0: TSize screenSize=TheClient->iScreen->SizeInPixels(); sl@0: sl@0: bitmap1.Create(screenSize,TheClient->iScreen->DisplayMode()); sl@0: mask1.Create(screenSize,TheClient->iScreen->DisplayMode()); sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); sl@0: sl@0: switch(++iTest->iState) sl@0: { sl@0: case 1: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0528 sl@0: */ sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0528")); sl@0: // Launch new process with PROTSERV capability to run CWSGraphics tests in sl@0: iTest->LogSubTest(KTest1); sl@0: // This process only launches succesfully when _DEBUG is defined for the build, because it depends sl@0: // on the existance of debug macros such as _UHEAP_MARK, _UHEAP_MARKEND, _UHEAP_FAILNEXT, ... etc sl@0: LaunchNewProcess(KTestExe); sl@0: break; sl@0: case 2: sl@0: { sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0017 sl@0: sl@0: @SYMPREQ PREQ1246 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Out of memery test when creating a CWsGraphic. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Out of memory test when creating a CWsGraphic. sl@0: sl@0: @SYMTestExpectedResults Whenever an API call fails, it should leave the number sl@0: of allocated heap cells unchanged. sl@0: */ sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0017")); sl@0: sl@0: iTest->LogSubTest(KTest2); sl@0: TInt failRate; sl@0: for(failRate=1;;failRate++) sl@0: { sl@0: __UHEAP_RESET; sl@0: __UHEAP_SETFAIL(RHeap::EDeterministic,failRate); sl@0: __UHEAP_MARK; sl@0: sl@0: TRAPD(ret,bTest=CWsGraphicBitmap::NewL(&bitmap1,&mask1)); sl@0: TEST((ret==KErrNone || ret==KErrNoMemory)); sl@0: if (ret!=KErrNone && ret!=KErrNoMemory) sl@0: { sl@0: _LIT(KLog,"Failed to create CWsGraphicBitmap error=%d"); sl@0: LOG_MESSAGE2(KLog,ret); sl@0: } sl@0: if (ret!=KErrNone) sl@0: { sl@0: __UHEAP_MARKEND; sl@0: } sl@0: else sl@0: { sl@0: TEST(bTest!=NULL); sl@0: if (bTest==NULL) sl@0: { sl@0: _LIT(KLog,"Object creation didn't leave but returned NULL"); sl@0: LOG_MESSAGE(KLog); sl@0: } sl@0: delete bTest; sl@0: bTest=NULL; sl@0: __UHEAP_MARKEND; sl@0: TLogMessageText logMessageText; sl@0: _LIT(KSet,"OOM test succeds after %d allocations."); sl@0: logMessageText.Format(KSet,failRate); sl@0: LOG_MESSAGE(logMessageText); sl@0: break; sl@0: } sl@0: } sl@0: __UHEAP_RESET; sl@0: } sl@0: break; sl@0: case 3: sl@0: iTest->LogSubTest(KTest3); sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0371")); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: sl@0: if (TestInterfaceExtensionL()==EWait) sl@0: --iTest->iState; sl@0: #endif sl@0: break; sl@0: case 4: sl@0: iTest->LogSubTest(KTest4); sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0372")); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: if (TestScreenRedirectionL()==EWait) sl@0: --iTest->iState; sl@0: #endif sl@0: break; sl@0: case 5: sl@0: iTest->LogSubTest(KTest5); sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0363")); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: if (TestTextCursorUnderRedirectionL(ETestStandardTextCursor) == EWait) sl@0: --iTest->iState; sl@0: #endif sl@0: break; sl@0: case 6: sl@0: iTest->LogSubTest(KTest6); sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0363")); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: if (TestTextCursorUnderRedirectionL(ETestCustomTextCursor) == EWait) sl@0: --iTest->iState; sl@0: #endif sl@0: break; sl@0: case 7: sl@0: iTest->LogSubTest(KTest7); sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0376")); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: if (TestFlickerRedirectionL()==EWait) sl@0: --iTest->iState; sl@0: #endif sl@0: break; sl@0: case 8: sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0378")); sl@0: iTest->LogSubTest(KTest8); sl@0: if (TestEventNotificationL()==EWait) sl@0: --iTest->iState; sl@0: break; sl@0: case 9: sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0381")); sl@0: iTest->LogSubTest(KTest9); sl@0: if (TestSuccessiveMessageL()==EWait) sl@0: --iTest->iState; sl@0: break; sl@0: case 10: sl@0: iTest->LogSubTest(KTest10); sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0527")); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: if(TestRedirectionUsingWsBackBufferL()==EWait) sl@0: --iTest->iState; sl@0: #endif sl@0: break; sl@0: case 11: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0529 sl@0: */ sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0529")); sl@0: iTest->LogSubTest(KTest11); sl@0: if(TestWindowGroupChangeL()==EWait) sl@0: --iTest->iState; sl@0: break; sl@0: case 12: sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0382")); sl@0: iTest->LogSubTest(KTest12); sl@0: if(TestFrameRateL()==EWait) sl@0: --iTest->iState; sl@0: break; sl@0: case 13: sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-LeakInService-0001")); sl@0: iTest->LogSubTest(KTest13); sl@0: DoTestLeakInServiceL(); sl@0: break; sl@0: case 14: sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-NegAddSwapGDArray-0001")); sl@0: iTest->LogSubTest(KTest14); sl@0: TestAddSwapGDArrayL(); sl@0: break; sl@0: case 15: sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0438")); sl@0: iTest->LogSubTest(KTest15); sl@0: TestNestedDrawerCRP(); sl@0: break; sl@0: case 16: sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0443")); sl@0: iTest->LogSubTest(KTest16); sl@0: TestNotifyRemoval(); sl@0: break; sl@0: case 17: sl@0: iTest->LogSubTest(KTest17); sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0530")); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0530 sl@0: */ sl@0: sl@0: TestScreenModeChangeL(); sl@0: #endif sl@0: break; sl@0: case 18: sl@0: iTest->LogSubTest(KTest18); sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0491")); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: sl@0: TestMWsUiBufferL(); sl@0: #endif sl@0: break; sl@0: case 19: sl@0: iTest->LogSubTest(KTest19); sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0531 sl@0: */ sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0531")); sl@0: TestGraphicDrawerCoverage(); sl@0: break; sl@0: default: sl@0: ((CTWsGraphsStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: ((CTWsGraphsStep*)iStep)->CloseTMSGraphicsStep(); sl@0: TestComplete(); sl@0: break; sl@0: } sl@0: ((CTWsGraphsStep*)iStep)->RecordTestResultL(); sl@0: } sl@0: sl@0: __WS_CONSTRUCT_STEP__(WsGraphs)