os/graphics/graphicsdeviceinterface/directgdi/test/tpanictests.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicsdeviceinterface/directgdi/test/tpanictests.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,649 @@
     1.4 +// Copyright (c) 2007-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 +#include "tpanictests.h"
    1.20 +#include <graphics/directgdicontext.h>
    1.21 +#include <graphics/directgdiimagetarget.h>
    1.22 +
    1.23 +_LIT(KPanicCategory, "DGDI");
    1.24 +
    1.25 +CTPanicTests::CTPanicTests()
    1.26 +	{
    1.27 +	SetTestStepName(KTDirectGdiPanicTestsStep);
    1.28 +	}
    1.29 +
    1.30 +CTPanicTests::~CTPanicTests()
    1.31 +	{
    1.32 +	}
    1.33 +
    1.34 +/**
    1.35 +@SYMTestCaseID		
    1.36 +	GRAPHICS-DIRECTGDI-PANIC-0001
    1.37 +
    1.38 +@SYMTestPriority
    1.39 +	Medium
    1.40 +
    1.41 +@SYMPREQ
    1.42 +	PREQ39
    1.43 +
    1.44 +@SYMREQ
    1.45 +	REQ9195
    1.46 +	REQ9201 
    1.47 +	REQ9202 
    1.48 +	REQ9222 
    1.49 +	REQ9223 
    1.50 +	REQ9236 
    1.51 +	REQ9237
    1.52 +
    1.53 +@SYMTestCaseDesc
    1.54 +	Tests if DirectGDI methods panic when called on a inactivated context.
    1.55 +
    1.56 +@SYMTestActions		
    1.57 +	Construct CDirectGdiDriver.
    1.58 +	Construct CDirectGdiContext.
    1.59 +	Construct RSgImage.
    1.60 +	Construct MDirectGdiImageTarget. 
    1.61 +	Create MDirectGdiImageTarget, using RSgImage.
    1.62 +
    1.63 +	Do not Activate CDirectGdiContext.
    1.64 +	Call any API on the context.
    1.65 +
    1.66 +	Destroy RSgImage.
    1.67 +	Destroy MDirectGdiImageTarget.
    1.68 +	Destroy CDirectGdiContext.
    1.69 +	Close CDirectGdiDriver.
    1.70 +
    1.71 +@SYMTestExpectedResults
    1.72 +	It should panic with panic code DGDI 7, EDirectGdiPanicContextNotActivated
    1.73 +	
    1.74 +@SYMTestStatus
    1.75 +	Implemented
    1.76 +*/
    1.77 +void CTPanicTests::TestContextNotActivatedL()
    1.78 +	{
    1.79 +	if (iUseDirectGdi)
    1.80 +		{
    1.81 +		TInt result = CDirectGdiDriver::Open();
    1.82 +		TESTNOERRORL(result);
    1.83 +		
    1.84 +		CDirectGdiDriver* dgdiDriver = CDirectGdiDriver::Static();		
    1.85 +		TEST(dgdiDriver != NULL);
    1.86 +		CleanupClosePushL(*dgdiDriver);
    1.87 +		
    1.88 +		CDirectGdiContext* gc = CDirectGdiContext::NewL(*dgdiDriver);		
    1.89 +	
    1.90 +		RSgImage* rsgImage1 = new RSgImage();
    1.91 +		TESTL(rsgImage1 != NULL);
    1.92 +		
    1.93 +		// Set the bitmap up...
    1.94 +		TSgImageInfo imageInfo;
    1.95 +		imageInfo.iSizeInPixels = TSize (320, 240);
    1.96 +		imageInfo.iPixelFormat = iTestParams.iTargetPixelFormat;
    1.97 +
    1.98 +		imageInfo.iUsage = ESgUsageDirectGdiTarget;
    1.99 +		result = rsgImage1->Create(imageInfo, NULL,0);
   1.100 +		TESTNOERRORL(result);
   1.101 +		
   1.102 +		RDirectGdiImageTarget* dgdiImageTarget1 = new RDirectGdiImageTarget(*dgdiDriver);
   1.103 +		TESTL(dgdiImageTarget1 != NULL);
   1.104 +		result = dgdiImageTarget1->Create(*rsgImage1);
   1.105 +		TESTNOERRORL(result);
   1.106 +		
   1.107 +		TRect rect(10, 15, 100, 100);
   1.108 +		gc->DrawEllipse(rect);
   1.109 +		
   1.110 +		dgdiImageTarget1->Close();	
   1.111 +		delete(dgdiImageTarget1);
   1.112 +		rsgImage1->Close();
   1.113 +		delete(rsgImage1);
   1.114 +		delete(gc);
   1.115 +		CleanupStack::PopAndDestroy(1);
   1.116 +		}
   1.117 +	else //BitGDI
   1.118 +		User::Panic(KPanicCategory, 7);
   1.119 +	}
   1.120 +
   1.121 +/**
   1.122 +@SYMTestCaseID	
   1.123 +	GRAPHICS-DIRECTGDI-PANIC-0002
   1.124 +
   1.125 +@SYMTestPriority
   1.126 +	Medium
   1.127 +
   1.128 +@SYMPREQ
   1.129 +	PREQ39
   1.130 +
   1.131 +@SYMREQ
   1.132 +	REQ9195
   1.133 +	REQ9201 
   1.134 +	REQ9202 
   1.135 +	REQ9222 
   1.136 +	REQ9223 
   1.137 +	REQ9236 
   1.138 +	REQ9237
   1.139 +
   1.140 +@SYMTestCaseDesc
   1.141 +	Testing if a panic is raised during text drawing functions usage without valid font set.
   1.142 +
   1.143 +@SYMTestActions
   1.144 +	Context is created and activated.
   1.145 +
   1.146 +	Set font in context.
   1.147 +	Call any DrawText() API on the context.
   1.148 +
   1.149 +	Reset font in context.
   1.150 +	Call any DrawText() API on the context.
   1.151 +
   1.152 +@SYMTestExpectedResults
   1.153 +	It should panic with panic code DGDI 11, EDirectGdiPanicNoFontSelected.
   1.154 +
   1.155 +@SYMTestStatus
   1.156 +	Implemented
   1.157 +*/
   1.158 +
   1.159 +void CTPanicTests::TestFontNotSetL()
   1.160 +	{
   1.161 +	if(iUseDirectGdi)
   1.162 +		{
   1.163 +		_LIT(KText, "test");
   1.164 +
   1.165 +		ResetGc();
   1.166 +
   1.167 +		CFont* font = GetFont();
   1.168 +		TESTL(font != NULL);
   1.169 +
   1.170 +		iGc->SetPenColor(TRgb(0, 0, 0));
   1.171 +
   1.172 +		iGc->SetFont(font);
   1.173 +		iGc->DrawText(KText, NULL, TPoint(10, 30));
   1.174 +	
   1.175 +		iGc->ResetFont();
   1.176 +		iGc->DrawText(KText, NULL, TPoint(10, 50));
   1.177 +	
   1.178 +		ReleaseFont(font);
   1.179 +		}
   1.180 +	else //BitGDI
   1.181 +		User::Panic( KPanicCategory, 11);
   1.182 +	}
   1.183 +
   1.184 +/**
   1.185 +@SYMTestCaseID		
   1.186 +	GRAPHICS-DIRECTGDI-PANIC-0003
   1.187 +
   1.188 +@SYMTestPriority
   1.189 +	Medium
   1.190 +
   1.191 +@SYMPREQ
   1.192 +	PREQ39
   1.193 +
   1.194 +@SYMREQ
   1.195 +	REQ9195
   1.196 +	REQ9201 
   1.197 +	REQ9202 
   1.198 +	REQ9222 
   1.199 +	REQ9223 
   1.200 +	REQ9236 
   1.201 +	REQ9237
   1.202 +
   1.203 +@SYMTestCaseDesc
   1.204 +	Tests the negative conditions that can only be reached by creating RSgImage with an invalid pixel type, to
   1.205 +	improve the code coverage.
   1.206 +	
   1.207 +@SYMTestActions		
   1.208 +	Construct CDirectGdiDriver.
   1.209 +	Construct CDirectGdiContext.
   1.210 +
   1.211 +	Construct RSgImage with unsupported pixel type and do not check for the return error code.
   1.212 +	Construct MDirectGdiImageTarget.
   1.213 +	Create MDirectGdiImageTarget, using RSgImage, ignoring the return error code.
   1.214 +
   1.215 +	Activate CDirectGdiContext using MDirectGdiImageTarget.
   1.216 +   
   1.217 +	Destroy RSgImage.
   1.218 +	Destroy MDirectGdiImageTarget.
   1.219 +
   1.220 +	Destroy CDirectGdiContext.
   1.221 +	Close CDirectGdiDriver.
   1.222 +
   1.223 +@SYMTestExpectedResults
   1.224 +	It should panic with panic code DGDI 21, EDirectGdiImageTargetInfoError
   1.225 +	
   1.226 +@SYMTestStatus
   1.227 +	Implemented
   1.228 +*/
   1.229 +void CTPanicTests::TestInvalidTargetL()
   1.230 +	{	
   1.231 +	if(iUseDirectGdi)
   1.232 +		{
   1.233 +		TInt err = CDirectGdiDriver::Open();
   1.234 +		TESTNOERROR(err);
   1.235 +		
   1.236 +		CDirectGdiDriver* dgdiDriver = CDirectGdiDriver::Static();	
   1.237 +		TESTL(dgdiDriver != NULL);
   1.238 +		CleanupClosePushL(*dgdiDriver);
   1.239 +		
   1.240 +		CDirectGdiContext* gc = CDirectGdiContext::NewL(*dgdiDriver);
   1.241 +		RSgImage rsgImage;
   1.242 +			
   1.243 +		// Set the bitmap up...
   1.244 +		TSgImageInfo imageInfo;
   1.245 +		imageInfo.iSizeInPixels = TSize (320, 240);
   1.246 +		imageInfo.iPixelFormat = EUidPixelFormatA_8;
   1.247 +		imageInfo.iUsage = ESgUsageDirectGdiTarget;
   1.248 +		rsgImage.Create(imageInfo, NULL,0);
   1.249 +		
   1.250 +		RDirectGdiImageTarget dgdiImageTarget(*dgdiDriver);
   1.251 +		dgdiImageTarget.Create(rsgImage);	
   1.252 +		gc->Activate (dgdiImageTarget);
   1.253 +			
   1.254 +		rsgImage.Close();
   1.255 +		dgdiImageTarget.Close();	
   1.256 +		delete gc;
   1.257 +		CleanupStack::PopAndDestroy(1);
   1.258 +		}
   1.259 +	else //BitGDI
   1.260 +		User::Panic( KPanicCategory, 21);
   1.261 +	}
   1.262 +
   1.263 +/**
   1.264 +@SYMTestCaseID		
   1.265 +	GRAPHICS-DIRECTGDI-PANIC-0004
   1.266 +
   1.267 +@SYMTestPriority
   1.268 +	Medium
   1.269 +
   1.270 +@SYMPREQ
   1.271 +	PREQ39
   1.272 +
   1.273 +@SYMREQ
   1.274 +	REQ9195
   1.275 +	REQ9201 
   1.276 +	REQ9202 
   1.277 +	REQ9222 
   1.278 +	REQ9223 
   1.279 +	REQ9236 
   1.280 +	REQ9237
   1.281 +
   1.282 +@SYMTestCaseDesc
   1.283 +	Test that the adapter panics when an attempt is made to activate a target with an invalid handle.
   1.284 +
   1.285 +@SYMTestActions		
   1.286 +	Create an RSgImage.
   1.287 +	Make it a target for the driver.
   1.288 +	Change the target's handle so it has an erroneous handle.
   1.289 +	Attempt to activate the target.
   1.290 +	(This test only works in _DEBUG mode as the handle check only happens in _DEBUG mode)
   1.291 +
   1.292 +@SYMTestExpectedResults
   1.293 +	The test should panic when the target is activated DGDIAdapter 32, EDirectGdiPanicResourceHandleNotFound.
   1.294 +  
   1.295 +@SYMTestStatus
   1.296 +	Implemented
   1.297 +*/
   1.298 +void CTPanicTests::TestImageInvalidTargetHandleL()
   1.299 +	{
   1.300 +#ifdef _DEBUG
   1.301 +	TInt err = CDirectGdiDriver::Open();
   1.302 +	TESTNOERROR(err);
   1.303 +	
   1.304 +	CDirectGdiDriver* dgdiDriver = CDirectGdiDriver::Static();	
   1.305 +	TESTL(dgdiDriver != NULL);
   1.306 +	CleanupClosePushL(*dgdiDriver);
   1.307 +	
   1.308 +	CDirectGdiContext* gc = CDirectGdiContext::NewL(*dgdiDriver);
   1.309 +	RSgImage rsgImage;
   1.310 +		
   1.311 +	// Set the bitmap up...
   1.312 +	TSgImageInfo imageInfo;
   1.313 +	imageInfo.iSizeInPixels = TSize (320, 240);
   1.314 +	imageInfo.iPixelFormat = iTestParams.iTargetPixelFormat;
   1.315 +	imageInfo.iUsage = ESgUsageDirectGdiTarget;
   1.316 +	rsgImage.Create(imageInfo, NULL,0);
   1.317 +	
   1.318 +	RDirectGdiImageTarget dgdiImageTarget(*dgdiDriver);
   1.319 +	dgdiImageTarget.Create(rsgImage);	
   1.320 +	
   1.321 +	// Set the target's handle to a non-null invalid handle.
   1.322 +	dgdiImageTarget.iHandle = 0x12345678;
   1.323 +	
   1.324 +	// Activate should panic (DGDIAdapter EDirectGdiTargetHandleNotFound 32)
   1.325 +	gc->Activate (dgdiImageTarget);
   1.326 +		
   1.327 +	rsgImage.Close();
   1.328 +	dgdiImageTarget.Close();	
   1.329 +	delete gc;
   1.330 +	CleanupStack::PopAndDestroy(1);
   1.331 +#else
   1.332 +	User::Panic(KPanicCategory, 32);
   1.333 +#endif
   1.334 +	}
   1.335 +
   1.336 +/**
   1.337 +@SYMTestCaseID		
   1.338 +	GRAPHICS-DIRECTGDI-PANIC-0005
   1.339 +
   1.340 +@SYMTestPriority
   1.341 +	Medium
   1.342 +
   1.343 +@SYMPREQ
   1.344 +	PREQ39
   1.345 +
   1.346 +@SYMTestCaseDesc
   1.347 +	Tests the negative conditions that the same RDirectGdiImageTarget object
   1.348 +	is created twice.
   1.349 +	
   1.350 +@SYMTestActions		
   1.351 +	Construct CDirectGdiDriver.
   1.352 +	Construct RDirectGdiImageTarget twice.
   1.353 +  
   1.354 +@SYMTestExpectedResults
   1.355 +	It should panic with panic code DGDIAdapter 17, EDirectGdiImageTargetAlreadyExists
   1.356 +	
   1.357 +@SYMTestStatus
   1.358 +	Implemented
   1.359 +*/
   1.360 +void CTPanicTests::TestImageTargetActivatedTwiceL()
   1.361 +	{
   1.362 +	if(iUseDirectGdi)
   1.363 +		{
   1.364 +		TInt err = CDirectGdiDriver::Open();
   1.365 +		TESTNOERRORL(err);			
   1.366 +		CDirectGdiDriver* dgdiDriver = CDirectGdiDriver::Static();
   1.367 +		TESTL(dgdiDriver != NULL);	
   1.368 +		CleanupClosePushL(*dgdiDriver);	
   1.369 +		
   1.370 +		TSgImageInfo info2;
   1.371 +		info2.iSizeInPixels = TSize(8, 8);
   1.372 +		info2.iUsage = ESgUsageDirectGdiTarget;
   1.373 +		info2.iPixelFormat = EUidPixelFormatRGB_565;
   1.374 +		info2.iCpuAccess = ESgCpuAccessNone;
   1.375 +		info2.iShareable = ETrue;
   1.376 +		RSgImage image2;
   1.377 +		User::LeaveIfError(image2.Create(info2, NULL, 0));
   1.378 +		CleanupClosePushL(image2);
   1.379 +		
   1.380 +		RDirectGdiImageTarget dgdiImageTarget(*dgdiDriver);
   1.381 +		TESTNOERRORL(dgdiImageTarget.Create(image2));
   1.382 +		CleanupClosePushL(dgdiImageTarget);
   1.383 +		dgdiImageTarget.Create(image2); //should panic here
   1.384 +		CleanupClosePushL(dgdiImageTarget);
   1.385 +		
   1.386 +		CleanupStack::PopAndDestroy(4, dgdiDriver);	
   1.387 +		}
   1.388 +	else //BitGDI
   1.389 +		{
   1.390 +		User::Panic( KPanicCategory, 17);
   1.391 +		}
   1.392 +	}
   1.393 +
   1.394 +/**
   1.395 +@SYMTestCaseID		
   1.396 +	GRAPHICS-DIRECTGDI-PANIC-0006
   1.397 +
   1.398 +@SYMTestPriority
   1.399 +	Medium
   1.400 +
   1.401 +@SYMPREQ
   1.402 +	PREQ39
   1.403 +
   1.404 +@SYMTestCaseDesc
   1.405 +	Tests the negative conditions that the same RDirectGdiDrawableSource object
   1.406 +	is created twice.
   1.407 +	
   1.408 +@SYMTestActions		
   1.409 +	Construct CDirectGdiDriver.
   1.410 +	Construct RDirectGdiDrawableSource twice.
   1.411 +  
   1.412 +@SYMTestExpectedResults
   1.413 +	It should panic with panic code DGDI 18, EDirectGdiImageSourceAlreadyExists
   1.414 +	
   1.415 +@SYMTestStatus
   1.416 +	Implemented
   1.417 +*/
   1.418 +void CTPanicTests::TestImageSourceActivatedTwiceL()
   1.419 +	{
   1.420 +	if(iUseDirectGdi)
   1.421 +		{
   1.422 +		TInt err = CDirectGdiDriver::Open();
   1.423 +		TESTNOERRORL(err);			
   1.424 +		CDirectGdiDriver* dgdiDriver = CDirectGdiDriver::Static();
   1.425 +		TESTL(dgdiDriver != NULL);	
   1.426 +		CleanupClosePushL(*dgdiDriver);	
   1.427 +		
   1.428 +		TSgImageInfo info1;
   1.429 +		info1.iSizeInPixels = TSize(8, 8);
   1.430 +		info1.iUsage = ESgUsageDirectGdiSource;
   1.431 +		info1.iPixelFormat = EUidPixelFormatRGB_565;
   1.432 +		info1.iCpuAccess = ESgCpuAccessReadWrite;
   1.433 +		info1.iShareable = ETrue;	
   1.434 +		RSgImage image1;
   1.435 +		User::LeaveIfError(image1.Create(info1, NULL, 0));
   1.436 +		CleanupClosePushL(image1);
   1.437 +		
   1.438 +		RDirectGdiDrawableSource dgdiImageSource(*dgdiDriver);
   1.439 +		TESTNOERRORL(dgdiImageSource.Create(image1));
   1.440 +		CleanupClosePushL(dgdiImageSource);
   1.441 +		dgdiImageSource.Create(image1); //should panic here
   1.442 +		CleanupClosePushL(dgdiImageSource);
   1.443 +		
   1.444 +		CleanupStack::PopAndDestroy(4, dgdiDriver);
   1.445 +		}
   1.446 +	else //BitGDI
   1.447 +		{
   1.448 +		User::Panic( KPanicCategory, 18);
   1.449 +		}
   1.450 +	}
   1.451 +
   1.452 +/**
   1.453 +@SYMTestCaseID		
   1.454 +	GRAPHICS-DIRECTGDI-PANIC-0007
   1.455 +
   1.456 +@SYMTestPriority
   1.457 +	Medium
   1.458 +
   1.459 +@SYMPREQ
   1.460 +	PREQ39
   1.461 +
   1.462 +@SYMREQ
   1.463 +	REQ9195
   1.464 +	REQ9201 
   1.465 +	REQ9202 
   1.466 +	REQ9222 
   1.467 +	REQ9223 
   1.468 +	REQ9236 
   1.469 +	REQ9237
   1.470 +
   1.471 +@SYMTestCaseDesc
   1.472 +	Tests the negative conditions that the same RDirectGdiDrawableSource object
   1.473 +	is created twice.
   1.474 +	
   1.475 +@SYMTestActions		
   1.476 +	Construct CDirectGdiDriver.
   1.477 +	Construct RDirectGdiDrawableSource twice.
   1.478 +  
   1.479 +@SYMTestExpectedResults
   1.480 +	It should panic with panic code DGDIAdapter 19, EDirectGdiDrawableSourceAlreadyExists
   1.481 +	
   1.482 +@SYMTestStatus
   1.483 +	Implemented
   1.484 +*/
   1.485 +void CTPanicTests::TestDrawableSourceActivatedTwiceL()
   1.486 +	{
   1.487 +	if(iUseDirectGdi)
   1.488 +		{
   1.489 +		TInt err = CDirectGdiDriver::Open();
   1.490 +		TESTNOERRORL(err);			
   1.491 +		CDirectGdiDriver* dgdiDriver = CDirectGdiDriver::Static();
   1.492 +		TESTL(dgdiDriver != NULL);	
   1.493 +		CleanupClosePushL(*dgdiDriver);	
   1.494 +		
   1.495 +		TSgImageInfo info1;
   1.496 +		info1.iSizeInPixels = TSize(8, 8);
   1.497 +		info1.iUsage = ESgUsageDirectGdiSource;
   1.498 +		info1.iPixelFormat = EUidPixelFormatARGB_8888_PRE;
   1.499 +		info1.iCpuAccess = ESgCpuAccessReadWrite;
   1.500 +		info1.iShareable = ETrue;	
   1.501 +		RSgImage image1;
   1.502 +		TESTNOERRORL(image1.Create(info1, NULL, 0));
   1.503 +		CleanupClosePushL(image1);
   1.504 +		
   1.505 +		RDirectGdiDrawableSource dgdiDrawableSource(*dgdiDriver);
   1.506 +		TESTNOERRORL(dgdiDrawableSource.Create(image1));
   1.507 +		CleanupClosePushL(dgdiDrawableSource);
   1.508 +		dgdiDrawableSource.Create(image1); //should panic here
   1.509 +		CleanupClosePushL(dgdiDrawableSource);
   1.510 +		
   1.511 +		CleanupStack::PopAndDestroy(4, dgdiDriver);
   1.512 +		}
   1.513 +	else //BitGDI
   1.514 +		{
   1.515 +		User::Panic( KPanicCategory, 19);
   1.516 +		}
   1.517 +	}
   1.518 +
   1.519 +/**
   1.520 +@SYMTestCaseID		
   1.521 +	GRAPHICS-DIRECTGDI-PANIC-0008
   1.522 +	
   1.523 +@SYMTestPriority
   1.524 +	Medium
   1.525 +
   1.526 +@SYMPREQ
   1.527 +	PREQ39
   1.528 +
   1.529 +@SYMREQ
   1.530 +	REQ9195
   1.531 +	REQ9201 
   1.532 +	REQ9202 
   1.533 +	REQ9222 
   1.534 +	REQ9223 
   1.535 +	REQ9236 
   1.536 +	REQ9237
   1.537 +
   1.538 +@SYMTestCaseDesc
   1.539 +	Make sure a panic occurs when calling SetBrushStyle() with EPatternedBrush when no brush pattern has been set.
   1.540 +	
   1.541 +@SYMTestActions		
   1.542 + 	Set brush style to EPatternedBrush.
   1.543 +  
   1.544 +@SYMTestExpectedResults
   1.545 +	It should panic with panic code DGDI 9, EDirectGdiBrushPatternNotSet.
   1.546 +	
   1.547 +@SYMTestStatus
   1.548 +	Implemented
   1.549 +*/
   1.550 +void CTPanicTests::TestBrushPatternNotSetL()
   1.551 +	{
   1.552 +	if(iUseDirectGdi)
   1.553 +		{
   1.554 +		ResetGc();
   1.555 +		iGc->SetBrushStyle(DirectGdi::EPatternedBrush);		
   1.556 +		}
   1.557 +	else //BitGDI
   1.558 +		User::Panic( KPanicCategory, 9);
   1.559 +	}
   1.560 +
   1.561 +/**
   1.562 +Override of base class virtual
   1.563 +@leave Gets system wide error code
   1.564 +@return - TVerdict code
   1.565 +*/
   1.566 +TVerdict CTPanicTests::doTestStepPreambleL()
   1.567 +	{			
   1.568 +	CTDirectGdiStepBase::doTestStepPreambleL();	
   1.569 +	return TestStepResult();
   1.570 +	}
   1.571 +	
   1.572 +/** 
   1.573 +Override of base class pure virtual
   1.574 +Our implementation only gets called if the base class doTestStepPreambleL() did
   1.575 +not leave. That being the case, the current test result value will be EPass.
   1.576 +@leave Gets system wide error code
   1.577 +@return TVerdict code
   1.578 +*/	
   1.579 +TVerdict CTPanicTests::doTestStepL()
   1.580 +	{	
   1.581 +	// Test for each pixel format
   1.582 +	for(TInt targetPixelFormatIndex = iTargetPixelFormatArray.Count() - 1; targetPixelFormatIndex >= 0 ; targetPixelFormatIndex--)
   1.583 +		{
   1.584 +		iTestParams.iTargetPixelFormat = iTargetPixelFormatArray[targetPixelFormatIndex];
   1.585 +		SetTargetL(iTestParams.iTargetPixelFormat);
   1.586 +		RunTestsL();
   1.587 +		RunOomTestsL();
   1.588 +		}
   1.589 +
   1.590 +	return TestStepResult();
   1.591 +	}
   1.592 +
   1.593 +/**
   1.594 +Override of base class pure virtual
   1.595 +Lists the tests to be run
   1.596 +*/
   1.597 +void CTPanicTests::RunTestsL()
   1.598 +	{
   1.599 +	INFO_PRINTF1(_L("DirectGdi Panic Tests" ));
   1.600 +	TInt aCurTestCase;
   1.601 +	//Read the case number from the ini file
   1.602 +	TBool res = GetIntFromConfig(ConfigSection(), KCaseNumber, aCurTestCase);		
   1.603 +	if(!res)
   1.604 +		{
   1.605 +		return ;
   1.606 +		}			
   1.607 +	SetTestStepID(KUnknownSYMTestCaseIDName);
   1.608 +	switch(aCurTestCase)
   1.609 +		{			
   1.610 +		case 1:
   1.611 +			INFO_PRINTF1(_L("TestContextNotActivatedL\n"));
   1.612 +			SetTestStepID(_L("GRAPHICS-DIRECTGDI-PANIC-0001"));
   1.613 +			TestContextNotActivatedL();
   1.614 +			break;
   1.615 +		case 2:
   1.616 +			INFO_PRINTF1(_L("TestFontNotSetL\r\n"));
   1.617 +			SetTestStepID(_L("GRAPHICS-DIRECTGDI-PANIC-0002"));
   1.618 +			TestFontNotSetL();
   1.619 +			break;
   1.620 +		case 3:
   1.621 +			INFO_PRINTF1(_L("TestInvalidTargetL\r\n"));
   1.622 +			SetTestStepID(_L("GRAPHICS-DIRECTGDI-PANIC-0003"));
   1.623 +			TestInvalidTargetL();
   1.624 +			break;
   1.625 +		case 4:
   1.626 +			INFO_PRINTF1(_L("TestImageInvalidTargetHandleL\r\n"));
   1.627 +			SetTestStepID(_L("GRAPHICS-DIRECTGDI-PANIC-0004"));
   1.628 +			TestImageInvalidTargetHandleL();
   1.629 +			break;
   1.630 +		case 5:
   1.631 +			INFO_PRINTF1(_L("TestImageTargetActivatedTwiceL\r\n"));
   1.632 +			SetTestStepID(_L("GRAPHICS-DIRECTGDI-PANIC-0005"));
   1.633 +			TestImageTargetActivatedTwiceL();
   1.634 +			break;	
   1.635 +		case 6:
   1.636 +			INFO_PRINTF1(_L("TestImageSourceActivatedTwiceL\r\n"));
   1.637 +			SetTestStepID(_L("GRAPHICS-DIRECTGDI-PANIC-0006"));
   1.638 +			TestImageSourceActivatedTwiceL();
   1.639 +			break;
   1.640 +		case 7:
   1.641 +			INFO_PRINTF1(_L("TestDrawableSourceActivatedTwiceL\r\n"));
   1.642 +			SetTestStepID(_L("GRAPHICS-DIRECTGDI-PANIC-0007"));
   1.643 +			TestDrawableSourceActivatedTwiceL();
   1.644 +			break;
   1.645 +		case 8:
   1.646 +			INFO_PRINTF1(_L("TestBrushPatternNotSetL\r\n"));
   1.647 +			SetTestStepID(_L("GRAPHICS-DIRECTGDI-PANIC-0008"));
   1.648 +			TestBrushPatternNotSetL();
   1.649 +			break;
   1.650 +		}
   1.651 +	RecordTestResultL();
   1.652 +	}