windowing/windowserver/test/tauto/TMULSCREENS.CPP
changeset 103 2717213c588a
equal deleted inserted replaced
98:bf7481649c98 103:2717213c588a
       
     1 // Copyright (c) 2006-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 // Enable Multiple Displays
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @test
       
    21  @internalComponent - Internal Symbian test code
       
    22 */
       
    23 
       
    24 #include "TMULSCREENS.h"
       
    25 
       
    26 const TInt KFstScreenNo = 0;
       
    27 const TInt KSndScreenNo = 1;
       
    28 
       
    29 CTMulScreens::CTMulScreens(CTestStep* aStep):
       
    30 	CTWsGraphicsBase(aStep)
       
    31 	{
       
    32 	}
       
    33 
       
    34 void CTMulScreens::ConstructL()
       
    35 	{
       
    36 	User::LeaveIfError(iRws.Connect());
       
    37 	iFstScreenDevice =new(ELeave) CWsScreenDevice(iRws);
       
    38 	TInt err = iFstScreenDevice->Construct(KFstScreenNo);
       
    39 	iTest->LogLeave(err);
       
    40 	User::LeaveIfError(err);
       
    41 	iNumScreens = iRws.NumberOfScreens();
       
    42 	if(KSndScreenNo<iNumScreens)
       
    43 		{
       
    44 		iSndScreenDevice =new(ELeave) CWsScreenDevice(iRws);
       
    45 		err = iSndScreenDevice->Construct(KSndScreenNo);
       
    46 		iTest->LogLeave(err);
       
    47 		User::LeaveIfError(err);
       
    48 		}
       
    49 	INFO_PRINTF2(_L("The number of screens supported on this device is %d"),iNumScreens);
       
    50 	}
       
    51 
       
    52 CTMulScreens::~CTMulScreens()
       
    53 	{
       
    54 	iFstWinGp.Close();
       
    55 	if(KSndScreenNo<iNumScreens)
       
    56 		{
       
    57 		iSndWinGp.Close();
       
    58 		delete iSndScreenDevice;
       
    59 		}
       
    60 	delete iFstScreenDevice;
       
    61 	iRws.Close();
       
    62 	}
       
    63 
       
    64 /**
       
    65    @SYMTestCaseID          GRAPHICS-WSERV-0383
       
    66 
       
    67    @SYMPREQ					PREQ1227
       
    68 
       
    69    @SYMREQ					REQ5541
       
    70 
       
    71    @SYMTestCaseDesc			Create Window Group(s) on each screen.
       
    72 
       
    73    @SYMTestPriority			High
       
    74 
       
    75    @SYMTestStatus			Implemented
       
    76 
       
    77    @SYMTestActions			Call RWsSession::NumWindowGroups() to get the number of window groups of a given window group priority running on a specified screen.
       
    78    							Test the number of Window Groups on each screen.
       
    79    							Test the size of the list of window group on each screen.
       
    80    							Test the Window Group which has the keyboard focus on the second screen.
       
    81 							API Calls:\n
       
    82 							TInt RWsSession::NumWindowGroups(TInt aScreenNumber,TInt aPriority) const
       
    83 							TInt RWsSession::WindowGroupList(CArrayFixFlat<TInt>* aWindowList,TInt aScreenNumber,TInt aPriority)
       
    84 							TInt RWindowGroup::Construct(TUint32 aClientHandle,CWsScreenDevice* aScreenDevice)
       
    85 							TInt RWsSession::GetFocusWindowGroup(TInt aScreenNumber)
       
    86 
       
    87    @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
       
    88    							and two window groups on the second screen.
       
    89 							If only one screen is configured, then it will create one group on the primary screen.
       
    90 							Otherwise this function leaves with a system-wide error.
       
    91 */
       
    92 
       
    93 void CTMulScreens::TestCreateGroupWindowsL()
       
    94 	{
       
    95 	const TInt fstNumWinGps = iRws.NumWindowGroups(KFstScreenNo,EAllPriorities);
       
    96 	CArrayFixFlat<TInt>* fstList = new(ELeave) CArrayFixFlat<TInt>(1);
       
    97 	CleanupStack::PushL(fstList);
       
    98 	TInt err = iRws.WindowGroupList(fstList,KFstScreenNo,EAllPriorities);
       
    99 	TEST(err==KErrNone);
       
   100 	TEST(fstList->Count()==fstNumWinGps);
       
   101 	err = iRws.WindowGroupList(fstList); //test existing api
       
   102 	TEST(err==KErrNone);
       
   103 	TEST(fstList->Count()==(iRws.NumWindowGroups())); 
       
   104 	iFstWinGp = RWindowGroup(iRws);
       
   105 	TRAP(err,iFstWinGp.Construct(ENullWsHandle,iFstScreenDevice));
       
   106 	TEST(err==KErrNone);
       
   107 	if(err==KErrNone)
       
   108 		{
       
   109 		TEST(iRws.NumWindowGroups(KFstScreenNo,EAllPriorities) == (fstNumWinGps+1));
       
   110 		}
       
   111 	CleanupStack::PopAndDestroy(fstList);
       
   112 
       
   113 	//Second screen has been configured.
       
   114 	if(KSndScreenNo<iNumScreens)
       
   115 		{
       
   116 		TInt winId = iRws.GetFocusWindowGroup(KSndScreenNo);
       
   117 		TEST(winId==KErrGeneral);
       
   118 		iSndWinGp = RWindowGroup(iRws);
       
   119 		TRAP(err,iSndWinGp.Construct(ENullWsHandle,ETrue,iSndScreenDevice));
       
   120 		TEST(err==KErrNone);
       
   121 		if(err==KErrNone)
       
   122 			{
       
   123 			winId = iRws.GetFocusWindowGroup(KSndScreenNo);
       
   124 			TEST(winId==iSndWinGp.Identifier());
       
   125 			TEST(iRws.NumWindowGroups(KFstScreenNo,EAllPriorities) == (fstNumWinGps+1)); //test that the no. of screens unchanged on first screen
       
   126 			CArrayFixFlat<TInt>* sndList =new(ELeave) CArrayFixFlat<TInt>(1);
       
   127 			CleanupStack::PushL(sndList);
       
   128 			TInt sndNumWinGps = iRws.NumWindowGroups(KSndScreenNo,iSndWinGp.OrdinalPriority());
       
   129 			err = iRws.WindowGroupList(sndList,KSndScreenNo,iSndWinGp.OrdinalPriority());
       
   130 			TEST(err==KErrNone);
       
   131 			TEST(sndList->Count()==sndNumWinGps);
       
   132 
       
   133 			iSndWinGp.SetOrdinalPosition(iSndWinGp.OrdinalPosition(),EAllPriorities);
       
   134 			TInt allPriNumWinGps= iRws.NumWindowGroups(EAllPriorities);
       
   135 			CArrayFixFlat<TInt>* allPriList =new(ELeave) CArrayFixFlat<TInt>(1);
       
   136 			CleanupStack::PushL(allPriList);
       
   137 			err = iRws.WindowGroupList(EAllPriorities,allPriList);
       
   138 			TEST(err==KErrNone);
       
   139 			TEST(allPriList->Count()==allPriNumWinGps);
       
   140 
       
   141 			CleanupStack::PopAndDestroy(2,sndList);
       
   142 			}
       
   143 		RWindowGroup trdWinGp = RWindowGroup(iRws);
       
   144 		TRAP(err,trdWinGp.Construct(ENullWsHandle,ETrue,iSndScreenDevice));
       
   145 		TEST(err==KErrNone);
       
   146 		if(err==KErrNone)
       
   147 			{
       
   148 			winId = iRws.GetFocusWindowGroup(KSndScreenNo);
       
   149 			TEST(winId==trdWinGp.Identifier());
       
   150 			trdWinGp.Close();
       
   151 			}
       
   152 		}
       
   153 	}
       
   154 
       
   155 /**
       
   156    @SYMTestCaseID          GRAPHICS-WSERV-0384
       
   157 
       
   158    @SYMPREQ					PREQ1227
       
   159 
       
   160    @SYMREQ					REQ5541
       
   161 
       
   162    @SYMTestCaseDependencies	SYMTestCaseID GRAPHICS-WSERV-0383
       
   163 
       
   164    @SYMTestCaseDesc			Create a blank window on each screen.
       
   165 
       
   166    @SYMTestPriority			High
       
   167 
       
   168    @SYMTestStatus			Implemented
       
   169 
       
   170    @SYMTestActions			Test that each blank window is created on a different screen.
       
   171 							API Calls:\n
       
   172 							TInt RBlankWindow::Construct(const RWindowTreeNode &parent, TUint32 aClientHandle) where parent is
       
   173 							a Window Group created on each screen.
       
   174 
       
   175    @SYMTestExpectedResults	The background colour of the first screen changes to blue and that of the second one changes to green.
       
   176    							Otherwise this function leaves with a system-wide error.
       
   177 */
       
   178 void CTMulScreens::TestCreateBlankWindowsL()
       
   179 	{
       
   180 	RBlankWindow fstBlankWin(iRws);
       
   181 	CleanupClosePushL(fstBlankWin);
       
   182 	TRAPD(err,fstBlankWin.Construct(iFstWinGp,ENullWsHandle));
       
   183 	TEST(err==KErrNone);
       
   184 	if(err==KErrNone)
       
   185 		{
       
   186 		fstBlankWin.SetRequiredDisplayMode(EColor256);
       
   187 		fstBlankWin.SetColor(TRgb(0,0,255)); // paint the screen blue
       
   188 		fstBlankWin.Activate();
       
   189 		iRws.Flush();
       
   190 		TheClient->WaitForRedrawsToFinish();
       
   191 		User::After(6000000);
       
   192 		}
       
   193 	CleanupStack::PopAndDestroy();//fstBlankWin	
       
   194 	
       
   195 	// Second screen
       
   196 	if(KSndScreenNo<iNumScreens)
       
   197 		{
       
   198 		RBlankWindow sndBlankWin(iRws);
       
   199 		CleanupClosePushL(sndBlankWin);
       
   200 		TRAP(err,sndBlankWin.Construct(iSndWinGp,ENullWsHandle));
       
   201 		TEST(err==KErrNone);
       
   202 		if(err==KErrNone)
       
   203 			{
       
   204 			sndBlankWin.SetRequiredDisplayMode(EColor256);
       
   205 			sndBlankWin.SetColor(TRgb(0,255,0));	//paint the screen green
       
   206 			sndBlankWin.Activate(); //there is a defect in Activate() because there is a delay before the second screen turns green
       
   207 			iRws.Flush();
       
   208 			TheClient->WaitForRedrawsToFinish();
       
   209 			User::After(6000000);
       
   210 			}
       
   211 		CleanupStack::PopAndDestroy(); //sndBlankWin
       
   212 		}
       
   213 	}
       
   214 
       
   215 
       
   216 /**
       
   217    @SYMTestCaseID          GRAPHICS-WSERV-0385
       
   218 
       
   219    @SYMPREQ					PREQ1227
       
   220 
       
   221    @SYMREQ					REQ5541
       
   222 
       
   223    @SYMTestCaseDependencies	SYMTestCaseID GRAPHICS-WSERV-0383
       
   224 
       
   225    @SYMTestCaseDesc			Test the Window Group that has the keyboard focus for each screen.
       
   226 
       
   227    @SYMTestPriority			High
       
   228 
       
   229    @SYMTestStatus			Implemented
       
   230 
       
   231    @SYMTestActions			Call RWsSession::GetFocusWindowGroup on each screen.
       
   232 							API Calls:\n
       
   233 							TInt RWsSession::GetFocusWindowGroup(TInt aScreenNumber)
       
   234 
       
   235    @SYMTestExpectedResults	The identifier returned by the API for each screen is tested to see if it is the expected Window Group ID; ie the
       
   236    							ID of the window group created in the first test case.
       
   237 */
       
   238 void CTMulScreens::TestGetFocusWindow()
       
   239 	{
       
   240 	TInt winId = iRws.GetFocusWindowGroup(KFstScreenNo);
       
   241 	TEST(winId==iFstWinGp.Identifier());
       
   242 	if(KSndScreenNo<iNumScreens)
       
   243 		{
       
   244 		winId = iRws.GetFocusWindowGroup(KSndScreenNo);
       
   245 		TEST(winId==iSndWinGp.Identifier());
       
   246 		TEST(iRws.GetFocusWindowGroup()==iFstWinGp.Identifier());
       
   247 		}
       
   248 	}
       
   249 
       
   250 /**
       
   251    @SYMTestCaseID          GRAPHICS-WSERV-0386
       
   252 
       
   253    @SYMPREQ					PREQ1227
       
   254 
       
   255    @SYMREQ					REQ5541
       
   256 
       
   257    @SYMTestCaseDependencies	SYMTestCaseID GRAPHICS-WSERV-0383
       
   258 
       
   259    @SYMTestCaseDesc			Test the default owning window on each screen.
       
   260 
       
   261    @SYMTestPriority			High
       
   262 
       
   263    @SYMTestStatus			Implemented
       
   264 
       
   265    @SYMTestActions			Call RWsSession::GetDefaultOwningWindow() to return the ID of the default owning window.
       
   266    							Call RWsSession::DefaultOwningWindow() on the second Window Group to set it as the default owning window on the second screen.
       
   267    							Call new API RWsSession::GetDefaultOwningWindow(TInt aScreenNumber) to get the default owning window on the second screen.
       
   268    							API Calls:\n
       
   269 							TInt RWsSession::GetFocusWindowGroup()
       
   270 							TInt RWsSession::GetFocusWindowGroup(TInt aScreenNumber)
       
   271 
       
   272    @SYMTestExpectedResults	The identifier returned by the API for each screen is tested to see that they are not the same.
       
   273 */
       
   274 void CTMulScreens::TestGetDefaultOwningWindow()
       
   275 	{
       
   276 	if(KSndScreenNo<iNumScreens)
       
   277 		{
       
   278 		TInt prevWinId = iRws.GetDefaultOwningWindow();
       
   279 		iSndWinGp.DefaultOwningWindow();
       
   280 		TInt winId = iRws.GetDefaultOwningWindow(KSndScreenNo);
       
   281 		TEST(winId==iSndWinGp.Identifier());
       
   282 		TEST(prevWinId!=winId);
       
   283 		}
       
   284 	}
       
   285 
       
   286 /**
       
   287    @SYMTestCaseID          GRAPHICS-WSERV-0387
       
   288 
       
   289    @SYMPREQ					PREQ1227
       
   290 
       
   291    @SYMREQ					REQ5541
       
   292 
       
   293    @SYMTestCaseDesc			Test the background colour.
       
   294 
       
   295    @SYMTestPriority			High
       
   296 
       
   297    @SYMTestStatus			Implemented
       
   298 
       
   299    @SYMTestActions			Call RWsSession::GetBackgroundColor() to store the default value;Change the background colour by calling RWsSession::SetBackgroundColor();
       
   300    							Test that the background has changed; Restore the background colour.
       
   301    							API Calls:\n
       
   302    							TRgb RWsSession::GetBackgroundColor() const
       
   303 							void RWsSession::SetBackgroundColor(TRgb colour)
       
   304 
       
   305    @SYMTestExpectedResults	 Background color should change when SetBackgroundColor is called.
       
   306 */
       
   307 void CTMulScreens::TestSetBackgroundColour()
       
   308 	{
       
   309 	TRgb rgb_b4 = iRws.GetBackgroundColor();
       
   310 	iRws.SetBackgroundColor(KRgbBlack);
       
   311 	TEST(iRws.GetBackgroundColor()==KRgbBlack);
       
   312 	iRws.SetBackgroundColor(rgb_b4);
       
   313 	TEST(iRws.GetBackgroundColor()==rgb_b4);
       
   314 	}
       
   315 
       
   316 /**
       
   317    @SYMTestCaseID          GRAPHICS-WSERV-0388
       
   318 
       
   319    @SYMPREQ					PREQ1227
       
   320 
       
   321    @SYMREQ					REQ5541
       
   322 
       
   323    @SYMTestCaseDesc			Test the shadow vector.
       
   324 
       
   325    @SYMTestPriority			High
       
   326 
       
   327    @SYMTestStatus			Implemented
       
   328 
       
   329    @SYMTestActions			Call RWsSession::ShadowVector() to store the default value;Call RWsSession::SetShadowVector() to change the shadow vector;
       
   330    							Test that the shadow vector has changed; Restore the shadow vector.
       
   331    							API Calls:\n
       
   332    							TPoint RWsSession::ShadowVector() const
       
   333 							void RWsSession::SetShadowVector(const TPoint &aVector);
       
   334 
       
   335    @SYMTestExpectedResults	 The shadow vector should change when SetShadowVector is called.
       
   336 */
       
   337 void CTMulScreens::TestSetShadowVector()
       
   338 	{
       
   339 	TPoint point_b4 = iRws.ShadowVector();
       
   340 	
       
   341 	iRws.SetShadowVector(TPoint(3,3));
       
   342 	
       
   343 	#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
       
   344 	TEST(iRws.ShadowVector()==TPoint(0,0)); // in NGA SetShadowVector & ShadowVector are deprecated
       
   345 	#else
       
   346 	TEST(iRws.ShadowVector()==TPoint(3,3));
       
   347 	#endif
       
   348 	
       
   349 	iRws.SetShadowVector(point_b4);
       
   350 	
       
   351 	#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
       
   352 	TEST(iRws.ShadowVector()==TPoint(0,0)); // in NGA SetShadowVector & ShadowVector are deprecated
       
   353 	#else
       
   354 	TEST(iRws.ShadowVector()==point_b4);
       
   355 	#endif
       
   356 	}
       
   357 
       
   358 /**
       
   359    @SYMTestCaseID          GRAPHICS-WSERV-0389
       
   360 
       
   361    @SYMPREQ					PREQ1227
       
   362 
       
   363    @SYMREQ					REQ5541
       
   364 
       
   365    @SYMTestCaseDesc			Negative tests for the APIs listed below.
       
   366 
       
   367    @SYMTestPriority			High
       
   368 
       
   369    @SYMTestStatus			Implemented
       
   370 
       
   371    @SYMTestActions			Launch a thread to call TestInvalidScreenNumber. Pass an invalid screen number to the APIs listed below.
       
   372    							API Calls:\n
       
   373    							TInt RWsSession::NumWindowGroups(TInt aScreenNumber,TInt aPriority) const
       
   374 							TInt RWsSession::WindowGroupList(CArrayFixFlat<TInt>* aWindowList,TInt aScreenNumber,TInt aPriority)
       
   375 							TInt RWsSession::GetFocusWindowGroup(TInt aScreenNumber)
       
   376 							TInt GetDefaultOwningWindow(TInt aScreenNumber)
       
   377 							TDisplayMode GetDefModeMaxNumColors(TInt aScreenNumber,TInt& aColor,TInt& aGray) const
       
   378    							TInt GetColorModeList(TInt aScreenNumber,CArrayFixFlat<TInt>* aModeList) const
       
   379 
       
   380    @SYMTestExpectedResults	 The thread panics and exits with reason EWservPanicScreenNumber.
       
   381 */
       
   382 void CTMulScreens::TestPanicsL()
       
   383 	{
       
   384 	TInt firstTest = 1;
       
   385 	TInt lastTest = 6;
       
   386 	const TInt KInvalidScreenNumber = 2;
       
   387 	for (TInt option=firstTest;option<=lastTest;option++)
       
   388 		{
       
   389 		TEST(iTest->TestWsPanicL(&TestInvalidScreenNumberL,EWservPanicScreenNumber,option,(TAny*)KInvalidScreenNumber));
       
   390 		}
       
   391 	}
       
   392 
       
   393 TInt CTMulScreens::TestInvalidScreenNumberL(TInt aOption, TAny *aScreenNumber)
       
   394 	{
       
   395 	RWsSession wsSession;
       
   396 	wsSession.Connect();
       
   397 	switch((TInt)aOption)
       
   398 		{
       
   399 		case 1:
       
   400 			wsSession.NumWindowGroups((TInt)aScreenNumber,EAllPriorities);
       
   401 			break;
       
   402 		case 2:
       
   403 			{
       
   404 			CArrayFixFlat<TInt>* list = new(ELeave) CArrayFixFlat<TInt>(1);
       
   405 			wsSession.WindowGroupList(list,(TInt)aScreenNumber,EAllPriorities);
       
   406 			}
       
   407 			break;
       
   408 		case 3:
       
   409 			wsSession.GetFocusWindowGroup((TInt)aScreenNumber);
       
   410 			break;
       
   411 		case 4:
       
   412 			wsSession.GetDefaultOwningWindow((TInt)aScreenNumber);
       
   413 			break;
       
   414 		case 5:
       
   415 			{
       
   416 			CArrayFixFlat<TInt>* list = new(ELeave) CArrayFixFlat<TInt>(1);
       
   417 			wsSession.GetColorModeList((TInt)aScreenNumber,list);
       
   418 			}
       
   419 			break;
       
   420 		case 6:
       
   421 			{
       
   422 			TInt color,gray;
       
   423 			wsSession.GetDefModeMaxNumColors((TInt)aScreenNumber,color,gray);
       
   424 			}
       
   425 			break;
       
   426 		default:
       
   427 			User::Panic(_L("Default panic"),KErrGeneral);
       
   428 			break;
       
   429 		}
       
   430 	return KErrNone;
       
   431 	}
       
   432 
       
   433 
       
   434 /**
       
   435    @SYMTestCaseID          GRAPHICS-WSERV-0390
       
   436 
       
   437    @SYMPREQ					PREQ1227
       
   438 
       
   439    @SYMREQ					REQ5541
       
   440 
       
   441    @SYMTestCaseDependencies	SYMTestCaseID GRAPHICS-WSERV-0383
       
   442 
       
   443    @SYMTestCaseDesc			Test that CWindowGc updates its screendevice each time it is activated on a window.
       
   444 
       
   445    @SYMTestPriority			High
       
   446 
       
   447    @SYMTestStatus			Implemented
       
   448 
       
   449    @SYMTestActions			Activate the gc on both RWindows.CWindowGc::Device() is called after each activation has taken place.
       
   450    							API Calls:\n
       
   451    							void CWindowGc::Activate(RDrawableWindow &aDevice);
       
   452    							void CWindowGc::Deactivate();
       
   453    							CGraphicsDevice* CWindowGc::Device() const
       
   454    							TInt RWindow::Construct(const RWindowTreeNode &parent,TUint32 aHandle);
       
   455 
       
   456    @SYMTestExpectedResults	CWindowGc::Device() returns the screendevice on which the gc was last activated.
       
   457 */
       
   458 void CTMulScreens::TestDeviceL()
       
   459 	{
       
   460 	RWindow fstWin(iRws);
       
   461 	User::LeaveIfError(fstWin.Construct(iFstWinGp,ENullWsHandle));
       
   462 	CleanupClosePushL(fstWin);
       
   463 	fstWin.Activate();
       
   464 
       
   465 	CWindowGc* gc=new (ELeave) CWindowGc(iFstScreenDevice);
       
   466 	User::LeaveIfError(gc->Construct());
       
   467 	CleanupStack::PushL(gc);
       
   468 	gc->Activate(fstWin);
       
   469 
       
   470 	TEST((CWsScreenDevice*)gc->Device()==iFstScreenDevice);
       
   471 	gc->Deactivate();
       
   472 
       
   473 	if(KSndScreenNo<iNumScreens)
       
   474 		{
       
   475 		RWindow sndWin(iRws);
       
   476 		User::LeaveIfError(sndWin.Construct(iSndWinGp,ENullWsHandle));
       
   477 		CleanupClosePushL(sndWin);
       
   478 		sndWin.Activate();
       
   479 
       
   480 		gc->Activate(sndWin);
       
   481 		TEST((CWsScreenDevice*)gc->Device()==iSndScreenDevice);
       
   482 		gc->Deactivate();
       
   483 		CleanupStack::PopAndDestroy();
       
   484 		}
       
   485 
       
   486 	CleanupStack::PopAndDestroy(2,&fstWin);
       
   487 	}
       
   488 
       
   489 /**
       
   490    @SYMTestCaseID          GRAPHICS-WSERV-0034
       
   491 
       
   492    @SYMPREQ					PREQ1227
       
   493 
       
   494    @SYMREQ					REQ5541
       
   495 
       
   496    @SYMTestCaseDesc			Test that the order of creating a screen device and window group does not matter.
       
   497 
       
   498    @SYMTestPriority			High
       
   499 
       
   500    @SYMTestStatus			Implemented
       
   501 
       
   502    @SYMTestActions			Create a window group before creating the screen device. Create a graphics context and call activate on it.
       
   503    							API Calls:\n
       
   504    							TInt RWindowGroup::Construct(TUint32 aClientHandle)
       
   505    							TInt CWsScreenDevice::Construct()
       
   506     						void CWindowGc::Activate(RDrawableWindow &aDevice);
       
   507    							void CWindowGc::Deactivate();
       
   508    							TInt RWindow::Construct(const RWindowTreeNode &parent,TUint32 aHandle);
       
   509 
       
   510    @SYMTestExpectedResults	 The test code does not panic with EWservPanicGroupWinScreenDeviceDeleted
       
   511 */
       
   512 void CTMulScreens::TestInitaliseScreenDeviceL()
       
   513 	{
       
   514 	RWsSession rws1;
       
   515 	User::LeaveIfError(rws1.Connect());
       
   516 	CleanupClosePushL(rws1);
       
   517 
       
   518 	RWindowGroup gw1(rws1);
       
   519 	User::LeaveIfError(gw1.Construct(ENullWsHandle));
       
   520 	CleanupClosePushL(gw1);
       
   521 
       
   522 	CWsScreenDevice* screen1 = new (ELeave) CWsScreenDevice(rws1);
       
   523 	User::LeaveIfError(screen1->Construct());
       
   524 	CleanupStack::PushL(screen1);
       
   525 
       
   526 	RWindow win1(rws1);
       
   527 	User::LeaveIfError(win1.Construct(gw1,ETrue));
       
   528 	CleanupClosePushL(win1);
       
   529 	win1.Activate();
       
   530 
       
   531 	CWindowGc* gc=new (ELeave) CWindowGc(screen1);
       
   532 	User::LeaveIfError(gc->Construct());
       
   533 	CleanupStack::PushL(gc);
       
   534 	gc->Activate(win1);
       
   535 
       
   536 	CleanupStack::PopAndDestroy(5,&rws1);
       
   537 	}
       
   538 
       
   539 /**
       
   540 @SYMTestCaseID		GRAPHICS-WSERV-0492
       
   541 
       
   542 @SYMDEF             PDEF126432
       
   543 
       
   544 @SYMTestCaseDesc    Test the screen number that a window is located on
       
   545 
       
   546 @SYMTestPriority    Medium
       
   547 
       
   548 @SYMTestStatus      Implemented
       
   549 
       
   550 @SYMTestActions     Create two windows on two screens respectively 
       
   551 					and check the screen number that each window is located on
       
   552 
       
   553 @SYMTestExpectedResults The screen numbers should match the expected ones
       
   554 */
       
   555 void CTMulScreens::TestScreenNumbersOfWindowsL()
       
   556 	{
       
   557 	// First screen
       
   558 	RWindow fstWin(iRws);
       
   559 	CleanupClosePushL(fstWin);
       
   560 	TRAPD(err,fstWin.Construct(iFstWinGp,ENullWsHandle));
       
   561 	TEST(err==KErrNone);
       
   562 	if(err==KErrNone)
       
   563 		{
       
   564 		fstWin.Activate();
       
   565 		iRws.Flush();
       
   566 		}
       
   567 	TEST(fstWin.ScreenNumber()==KFstScreenNo);
       
   568 	CleanupStack::PopAndDestroy();//fstWin	
       
   569 	
       
   570 	// Second screen
       
   571 	if(KSndScreenNo<iNumScreens)
       
   572 		{
       
   573 		RWindow sndWin(iRws);
       
   574 		CleanupClosePushL(sndWin);
       
   575 		TRAP(err,sndWin.Construct(iSndWinGp,ENullWsHandle));
       
   576 		TEST(err==KErrNone);
       
   577 		if(err==KErrNone)
       
   578 			{
       
   579 			sndWin.Activate(); 
       
   580 			iRws.Flush();
       
   581 			}
       
   582 		TEST(sndWin.ScreenNumber()==KSndScreenNo);
       
   583 		CleanupStack::PopAndDestroy(); //sndWin
       
   584 		}
       
   585 	}	
       
   586 	
       
   587 void CTMulScreens::RunTestCaseL(TInt aCurTestCase)
       
   588 	{
       
   589 	_LIT(KTest0,"Create a window group on each screen");
       
   590 	_LIT(KTest1,"Create a blank window on each screen");
       
   591 	_LIT(KTest2,"Get focus window");
       
   592 	_LIT(KTest3,"Get default owning window");
       
   593 	_LIT(KTest4,"Change background colour");
       
   594 	_LIT(KTest5,"Change shadow vector");
       
   595 	_LIT(KTest6,"Panic Tests");
       
   596 	_LIT(KTest7,"Test device pointer returned by GC");
       
   597 	_LIT(KTest8,"Initialise ScreenDevice");
       
   598 	_LIT(KTest9,"Test screen numbers that windows are located on");
       
   599 	((CTMulScreensStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
       
   600 
       
   601 	switch(aCurTestCase)
       
   602 		{
       
   603 		case 1:
       
   604 			((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0383"));
       
   605 			INFO_PRINTF1(KTest0);
       
   606 			TestCreateGroupWindowsL();
       
   607 			break;
       
   608 		case 2:
       
   609 			((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0384"));
       
   610 			INFO_PRINTF1(KTest1);
       
   611 			TestCreateBlankWindowsL();
       
   612 			break;
       
   613 		case 3:
       
   614 			((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0385"));
       
   615 			INFO_PRINTF1(KTest2);
       
   616 			TestGetFocusWindow();
       
   617 		case 4:
       
   618 			((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0386"));
       
   619 			INFO_PRINTF1(KTest3);
       
   620 			TestGetDefaultOwningWindow();
       
   621 			break;
       
   622 		case 5:
       
   623 			((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0387"));
       
   624 			INFO_PRINTF1(KTest4);
       
   625 			TestSetBackgroundColour();
       
   626 			break;
       
   627 		case 6:
       
   628 			((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0388"));
       
   629 			INFO_PRINTF1(KTest5);
       
   630 			TestSetShadowVector();
       
   631 			break;
       
   632 		case 7:
       
   633 			((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0389"));
       
   634 			INFO_PRINTF1(KTest6);
       
   635 			TestPanicsL();
       
   636 			break;
       
   637 		case 8:
       
   638 			((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0390"));
       
   639 			INFO_PRINTF1(KTest7);
       
   640 			TestDeviceL();
       
   641 			break;
       
   642 		case 9:
       
   643 			((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0034"));
       
   644 			INFO_PRINTF1(KTest8);
       
   645 			TestInitaliseScreenDeviceL();
       
   646 			break;
       
   647 		case 10:
       
   648 			((CTMulScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0492"));
       
   649 			INFO_PRINTF1(KTest9);
       
   650 			TestScreenNumbersOfWindowsL();
       
   651 		case 11:
       
   652 			((CTMulScreensStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
       
   653 			((CTMulScreensStep*)iStep)->CloseTMSGraphicsStep();
       
   654 			INFO_PRINTF1(_L("All tests completed.\n"));
       
   655 			TestComplete();
       
   656 			break;
       
   657 		default:
       
   658 			((CTMulScreensStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
       
   659 			((CTMulScreensStep*)iStep)->CloseTMSGraphicsStep();
       
   660 			INFO_PRINTF1(_L("CTMulScreens::RunTestCaseL default case\n"));
       
   661 			break;
       
   662 		}
       
   663 	((CTMulScreensStep*)iStep)->RecordTestResultL();
       
   664 	}
       
   665 
       
   666 __WS_CONSTRUCT_STEP__(MulScreens)