First public contribution.
1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Generate a list of rectangles to be used as parameters for graphics tests
21 @internalComponent - Internal Symbian test code
25 #include "TRECTLIST.H"
27 CTRectList::CTRectList(CTestStep* aStep) : CTWsGraphicsBase(aStep)
31 CTRectList::~CTRectList()
35 void CTRectList::ConstructL()
37 TheGc->Activate(*BaseWin->Win());
38 TheGc->SetBrushColor(TRgb::Gray16(14));
39 TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
40 TheGc->SetPenStyle(CGraphicsContext::ENullPen);
41 TheGc->DrawRect(TRect(BaseWin->Win()->Size()));
43 TSize size(TestWin->Size());
44 TSize scaleSize(size.iWidth/scale,size.iHeight/scale);
45 iOffset1=TPoint((size.iWidth-scaleSize.iWidth)/2,(size.iWidth-scaleSize.iHeight)/2);
46 TheGc->DrawRect(TRect(iOffset1,scaleSize));
49 TheGc->Activate(*TestWin->Win());
50 TheGc->SetBrushColor(TRgb::Gray16(15));
51 TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
52 TheGc->SetPenStyle(CGraphicsContext::ENullPen);
53 TheGc->DrawRect(TRect(TestWin->Win()->Size()));
56 TSize size(TestWin->Size());
57 TSize scaleSize(size.iWidth/scale,size.iHeight/scale);
58 iOffset2=TPoint((size.iWidth-scaleSize.iWidth)/2,(size.iWidth-scaleSize.iHeight)/2);
59 TheGc->DrawRect(TRect(iOffset2,scaleSize));
64 void CTRectList::RunTestCaseL(TInt /*aCurTestCase*/)
66 ((CTRectListStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
67 switch(++iTest->iState)
70 @SYMTestCaseID GRAPHICS-WSERV-0028
74 @SYMTestCaseDesc Draw rectangles from a list in two different positions
79 @SYMTestStatus Implemented
81 @SYMTestActions Draw a list of rectangles to the screen
83 @SYMTestExpectedResults Rectangles are drawn without error
86 ((CTRectListStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0028"));
87 iTest->LogSubTest(_L("RectListCheck"));
89 TheGc->Activate(*BaseWin->Win());
90 TheGc->SetPenColor(TRgb::Gray16(7));
92 for(TInt index=0;index<iTest->iTestRects.Count3();index++)
94 TRect rect=iTest->iTestRects[index];
100 TheGc->DrawRect(rect);
105 TheGc->Activate(*TestWin->Win());
106 TheGc->SetPenColor(TRgb::Gray16(7));
108 for(TInt index=0;index<iTest->iTestRects.Count3();index++)
110 TRect rect=iTest->iTestRects[index];
116 TheGc->DrawRect(rect);
118 TheClient->iWs.Flush();
124 ((CTRectListStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
125 iTest->LogSubTest(_L("Panic"));
128 ((CTRectListStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
129 ((CTRectListStep*)iStep)->CloseTMSGraphicsStep();
133 ((CTRectListStep*)iStep)->RecordTestResultL();
136 __WS_CONSTRUCT_STEP__(RectList)