1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/TBLANK.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,271 @@
1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Test blank windows
1.18 +//
1.19 +//
1.20 +
1.21 +/**
1.22 + @file
1.23 + @test
1.24 + @internalComponent - Internal Symbian test code
1.25 +*/
1.26 +
1.27 +
1.28 +#include "TBLANK.H"
1.29 +
1.30 +
1.31 +CBaseWindow::CBaseWindow() : CTWin()
1.32 + {}
1.33 +
1.34 +void CBaseWindow::ConstructL(CTWinBase &parent)
1.35 + {
1.36 + CTWin::ConstructL(parent);
1.37 + }
1.38 +
1.39 +void CBaseWindow::Draw()
1.40 + {
1.41 + iGc->SetBrushColor(iRgb);
1.42 + iGc->Clear();
1.43 + }
1.44 +
1.45 +void CBaseWindow::SetColor(const TRgb &aRgb)
1.46 + {
1.47 + iRgb=aRgb;
1.48 + iGc->Activate(iWin);
1.49 + Draw();
1.50 + iGc->Deactivate();
1.51 + }
1.52 +
1.53 +//
1.54 +
1.55 +TInt DestructCallbackBlank(TAny *aParam)
1.56 + {
1.57 + ((CTBlank *)aParam)->doDestruct();
1.58 + return(0);
1.59 + }
1.60 +
1.61 +
1.62 +CTBlank::CTBlank(CTestStep* aStep):
1.63 + CTWsGraphicsBase(aStep)
1.64 + {
1.65 + INFO_PRINTF1(_L("Testing TBlank functions"));
1.66 + }
1.67 +
1.68 +void CTBlank::doDestruct()
1.69 + {
1.70 + BaseWin->SetVisible(ETrue);
1.71 + TestWin->SetVisible(ETrue);
1.72 + delete iBaseWin;
1.73 + delete iTestWin;
1.74 + iBaseWin = NULL;
1.75 + iTestWin = NULL;
1.76 +// CActiveScheduler::Stop();
1.77 + }
1.78 +
1.79 +CTBlank::~CTBlank()
1.80 + {
1.81 + TCallBack callBack(DestructCallbackBlank,this);
1.82 + TheClient->SetRedrawCancelFunction(callBack);
1.83 +// CActiveScheduler::Start();
1.84 + }
1.85 +
1.86 +void CTBlank::ConstructL()
1.87 + {
1.88 + BaseWin->SetVisible(EFalse);
1.89 + TestWin->SetVisible(EFalse);
1.90 + }
1.91 +
1.92 +void CTBlank::SetColor(const TRgb &aRgb)
1.93 + {
1.94 + iTestWin->SetColor(aRgb);
1.95 + iBaseWin->SetColor(aRgb);
1.96 + }
1.97 +
1.98 +void CTBlank::InvalidateTestWin(const TRect &aRect)
1.99 + {
1.100 + TRect rect(aRect);
1.101 + rect.Move(iTestWin->BaseWin()->InquireOffset(*(TheClient->iGroup->WinTreeNode())));
1.102 + CTUser::Splat(TheClient, rect,TRgb(0,0,0));
1.103 + }
1.104 +
1.105 +void CTBlank::CheckBlankWindows()
1.106 + {
1.107 + User::Heap().Check();
1.108 + CheckRect(iBaseWin,iTestWin,TRect(BaseWin->Size()),_L("CheckBlankWindows - CheckRect(iBaseWin,iTestWin,TRect(BaseWin->Size()) failed"));
1.109 + }
1.110 +
1.111 +void CTBlank::RunTestCaseL(TInt /*aCurTestCase*/)
1.112 + {
1.113 + TSize screenSize;
1.114 + TInt winWidth;
1.115 + TInt winHeight;
1.116 + ((CTBlankStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
1.117 +
1.118 + switch(++iTest->iState)
1.119 + {
1.120 +/**
1.121 +@SYMTestCaseID GRAPHICS-WSERV-0022
1.122 +
1.123 +@SYMDEF DEF081259
1.124 +
1.125 +@SYMTestCaseDesc Create a base and test blank windows and invalidate an
1.126 + area of the test window
1.127 +
1.128 +@SYMTestPriority High
1.129 +
1.130 +@SYMTestStatus Implemented
1.131 +
1.132 +@SYMTestActions Two windows are created and an area of a window is
1.133 + invalidated
1.134 +
1.135 +@SYMTestExpectedResults Windows create and invalidate without error
1.136 +*/
1.137 + case 1:
1.138 + ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0022"));
1.139 + iTest->LogSubTest(_L("Blank 1"));
1.140 + screenSize=TheClient->iGroup->Size();
1.141 + winWidth=(screenSize.iWidth/3)-10;
1.142 + winHeight=screenSize.iHeight-10;
1.143 + iBaseWin=new(ELeave) CBaseWindow();
1.144 + iBaseWin->SetUpL(TPoint(screenSize.iWidth/3+5,5),TSize(winWidth,winHeight),TheClient->iGroup,*TheClient->iGc);
1.145 + iBaseWin->SetColor(TRgb(255,255,255));
1.146 + iTestWin=new(ELeave) CTBlankWindow();
1.147 + iTestWin->SetUpL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight),TheClient->iGroup,*TheClient->iGc);
1.148 + SetColor(TRgb::Gray4(2));
1.149 + InvalidateTestWin(TRect(10,10,50,50));
1.150 + break;
1.151 +/**
1.152 +@SYMTestCaseID GRAPHICS-WSERV-0023
1.153 +
1.154 +@SYMDEF DEF081259
1.155 +
1.156 +@SYMTestCaseDesc Check that a base blank window is the same as a
1.157 + test window which has had an area invalidated
1.158 +
1.159 +@SYMTestPriority High
1.160 +
1.161 +@SYMTestStatus Implemented
1.162 +
1.163 +@SYMTestActions Check the test window is the same as the base window
1.164 +
1.165 +@SYMTestExpectedResults The windows are identical
1.166 +*/
1.167 + case 2:
1.168 + ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0023"));
1.169 + iTest->LogSubTest(_L("Check Blank 1"));
1.170 + CheckBlankWindows();
1.171 + break;
1.172 +/**
1.173 +@SYMTestCaseID GRAPHICS-WSERV-0024
1.174 +
1.175 +@SYMDEF DEF081259
1.176 +
1.177 +@SYMTestCaseDesc Set a color and invalidate two areas of a test blank
1.178 + window
1.179 +
1.180 +@SYMTestPriority High
1.181 +
1.182 +@SYMTestStatus Implemented
1.183 +
1.184 +@SYMTestActions Invalidate two areas of a test blank window
1.185 +
1.186 +@SYMTestExpectedResults The window areas are invalidated without error
1.187 +*/
1.188 + case 3:
1.189 + ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0024"));
1.190 + iTest->LogSubTest(_L("Blank 2"));
1.191 + SetColor(TRgb(0,0,0));
1.192 + InvalidateTestWin(TRect(1,1,150,20));
1.193 + InvalidateTestWin(TRect(10,-10,20,90));
1.194 + break;
1.195 +/**
1.196 +@SYMTestCaseID GRAPHICS-WSERV-0025
1.197 +
1.198 +@SYMDEF DEF081259
1.199 +
1.200 +@SYMTestCaseDesc Check a base blank window is identical to a test
1.201 + blank window which has had two areas invalidated
1.202 +
1.203 +@SYMTestPriority High
1.204 +
1.205 +@SYMTestStatus Implemented
1.206 +
1.207 +@SYMTestActions Check the test window is the same as the base window
1.208 +
1.209 +@SYMTestExpectedResults The windows are identical
1.210 +*/
1.211 + case 4:
1.212 + ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0025"));
1.213 + iTest->LogSubTest(_L("Check Blank 2"));
1.214 + CheckBlankWindows();
1.215 + break;
1.216 +/**
1.217 +@SYMTestCaseID GRAPHICS-WSERV-0026
1.218 +
1.219 +@SYMDEF DEF081259
1.220 +
1.221 +@SYMTestCaseDesc Set a color and invalidate three areas of a test blank
1.222 + window
1.223 +
1.224 +@SYMTestPriority High
1.225 +
1.226 +@SYMTestStatus Implemented
1.227 +
1.228 +@SYMTestActions Invalidate three areas of a test blank window
1.229 +
1.230 +@SYMTestExpectedResults The window areas are invalidated without error
1.231 +*/
1.232 + case 5:
1.233 + ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0026"));
1.234 + iTest->LogSubTest(_L("Blank 3"));
1.235 + SetColor(TRgb(255,255,255));
1.236 + InvalidateTestWin(TRect(-1000,100,1000,120));
1.237 + InvalidateTestWin(TRect(1,1,150,20));
1.238 + InvalidateTestWin(TRect(10,30,20,60));
1.239 + break;
1.240 +/**
1.241 +@SYMTestCaseID GRAPHICS-WSERV-0027
1.242 +
1.243 +@@SYMDEF DEF081259
1.244 +
1.245 +@SYMTestCaseDesc Check a base blank window is identical to a test
1.246 + blank window which has had three areas invalidated
1.247 +
1.248 +@SYMTestPriority High
1.249 +
1.250 +@SYMTestStatus Implemented
1.251 +
1.252 +@SYMTestActions Check the test window is the same as the base window
1.253 +
1.254 +@SYMTestExpectedResults The windows are identical
1.255 +*/
1.256 + case 6:
1.257 + ((CTBlankStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0027"));
1.258 + iTest->LogSubTest(_L("Check Blank 3"));
1.259 + CheckBlankWindows();
1.260 + delete iBaseWin;
1.261 + delete iTestWin;
1.262 + iBaseWin = NULL;
1.263 + iTestWin = NULL;
1.264 + break;
1.265 + case 7:
1.266 + ((CTBlankStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
1.267 + ((CTBlankStep*)iStep)->CloseTMSGraphicsStep();
1.268 + TestComplete();
1.269 + break;
1.270 + }
1.271 + ((CTBlankStep*)iStep)->RecordTestResultL();
1.272 + }
1.273 +
1.274 +__WS_CONSTRUCT_STEP__(Blank)