sl@0: // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Test blank windows 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: sl@0: #include "TBLANK.H" sl@0: sl@0: sl@0: CBaseWindow::CBaseWindow() : CTWin() sl@0: {} sl@0: sl@0: void CBaseWindow::ConstructL(CTWinBase &parent) sl@0: { sl@0: CTWin::ConstructL(parent); sl@0: } sl@0: sl@0: void CBaseWindow::Draw() sl@0: { sl@0: iGc->SetBrushColor(iRgb); sl@0: iGc->Clear(); sl@0: } sl@0: sl@0: void CBaseWindow::SetColor(const TRgb &aRgb) sl@0: { sl@0: iRgb=aRgb; sl@0: iGc->Activate(iWin); sl@0: Draw(); sl@0: iGc->Deactivate(); sl@0: } sl@0: sl@0: // sl@0: sl@0: TInt DestructCallbackBlank(TAny *aParam) sl@0: { sl@0: ((CTBlank *)aParam)->doDestruct(); sl@0: return(0); sl@0: } sl@0: sl@0: sl@0: CTBlank::CTBlank(CTestStep* aStep): sl@0: CTWsGraphicsBase(aStep) sl@0: { sl@0: INFO_PRINTF1(_L("Testing TBlank functions")); sl@0: } sl@0: sl@0: void CTBlank::doDestruct() sl@0: { sl@0: BaseWin->SetVisible(ETrue); sl@0: TestWin->SetVisible(ETrue); sl@0: delete iBaseWin; sl@0: delete iTestWin; sl@0: iBaseWin = NULL; sl@0: iTestWin = NULL; sl@0: // CActiveScheduler::Stop(); sl@0: } sl@0: sl@0: CTBlank::~CTBlank() sl@0: { sl@0: TCallBack callBack(DestructCallbackBlank,this); sl@0: TheClient->SetRedrawCancelFunction(callBack); sl@0: // CActiveScheduler::Start(); sl@0: } sl@0: sl@0: void CTBlank::ConstructL() sl@0: { sl@0: BaseWin->SetVisible(EFalse); sl@0: TestWin->SetVisible(EFalse); sl@0: } sl@0: sl@0: void CTBlank::SetColor(const TRgb &aRgb) sl@0: { sl@0: iTestWin->SetColor(aRgb); sl@0: iBaseWin->SetColor(aRgb); sl@0: } sl@0: sl@0: void CTBlank::InvalidateTestWin(const TRect &aRect) sl@0: { sl@0: TRect rect(aRect); sl@0: rect.Move(iTestWin->BaseWin()->InquireOffset(*(TheClient->iGroup->WinTreeNode()))); sl@0: CTUser::Splat(TheClient, rect,TRgb(0,0,0)); sl@0: } sl@0: sl@0: void CTBlank::CheckBlankWindows() sl@0: { sl@0: User::Heap().Check(); sl@0: CheckRect(iBaseWin,iTestWin,TRect(BaseWin->Size()),_L("CheckBlankWindows - CheckRect(iBaseWin,iTestWin,TRect(BaseWin->Size()) failed")); sl@0: } sl@0: sl@0: void CTBlank::RunTestCaseL(TInt /*aCurTestCase*/) sl@0: { sl@0: TSize screenSize; sl@0: TInt winWidth; sl@0: TInt winHeight; sl@0: ((CTBlankStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); sl@0: sl@0: switch(++iTest->iState) sl@0: { sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0022 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Create a base and test blank windows and invalidate an sl@0: area of the test window sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Two windows are created and an area of a window is sl@0: invalidated sl@0: sl@0: @SYMTestExpectedResults Windows create and invalidate without error sl@0: */ sl@0: case 1: sl@0: ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0022")); sl@0: iTest->LogSubTest(_L("Blank 1")); sl@0: screenSize=TheClient->iGroup->Size(); sl@0: winWidth=(screenSize.iWidth/3)-10; sl@0: winHeight=screenSize.iHeight-10; sl@0: iBaseWin=new(ELeave) CBaseWindow(); sl@0: iBaseWin->SetUpL(TPoint(screenSize.iWidth/3+5,5),TSize(winWidth,winHeight),TheClient->iGroup,*TheClient->iGc); sl@0: iBaseWin->SetColor(TRgb(255,255,255)); sl@0: iTestWin=new(ELeave) CTBlankWindow(); sl@0: iTestWin->SetUpL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight),TheClient->iGroup,*TheClient->iGc); sl@0: SetColor(TRgb::Gray4(2)); sl@0: InvalidateTestWin(TRect(10,10,50,50)); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0023 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Check that a base blank window is the same as a sl@0: test window which has had an area invalidated sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Check the test window is the same as the base window sl@0: sl@0: @SYMTestExpectedResults The windows are identical sl@0: */ sl@0: case 2: sl@0: ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0023")); sl@0: iTest->LogSubTest(_L("Check Blank 1")); sl@0: CheckBlankWindows(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0024 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Set a color and invalidate two areas of a test blank sl@0: window sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Invalidate two areas of a test blank window sl@0: sl@0: @SYMTestExpectedResults The window areas are invalidated without error sl@0: */ sl@0: case 3: sl@0: ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0024")); sl@0: iTest->LogSubTest(_L("Blank 2")); sl@0: SetColor(TRgb(0,0,0)); sl@0: InvalidateTestWin(TRect(1,1,150,20)); sl@0: InvalidateTestWin(TRect(10,-10,20,90)); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0025 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Check a base blank window is identical to a test sl@0: blank window which has had two areas invalidated sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Check the test window is the same as the base window sl@0: sl@0: @SYMTestExpectedResults The windows are identical sl@0: */ sl@0: case 4: sl@0: ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0025")); sl@0: iTest->LogSubTest(_L("Check Blank 2")); sl@0: CheckBlankWindows(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0026 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Set a color and invalidate three areas of a test blank sl@0: window sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Invalidate three areas of a test blank window sl@0: sl@0: @SYMTestExpectedResults The window areas are invalidated without error sl@0: */ sl@0: case 5: sl@0: ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0026")); sl@0: iTest->LogSubTest(_L("Blank 3")); sl@0: SetColor(TRgb(255,255,255)); sl@0: InvalidateTestWin(TRect(-1000,100,1000,120)); sl@0: InvalidateTestWin(TRect(1,1,150,20)); sl@0: InvalidateTestWin(TRect(10,30,20,60)); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0027 sl@0: sl@0: @@SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Check a base blank window is identical to a test sl@0: blank window which has had three areas invalidated sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Check the test window is the same as the base window sl@0: sl@0: @SYMTestExpectedResults The windows are identical sl@0: */ sl@0: case 6: sl@0: ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0027")); sl@0: iTest->LogSubTest(_L("Check Blank 3")); sl@0: CheckBlankWindows(); sl@0: delete iBaseWin; sl@0: delete iTestWin; sl@0: iBaseWin = NULL; sl@0: iTestWin = NULL; sl@0: break; sl@0: case 7: sl@0: ((CTBlankStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: ((CTBlankStep*)iStep)->CloseTMSGraphicsStep(); sl@0: TestComplete(); sl@0: break; sl@0: } sl@0: ((CTBlankStep*)iStep)->RecordTestResultL(); sl@0: } sl@0: sl@0: __WS_CONSTRUCT_STEP__(Blank)