1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/TMULSCREENS.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,666 @@
1.4 +// Copyright (c) 2006-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 +// Enable Multiple Displays
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 +#include "TMULSCREENS.h"
1.28 +
1.29 +const TInt KFstScreenNo = 0;
1.30 +const TInt KSndScreenNo = 1;
1.31 +
1.32 +CTMulScreens::CTMulScreens(CTestStep* aStep):
1.33 + CTWsGraphicsBase(aStep)
1.34 + {
1.35 + }
1.36 +
1.37 +void CTMulScreens::ConstructL()
1.38 + {
1.39 + User::LeaveIfError(iRws.Connect());
1.40 + iFstScreenDevice =new(ELeave) CWsScreenDevice(iRws);
1.41 + TInt err = iFstScreenDevice->Construct(KFstScreenNo);
1.42 + iTest->LogLeave(err);
1.43 + User::LeaveIfError(err);
1.44 + iNumScreens = iRws.NumberOfScreens();
1.45 + if(KSndScreenNo<iNumScreens)
1.46 + {
1.47 + iSndScreenDevice =new(ELeave) CWsScreenDevice(iRws);
1.48 + err = iSndScreenDevice->Construct(KSndScreenNo);
1.49 + iTest->LogLeave(err);
1.50 + User::LeaveIfError(err);
1.51 + }
1.52 + INFO_PRINTF2(_L("The number of screens supported on this device is %d"),iNumScreens);
1.53 + }
1.54 +
1.55 +CTMulScreens::~CTMulScreens()
1.56 + {
1.57 + iFstWinGp.Close();
1.58 + if(KSndScreenNo<iNumScreens)
1.59 + {
1.60 + iSndWinGp.Close();
1.61 + delete iSndScreenDevice;
1.62 + }
1.63 + delete iFstScreenDevice;
1.64 + iRws.Close();
1.65 + }
1.66 +
1.67 +/**
1.68 + @SYMTestCaseID GRAPHICS-WSERV-0383
1.69 +
1.70 + @SYMPREQ PREQ1227
1.71 +
1.72 + @SYMREQ REQ5541
1.73 +
1.74 + @SYMTestCaseDesc Create Window Group(s) on each screen.
1.75 +
1.76 + @SYMTestPriority High
1.77 +
1.78 + @SYMTestStatus Implemented
1.79 +
1.80 + @SYMTestActions Call RWsSession::NumWindowGroups() to get the number of window groups of a given window group priority running on a specified screen.
1.81 + Test the number of Window Groups on each screen.
1.82 + Test the size of the list of window group on each screen.
1.83 + Test the Window Group which has the keyboard focus on the second screen.
1.84 + API Calls:\n
1.85 + TInt RWsSession::NumWindowGroups(TInt aScreenNumber,TInt aPriority) const
1.86 + TInt RWsSession::WindowGroupList(CArrayFixFlat<TInt>* aWindowList,TInt aScreenNumber,TInt aPriority)
1.87 + TInt RWindowGroup::Construct(TUint32 aClientHandle,CWsScreenDevice* aScreenDevice)
1.88 + TInt RWsSession::GetFocusWindowGroup(TInt aScreenNumber)
1.89 +
1.90 + @SYMTestExpectedResults Provided that a second screen is configured in the epoc.ini and the wsini.ini, this test case will create one window group on the first screen
1.91 + and two window groups on the second screen.
1.92 + If only one screen is configured, then it will create one group on the primary screen.
1.93 + Otherwise this function leaves with a system-wide error.
1.94 +*/
1.95 +
1.96 +void CTMulScreens::TestCreateGroupWindowsL()
1.97 + {
1.98 + const TInt fstNumWinGps = iRws.NumWindowGroups(KFstScreenNo,EAllPriorities);
1.99 + CArrayFixFlat<TInt>* fstList = new(ELeave) CArrayFixFlat<TInt>(1);
1.100 + CleanupStack::PushL(fstList);
1.101 + TInt err = iRws.WindowGroupList(fstList,KFstScreenNo,EAllPriorities);
1.102 + TEST(err==KErrNone);
1.103 + TEST(fstList->Count()==fstNumWinGps);
1.104 + err = iRws.WindowGroupList(fstList); //test existing api
1.105 + TEST(err==KErrNone);
1.106 + TEST(fstList->Count()==(iRws.NumWindowGroups()));
1.107 + iFstWinGp = RWindowGroup(iRws);
1.108 + TRAP(err,iFstWinGp.Construct(ENullWsHandle,iFstScreenDevice));
1.109 + TEST(err==KErrNone);
1.110 + if(err==KErrNone)
1.111 + {
1.112 + TEST(iRws.NumWindowGroups(KFstScreenNo,EAllPriorities) == (fstNumWinGps+1));
1.113 + }
1.114 + CleanupStack::PopAndDestroy(fstList);
1.115 +
1.116 + //Second screen has been configured.
1.117 + if(KSndScreenNo<iNumScreens)
1.118 + {
1.119 + TInt winId = iRws.GetFocusWindowGroup(KSndScreenNo);
1.120 + TEST(winId==KErrGeneral);
1.121 + iSndWinGp = RWindowGroup(iRws);
1.122 + TRAP(err,iSndWinGp.Construct(ENullWsHandle,ETrue,iSndScreenDevice));
1.123 + TEST(err==KErrNone);
1.124 + if(err==KErrNone)
1.125 + {
1.126 + winId = iRws.GetFocusWindowGroup(KSndScreenNo);
1.127 + TEST(winId==iSndWinGp.Identifier());
1.128 + TEST(iRws.NumWindowGroups(KFstScreenNo,EAllPriorities) == (fstNumWinGps+1)); //test that the no. of screens unchanged on first screen
1.129 + CArrayFixFlat<TInt>* sndList =new(ELeave) CArrayFixFlat<TInt>(1);
1.130 + CleanupStack::PushL(sndList);
1.131 + TInt sndNumWinGps = iRws.NumWindowGroups(KSndScreenNo,iSndWinGp.OrdinalPriority());
1.132 + err = iRws.WindowGroupList(sndList,KSndScreenNo,iSndWinGp.OrdinalPriority());
1.133 + TEST(err==KErrNone);
1.134 + TEST(sndList->Count()==sndNumWinGps);
1.135 +
1.136 + iSndWinGp.SetOrdinalPosition(iSndWinGp.OrdinalPosition(),EAllPriorities);
1.137 + TInt allPriNumWinGps= iRws.NumWindowGroups(EAllPriorities);
1.138 + CArrayFixFlat<TInt>* allPriList =new(ELeave) CArrayFixFlat<TInt>(1);
1.139 + CleanupStack::PushL(allPriList);
1.140 + err = iRws.WindowGroupList(EAllPriorities,allPriList);
1.141 + TEST(err==KErrNone);
1.142 + TEST(allPriList->Count()==allPriNumWinGps);
1.143 +
1.144 + CleanupStack::PopAndDestroy(2,sndList);
1.145 + }
1.146 + RWindowGroup trdWinGp = RWindowGroup(iRws);
1.147 + TRAP(err,trdWinGp.Construct(ENullWsHandle,ETrue,iSndScreenDevice));
1.148 + TEST(err==KErrNone);
1.149 + if(err==KErrNone)
1.150 + {
1.151 + winId = iRws.GetFocusWindowGroup(KSndScreenNo);
1.152 + TEST(winId==trdWinGp.Identifier());
1.153 + trdWinGp.Close();
1.154 + }
1.155 + }
1.156 + }
1.157 +
1.158 +/**
1.159 + @SYMTestCaseID GRAPHICS-WSERV-0384
1.160 +
1.161 + @SYMPREQ PREQ1227
1.162 +
1.163 + @SYMREQ REQ5541
1.164 +
1.165 + @SYMTestCaseDependencies SYMTestCaseID GRAPHICS-WSERV-0383
1.166 +
1.167 + @SYMTestCaseDesc Create a blank window on each screen.
1.168 +
1.169 + @SYMTestPriority High
1.170 +
1.171 + @SYMTestStatus Implemented
1.172 +
1.173 + @SYMTestActions Test that each blank window is created on a different screen.
1.174 + API Calls:\n
1.175 + TInt RBlankWindow::Construct(const RWindowTreeNode &parent, TUint32 aClientHandle) where parent is
1.176 + a Window Group created on each screen.
1.177 +
1.178 + @SYMTestExpectedResults The background colour of the first screen changes to blue and that of the second one changes to green.
1.179 + Otherwise this function leaves with a system-wide error.
1.180 +*/
1.181 +void CTMulScreens::TestCreateBlankWindowsL()
1.182 + {
1.183 + RBlankWindow fstBlankWin(iRws);
1.184 + CleanupClosePushL(fstBlankWin);
1.185 + TRAPD(err,fstBlankWin.Construct(iFstWinGp,ENullWsHandle));
1.186 + TEST(err==KErrNone);
1.187 + if(err==KErrNone)
1.188 + {
1.189 + fstBlankWin.SetRequiredDisplayMode(EColor256);
1.190 + fstBlankWin.SetColor(TRgb(0,0,255)); // paint the screen blue
1.191 + fstBlankWin.Activate();
1.192 + iRws.Flush();
1.193 + TheClient->WaitForRedrawsToFinish();
1.194 + User::After(6000000);
1.195 + }
1.196 + CleanupStack::PopAndDestroy();//fstBlankWin
1.197 +
1.198 + // Second screen
1.199 + if(KSndScreenNo<iNumScreens)
1.200 + {
1.201 + RBlankWindow sndBlankWin(iRws);
1.202 + CleanupClosePushL(sndBlankWin);
1.203 + TRAP(err,sndBlankWin.Construct(iSndWinGp,ENullWsHandle));
1.204 + TEST(err==KErrNone);
1.205 + if(err==KErrNone)
1.206 + {
1.207 + sndBlankWin.SetRequiredDisplayMode(EColor256);
1.208 + sndBlankWin.SetColor(TRgb(0,255,0)); //paint the screen green
1.209 + sndBlankWin.Activate(); //there is a defect in Activate() because there is a delay before the second screen turns green
1.210 + iRws.Flush();
1.211 + TheClient->WaitForRedrawsToFinish();
1.212 + User::After(6000000);
1.213 + }
1.214 + CleanupStack::PopAndDestroy(); //sndBlankWin
1.215 + }
1.216 + }
1.217 +
1.218 +
1.219 +/**
1.220 + @SYMTestCaseID GRAPHICS-WSERV-0385
1.221 +
1.222 + @SYMPREQ PREQ1227
1.223 +
1.224 + @SYMREQ REQ5541
1.225 +
1.226 + @SYMTestCaseDependencies SYMTestCaseID GRAPHICS-WSERV-0383
1.227 +
1.228 + @SYMTestCaseDesc Test the Window Group that has the keyboard focus for each screen.
1.229 +
1.230 + @SYMTestPriority High
1.231 +
1.232 + @SYMTestStatus Implemented
1.233 +
1.234 + @SYMTestActions Call RWsSession::GetFocusWindowGroup on each screen.
1.235 + API Calls:\n
1.236 + TInt RWsSession::GetFocusWindowGroup(TInt aScreenNumber)
1.237 +
1.238 + @SYMTestExpectedResults The identifier returned by the API for each screen is tested to see if it is the expected Window Group ID; ie the
1.239 + ID of the window group created in the first test case.
1.240 +*/
1.241 +void CTMulScreens::TestGetFocusWindow()
1.242 + {
1.243 + TInt winId = iRws.GetFocusWindowGroup(KFstScreenNo);
1.244 + TEST(winId==iFstWinGp.Identifier());
1.245 + if(KSndScreenNo<iNumScreens)
1.246 + {
1.247 + winId = iRws.GetFocusWindowGroup(KSndScreenNo);
1.248 + TEST(winId==iSndWinGp.Identifier());
1.249 + TEST(iRws.GetFocusWindowGroup()==iFstWinGp.Identifier());
1.250 + }
1.251 + }
1.252 +
1.253 +/**
1.254 + @SYMTestCaseID GRAPHICS-WSERV-0386
1.255 +
1.256 + @SYMPREQ PREQ1227
1.257 +
1.258 + @SYMREQ REQ5541
1.259 +
1.260 + @SYMTestCaseDependencies SYMTestCaseID GRAPHICS-WSERV-0383
1.261 +
1.262 + @SYMTestCaseDesc Test the default owning window on each screen.
1.263 +
1.264 + @SYMTestPriority High
1.265 +
1.266 + @SYMTestStatus Implemented
1.267 +
1.268 + @SYMTestActions Call RWsSession::GetDefaultOwningWindow() to return the ID of the default owning window.
1.269 + Call RWsSession::DefaultOwningWindow() on the second Window Group to set it as the default owning window on the second screen.
1.270 + Call new API RWsSession::GetDefaultOwningWindow(TInt aScreenNumber) to get the default owning window on the second screen.
1.271 + API Calls:\n
1.272 + TInt RWsSession::GetFocusWindowGroup()
1.273 + TInt RWsSession::GetFocusWindowGroup(TInt aScreenNumber)
1.274 +
1.275 + @SYMTestExpectedResults The identifier returned by the API for each screen is tested to see that they are not the same.
1.276 +*/
1.277 +void CTMulScreens::TestGetDefaultOwningWindow()
1.278 + {
1.279 + if(KSndScreenNo<iNumScreens)
1.280 + {
1.281 + TInt prevWinId = iRws.GetDefaultOwningWindow();
1.282 + iSndWinGp.DefaultOwningWindow();
1.283 + TInt winId = iRws.GetDefaultOwningWindow(KSndScreenNo);
1.284 + TEST(winId==iSndWinGp.Identifier());
1.285 + TEST(prevWinId!=winId);
1.286 + }
1.287 + }
1.288 +
1.289 +/**
1.290 + @SYMTestCaseID GRAPHICS-WSERV-0387
1.291 +
1.292 + @SYMPREQ PREQ1227
1.293 +
1.294 + @SYMREQ REQ5541
1.295 +
1.296 + @SYMTestCaseDesc Test the background colour.
1.297 +
1.298 + @SYMTestPriority High
1.299 +
1.300 + @SYMTestStatus Implemented
1.301 +
1.302 + @SYMTestActions Call RWsSession::GetBackgroundColor() to store the default value;Change the background colour by calling RWsSession::SetBackgroundColor();
1.303 + Test that the background has changed; Restore the background colour.
1.304 + API Calls:\n
1.305 + TRgb RWsSession::GetBackgroundColor() const
1.306 + void RWsSession::SetBackgroundColor(TRgb colour)
1.307 +
1.308 + @SYMTestExpectedResults Background color should change when SetBackgroundColor is called.
1.309 +*/
1.310 +void CTMulScreens::TestSetBackgroundColour()
1.311 + {
1.312 + TRgb rgb_b4 = iRws.GetBackgroundColor();
1.313 + iRws.SetBackgroundColor(KRgbBlack);
1.314 + TEST(iRws.GetBackgroundColor()==KRgbBlack);
1.315 + iRws.SetBackgroundColor(rgb_b4);
1.316 + TEST(iRws.GetBackgroundColor()==rgb_b4);
1.317 + }
1.318 +
1.319 +/**
1.320 + @SYMTestCaseID GRAPHICS-WSERV-0388
1.321 +
1.322 + @SYMPREQ PREQ1227
1.323 +
1.324 + @SYMREQ REQ5541
1.325 +
1.326 + @SYMTestCaseDesc Test the shadow vector.
1.327 +
1.328 + @SYMTestPriority High
1.329 +
1.330 + @SYMTestStatus Implemented
1.331 +
1.332 + @SYMTestActions Call RWsSession::ShadowVector() to store the default value;Call RWsSession::SetShadowVector() to change the shadow vector;
1.333 + Test that the shadow vector has changed; Restore the shadow vector.
1.334 + API Calls:\n
1.335 + TPoint RWsSession::ShadowVector() const
1.336 + void RWsSession::SetShadowVector(const TPoint &aVector);
1.337 +
1.338 + @SYMTestExpectedResults The shadow vector should change when SetShadowVector is called.
1.339 +*/
1.340 +void CTMulScreens::TestSetShadowVector()
1.341 + {
1.342 + TPoint point_b4 = iRws.ShadowVector();
1.343 +
1.344 + iRws.SetShadowVector(TPoint(3,3));
1.345 +
1.346 + #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
1.347 + TEST(iRws.ShadowVector()==TPoint(0,0)); // in NGA SetShadowVector & ShadowVector are deprecated
1.348 + #else
1.349 + TEST(iRws.ShadowVector()==TPoint(3,3));
1.350 + #endif
1.351 +
1.352 + iRws.SetShadowVector(point_b4);
1.353 +
1.354 + #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
1.355 + TEST(iRws.ShadowVector()==TPoint(0,0)); // in NGA SetShadowVector & ShadowVector are deprecated
1.356 + #else
1.357 + TEST(iRws.ShadowVector()==point_b4);
1.358 + #endif
1.359 + }
1.360 +
1.361 +/**
1.362 + @SYMTestCaseID GRAPHICS-WSERV-0389
1.363 +
1.364 + @SYMPREQ PREQ1227
1.365 +
1.366 + @SYMREQ REQ5541
1.367 +
1.368 + @SYMTestCaseDesc Negative tests for the APIs listed below.
1.369 +
1.370 + @SYMTestPriority High
1.371 +
1.372 + @SYMTestStatus Implemented
1.373 +
1.374 + @SYMTestActions Launch a thread to call TestInvalidScreenNumber. Pass an invalid screen number to the APIs listed below.
1.375 + API Calls:\n
1.376 + TInt RWsSession::NumWindowGroups(TInt aScreenNumber,TInt aPriority) const
1.377 + TInt RWsSession::WindowGroupList(CArrayFixFlat<TInt>* aWindowList,TInt aScreenNumber,TInt aPriority)
1.378 + TInt RWsSession::GetFocusWindowGroup(TInt aScreenNumber)
1.379 + TInt GetDefaultOwningWindow(TInt aScreenNumber)
1.380 + TDisplayMode GetDefModeMaxNumColors(TInt aScreenNumber,TInt& aColor,TInt& aGray) const
1.381 + TInt GetColorModeList(TInt aScreenNumber,CArrayFixFlat<TInt>* aModeList) const
1.382 +
1.383 + @SYMTestExpectedResults The thread panics and exits with reason EWservPanicScreenNumber.
1.384 +*/
1.385 +void CTMulScreens::TestPanicsL()
1.386 + {
1.387 + TInt firstTest = 1;
1.388 + TInt lastTest = 6;
1.389 + const TInt KInvalidScreenNumber = 2;
1.390 + for (TInt option=firstTest;option<=lastTest;option++)
1.391 + {
1.392 + TEST(iTest->TestWsPanicL(&TestInvalidScreenNumberL,EWservPanicScreenNumber,option,(TAny*)KInvalidScreenNumber));
1.393 + }
1.394 + }
1.395 +
1.396 +TInt CTMulScreens::TestInvalidScreenNumberL(TInt aOption, TAny *aScreenNumber)
1.397 + {
1.398 + RWsSession wsSession;
1.399 + wsSession.Connect();
1.400 + switch((TInt)aOption)
1.401 + {
1.402 + case 1:
1.403 + wsSession.NumWindowGroups((TInt)aScreenNumber,EAllPriorities);
1.404 + break;
1.405 + case 2:
1.406 + {
1.407 + CArrayFixFlat<TInt>* list = new(ELeave) CArrayFixFlat<TInt>(1);
1.408 + wsSession.WindowGroupList(list,(TInt)aScreenNumber,EAllPriorities);
1.409 + }
1.410 + break;
1.411 + case 3:
1.412 + wsSession.GetFocusWindowGroup((TInt)aScreenNumber);
1.413 + break;
1.414 + case 4:
1.415 + wsSession.GetDefaultOwningWindow((TInt)aScreenNumber);
1.416 + break;
1.417 + case 5:
1.418 + {
1.419 + CArrayFixFlat<TInt>* list = new(ELeave) CArrayFixFlat<TInt>(1);
1.420 + wsSession.GetColorModeList((TInt)aScreenNumber,list);
1.421 + }
1.422 + break;
1.423 + case 6:
1.424 + {
1.425 + TInt color,gray;
1.426 + wsSession.GetDefModeMaxNumColors((TInt)aScreenNumber,color,gray);
1.427 + }
1.428 + break;
1.429 + default:
1.430 + User::Panic(_L("Default panic"),KErrGeneral);
1.431 + break;
1.432 + }
1.433 + return KErrNone;
1.434 + }
1.435 +
1.436 +
1.437 +/**
1.438 + @SYMTestCaseID GRAPHICS-WSERV-0390
1.439 +
1.440 + @SYMPREQ PREQ1227
1.441 +
1.442 + @SYMREQ REQ5541
1.443 +
1.444 + @SYMTestCaseDependencies SYMTestCaseID GRAPHICS-WSERV-0383
1.445 +
1.446 + @SYMTestCaseDesc Test that CWindowGc updates its screendevice each time it is activated on a window.
1.447 +
1.448 + @SYMTestPriority High
1.449 +
1.450 + @SYMTestStatus Implemented
1.451 +
1.452 + @SYMTestActions Activate the gc on both RWindows.CWindowGc::Device() is called after each activation has taken place.
1.453 + API Calls:\n
1.454 + void CWindowGc::Activate(RDrawableWindow &aDevice);
1.455 + void CWindowGc::Deactivate();
1.456 + CGraphicsDevice* CWindowGc::Device() const
1.457 + TInt RWindow::Construct(const RWindowTreeNode &parent,TUint32 aHandle);
1.458 +
1.459 + @SYMTestExpectedResults CWindowGc::Device() returns the screendevice on which the gc was last activated.
1.460 +*/
1.461 +void CTMulScreens::TestDeviceL()
1.462 + {
1.463 + RWindow fstWin(iRws);
1.464 + User::LeaveIfError(fstWin.Construct(iFstWinGp,ENullWsHandle));
1.465 + CleanupClosePushL(fstWin);
1.466 + fstWin.Activate();
1.467 +
1.468 + CWindowGc* gc=new (ELeave) CWindowGc(iFstScreenDevice);
1.469 + User::LeaveIfError(gc->Construct());
1.470 + CleanupStack::PushL(gc);
1.471 + gc->Activate(fstWin);
1.472 +
1.473 + TEST((CWsScreenDevice*)gc->Device()==iFstScreenDevice);
1.474 + gc->Deactivate();
1.475 +
1.476 + if(KSndScreenNo<iNumScreens)
1.477 + {
1.478 + RWindow sndWin(iRws);
1.479 + User::LeaveIfError(sndWin.Construct(iSndWinGp,ENullWsHandle));
1.480 + CleanupClosePushL(sndWin);
1.481 + sndWin.Activate();
1.482 +
1.483 + gc->Activate(sndWin);
1.484 + TEST((CWsScreenDevice*)gc->Device()==iSndScreenDevice);
1.485 + gc->Deactivate();
1.486 + CleanupStack::PopAndDestroy();
1.487 + }
1.488 +
1.489 + CleanupStack::PopAndDestroy(2,&fstWin);
1.490 + }
1.491 +
1.492 +/**
1.493 + @SYMTestCaseID GRAPHICS-WSERV-0034
1.494 +
1.495 + @SYMPREQ PREQ1227
1.496 +
1.497 + @SYMREQ REQ5541
1.498 +
1.499 + @SYMTestCaseDesc Test that the order of creating a screen device and window group does not matter.
1.500 +
1.501 + @SYMTestPriority High
1.502 +
1.503 + @SYMTestStatus Implemented
1.504 +
1.505 + @SYMTestActions Create a window group before creating the screen device. Create a graphics context and call activate on it.
1.506 + API Calls:\n
1.507 + TInt RWindowGroup::Construct(TUint32 aClientHandle)
1.508 + TInt CWsScreenDevice::Construct()
1.509 + void CWindowGc::Activate(RDrawableWindow &aDevice);
1.510 + void CWindowGc::Deactivate();
1.511 + TInt RWindow::Construct(const RWindowTreeNode &parent,TUint32 aHandle);
1.512 +
1.513 + @SYMTestExpectedResults The test code does not panic with EWservPanicGroupWinScreenDeviceDeleted
1.514 +*/
1.515 +void CTMulScreens::TestInitaliseScreenDeviceL()
1.516 + {
1.517 + RWsSession rws1;
1.518 + User::LeaveIfError(rws1.Connect());
1.519 + CleanupClosePushL(rws1);
1.520 +
1.521 + RWindowGroup gw1(rws1);
1.522 + User::LeaveIfError(gw1.Construct(ENullWsHandle));
1.523 + CleanupClosePushL(gw1);
1.524 +
1.525 + CWsScreenDevice* screen1 = new (ELeave) CWsScreenDevice(rws1);
1.526 + User::LeaveIfError(screen1->Construct());
1.527 + CleanupStack::PushL(screen1);
1.528 +
1.529 + RWindow win1(rws1);
1.530 + User::LeaveIfError(win1.Construct(gw1,ETrue));
1.531 + CleanupClosePushL(win1);
1.532 + win1.Activate();
1.533 +
1.534 + CWindowGc* gc=new (ELeave) CWindowGc(screen1);
1.535 + User::LeaveIfError(gc->Construct());
1.536 + CleanupStack::PushL(gc);
1.537 + gc->Activate(win1);
1.538 +
1.539 + CleanupStack::PopAndDestroy(5,&rws1);
1.540 + }
1.541 +
1.542 +/**
1.543 +@SYMTestCaseID GRAPHICS-WSERV-0492
1.544 +
1.545 +@SYMDEF PDEF126432
1.546 +
1.547 +@SYMTestCaseDesc Test the screen number that a window is located on
1.548 +
1.549 +@SYMTestPriority Medium
1.550 +
1.551 +@SYMTestStatus Implemented
1.552 +
1.553 +@SYMTestActions Create two windows on two screens respectively
1.554 + and check the screen number that each window is located on
1.555 +
1.556 +@SYMTestExpectedResults The screen numbers should match the expected ones
1.557 +*/
1.558 +void CTMulScreens::TestScreenNumbersOfWindowsL()
1.559 + {
1.560 + // First screen
1.561 + RWindow fstWin(iRws);
1.562 + CleanupClosePushL(fstWin);
1.563 + TRAPD(err,fstWin.Construct(iFstWinGp,ENullWsHandle));
1.564 + TEST(err==KErrNone);
1.565 + if(err==KErrNone)
1.566 + {
1.567 + fstWin.Activate();
1.568 + iRws.Flush();
1.569 + }
1.570 + TEST(fstWin.ScreenNumber()==KFstScreenNo);
1.571 + CleanupStack::PopAndDestroy();//fstWin
1.572 +
1.573 + // Second screen
1.574 + if(KSndScreenNo<iNumScreens)
1.575 + {
1.576 + RWindow sndWin(iRws);
1.577 + CleanupClosePushL(sndWin);
1.578 + TRAP(err,sndWin.Construct(iSndWinGp,ENullWsHandle));
1.579 + TEST(err==KErrNone);
1.580 + if(err==KErrNone)
1.581 + {
1.582 + sndWin.Activate();
1.583 + iRws.Flush();
1.584 + }
1.585 + TEST(sndWin.ScreenNumber()==KSndScreenNo);
1.586 + CleanupStack::PopAndDestroy(); //sndWin
1.587 + }
1.588 + }
1.589 +
1.590 +void CTMulScreens::RunTestCaseL(TInt aCurTestCase)
1.591 + {
1.592 + _LIT(KTest0,"Create a window group on each screen");
1.593 + _LIT(KTest1,"Create a blank window on each screen");
1.594 + _LIT(KTest2,"Get focus window");
1.595 + _LIT(KTest3,"Get default owning window");
1.596 + _LIT(KTest4,"Change background colour");
1.597 + _LIT(KTest5,"Change shadow vector");
1.598 + _LIT(KTest6,"Panic Tests");
1.599 + _LIT(KTest7,"Test device pointer returned by GC");
1.600 + _LIT(KTest8,"Initialise ScreenDevice");
1.601 + _LIT(KTest9,"Test screen numbers that windows are located on");
1.602 + ((CTMulScreensStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
1.603 +
1.604 + switch(aCurTestCase)
1.605 + {
1.606 + case 1:
1.607 + ((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0383"));
1.608 + INFO_PRINTF1(KTest0);
1.609 + TestCreateGroupWindowsL();
1.610 + break;
1.611 + case 2:
1.612 + ((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0384"));
1.613 + INFO_PRINTF1(KTest1);
1.614 + TestCreateBlankWindowsL();
1.615 + break;
1.616 + case 3:
1.617 + ((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0385"));
1.618 + INFO_PRINTF1(KTest2);
1.619 + TestGetFocusWindow();
1.620 + case 4:
1.621 + ((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0386"));
1.622 + INFO_PRINTF1(KTest3);
1.623 + TestGetDefaultOwningWindow();
1.624 + break;
1.625 + case 5:
1.626 + ((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0387"));
1.627 + INFO_PRINTF1(KTest4);
1.628 + TestSetBackgroundColour();
1.629 + break;
1.630 + case 6:
1.631 + ((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0388"));
1.632 + INFO_PRINTF1(KTest5);
1.633 + TestSetShadowVector();
1.634 + break;
1.635 + case 7:
1.636 + ((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0389"));
1.637 + INFO_PRINTF1(KTest6);
1.638 + TestPanicsL();
1.639 + break;
1.640 + case 8:
1.641 + ((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0390"));
1.642 + INFO_PRINTF1(KTest7);
1.643 + TestDeviceL();
1.644 + break;
1.645 + case 9:
1.646 + ((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0034"));
1.647 + INFO_PRINTF1(KTest8);
1.648 + TestInitaliseScreenDeviceL();
1.649 + break;
1.650 + case 10:
1.651 + ((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0492"));
1.652 + INFO_PRINTF1(KTest9);
1.653 + TestScreenNumbersOfWindowsL();
1.654 + case 11:
1.655 + ((CTMulScreensStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
1.656 + ((CTMulScreensStep*)iStep)->CloseTMSGraphicsStep();
1.657 + INFO_PRINTF1(_L("All tests completed.\n"));
1.658 + TestComplete();
1.659 + break;
1.660 + default:
1.661 + ((CTMulScreensStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
1.662 + ((CTMulScreensStep*)iStep)->CloseTMSGraphicsStep();
1.663 + INFO_PRINTF1(_L("CTMulScreens::RunTestCaseL default case\n"));
1.664 + break;
1.665 + }
1.666 + ((CTMulScreensStep*)iStep)->RecordTestResultL();
1.667 + }
1.668 +
1.669 +__WS_CONSTRUCT_STEP__(MulScreens)