|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Generate a list of rectangles to be used as parameters for graphics tests |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @test |
|
21 @internalComponent - Internal Symbian test code |
|
22 */ |
|
23 |
|
24 |
|
25 #include "TRECTLIST.H" |
|
26 |
|
27 CTRectList::CTRectList(CTestStep* aStep) : CTWsGraphicsBase(aStep) |
|
28 { |
|
29 } |
|
30 |
|
31 CTRectList::~CTRectList() |
|
32 { |
|
33 } |
|
34 |
|
35 void CTRectList::ConstructL() |
|
36 { |
|
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())); |
|
42 TInt scale=16; |
|
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)); |
|
47 TheGc->Deactivate(); |
|
48 // |
|
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())); |
|
54 { |
|
55 TInt scale=1; |
|
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)); |
|
60 TheGc->Deactivate(); |
|
61 } |
|
62 } |
|
63 |
|
64 void CTRectList::RunTestCaseL(TInt /*aCurTestCase*/) |
|
65 { |
|
66 ((CTRectListStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); |
|
67 switch(++iTest->iState) |
|
68 { |
|
69 /** |
|
70 @SYMTestCaseID GRAPHICS-WSERV-0028 |
|
71 |
|
72 @@SYMDEF DEF081259 |
|
73 |
|
74 @SYMTestCaseDesc Draw rectangles from a list in two different positions |
|
75 on the screen |
|
76 |
|
77 @SYMTestPriority High |
|
78 |
|
79 @SYMTestStatus Implemented |
|
80 |
|
81 @SYMTestActions Draw a list of rectangles to the screen |
|
82 |
|
83 @SYMTestExpectedResults Rectangles are drawn without error |
|
84 */ |
|
85 case 1: |
|
86 ((CTRectListStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0028")); |
|
87 iTest->LogSubTest(_L("RectListCheck")); |
|
88 { |
|
89 TheGc->Activate(*BaseWin->Win()); |
|
90 TheGc->SetPenColor(TRgb::Gray16(7)); |
|
91 TInt scale=16; |
|
92 for(TInt index=0;index<iTest->iTestRects.Count3();index++) |
|
93 { |
|
94 TRect rect=iTest->iTestRects[index]; |
|
95 rect.iTl.iX/=scale; |
|
96 rect.iTl.iY/=scale; |
|
97 rect.iBr.iX/=scale; |
|
98 rect.iBr.iY/=scale; |
|
99 rect.Move(iOffset1); |
|
100 TheGc->DrawRect(rect); |
|
101 } |
|
102 TheGc->Deactivate(); |
|
103 } |
|
104 { |
|
105 TheGc->Activate(*TestWin->Win()); |
|
106 TheGc->SetPenColor(TRgb::Gray16(7)); |
|
107 TInt scale=1; |
|
108 for(TInt index=0;index<iTest->iTestRects.Count3();index++) |
|
109 { |
|
110 TRect rect=iTest->iTestRects[index]; |
|
111 rect.iTl.iX/=scale; |
|
112 rect.iTl.iY/=scale; |
|
113 rect.iBr.iX/=scale; |
|
114 rect.iBr.iY/=scale; |
|
115 rect.Move(iOffset2); |
|
116 TheGc->DrawRect(rect); |
|
117 } |
|
118 TheClient->iWs.Flush(); |
|
119 TheGc->Deactivate(); |
|
120 } |
|
121 TEST(ETrue); |
|
122 break; |
|
123 case 2: |
|
124 ((CTRectListStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); |
|
125 iTest->LogSubTest(_L("Panic")); |
|
126 break; |
|
127 case 3: |
|
128 ((CTRectListStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); |
|
129 ((CTRectListStep*)iStep)->CloseTMSGraphicsStep(); |
|
130 TestComplete(); |
|
131 break; |
|
132 } |
|
133 ((CTRectListStep*)iStep)->RecordTestResultL(); |
|
134 } |
|
135 |
|
136 __WS_CONSTRUCT_STEP__(RectList) |