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.
21 @internalComponent - Internal Symbian test code
28 CBaseWindow::CBaseWindow() : CTWin()
31 void CBaseWindow::ConstructL(CTWinBase &parent)
33 CTWin::ConstructL(parent);
36 void CBaseWindow::Draw()
38 iGc->SetBrushColor(iRgb);
42 void CBaseWindow::SetColor(const TRgb &aRgb)
52 TInt DestructCallbackBlank(TAny *aParam)
54 ((CTBlank *)aParam)->doDestruct();
59 CTBlank::CTBlank(CTestStep* aStep):
60 CTWsGraphicsBase(aStep)
62 INFO_PRINTF1(_L("Testing TBlank functions"));
65 void CTBlank::doDestruct()
67 BaseWin->SetVisible(ETrue);
68 TestWin->SetVisible(ETrue);
73 // CActiveScheduler::Stop();
78 TCallBack callBack(DestructCallbackBlank,this);
79 TheClient->SetRedrawCancelFunction(callBack);
80 // CActiveScheduler::Start();
83 void CTBlank::ConstructL()
85 BaseWin->SetVisible(EFalse);
86 TestWin->SetVisible(EFalse);
89 void CTBlank::SetColor(const TRgb &aRgb)
91 iTestWin->SetColor(aRgb);
92 iBaseWin->SetColor(aRgb);
95 void CTBlank::InvalidateTestWin(const TRect &aRect)
98 rect.Move(iTestWin->BaseWin()->InquireOffset(*(TheClient->iGroup->WinTreeNode())));
99 CTUser::Splat(TheClient, rect,TRgb(0,0,0));
102 void CTBlank::CheckBlankWindows()
104 User::Heap().Check();
105 CheckRect(iBaseWin,iTestWin,TRect(BaseWin->Size()),_L("CheckBlankWindows - CheckRect(iBaseWin,iTestWin,TRect(BaseWin->Size()) failed"));
108 void CTBlank::RunTestCaseL(TInt /*aCurTestCase*/)
113 ((CTBlankStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
115 switch(++iTest->iState)
118 @SYMTestCaseID GRAPHICS-WSERV-0022
122 @SYMTestCaseDesc Create a base and test blank windows and invalidate an
123 area of the test window
125 @SYMTestPriority High
127 @SYMTestStatus Implemented
129 @SYMTestActions Two windows are created and an area of a window is
132 @SYMTestExpectedResults Windows create and invalidate without error
135 ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0022"));
136 iTest->LogSubTest(_L("Blank 1"));
137 screenSize=TheClient->iGroup->Size();
138 winWidth=(screenSize.iWidth/3)-10;
139 winHeight=screenSize.iHeight-10;
140 iBaseWin=new(ELeave) CBaseWindow();
141 iBaseWin->SetUpL(TPoint(screenSize.iWidth/3+5,5),TSize(winWidth,winHeight),TheClient->iGroup,*TheClient->iGc);
142 iBaseWin->SetColor(TRgb(255,255,255));
143 iTestWin=new(ELeave) CTBlankWindow();
144 iTestWin->SetUpL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight),TheClient->iGroup,*TheClient->iGc);
145 SetColor(TRgb::Gray4(2));
146 InvalidateTestWin(TRect(10,10,50,50));
149 @SYMTestCaseID GRAPHICS-WSERV-0023
153 @SYMTestCaseDesc Check that a base blank window is the same as a
154 test window which has had an area invalidated
156 @SYMTestPriority High
158 @SYMTestStatus Implemented
160 @SYMTestActions Check the test window is the same as the base window
162 @SYMTestExpectedResults The windows are identical
165 ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0023"));
166 iTest->LogSubTest(_L("Check Blank 1"));
170 @SYMTestCaseID GRAPHICS-WSERV-0024
174 @SYMTestCaseDesc Set a color and invalidate two areas of a test blank
177 @SYMTestPriority High
179 @SYMTestStatus Implemented
181 @SYMTestActions Invalidate two areas of a test blank window
183 @SYMTestExpectedResults The window areas are invalidated without error
186 ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0024"));
187 iTest->LogSubTest(_L("Blank 2"));
188 SetColor(TRgb(0,0,0));
189 InvalidateTestWin(TRect(1,1,150,20));
190 InvalidateTestWin(TRect(10,-10,20,90));
193 @SYMTestCaseID GRAPHICS-WSERV-0025
197 @SYMTestCaseDesc Check a base blank window is identical to a test
198 blank window which has had two areas invalidated
200 @SYMTestPriority High
202 @SYMTestStatus Implemented
204 @SYMTestActions Check the test window is the same as the base window
206 @SYMTestExpectedResults The windows are identical
209 ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0025"));
210 iTest->LogSubTest(_L("Check Blank 2"));
214 @SYMTestCaseID GRAPHICS-WSERV-0026
218 @SYMTestCaseDesc Set a color and invalidate three areas of a test blank
221 @SYMTestPriority High
223 @SYMTestStatus Implemented
225 @SYMTestActions Invalidate three areas of a test blank window
227 @SYMTestExpectedResults The window areas are invalidated without error
230 ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0026"));
231 iTest->LogSubTest(_L("Blank 3"));
232 SetColor(TRgb(255,255,255));
233 InvalidateTestWin(TRect(-1000,100,1000,120));
234 InvalidateTestWin(TRect(1,1,150,20));
235 InvalidateTestWin(TRect(10,30,20,60));
238 @SYMTestCaseID GRAPHICS-WSERV-0027
242 @SYMTestCaseDesc Check a base blank window is identical to a test
243 blank window which has had three areas invalidated
245 @SYMTestPriority High
247 @SYMTestStatus Implemented
249 @SYMTestActions Check the test window is the same as the base window
251 @SYMTestExpectedResults The windows are identical
254 ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0027"));
255 iTest->LogSubTest(_L("Check Blank 3"));
263 ((CTBlankStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
264 ((CTBlankStep*)iStep)->CloseTMSGraphicsStep();
268 ((CTBlankStep*)iStep)->RecordTestResultL();
271 __WS_CONSTRUCT_STEP__(Blank)