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: // Generate a list of rectangles to be used as parameters for graphics tests 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 "TRECTLIST.H" sl@0: sl@0: CTRectList::CTRectList(CTestStep* aStep) : CTWsGraphicsBase(aStep) sl@0: { sl@0: } sl@0: sl@0: CTRectList::~CTRectList() sl@0: { sl@0: } sl@0: sl@0: void CTRectList::ConstructL() sl@0: { sl@0: TheGc->Activate(*BaseWin->Win()); sl@0: TheGc->SetBrushColor(TRgb::Gray16(14)); sl@0: TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TheGc->SetPenStyle(CGraphicsContext::ENullPen); sl@0: TheGc->DrawRect(TRect(BaseWin->Win()->Size())); sl@0: TInt scale=16; sl@0: TSize size(TestWin->Size()); sl@0: TSize scaleSize(size.iWidth/scale,size.iHeight/scale); sl@0: iOffset1=TPoint((size.iWidth-scaleSize.iWidth)/2,(size.iWidth-scaleSize.iHeight)/2); sl@0: TheGc->DrawRect(TRect(iOffset1,scaleSize)); sl@0: TheGc->Deactivate(); sl@0: // sl@0: TheGc->Activate(*TestWin->Win()); sl@0: TheGc->SetBrushColor(TRgb::Gray16(15)); sl@0: TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TheGc->SetPenStyle(CGraphicsContext::ENullPen); sl@0: TheGc->DrawRect(TRect(TestWin->Win()->Size())); sl@0: { sl@0: TInt scale=1; sl@0: TSize size(TestWin->Size()); sl@0: TSize scaleSize(size.iWidth/scale,size.iHeight/scale); sl@0: iOffset2=TPoint((size.iWidth-scaleSize.iWidth)/2,(size.iWidth-scaleSize.iHeight)/2); sl@0: TheGc->DrawRect(TRect(iOffset2,scaleSize)); sl@0: TheGc->Deactivate(); sl@0: } sl@0: } sl@0: sl@0: void CTRectList::RunTestCaseL(TInt /*aCurTestCase*/) sl@0: { sl@0: ((CTRectListStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); sl@0: switch(++iTest->iState) sl@0: { sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0028 sl@0: sl@0: @@SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Draw rectangles from a list in two different positions sl@0: on the screen sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Draw a list of rectangles to the screen sl@0: sl@0: @SYMTestExpectedResults Rectangles are drawn without error sl@0: */ sl@0: case 1: sl@0: ((CTRectListStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0028")); sl@0: iTest->LogSubTest(_L("RectListCheck")); sl@0: { sl@0: TheGc->Activate(*BaseWin->Win()); sl@0: TheGc->SetPenColor(TRgb::Gray16(7)); sl@0: TInt scale=16; sl@0: for(TInt index=0;indexiTestRects.Count3();index++) sl@0: { sl@0: TRect rect=iTest->iTestRects[index]; sl@0: rect.iTl.iX/=scale; sl@0: rect.iTl.iY/=scale; sl@0: rect.iBr.iX/=scale; sl@0: rect.iBr.iY/=scale; sl@0: rect.Move(iOffset1); sl@0: TheGc->DrawRect(rect); sl@0: } sl@0: TheGc->Deactivate(); sl@0: } sl@0: { sl@0: TheGc->Activate(*TestWin->Win()); sl@0: TheGc->SetPenColor(TRgb::Gray16(7)); sl@0: TInt scale=1; sl@0: for(TInt index=0;indexiTestRects.Count3();index++) sl@0: { sl@0: TRect rect=iTest->iTestRects[index]; sl@0: rect.iTl.iX/=scale; sl@0: rect.iTl.iY/=scale; sl@0: rect.iBr.iX/=scale; sl@0: rect.iBr.iY/=scale; sl@0: rect.Move(iOffset2); sl@0: TheGc->DrawRect(rect); sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: TheGc->Deactivate(); sl@0: } sl@0: TEST(ETrue); sl@0: break; sl@0: case 2: sl@0: ((CTRectListStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: iTest->LogSubTest(_L("Panic")); sl@0: break; sl@0: case 3: sl@0: ((CTRectListStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: ((CTRectListStep*)iStep)->CloseTMSGraphicsStep(); sl@0: TestComplete(); sl@0: break; sl@0: } sl@0: ((CTRectListStep*)iStep)->RecordTestResultL(); sl@0: } sl@0: sl@0: __WS_CONSTRUCT_STEP__(RectList)