os/graphics/windowing/windowserver/test/t_genericplugin/src/t_wservgenericpluginstepload.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserver/test/t_genericplugin/src/t_wservgenericpluginstepload.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,548 @@
     1.4 +// Copyright (c) 2008-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 +//
    1.18 +
    1.19 +/**
    1.20 + @file
    1.21 + @test
    1.22 + @internalComponent
    1.23 +*/
    1.24 +
    1.25 +#include "t_wservgenericpluginstepload.h"
    1.26 +#include <tefunit.h>
    1.27 +#include <e32const.h>	//KNullUidValue
    1.28 +#include <gdi.h>
    1.29 +#include <stdlib.h>
    1.30 +
    1.31 +const TPoint KWinPos(0,0);
    1.32 +const TSize KWinSize(100,100);
    1.33 +const TRect KWinRect(KWinPos,KWinSize);
    1.34 +const TRect KEllipseRect(TPoint(10,10), TSize(50,50));
    1.35 +
    1.36 +_LIT(KDefaultPluginBmp, "Z:\\wstest\\genericplugin\\defaultplugin.mbm");
    1.37 +_LIT(KTestPluginBmp, "Z:\\wstest\\genericplugin\\testplugin.mbm");
    1.38 +_LIT(KTWServGenericPluginStepTestId,"testid");
    1.39 +
    1.40 +/**
    1.41 +Constructor of CT_WServGenericpluginStepLoad
    1.42 +*/
    1.43 +CT_WServGenericpluginStepLoad::CT_WServGenericpluginStepLoad()
    1.44 +	{
    1.45 +	SetTestStepName(KT_WServGenericpluginStepLoad);
    1.46 +	}
    1.47 +
    1.48 +/**
    1.49 +Destructor of CT_WServGenericpluginStepLoad
    1.50 +*/
    1.51 +CT_WServGenericpluginStepLoad::~CT_WServGenericpluginStepLoad()
    1.52 +	{
    1.53 +	delete iGc;
    1.54 +	delete iScreen;
    1.55 +	delete iScreen1;
    1.56 +	delete iDefaultPluginBmp;
    1.57 +	delete iTestPluginBmp;
    1.58 +	iWinGroup.Close();
    1.59 +	iWinGroup1.Close();
    1.60 +	iWsSession.Flush();
    1.61 +	iWsSession.Close();
    1.62 +	}
    1.63 +
    1.64 +/**
    1.65 +Checks if message is logged in the log file.
    1.66 +@param	aMsg The message to be checked.
    1.67 +@return ETrue if the message is found in the log file, otherwise EFalse.
    1.68 +*/
    1.69 +TInt CT_WServGenericpluginStepLoad::CheckLogL(TDesC8& aMsg)
    1.70 +	{
    1.71 +	RFs fs;
    1.72 +	CleanupClosePushL(fs);
    1.73 +	User::LeaveIfError(fs.Connect());
    1.74 +	
    1.75 +	RFile logFile;
    1.76 +	CleanupClosePushL(logFile);
    1.77 +
    1.78 +	TInt ret = logFile.Open(fs, KLogFileName, EFileShareAny|EFileRead);
    1.79 +	if (ret == KErrNone)
    1.80 +		{
    1.81 +		TInt fileSize;
    1.82 +    	User::LeaveIfError(logFile.Size(fileSize));
    1.83 +
    1.84 +		HBufC8* buf = HBufC8::NewLC(fileSize);
    1.85 +		TPtr8 ptr(buf->Des());
    1.86 +		ret = logFile.Read(ptr);
    1.87 +		if (ret == KErrNone)
    1.88 +			{
    1.89 +			ret = ptr.Find(aMsg);
    1.90 +			if (ret != KErrNotFound)
    1.91 +				{
    1.92 +				ret = EMsgFound;
    1.93 +				}
    1.94 +			else
    1.95 +				{
    1.96 +				ret = EMsgNotFound;
    1.97 +				}		
    1.98 +			}
    1.99 +		CleanupStack::PopAndDestroy(buf);	
   1.100 +		}
   1.101 +	else if (ret == KErrNotFound)
   1.102 +		{
   1.103 +		ret = EFileNotExist;
   1.104 +		}
   1.105 +	CleanupStack::PopAndDestroy(&logFile);
   1.106 +	CleanupStack::PopAndDestroy(&fs);
   1.107 +	return ret;
   1.108 +	}
   1.109 +
   1.110 +/**
   1.111 +Overrides test step preamble.
   1.112 +*/
   1.113 +enum TVerdict CT_WServGenericpluginStepLoad::doTestStepPreambleL()
   1.114 +	{
   1.115 +	TVerdict ret = CTestStep::doTestStepPreambleL();
   1.116 +	if ( !GetIntFromConfig( ConfigSection(), KTWServGenericPluginStepTestId, iTestId ))
   1.117 +		{
   1.118 +		User::Leave(KErrNotFound);
   1.119 +		}
   1.120 +	else
   1.121 +		{
   1.122 +		iDisplayMode = EColor64K;
   1.123 +		User::LeaveIfError(iWsSession.Connect());
   1.124 +
   1.125 +		iScreen = new (ELeave) CWsScreenDevice(iWsSession);
   1.126 +		User::LeaveIfError(iScreen->Construct());
   1.127 +		iWinGroup = RWindowGroup(iWsSession);
   1.128 +		User::LeaveIfError(iWinGroup.Construct(KNullWsHandle, iScreen));
   1.129 +		iWinGroup.AutoForeground(ETrue);
   1.130 +		iGc = new (ELeave) CWindowGc(iScreen);
   1.131 +		User::LeaveIfError(iGc->Construct());
   1.132 +
   1.133 +		iScreen1 = new (ELeave) CWsScreenDevice(iWsSession);
   1.134 +		User::LeaveIfError(iScreen1->Construct(1));
   1.135 +		iWinGroup1 = RWindowGroup(iWsSession);
   1.136 +		User::LeaveIfError(iWinGroup1.Construct(KNullWsHandle, iScreen1) );
   1.137 +		iWinGroup1.AutoForeground(ETrue);
   1.138 +	
   1.139 +		iDefaultPluginBmp = new(ELeave) CFbsBitmap;
   1.140 +		User::LeaveIfError(iDefaultPluginBmp->Load(KDefaultPluginBmp));
   1.141 +		iTestPluginBmp = new(ELeave) CFbsBitmap;
   1.142 +		User::LeaveIfError(iTestPluginBmp->Load(KTestPluginBmp));
   1.143 +		iWsSession.Flush();
   1.144 +		}
   1.145 +	return ret;
   1.146 +	}
   1.147 +
   1.148 +/**
   1.149 +Overrides test step prostamble.
   1.150 +*/
   1.151 +enum TVerdict CT_WServGenericpluginStepLoad::doTestStepPostambleL()
   1.152 +	{
   1.153 +	return TestStepResult();
   1.154 +	}
   1.155 +
   1.156 +/**
   1.157 +Starts test step
   1.158 +@return TVerdict pass / fail
   1.159 +*/
   1.160 +enum TVerdict CT_WServGenericpluginStepLoad::doTestStepL()
   1.161 +	{
   1.162 +	__UHEAP_MARK;
   1.163 +	RWindow win;
   1.164 +	CleanupClosePushL(win);
   1.165 +	CreateRWindowL(iWinGroup, win, KWinPos, KRgbBlue, KWinSize);
   1.166 +	DrawShape(win);
   1.167 +	
   1.168 +	RWindow win1;
   1.169 +	CleanupClosePushL(win1);
   1.170 +	CreateRWindowL(iWinGroup1, win1, KWinPos, KRgbBlue, KWinSize);
   1.171 +	DrawShape(win1);
   1.172 +	
   1.173 +	switch( iTestId )
   1.174 +		{
   1.175 +		case 1:
   1.176 +			INFO_PRINTF1(_L("Testing Control of CWsPlugin loading from WSINI.INI..."));
   1.177 +			GraphicsWservGenericpluginLoad1L();
   1.178 +			break;
   1.179 +		case 2:	
   1.180 +			INFO_PRINTF1(_L("Testing that plugins can be specified on a per-screen basis through WSINI.INI file..."));
   1.181 +			GraphicsWservGenericpluginLoad2L();
   1.182 +			break;
   1.183 +		case 3:	
   1.184 +			INFO_PRINTF1(_L("Testing Integer and string attributes in WSINI.INI file can be read from CWsPlugin..."));
   1.185 +			GraphicsWservGenericpluginLoad3L();
   1.186 +			break;
   1.187 +		case 4:
   1.188 +			INFO_PRINTF1(_L("Testing CWsPlugin can gain information about closing windows using MWsWindow interface..."));
   1.189 +			GraphicsWservGenericpluginLoad4L();
   1.190 +			break;
   1.191 +		case 5:	
   1.192 +			INFO_PRINTF1(_L("Testing CWsPlugin can obtain instance of another CWPlugin..."));
   1.193 +			GraphicsWservGenericpluginLoad5L();
   1.194 +			break;
   1.195 +		default:
   1.196 +			break;	
   1.197 +		}
   1.198 +	CleanupStack::PopAndDestroy(2,&win);
   1.199 +
   1.200 +	__UHEAP_MARKEND;
   1.201 +	return TestStepResult();
   1.202 +	}
   1.203 +
   1.204 +/**
   1.205 +Creates a RWindow
   1.206 +@param aWinGroup The window group object
   1.207 +@param aWin	The window object
   1.208 +@param aPos	The Position of the window
   1.209 +@param aBkgdColor The background color of the window
   1.210 +@param aSize The size of the window
   1.211 +@param aHandle The handle of the window
   1.212 +*/
   1.213 +void CT_WServGenericpluginStepLoad::CreateRWindowL(const RWindowGroup& aWinGroup, 
   1.214 +												   RWindow& aWin, 
   1.215 +												   const TPoint& aPos, 
   1.216 +												   const TRgb& aBkgdColor, 
   1.217 +												   const TSize& aWinSize,
   1.218 +												   const TUint32 aHandle)
   1.219 +	{
   1.220 +	aWin = RWindow( iWsSession );
   1.221 +	CleanupClosePushL( aWin );
   1.222 +	User::LeaveIfError( aWin.Construct( aWinGroup, aHandle ) );
   1.223 +	CleanupStack::Pop(&aWin);
   1.224 +	aWin.SetRequiredDisplayMode(iDisplayMode);
   1.225 +	aWin.SetExtent(aPos, aWinSize);
   1.226 +	aWin.SetBackgroundColor( aBkgdColor );
   1.227 +	aWin.Activate();
   1.228 +	aWin.SetVisible( ETrue );
   1.229 +	}
   1.230 +
   1.231 +/**
   1.232 +Draw an ellipse to the window and fade the window.
   1.233 +@param aWin The window object
   1.234 +*/
   1.235 +void CT_WServGenericpluginStepLoad::DrawShape(RWindow& aWin)
   1.236 +	{
   1.237 +	TUint8 white = 255;
   1.238 +	TUint8 black = 128;
   1.239 +	
   1.240 +	iGc->Activate(aWin);
   1.241 +	iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
   1.242 +	iGc->SetBrushColor(KRgbWhite);
   1.243 +	iGc->DrawEllipse(KEllipseRect);
   1.244 +	iWsSession.Flush();	
   1.245 +	User::After(KDelay);
   1.246 +	
   1.247 +	aWin.SetFaded(ETrue,RWindowTreeNode::EFadeWindowOnly,black,white);
   1.248 +	iWsSession.Flush();	
   1.249 +	User::After(KDelay);
   1.250 +
   1.251 +	iGc->Deactivate();
   1.252 +	}
   1.253 +
   1.254 +/**
   1.255 +Compare the window with the bitmap.
   1.256 +@param aScreen The screen device object
   1.257 +@param aBitmap The bitmap object for comparison
   1.258 +@return ETrue if the window and the bitmap is identified. Otherwise return EFalse.
   1.259 +*/
   1.260 +TBool CT_WServGenericpluginStepLoad::CompareDisplayL(CWsScreenDevice* aScreen, CFbsBitmap* aBitmap)
   1.261 +	{
   1.262 +	// Capture window display to bitmap
   1.263 +	CFbsBitmap* screenBitmap = new(ELeave) CFbsBitmap();
   1.264 +	CleanupStack::PushL(screenBitmap);
   1.265 +	User::LeaveIfError(screenBitmap->Create(KWinRect.Size(), iDisplayMode));
   1.266 +	User::LeaveIfError(aScreen->CopyScreenToBitmap(screenBitmap, KWinRect));	
   1.267 +	
   1.268 +	//Compare the window bitmap with the bitmap pass in for comparison
   1.269 +	TBool ret = ETrue;
   1.270 +	
   1.271 +	const TReal KErrorLimit = 0.05;
   1.272 +	
   1.273 +	TInt mismatchedPixels = 0;
   1.274 +	TRgb testWinPix = TRgb(0,0,0,0);
   1.275 +	TRgb checkWinPix = TRgb(0,0,0,0);
   1.276 +	for (TInt x = 0; x < KWinRect.Width(); x++)
   1.277 +		{
   1.278 +		for (TInt y = 0; y < KWinRect.Height(); y++)
   1.279 +			{
   1.280 +			screenBitmap->GetPixel(testWinPix, TPoint(x,y));
   1.281 +			aBitmap->GetPixel(checkWinPix, TPoint(x,y));
   1.282 +			
   1.283 +			//check if there are differeces between test Window colors and check Window colors
   1.284 +			if(((TReal)abs(testWinPix.Red() - checkWinPix.Red())/255) > KErrorLimit || 
   1.285 +					((TReal)abs(testWinPix.Blue() - checkWinPix.Blue())/255) > KErrorLimit || 
   1.286 +					((TReal)abs(testWinPix.Green() - checkWinPix.Green())/255) > KErrorLimit || 
   1.287 +					((TReal)abs(testWinPix.Alpha() - checkWinPix.Alpha())/255) > KErrorLimit)
   1.288 +				{
   1.289 +				mismatchedPixels++;  // -- Useful for debugging
   1.290 +				ret = EFalse;
   1.291 +				break;
   1.292 +				}
   1.293 +			}
   1.294 +		}
   1.295 +	
   1.296 +	/* INFO_PRINTF2(_L("Number of different pixels: %i"), mismatchedPixels); */ // -- Useful for debugging
   1.297 +	
   1.298 +
   1.299 +	CleanupStack::PopAndDestroy(screenBitmap);	
   1.300 +	
   1.301 +	
   1.302 +	
   1.303 +	return ret;
   1.304 +	}
   1.305 +
   1.306 +/**
   1.307 +Calculate the portion of window displayed on the screen (absRect).
   1.308 +@param aAbsRect The size of the window displayed on the screen
   1.309 +@param aPos The origin of the window
   1.310 +@param aWinSize The size of the window
   1.311 +*/
   1.312 +void CT_WServGenericpluginStepLoad::CalcAbsRect(TSize& aAbsRect, const TPoint& aPos, const TSize& aWinSize)
   1.313 +	{
   1.314 +	if((aPos.iX + aWinSize.iWidth) > iScreen->SizeInPixels().iWidth)
   1.315 +		{
   1.316 +		aAbsRect.iWidth = iScreen->SizeInPixels().iWidth - aPos.iX;
   1.317 +		}	
   1.318 +	else if(aPos.iX < 0)
   1.319 +		{
   1.320 +		aAbsRect.iWidth = aPos.iX + aWinSize.iWidth;
   1.321 +		}
   1.322 +	else
   1.323 +		{
   1.324 +		aAbsRect.iWidth = aWinSize.iWidth;
   1.325 +		}
   1.326 +	if((aPos.iY + aWinSize.iHeight) > iScreen->SizeInPixels().iHeight)
   1.327 +		{
   1.328 +		aAbsRect.iHeight = iScreen->SizeInPixels().iHeight - aPos.iY;
   1.329 +		}
   1.330 +	else if(aPos.iY < 0)
   1.331 +		{
   1.332 +		aAbsRect.iHeight = aPos.iY + aWinSize.iHeight;
   1.333 +		}
   1.334 +	else
   1.335 +		{
   1.336 +		aAbsRect.iHeight = aWinSize.iHeight;
   1.337 +		}
   1.338 +	}
   1.339 +
   1.340 +/**
   1.341 +@SYMTestCaseID			graphics-wserv-1841-0001
   1.342 +@SYMPREQ				1841
   1.343 +@SYMTestCaseDesc		Control of CWsPlugin loading from WSINI.INI			
   1.344 +@SYMTestActions			tests alternative fader specified by an ID and alternative 
   1.345 +						render stage specified by TYPE in wsini.ini file are loaded
   1.346 +@SYMTestStatus			Implemented
   1.347 +@SYMTestPriority		2
   1.348 +@SYMTestExpectedResults	Alternative plugins are loaded as specified.
   1.349 +						Window created in screen 0 is faded with custom fader and 
   1.350 +						two lines are drawn on the left top window by custom render stage.
   1.351 +@SYMTestType			CT
   1.352 +*/	
   1.353 +void CT_WServGenericpluginStepLoad::GraphicsWservGenericpluginLoad1L()
   1.354 +	{
   1.355 +	//Compare the window with the bitmap which uses test plugin. They are identical.
   1.356 +	TEST(CompareDisplayL(iScreen, iTestPluginBmp));
   1.357 +	//Check the log file. Test fader and test render stage are created.
   1.358 +	TBuf8<255> msg(_L8("TestMWsIniFile is created."));
   1.359 +	TEST(CheckLogL(msg) == EMsgFound);
   1.360 +	msg = _L8("TestRenderStageFactory is created.");
   1.361 +	TEST(CheckLogL(msg) == EMsgFound);
   1.362 +	msg = _L8("TestRenderStage is created.");
   1.363 +	TEST(CheckLogL(msg) == EMsgFound);
   1.364 +	}
   1.365 +
   1.366 +/**
   1.367 +@SYMTestCaseID			graphics-wserv-1841-0002
   1.368 +@SYMPREQ				1841
   1.369 +@SYMTestCaseDesc		Test that plugins can be specified on a per-screen basis through WSINI.INI file
   1.370 +@SYMTestActions			Create modified WSINI.INI file which specifies different fader and render stage
   1.371 +						plugins to be used on screens 0 and 1.
   1.372 +@SYMTestStatus			Implemented
   1.373 +@SYMTestPriority		2
   1.374 +@SYMTestExpectedResults	Both sets of plugins are loaded, and the correct plugin is used on each screen.
   1.375 +						Windows created in different screen are faded with different color.
   1.376 +						Windows in screen 0 have two lines drawn on left top window by custom render stage 
   1.377 +						while windows in screen 1 use standard render stage.
   1.378 +@SYMTestType			CT
   1.379 +*/
   1.380 +void CT_WServGenericpluginStepLoad::GraphicsWservGenericpluginLoad2L()
   1.381 +	{
   1.382 +	//Test drawing in screen 0. testfader and testRenderStage are used.
   1.383 +	//Compare the window with the bitmap which uses default plugin.
   1.384 +	TEST(!CompareDisplayL(iScreen, iDefaultPluginBmp));
   1.385 +	//Compare the window with the bitmap which uses test plugins.
   1.386 +	TEST(CompareDisplayL(iScreen, iTestPluginBmp));
   1.387 +
   1.388 +	//Test drawing in screen 1. testfader_data and testrenderstage_invalid are used.
   1.389 +	//TestRenderStage_Invalid is not created because NULL is returned from CreateStageL.
   1.390 +	
   1.391 +	//Check the log file. 
   1.392 +	TBuf8<255> msg(_L8("TestMWsIniFile is created."));
   1.393 +	TEST(CheckLogL(msg) == EMsgFound);
   1.394 +	msg = _L8("TestRenderStageFactory is created.");
   1.395 +	TEST(CheckLogL(msg) == EMsgFound);
   1.396 +	msg = _L8("TestRenderStage is created.");
   1.397 +	TEST(CheckLogL(msg) == EMsgFound);
   1.398 +	msg = _L8("TestRenderStage_invalid is created.");
   1.399 +	TEST(CheckLogL(msg) == EMsgNotFound);
   1.400 +	}
   1.401 +
   1.402 +/**
   1.403 +@SYMTestCaseID			graphics-wserv-1841-0004
   1.404 +@SYMPREQ				1841
   1.405 +@SYMTestCaseDesc		Integer and string attributes in WSINI.INI file can be read from CWsPlugin. 			
   1.406 +@SYMTestActions			Create modified WSINI.INI file which specifies a test fader to be loaded to screen 0.
   1.407 +						Specifies integer and string variables for default, custom, and screen sections
   1.408 +@SYMTestStatus			Implemented
   1.409 +@SYMTestPriority		2
   1.410 +@SYMTestExpectedResults	Alternative plug-in is loaded as specified and attributes can be accessed from plug-in.
   1.411 +@SYMTestType			CT
   1.412 +*/	
   1.413 +void CT_WServGenericpluginStepLoad::GraphicsWservGenericpluginLoad3L()
   1.414 +	{
   1.415 +	//Check the log file.
   1.416 +	TBuf8<255> msg;
   1.417 +	msg = _L8("Screen Section has correct integer data");
   1.418 +	TEST(CheckLogL(msg) == EMsgFound);
   1.419 +	msg = _L8("Screen Section has correct string data");
   1.420 +	TEST(CheckLogL(msg) == EMsgFound);
   1.421 +	msg = _L8("Custom Section has correct integer data");
   1.422 +	TEST(CheckLogL(msg) == EMsgFound);
   1.423 +	msg = _L8("Custom Section has correct string data");
   1.424 +	TEST(CheckLogL(msg) == EMsgFound);
   1.425 +	msg = _L8("Default Section has correct integer data");
   1.426 +	TEST(CheckLogL(msg) == EMsgFound);
   1.427 +	msg = _L8("Default Section has correct string data");
   1.428 +	TEST(CheckLogL(msg) == EMsgFound);
   1.429 +	msg = _L8("Default Section does not have missing attribute");
   1.430 +	TEST(CheckLogL(msg) == EMsgFound);
   1.431 +	msg = _L8("Screen Section does not have missing attribute");
   1.432 +	TEST(CheckLogL(msg) == EMsgFound);
   1.433 +	msg = _L8("Custom Section does not have missing attribute");
   1.434 +	TEST(CheckLogL(msg) == EMsgFound);
   1.435 +	msg = _L8("Default Section - Integer data retrieved with method for string attribute");
   1.436 +	TEST(CheckLogL(msg) == EMsgFound);
   1.437 +	msg = _L8("Default Section - Could not access string attribute with method for integer attribute");
   1.438 +	TEST(CheckLogL(msg) == EMsgFound);
   1.439 +	msg = _L8("Screen Section - Integer data retrieved with method for string attribute");
   1.440 +	TEST(CheckLogL(msg) == EMsgFound);
   1.441 +	msg = _L8("Screen Section - Could not access string attribute with method for integer attribute");
   1.442 +	TEST(CheckLogL(msg) == EMsgFound);
   1.443 +	msg = _L8("Custom Section - Integer data retrieved with method for string attribute");
   1.444 +	TEST(CheckLogL(msg) == EMsgFound);
   1.445 +	msg = _L8("Custom Section - Could not access string attribute with method for integer attribute");
   1.446 +	TEST(CheckLogL(msg) == EMsgFound);
   1.447 +	msg = _L8("Could not access variables because screen does not exist");
   1.448 +	TEST(CheckLogL(msg) == EMsgFound);
   1.449 +	msg = _L8("Could not access variables because section does not exist");
   1.450 +	TEST(CheckLogL(msg) == EMsgFound);
   1.451 +	}
   1.452 +
   1.453 +/**
   1.454 +@SYMTestCaseID			graphics-wserv-1841-0005
   1.455 +@SYMPREQ				1841
   1.456 +@SYMTestCaseDesc		CWsPlugin can gain information about closing windows using MWsWindow interface.
   1.457 +@SYMTestActions			Create modified WSINI.INI file which specifies a test renderer to be loaded.
   1.458 +						Register CWsPLugin as eventhandler receiving EWindowClosing events.
   1.459 +@SYMTestStatus			Implemented
   1.460 +@SYMTestPriority		2
   1.461 +@SYMTestExpectedResults	Plugin can access information about closing windows through MWsWindow interface.
   1.462 +						Windows with different size and position are created and closed in screen 0.
   1.463 +@SYMTestType			CT
   1.464 +*/	
   1.465 +void CT_WServGenericpluginStepLoad::GraphicsWservGenericpluginLoad4L()
   1.466 +	{
   1.467 +	const TUint32 KWin1WsHandle = 0xFFFFFFFC;
   1.468 +	const TUint32 KWin2WsHandle = 0xFFFFFFFD;
   1.469 +	const TUint32 KWin3WsHandle = 0xFFFFFFFE;
   1.470 +	TPoint w1Point(50,240);
   1.471 +	TPoint w2Point(580,100);
   1.472 +	TPoint w3Point(25,100);
   1.473 +	TSize w1Size(10,10);
   1.474 +	TSize w2Size(150,70);
   1.475 +	TSize w3Size(50,140);
   1.476 +		
   1.477 +	//Draw windows with different origins and sizes	
   1.478 +	RWindow win;	
   1.479 +	CleanupClosePushL(win);
   1.480 +	CreateRWindowL(iWinGroup, win, w1Point, KRgbBlue, w1Size, KWin1WsHandle);
   1.481 +	DrawShape(win);
   1.482 +	CleanupStack::PopAndDestroy(&win);
   1.483 +	
   1.484 +	CleanupClosePushL(win);
   1.485 +	CreateRWindowL(iWinGroup, win, w2Point, KRgbBlue, w2Size, KWin2WsHandle);
   1.486 +	DrawShape(win);
   1.487 +	CleanupStack::PopAndDestroy(&win);
   1.488 +	
   1.489 +	CleanupClosePushL(win);
   1.490 +	CreateRWindowL(iWinGroup, win, w3Point, KRgbBlue, w3Size, KWin3WsHandle);
   1.491 +	DrawShape(win);
   1.492 +	CleanupStack::PopAndDestroy(&win);
   1.493 +	
   1.494 +	CleanupClosePushL(win); //create dummy 4th window to ensure window3 closing event has time to log info
   1.495 +	CreateRWindowL(iWinGroup, win, w2Point, KRgbBlue, w2Size, KWin2WsHandle);
   1.496 +	DrawShape(win);
   1.497 +	CleanupStack::PopAndDestroy(&win);
   1.498 +	
   1.499 +	//Calculate AbsRect values
   1.500 +	TSize absRect1;
   1.501 +	TSize absRect2;
   1.502 +	TSize absRect3;
   1.503 +	CalcAbsRect(absRect1, w1Point, w1Size);	
   1.504 +	CalcAbsRect(absRect2, w2Point, w2Size);	
   1.505 +	CalcAbsRect(absRect3, w3Point, w3Size);
   1.506 +	
   1.507 +	TBuf8<255> msg;
   1.508 +	//check log for window1 info
   1.509 +	msg.Format(_L8("Closing Window Handle %d - Origin: %d, %d"), KWin1WsHandle, w1Point.iX, w1Point.iY);
   1.510 +	TEST(CheckLogL(msg) == EMsgFound);
   1.511 +	msg.Format(_L8("Closing Window Handle %d - AbsRec: Height %d, Width %d"), KWin1WsHandle, absRect1.iHeight, absRect1.iWidth);
   1.512 +	TEST(CheckLogL(msg) == EMsgFound);
   1.513 +	msg.Format(_L8("Closing Window Handle %d - Size: Height %d, Width %d"), KWin1WsHandle, w1Size.iHeight, w1Size.iWidth);
   1.514 +	TEST(CheckLogL(msg) == EMsgFound);
   1.515 +	//check log for window2 info
   1.516 +	msg.Format(_L8("Closing Window Handle %d - Origin: %d, %d"), KWin2WsHandle, w2Point.iX, w2Point.iY);
   1.517 +	TEST(CheckLogL(msg) == EMsgFound);
   1.518 +	msg.Format(_L8("Closing Window Handle %d - AbsRec: Height %d, Width %d"), KWin2WsHandle, absRect2.iHeight, absRect2.iWidth);
   1.519 +	TEST(CheckLogL(msg) == EMsgFound);
   1.520 +	msg.Format(_L8("Closing Window Handle %d - Size: Height %d, Width %d"), KWin2WsHandle, w2Size.iHeight, w2Size.iWidth);
   1.521 +	TEST(CheckLogL(msg) == EMsgFound);
   1.522 +	//check log for window3 info
   1.523 +	msg.Format(_L8("Closing Window Handle %d - Origin: %d, %d"), KWin3WsHandle, w3Point.iX, w3Point.iY);
   1.524 +	TEST(CheckLogL(msg) == EMsgFound);
   1.525 +	msg.Format(_L8("Closing Window Handle %d - AbsRec: Height %d, Width %d"), KWin3WsHandle, absRect3.iHeight, absRect3.iWidth);
   1.526 +	TEST(CheckLogL(msg) == EMsgFound);
   1.527 +	msg.Format(_L8("Closing Window Handle %d - Size: Height %d, Width %d"), KWin3WsHandle, w3Size.iHeight, w3Size.iWidth);
   1.528 +	TEST(CheckLogL(msg) == EMsgFound);
   1.529 +	}
   1.530 +
   1.531 +/**
   1.532 +@SYMTestCaseID			graphics-wserv-1841-0006
   1.533 +@SYMPREQ				1841
   1.534 +@SYMTestCaseDesc		CWsPlugin can obtain instance of another CWPlugin.
   1.535 +@SYMTestActions			Create modified WSINI.INI file which specifies a test renderer, test fader, and service plug-in to be loaded.
   1.536 +						Service plugin offers elementary service to other plug-ins.
   1.537 +@SYMTestStatus			Implemented
   1.538 +@SYMTestPriority		2
   1.539 +@SYMTestExpectedResults	Test fader can access information set in service plugin by test renderer.
   1.540 +@SYMTestType			CT
   1.541 +*/
   1.542 +void CT_WServGenericpluginStepLoad::GraphicsWservGenericpluginLoad5L()
   1.543 +	{
   1.544 +	//Check the log file.
   1.545 +	TBuf8<255> msg;
   1.546 +	msg = _L8("Fading parameters have been set.");	
   1.547 +	TEST(CheckLogL(msg) == EMsgFound);
   1.548 +	msg = _L8("Returned fade color.");	
   1.549 +	TEST(CheckLogL(msg) == EMsgFound);
   1.550 +	}
   1.551 +