graphicsresourceservices/graphicsresource/test/tsgimagecollectiongeneric.cpp
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2007-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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent - Internal Symbian test code 
       
    20 */
       
    21 
       
    22 #include "tsgimagecollectiongeneric.h"
       
    23 
       
    24 CTSgImageCollectionGeneric::CTSgImageCollectionGeneric()
       
    25 	{
       
    26 	INFO_PRINTF1(_L("Graphics resource component test - RSgImageCollection Generic Tests.\r\n"));
       
    27 	}
       
    28 
       
    29 CTSgImageCollectionGeneric::~CTSgImageCollectionGeneric()
       
    30 	{
       
    31 	}
       
    32 
       
    33 /** 
       
    34 Overrides of base class pure virtual
       
    35 Our implementation only gets called if the base class doTestStepPreambleL() did
       
    36 not leave. That being the case, the current test result value will be EPass.
       
    37 @leave Gets system wide error code
       
    38 @return TVerdict code
       
    39 */
       
    40 TVerdict CTSgImageCollectionGeneric::doTestStepL()
       
    41 	{
       
    42 	SetTestStepID(_L("GRAPHICS-RESOURCE-0015"));
       
    43 	INFO_PRINTF1(_L("Creation of image collections.\r\n"));
       
    44 	TestCreateImageCollectionL();
       
    45 	RecordTestResultL();
       
    46 		
       
    47 	SetTestStepID(_L("GRAPHICS-RESOURCE-0016"));
       
    48 	INFO_PRINTF1(_L("Getting surface id of the image collection.\r\n"));
       
    49 	TestGetImageCollectionSurfaceIdL();
       
    50 	RecordTestResultL();
       
    51 	
       
    52 	SetTestStepID(_L("GRAPHICS-RESOURCE-0017"));
       
    53 	INFO_PRINTF1(_L("Getting the number of images in an image collection.\r\n"));
       
    54 	TestGetCollectionImageNumberL();
       
    55 	RecordTestResultL();
       
    56 		
       
    57 	SetTestStepID(_L("GRAPHICS-RESOURCE-0018"));
       
    58 	INFO_PRINTF1(_L("Getting information about the images in an image collection.\r\n"));
       
    59 	TestGetImageInfoInCollectionL();
       
    60 	RecordTestResultL();
       
    61 		
       
    62 	SetTestStepID(_L("GRAPHICS-RESOURCE-0019"));
       
    63 	INFO_PRINTF1(_L("Getting image at a specific location in an image collection.\r\n"));
       
    64 	TestOpenImageInCollectionL();
       
    65 	RecordTestResultL();
       
    66 		
       
    67 	SetTestStepID(_L("GRAPHICS-RESOURCE-0020"));
       
    68 	INFO_PRINTF1(_L("Mapping / Unmapping images in a collection.\r\n"));
       
    69 	TestMapImageInCollectionL();
       
    70 	RecordTestResultL();
       
    71 		
       
    72 	SetTestStepID(_L("GRAPHICS-RESOURCE-0021"));
       
    73 	INFO_PRINTF1(_L("Creation of multiple image collections.\r\n"));
       
    74 	TestCreateMultipleImageCollectionL();
       
    75 	RecordTestResultL();
       
    76 
       
    77 	SetTestStepID(_L("GRAPHICS-RESOURCE-0034"));
       
    78 	INFO_PRINTF1(_L("Creation of the image collection with invalid parameters\r\n"));
       
    79 	TestCreateImageCollectionInvalidL();
       
    80 	RecordTestResultL();
       
    81 
       
    82 	SetTestStepID(_L("GRAPHICS-RESOURCE-0035"));
       
    83 	INFO_PRINTF1(_L("Creation of multiple image collections with invalid parameters.\r\n"));
       
    84 	TestCreateMultipleImageCollectionsInvalidL();
       
    85 	RecordTestResultL();
       
    86 
       
    87 	SetTestStepID(_L("GRAPHICS-RESOURCE-0036"));
       
    88 	INFO_PRINTF1(_L("Getting information about the images in an image collection under various invalid conditions.\r\n"));
       
    89 	TestGetImageCollectionInfoInvalidL();
       
    90 	RecordTestResultL();
       
    91 
       
    92 	SetTestStepID(_L("GRAPHICS-RESOURCE-0037"));
       
    93 	INFO_PRINTF1(_L("Opening images from a collection under various invalid conditions.\r\n"));
       
    94 	TestOpenImageInCollectionInvalidL();
       
    95 	RecordTestResultL();
       
    96 
       
    97 	SetTestStepID(_L("GRAPHICS-RESOURCE-0038"));
       
    98 	INFO_PRINTF1(_L("Invalid mapping/unmapping tests on individual images in a collection\r\n"));
       
    99 	TestMapUnmapImagesInCollectionInvalidL();
       
   100 	RecordTestResultL();
       
   101 	
       
   102 #ifdef _DEBUG
       
   103 /**
       
   104 @SYMTestCaseID			GRAPHICS-RESOURCE-0094
       
   105 */
       
   106 	SetTestStepID(_L("GRAPHICS-RESOURCE-0094"));
       
   107 	INFO_PRINTF1(_L("RSgImageCollection generic out of memory tests.\r\n"));
       
   108 	TestOOM();
       
   109 	RecordTestResultL();
       
   110 	
       
   111 	SetTestStepID(_L("GRAPHICS-RESOURCE-0068"));
       
   112 	INFO_PRINTF1(_L("RSgImageCollection generic panic test - Close() with invalid imagecollection handle\r\n"));
       
   113 	TestPanicImageCollectionCloseInvalidHandleL();
       
   114 	RecordTestResultL();
       
   115 	
       
   116 	SetTestStepID(_L("GRAPHICS-RESOURCE-0069"));
       
   117 	INFO_PRINTF1(_L("RSgImageCollection generic panic test - Close() with non null imagecollection handle and uninitialised driver\r\n"));
       
   118 	TestPanicImageCollectionCloseNoDriverL();
       
   119     RecordTestResultL();
       
   120 	
       
   121 	SetTestStepID(_L("GRAPHICS-RESOURCE-0070"));
       
   122 	INFO_PRINTF1(_L("RSgImageCollection generic panic test - SurfaceId() with invalid imagecollection handle\r\n"));
       
   123 	TestPanicImageCollectionSurfaceIdInvalidHandleL();
       
   124 	RecordTestResultL();
       
   125 	
       
   126 	SetTestStepID(_L("GRAPHICS-RESOURCE-0071"));
       
   127 	INFO_PRINTF1(_L("RSgImageCollection generic panic test - SurfaceId() with non null imagecollection handle and uninitialised driver\r\n"));
       
   128 	TestPanicImageCollectionSurfaceIdNoDriverL();
       
   129 	RecordTestResultL();
       
   130 	
       
   131 	SetTestStepID(_L("GRAPHICS-RESOURCE-0072"));
       
   132 	INFO_PRINTF1(_L("RSgImageCollection generic panic test - GetInfo() with invalid imagecollection handle\r\n"));
       
   133 	TestPanicImageCollectionGetInfoInvalidHandleL();
       
   134 	RecordTestResultL();
       
   135 	
       
   136 	SetTestStepID(_L("GRAPHICS-RESOURCE-0073"));
       
   137 	INFO_PRINTF1(_L("RSgImageCollection generic panic test - GetInfo() with non null imagecollection handle and uninitialised driver\r\n"));
       
   138 	TestPanicImageCollectionGetInfoNoDriverL();
       
   139 	RecordTestResultL();
       
   140 	
       
   141 	SetTestStepID(_L("GRAPHICS-RESOURCE-0074"));
       
   142 	INFO_PRINTF1(_L("RSgImageCollection generic panic test - Count() with invalid imagecollection handle\r\n"));
       
   143 	TestPanicImageCollectionCountInvalidHandleL();
       
   144 	RecordTestResultL();
       
   145 	
       
   146 	SetTestStepID(_L("GRAPHICS-RESOURCE-0075"));
       
   147 	INFO_PRINTF1(_L("RSgImageCollection generic panic test - Count() with non null imagecollection handle and uninitialised driver\r\n"));
       
   148 	TestPanicImageCollectionCountNoDriverL();
       
   149 	RecordTestResultL();
       
   150 	
       
   151 	SetTestStepID(_L("GRAPHICS-RESOURCE-0076"));
       
   152 	INFO_PRINTF1(_L("RSgImageCollection generic panic test - OpenImage() with invalid imagecollection handle\r\n"));
       
   153 	TestPanicImageCollectionOpenImageInvalidHandleL();
       
   154 	RecordTestResultL();
       
   155 	
       
   156 	SetTestStepID(_L("GRAPHICS-RESOURCE-0077"));
       
   157 	INFO_PRINTF1(_L("RSgImageCollection generic panic test - OpenImage() with non null imagecollection handle and uninitialised driver\r\n"));
       
   158 	TestPanicImageCollectionOpenImageNoDriverL();
       
   159 	RecordTestResultL();
       
   160 	
       
   161 	SetTestStepID(_L("GRAPHICS-RESOURCE-0086"));
       
   162 	INFO_PRINTF1(_L("RSgImageCollection generic panic test - Create() a single image collection with an uninitialised driver\r\n"));
       
   163 	TestPanicImageCollectionCreateNoDriver1L();
       
   164 	RecordTestResultL();
       
   165 	
       
   166 	SetTestStepID(_L("GRAPHICS-RESOURCE-0086"));
       
   167 	INFO_PRINTF1(_L("RSgImageCollection generic panic test - Create() multiple image collections with an uninitialised driver\r\n"));
       
   168 	TestPanicImageCollectionCreateNoDriver2L();
       
   169 	RecordTestResultL();
       
   170 #else
       
   171 	INFO_PRINTF1(_L("Warning: Skipping the panic tests. \r\n"));
       
   172 #endif	
       
   173 	return TestStepResult();
       
   174 	}
       
   175 
       
   176 
       
   177 /**
       
   178 @SYMTestCaseID			GRAPHICS-RESOURCE-0015
       
   179 @SYMTestCaseDesc		Creates an image collection.
       
   180 @SYMPREQ				PREQ39
       
   181 @SYMREQ					REQ9214
       
   182 @SYMREQ					REQ9224 
       
   183 @SYMREQ					REQ9233  
       
   184 @SYMREQ					REQ9234 
       
   185 @SYMFssID				RSgImageCollection::Create(const TSgImageInfo&, TInt)\n 
       
   186 						RSgImageCollection::Close()
       
   187 @SYMTestPriority		Critical
       
   188 @SYMTestType			Unit Test
       
   189 @SYMTestPurpose			To ensure the image collection can be created.
       
   190 @SYMTestActions			Initialise the graphics resource component. Construct a TSgImageInfo object
       
   191 						and Initialise all the member variables. Call Create() on the RSgImageCollection
       
   192 						with the image info and number of images.
       
   193 @SYMTestExpectedResults	The function should return KErrNone and memory for the image objects
       
   194 						are successfully allocated.
       
   195 @SYMTestStatus			Implemented 
       
   196  */	
       
   197 void CTSgImageCollectionGeneric::TestCreateImageCollectionL()
       
   198 	{	
       
   199 	TestOpenDriverL();	
       
   200 	TSgImageInfo info;
       
   201 	info.iSizeInPixels = TSize(8, 8);
       
   202 	info.iUsage = ESgUsageDirectGdiTarget;
       
   203 	info.iPixelFormat = EUidPixelFormatRGB_565;
       
   204 	
       
   205 	RSgImageCollection collection;
       
   206 	TEST(collection.IsNull());
       
   207 	
       
   208 	CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
       
   209 	CleanupClosePushL(collection);
       
   210 	TEST(!collection.IsNull());
       
   211 	TEST(1 == SgDriver::ResourceCount());
       
   212 	
       
   213 	CleanupStack::PopAndDestroy();
       
   214 	TestCloseDriver();
       
   215 	}
       
   216 
       
   217 /**
       
   218 @SYMTestCaseID			GRAPHICS-RESOURCE-0016
       
   219 @SYMTestCaseDesc		Gets the surface id of the image collection.
       
   220 @SYMPREQ				PREQ39
       
   221 @SYMREQ					REQ9214
       
   222 @SYMREQ					REQ9215
       
   223 @SYMREQ					REQ9224 
       
   224 @SYMREQ					REQ9233  
       
   225 @SYMREQ					REQ9234
       
   226 @SYMFssID				RSgImageCollection::SurfaceId()\n
       
   227 @SYMTestPriority		Critical
       
   228 @SYMTestType			Unit Test
       
   229 @SYMTestPurpose			To ensure the surface id of the image collection can be retrieved successfully.
       
   230 @SYMTestActions			Initialise the graphics resource component. Create an image collection and call
       
   231 						SurfaceId() on it.
       
   232 @SYMTestExpectedResults	A non-null surface id should be returned.
       
   233 @SYMTestStatus			Implemented 
       
   234  */	
       
   235 void CTSgImageCollectionGeneric::TestGetImageCollectionSurfaceIdL()
       
   236 	{
       
   237 	const TSurfaceId KNullSurfaceId = {0, 0, 0, 0};
       
   238 	RSgImageCollection collection;
       
   239 	TSurfaceId surfaceid = collection.SurfaceId();
       
   240 	TEST(surfaceid == KNullSurfaceId);
       
   241 	TestOpenDriverL();	
       
   242 	CreateImageCollectionL(collection);
       
   243 	CleanupClosePushL(collection);	
       
   244 	surfaceid = collection.SurfaceId();
       
   245 	TEST(!surfaceid.IsNull());
       
   246 
       
   247 	CleanupStack::PopAndDestroy();
       
   248 	TestCloseDriver();
       
   249 	}
       
   250 
       
   251 /**
       
   252 @SYMTestCaseID			GRAPHICS-RESOURCE-0017
       
   253 @SYMTestCaseDesc		Gets the number of images in an image collection.
       
   254 @SYMPREQ				PREQ39
       
   255 @SYMREQ					REQ9214
       
   256 @SYMREQ					REQ9224 
       
   257 @SYMREQ					REQ9233  
       
   258 @SYMREQ					REQ9234
       
   259 @SYMFssID				RSgImageCollection::Count())\n
       
   260 @SYMTestPriority		Critical
       
   261 @SYMTestType			Unit Test
       
   262 @SYMTestPurpose			To ensure the function returns the correct number of images.
       
   263 @SYMTestActions			Initialise the graphics resource component. Declare an image collection. Call Count().
       
   264 						Create an image collection. Call Count() again.
       
   265 @SYMTestExpectedResults	First call should return zero. Second call should return the same value 
       
   266 						as the one passed to the function at creation time.
       
   267 @SYMTestStatus			Implemented 
       
   268  */	
       
   269 void CTSgImageCollectionGeneric::TestGetCollectionImageNumberL()
       
   270 	{	
       
   271 	RSgImageCollection collection;
       
   272 	TInt number = collection.Count();
       
   273 	TEST(0 == number);
       
   274 	TestOpenDriverL();	
       
   275 	CreateImageCollectionL(collection);
       
   276 	CleanupClosePushL(collection);	
       
   277 	number = collection.Count();
       
   278 	TEST(KNumImagesInCollection == number);
       
   279 	CleanupStack::PopAndDestroy();
       
   280 	TestCloseDriver();
       
   281 	}
       
   282 
       
   283 /**
       
   284 @SYMTestCaseID			GRAPHICS-RESOURCE-0018
       
   285 @SYMTestCaseDesc		Calls GetInfo() on an image collection.
       
   286 @SYMPREQ				PREQ39
       
   287 @SYMREQ					REQ9214
       
   288 @SYMREQ					REQ9224 
       
   289 @SYMREQ					REQ9233  
       
   290 @SYMREQ					REQ9234
       
   291 @SYMFssID				RSgImageCollection::GetInfo(TSgImageInfo&)\n
       
   292 @SYMTestPriority		Critical
       
   293 @SYMTestType			Unit Test
       
   294 @SYMTestPurpose			To ensure the information about the images in a collection can be correctly returned.
       
   295 @SYMTestActions			Initialise the graphics resource component. Construct a TSgImageInfo object and
       
   296 						Initialise all the member variables. Create an image collection. Call GetInfo() and
       
   297 						compare the returned TSgImageInfo object with the original one.
       
   298 @SYMTestExpectedResults	The function should return KErrNone and the returned information should be the
       
   299 						same as the old one.
       
   300 @SYMTestStatus			Implemented 
       
   301  */	
       
   302 void CTSgImageCollectionGeneric::TestGetImageInfoInCollectionL()
       
   303 	{
       
   304 	TestOpenDriverL();
       
   305 	TSgImageInfo info;
       
   306 	info.iSizeInPixels = TSize(8, 8);
       
   307 	info.iUsage = ESgUsageDirectGdiTarget;
       
   308 	info.iPixelFormat = EUidPixelFormatRGB_565;
       
   309 	
       
   310 	RSgImageCollection collection;
       
   311 	CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
       
   312 	CleanupClosePushL(collection);
       
   313 	TEST(!collection.IsNull());
       
   314 	
       
   315 	TSgImageInfo info2;
       
   316 	TEST(KErrNone == collection.GetInfo(info2));
       
   317 	TEST(CompareInfos(info, info2));
       
   318 	CleanupStack::PopAndDestroy();
       
   319 	
       
   320 	//get info with user attributes
       
   321 	TSgUserAttribute testAttributes[2] = {{0x00008888, 1}, {0x00009999, 2}};
       
   322 	info.iUserAttributes = testAttributes;
       
   323 	info.iUserAttributeCount = 2;
       
   324 	CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
       
   325 	CleanupClosePushL(collection);
       
   326 	TSgImageInfo info3;
       
   327 	TSgUserAttribute testAttributes2[2] = {{0x00008888, 0}, {0x00009999, 0}};
       
   328 	info3.iUserAttributes = testAttributes2;
       
   329 	info3.iUserAttributeCount = 2;
       
   330 	TEST(KErrNone == collection.GetInfo(info3));
       
   331 	TEST(CompareInfos(info, info3));
       
   332 	CleanupStack::PopAndDestroy();	
       
   333 	
       
   334 	TestCloseDriver();
       
   335 	}
       
   336 
       
   337 /**
       
   338 @SYMTestCaseID			GRAPHICS-RESOURCE-0019
       
   339 @SYMTestCaseDesc		Gets image at a specific location in an image collection.
       
   340 @SYMPREQ				PREQ39
       
   341 @SYMREQ					REQ9214
       
   342 @SYMREQ					REQ9224 
       
   343 @SYMREQ					REQ9233  
       
   344 @SYMREQ					REQ9234
       
   345 @SYMFssID				RSgImageCollection::OpenImage()\n
       
   346 @SYMTestPriority		Critical
       
   347 @SYMTestType			Unit Test
       
   348 @SYMTestPurpose			To ensure an image at a specific location can be returned.
       
   349 @SYMTestActions			Initialise the graphics resource component. Create the image collection. Call OpenImage() to 
       
   350 						return all the images in order. 
       
   351 @SYMTestExpectedResults	All the images are returned successfully.
       
   352 @SYMTestStatus			Implemented 
       
   353  */	
       
   354 void CTSgImageCollectionGeneric::TestOpenImageInCollectionL()
       
   355 	{	
       
   356 	TestOpenDriverL();
       
   357 	RSgImageCollection collection;
       
   358 	CreateImageCollectionL(collection);
       
   359 	CleanupClosePushL(collection);
       
   360 	
       
   361 	TSgImageInfo info1;
       
   362 	collection.GetInfo(info1);
       
   363 	
       
   364 	for(TInt i=0; i<KNumImagesInCollection; ++i)
       
   365 		{
       
   366 		RSgImage image;
       
   367 		CheckErrorL(KErrNone, collection.OpenImage(i, image), (TText8*)__FILE__, __LINE__);
       
   368 		TSgImageInfo info2;
       
   369 		CheckErrorL(KErrNone, image.GetInfo(info2), (TText8*)__FILE__, __LINE__);
       
   370 		TEST(CompareInfos(info1, info2));
       
   371 		image.Close();
       
   372 		}
       
   373 	
       
   374 	CleanupStack::PopAndDestroy();
       
   375 	TestCloseDriver();
       
   376 	}
       
   377 
       
   378 /**
       
   379 @SYMTestCaseID			GRAPHICS-RESOURCE-0020
       
   380 @SYMTestCaseDesc		Maps and unmaps images in a collection.
       
   381 @SYMPREQ				PREQ39
       
   382 @SYMREQ					REQ9214
       
   383 @SYMREQ					REQ9193
       
   384 @SYMREQ					REQ9219
       
   385 @SYMREQ					REQ9224 
       
   386 @SYMREQ					REQ9233  
       
   387 @SYMREQ					REQ9234
       
   388 @SYMFssID				RSgImageCollection::OpenImage()\n 
       
   389 						RSgImage::MapReadOnly(const TAny*&, TInt&) const\n
       
   390  						RSgImage::MapWriteOnly(TAny*&, TInt&)\n 
       
   391 						RSgImage::MapReadWrite(TAny*&, TInt&)\n 
       
   392 						RSgImage::Unmap ()\n
       
   393 @SYMTestPriority		Critical
       
   394 @SYMTestType			Unit Test
       
   395 @SYMTestPurpose			To ensure individual images in an image collection can be mapped and unmapped.
       
   396 @SYMTestActions			Initialise the graphics resource component. Create the image collection. Use the 
       
   397 						index operator to return all the images. Call MapXXX() and Unmap() functions on each 
       
   398 						of them.
       
   399 @SYMTestExpectedResults	All the functions should return KErrNone.
       
   400 @SYMTestStatus			Implemented 
       
   401  */	
       
   402 void CTSgImageCollectionGeneric::TestMapImageInCollectionL()
       
   403 	{
       
   404 	TestOpenDriverL();
       
   405 	TSgImageInfo info;
       
   406 	info.iSizeInPixels = TSize(8, 8);
       
   407 	info.iUsage = ESgUsageDirectGdiSource;
       
   408 	info.iPixelFormat = EUidPixelFormatRGB_565;
       
   409 	info.iCpuAccess = ESgCpuAccessReadWrite;
       
   410 	
       
   411 	RSgImageCollection collection;
       
   412 	CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
       
   413 	CleanupClosePushL(collection);
       
   414 	TEST(!collection.IsNull());
       
   415 	
       
   416 	TAny* dataAddress;
       
   417 	TInt dataStride;
       
   418 	
       
   419 	for(TInt i=0; i<collection.Count(); ++i)
       
   420 		{
       
   421 		RSgImage image;
       
   422 		CheckErrorL(KErrNone, collection.OpenImage(i, image), (TText8*)__FILE__, __LINE__);
       
   423 		TSgImageInfo imageInfo;
       
   424 		CheckErrorL(KErrNone, image.GetInfo(imageInfo), (TText8*)__FILE__, __LINE__);
       
   425 		
       
   426 		//test MapReadWrite
       
   427 		TInt mapResult = image.MapReadWrite(dataAddress, dataStride);
       
   428 		TEST(KErrNone == mapResult);
       
   429 		
       
   430 		if(KErrNone == mapResult)
       
   431 			{
       
   432 			//modify the image, set first line to blue
       
   433 			for(TInt x = 0; x < imageInfo.iSizeInPixels.iWidth; ++x)
       
   434 				{
       
   435 				*(TUint16*)PtrAdd(dataAddress, sizeof(TUint16) * x) = 0x1F;
       
   436 				}
       
   437 			
       
   438 			//check the modification
       
   439 			for(TInt x = 0; x < imageInfo.iSizeInPixels.iWidth; ++x)
       
   440 				{
       
   441 				TUint16 pixelValue = *(TUint16*)PtrAdd(dataAddress, sizeof(TUint16) * x);
       
   442 				if(pixelValue != 0x1F)
       
   443 					{
       
   444 					TEST(EFalse);
       
   445 					break;
       
   446 					}
       
   447 				}
       
   448 			}		
       
   449 		TEST(KErrNone == image.Unmap());	
       
   450 		image.Close();		
       
   451 		}
       
   452 	
       
   453 	CleanupStack::PopAndDestroy();
       
   454 	TestCloseDriver();
       
   455 	}
       
   456 
       
   457 /**
       
   458 @SYMTestCaseID			GRAPHICS-RESOURCE-0021
       
   459 @SYMTestCaseDesc		Creates multiple image collections.
       
   460 @SYMPREQ				PREQ39
       
   461 @SYMREQ					REQ9214
       
   462 @SYMREQ					REQ9224 
       
   463 @SYMREQ					REQ9233  
       
   464 @SYMREQ					REQ9234
       
   465 @SYMFssID				RSgImageCollection::Create(const TSgImageInfo&, TInt, RSgImageCollection*, TInt) \n
       
   466 						RSgImageCollection::Close()
       
   467 @SYMTestPriority		Critical
       
   468 @SYMTestType			Unit Test
       
   469 @SYMTestPurpose			To ensure multiple image collections can be created using the factory function.
       
   470 @SYMTestActions			Initialise the graphics resource component. Construct multiple TSgImageInfo objects
       
   471 						and Initialise all the member variables. Call the static Create() function.
       
   472 @SYMTestExpectedResults	The function should return KErrNone and memory for the image objects
       
   473 						are successfully allocated.
       
   474 @SYMTestStatus			Implemented 
       
   475  */	
       
   476 void CTSgImageCollectionGeneric::TestCreateMultipleImageCollectionL()
       
   477 	{
       
   478 	TestOpenDriverL();
       
   479 	
       
   480 	TSgImageInfo infos[3];
       
   481 	infos[0].iCpuAccess = ESgCpuAccessReadWrite;
       
   482 	infos[0].iPixelFormat = EUidPixelFormatXRGB_8888;
       
   483 	infos[0].iSizeInPixels = TSize(50, 50);
       
   484 	infos[0].iUsage = ESgUsageDirectGdiSource;
       
   485 	
       
   486 	infos[1].iCpuAccess = ESgCpuAccessNone;
       
   487 	infos[1].iPixelFormat = EUidPixelFormatRGB_565;
       
   488 	infos[1].iSizeInPixels = TSize(120, 120);
       
   489 	infos[1].iUsage = ESgUsageDirectGdiTarget|ESgUsageCompositionSource;
       
   490 	
       
   491 	infos[2].iCpuAccess = ESgCpuAccessNone;
       
   492 	infos[2].iPixelFormat = EUidPixelFormatARGB_8888_PRE;
       
   493 	infos[2].iSizeInPixels = TSize(200, 200);
       
   494 	infos[2].iUsage = ESgUsageDirectGdiTarget|ESgUsageCompositionSource;
       
   495 	
       
   496 	RSgImageCollection collections[3];
       
   497 	CheckErrorL(KErrNone, RSgImageCollection::Create(infos, KNumImagesInCollection, collections, 3), (TText8*)__FILE__, __LINE__);
       
   498 	CleanupClosePushL(collections[0]);
       
   499 	CleanupClosePushL(collections[1]);
       
   500 	CleanupClosePushL(collections[2]);
       
   501 	
       
   502 	for(TInt i=0; i<3; ++i)
       
   503 		{
       
   504 		RSgImageCollection& collection = collections[i];
       
   505 		TEST(!collection.IsNull());
       
   506 		
       
   507 		TSurfaceId surfaceid = collection.SurfaceId();
       
   508 		TEST(!surfaceid.IsNull());
       
   509 		
       
   510 		TSgImageInfo info;
       
   511 		TEST(KErrNone == collection.GetInfo(info));
       
   512 		TSgImageInfo oldInfo = infos[i];
       
   513 		
       
   514 		TEST(CompareInfos(oldInfo, info));
       
   515 		
       
   516 		TInt imagecount = collection.Count();
       
   517 		TEST(imagecount == KNumImagesInCollection);
       
   518 
       
   519 		for (TInt j = 0; j < KNumImagesInCollection; ++j)
       
   520 			{
       
   521 			RSgImage image;
       
   522 			CheckErrorL(KErrNone, collection.OpenImage(j, image), (TText8*)__FILE__, __LINE__);
       
   523 			TEST(KErrNone == image.GetInfo(info));
       
   524 			TEST(CompareInfos(oldInfo, info));
       
   525 			image.Close();
       
   526 			}
       
   527 		}
       
   528 	
       
   529 	CleanupStack::PopAndDestroy(3);
       
   530 	TestCloseDriver();
       
   531 	}
       
   532 
       
   533 
       
   534 /**
       
   535 @SYMTestCaseID			GRAPHICS-RESOURCE-0034
       
   536 @SYMTestCaseDesc		Creates an image collection with invalid parameters
       
   537 @SYMPREQ				PREQ39
       
   538 @SYMREQ					REQ9214
       
   539 @SYMREQ					REQ9224 
       
   540 @SYMREQ					REQ9233  
       
   541 @SYMREQ					REQ9234
       
   542 @SYMFssID				RSgImageCollection::Create(const TSgImageInfo, TInt)\n
       
   543 						RSgImageCollection::Close()
       
   544 @SYMTestPriority		Critical
       
   545 @SYMTestType			Unit Test
       
   546 @SYMTestPurpose			To check for different creation errors.
       
   547 @SYMTestActions			Initialise the graphics resource component. Call Create():\n
       
   548  						\t 1. on a non-null RSgImageCollection object\n
       
   549  						\t 2. with an invalid TSgImageInfo\n
       
   550  						\t 3. with a negative or zero image count\n
       
   551 						\t 4. with an unsupported TSgImageInfo\n
       
   552 						\t 5. with an TSgImageInfo with a size info bigger than the system memory\n
       
   553 						\t 6. with number of iUserAttributes more than KMaxHint(8)\n
       
   554 @SYMTestExpectedResults	The function should return\n
       
   555 						\t 1. KErrInUse\n
       
   556 						\t 2. KErrArgument\n
       
   557 						\t 3. KErrArgument\n
       
   558 						\t 4. KErrNotSupported\n
       
   559 						\t 5. KErrNoMemory\n
       
   560 						\t 6. KErrOverflow
       
   561 @SYMTestStatus			Implemented 
       
   562  */	
       
   563 void CTSgImageCollectionGeneric::TestCreateImageCollectionInvalidL()
       
   564 	{
       
   565 	TSgImageInfo info;
       
   566 	info.iSizeInPixels = TSize(8, 8);
       
   567 	info.iUsage = ESgUsageDirectGdiSource;
       
   568 	info.iPixelFormat = EUidPixelFormatRGB_565;
       
   569 	info.iCpuAccess = ESgCpuAccessReadWrite;
       
   570 	
       
   571 	RSgImageCollection collection;
       
   572 	TestOpenDriverL();
       
   573 	//non-empty handle
       
   574 	CreateImageCollectionL(collection);
       
   575 	CleanupClosePushL(collection);
       
   576 	TEST(KErrInUse == collection.Create(info, KNumImagesInCollection));
       
   577 	collection.Close();
       
   578 	
       
   579 	//invalid TSgImageInfo
       
   580 	TSgImageInfo info1;
       
   581 	info1.iSizeInPixels = TSize(-100, 100);
       
   582 	info1.iPixelFormat = EUidPixelFormatRGB_565;
       
   583 	info1.iCpuAccess = ESgCpuAccessReadWrite;
       
   584 	
       
   585 	TEST(KErrArgument == collection.Create(info1, KNumImagesInCollection));
       
   586 	collection.Close();
       
   587 	
       
   588 	//negative or zero image count
       
   589 	
       
   590 	TEST(KErrArgument == collection.Create(info, 0));
       
   591 	collection.Close();
       
   592 	
       
   593 	TEST(KErrArgument == collection.Create(info, -1));
       
   594 	collection.Close();
       
   595 	
       
   596 	//unsupported TSgImageInfo
       
   597 	TSgImageInfo info2;
       
   598 	info2.iCpuAccess = ESgCpuAccessReadWrite;
       
   599 	info2.iPixelFormat = EUidPixelFormatAP_88;
       
   600 	info2.iSizeInPixels = TSize(10, 10);
       
   601 	info2.iUsage = ESgUsageDirectGdiSource;
       
   602 	
       
   603 	TEST(KErrNotSupported == collection.Create(info2, KNumImagesInCollection));
       
   604 	collection.Close();
       
   605 	
       
   606 	//number of iUserAttributes more than KMaxHint(8)
       
   607 	TSgImageInfo info3;
       
   608 	info3.iSizeInPixels = TSize(100, 100);
       
   609 	info3.iPixelFormat = EUidPixelFormatRGB_565;
       
   610 	info3.iCpuAccess = ESgCpuAccessNone;
       
   611 	info3.iUsage = ESgUsageDirectGdiTarget;
       
   612 	info3.iUserAttributes = new TSgUserAttribute[100];
       
   613 	CleanupArrayDeletePushL(info3.iUserAttributes);
       
   614 	info3.iUserAttributeCount = 100;
       
   615 	TInt ret = collection.Create(info3, KNumImagesInCollection);
       
   616 	if(iRunningOomTests)
       
   617 		{
       
   618 		TEST(KErrNoMemory == ret || KErrOverflow == ret);
       
   619 		}
       
   620 	else
       
   621 		{
       
   622 		TEST(KErrOverflow == ret);
       
   623 		}
       
   624 	
       
   625 	CleanupStack::PopAndDestroy(2);
       
   626 	TestCloseDriver();
       
   627 	}
       
   628 
       
   629 /**
       
   630 @SYMTestCaseID			GRAPHICS-RESOURCE-0035
       
   631 @SYMTestCaseDesc		Creates multiple image collections with invalid parameters.
       
   632 @SYMPREQ				PREQ39
       
   633 @SYMREQ					REQ9214
       
   634 @SYMREQ					REQ9217
       
   635 @SYMREQ					REQ9224 
       
   636 @SYMREQ					REQ9233  
       
   637 @SYMREQ					REQ9234
       
   638 @SYMFssID				RSgImageCollection::Create(const TSgImageInfo[], TInt, RSgImageCollection[], TInt)\n
       
   639 						RSgImageCollection::Close()
       
   640 @SYMTestPriority		Critical
       
   641 @SYMTestType			Unit Test
       
   642 @SYMTestPurpose			To check for different creation errors when creating multiple image collections.
       
   643 @SYMTestActions			Initialise the graphics resource component. Call the static Create():\n
       
   644 						\t 1. on an array of RSgImageCollection objects with at least one non-null 
       
   645 						RSgImageCollection object\n
       
   646 						\t 2. with an array of TSgImageInfo objects with at least one invalid TSgImageInfo\n
       
   647 						\t 3. with a negative or zero image count\n
       
   648 						\t 4. with a negative or zero image collection count\n
       
   649 						\t 5. with an array of TSgImageInfo objects with at least one unsupported TSgImageInfo\n
       
   650 						\t 6. with an array of TSgImageInfo objects with at least one requesting immutable images\n
       
   651 @SYMTestExpectedResults	The function should return\n
       
   652 						\t 1. KErrInUse\n
       
   653 						\t 2. KErrArgument\n
       
   654 						\t 3. KErrArgument\n
       
   655 						\t 4. KErrArgument\n
       
   656 						\t 5. KErrNotSupported\n
       
   657 						\t 6. KErrNotSupported
       
   658 @SYMTestStatus			Partially Implemented 
       
   659  */
       
   660 void CTSgImageCollectionGeneric::TestCreateMultipleImageCollectionsInvalidL()
       
   661 	{
       
   662 	//TSgImageInfo array
       
   663 	TSgImageInfo info1;
       
   664 	info1.iCpuAccess = ESgCpuAccessNone;
       
   665 	info1.iPixelFormat = EUidPixelFormatXRGB_8888;
       
   666 	info1.iSizeInPixels = TSize(50, 50);
       
   667 	info1.iUsage = ESgUsageDirectGdiSource;
       
   668 	
       
   669 	TSgImageInfo info2;
       
   670 	info2.iCpuAccess = ESgCpuAccessReadOnly;
       
   671 	info2.iPixelFormat = EUidPixelFormatRGB_565;
       
   672 	info2.iSizeInPixels = TSize(120, 120);
       
   673 	info2.iUsage = ESgUsageScreenSource;
       
   674 	
       
   675 	TSgImageInfo info3;
       
   676 	info3.iCpuAccess = ESgCpuAccessReadWrite;
       
   677 	info3.iPixelFormat = EUidPixelFormatARGB_8888_PRE;
       
   678 	info3.iSizeInPixels = TSize(200, 200);
       
   679 	info3.iUsage = ESgUsageDirectGdiTarget;
       
   680 	
       
   681 	TSgImageInfo infos[] = {info1, info2, info3};
       
   682 	
       
   683 	//RSgImageCollection array
       
   684 	const TInt numberOfCollections = 3;
       
   685 	RSgImageCollection collections[numberOfCollections];
       
   686 	
       
   687 	TestOpenDriverL();
       
   688 	//create with one of the image info being invalid
       
   689 	infos[0].iSizeInPixels = TSize(-50, 50);
       
   690 	TEST(KErrArgument == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, numberOfCollections));
       
   691 	//reset
       
   692 	infos[0].iSizeInPixels = TSize(50, 50);
       
   693 	
       
   694 	//create with one of the image collection array element being non-null
       
   695 	CreateImageCollectionL(collections[0]);
       
   696 	CleanupClosePushL(collections[0]);
       
   697 	TEST(KErrInUse == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, numberOfCollections));
       
   698 	//rest
       
   699 	CleanupStack::PopAndDestroy();
       
   700 	
       
   701 	//create with a negative or zero image count
       
   702 	TEST(KErrArgument == RSgImageCollection::Create(infos, 0, collections, numberOfCollections));
       
   703 	TEST(KErrArgument == RSgImageCollection::Create(infos, -1, collections, numberOfCollections));
       
   704 	
       
   705 	//create with a negative or zero image collection count
       
   706 	TEST(KErrArgument == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, 0));
       
   707 	TEST(KErrArgument == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, -1));
       
   708 	
       
   709 	//create with one of the image info being unsupported
       
   710 	infos[0].iPixelFormat = EUidPixelFormatAP_88;
       
   711 	TEST(KErrNotSupported == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, numberOfCollections));
       
   712 	//reset
       
   713 	infos[0].iPixelFormat = EUidPixelFormatXRGB_8888;
       
   714 	
       
   715 	//create with some of the image info objects specifying constant images
       
   716 	TEST(KErrNotSupported == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, numberOfCollections));
       
   717 	
       
   718 	//close all collections
       
   719 	for(TInt i=0; i<numberOfCollections; ++i)
       
   720 		{
       
   721 		collections[i].Close();
       
   722 		}
       
   723 	
       
   724 	TestCloseDriver();
       
   725 	}
       
   726 
       
   727 /**
       
   728 @SYMTestCaseID			GRAPHICS-RESOURCE-0036
       
   729 @SYMTestCaseDesc		Calls GetInfo() on an image collection under various invalid conditions.
       
   730 @SYMPREQ				PREQ39
       
   731 @SYMREQ					REQ9214
       
   732 @SYMREQ					REQ9224 
       
   733 @SYMREQ					REQ9233  
       
   734 @SYMREQ					REQ9234
       
   735 @SYMFssID				RSgImageCollection::GetInfo(TSgImageInfo&)
       
   736 @SYMTestPriority		Critical
       
   737 @SYMTestType			Unit Test
       
   738 @SYMTestPurpose			To check the correct error messages are returned when GetInfo() is called 
       
   739 						under various invalid conditions.
       
   740 @SYMTestActions			Initialise the graphics resource component. Call GetInfo() on an image collection\n
       
   741 						\t 1. that is uninitialised\n
       
   742 						\t 2. TSgImageInfo has different user attributes Ids from the existing Ids.
       
   743 @SYMTestExpectedResults	The function should return:\n
       
   744 						\t 1. KErrBadHandle\n
       
   745 						\t 2. KErrNotFound or KErrArgument
       
   746 @SYMTestStatus			Implemented 
       
   747  */	
       
   748 void CTSgImageCollectionGeneric::TestGetImageCollectionInfoInvalidL()
       
   749 	{
       
   750 	TestOpenDriverL();
       
   751 	//uninitialised collection
       
   752 	RSgImageCollection collection;
       
   753 	TSgImageInfo info;
       
   754 	TEST(KErrBadHandle == collection.GetInfo(info));
       
   755 	
       
   756 	//TSgImageInfo has different user attributes Ids from the existing Ids.
       
   757 	info.iSizeInPixels = TSize(8, 8);
       
   758 	info.iUsage = ESgUsageDirectGdiTarget;
       
   759 	info.iPixelFormat = EUidPixelFormatRGB_565;
       
   760 	TSgUserAttribute testAttributes[] = {{0x00008888, 1}, {0x00009999, 2}};
       
   761 	info.iUserAttributes = testAttributes;
       
   762 	info.iUserAttributeCount = 2;
       
   763 	CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
       
   764 	CleanupClosePushL(collection);
       
   765 	TSgImageInfo info3;
       
   766 	TSgUserAttribute testAttributes2[1];
       
   767 	info3.iUserAttributes = testAttributes2;
       
   768 	info3.iUserAttributes[0].iUid = TUid::Uid(0x11111111);
       
   769 	info3.iUserAttributeCount = 1;
       
   770 	TInt result = collection.GetInfo(info3);
       
   771 	TEST(KErrNotFound == result || KErrArgument == result);
       
   772 	CleanupStack::PopAndDestroy();	
       
   773 	
       
   774 	TestCloseDriver();
       
   775 	}
       
   776 
       
   777 /**
       
   778 @SYMTestCaseID			GRAPHICS-RESOURCE-0037
       
   779 @SYMTestCaseDesc		Opens images from a collection under various invalid conditions.
       
   780 @SYMPREQ				PREQ39
       
   781 @SYMREQ					REQ9214
       
   782 @SYMREQ					REQ9224 
       
   783 @SYMREQ					REQ9233  
       
   784 @SYMREQ					REQ9234
       
   785 @SYMFssID				RSgImageCollection::OpenImage(TInt aIndex, RSgImage& aImage)
       
   786 @SYMTestPriority		Critical
       
   787 @SYMTestType			Unit Test
       
   788 @SYMTestPurpose			To ensure correct error messages are returned when client tries to 
       
   789 						open an image inside an image collection under various invalid conditions.
       
   790 @SYMTestActions			Initialise the graphics resource component. Call OpenImage():\n
       
   791 						\t 1. on an uninitialised image collection\n
       
   792 						\t 2. with a negative index\n
       
   793 						\t 3. with an index that is bigger than the number of images in the collection\n
       
   794 						\t 4. with non-null aImage\n
       
   795 @SYMTestExpectedResults	The function should return:\n
       
   796 						\t 1. KErrBadHandle\n
       
   797 						\t 2. KErrArgument\n
       
   798 						\t 3. KErrArgument\n
       
   799 						\t 4. KErrInUse\n
       
   800 @SYMTestStatus			Implemented 
       
   801  */	
       
   802 void CTSgImageCollectionGeneric::TestOpenImageInCollectionInvalidL()
       
   803 	{
       
   804 	TestOpenDriverL();
       
   805 	RSgImageCollection collection;
       
   806 	RSgImage image;
       
   807 	
       
   808 	//uninitialised image collection
       
   809 	TEST(KErrBadHandle == collection.OpenImage(0, image));
       
   810 	
       
   811 	CreateImageCollectionL(collection);	
       
   812 	CleanupClosePushL(collection);
       
   813 	//with a negative index
       
   814 	TEST(KErrArgument == collection.OpenImage(-1, image));
       
   815 	image.Close();
       
   816 	
       
   817 	//with an index that is bigger than the number of images in the collection
       
   818 	TInt invalidIndex = collection.Count();
       
   819 	TEST(KErrArgument == collection.OpenImage(invalidIndex, image));
       
   820 	image.Close();
       
   821 	
       
   822 	//with non-null aImage handle
       
   823 	CreateImageL(image);
       
   824 	CleanupClosePushL(image);
       
   825 	TEST(KErrInUse == collection.OpenImage(0, image));
       
   826 	CleanupStack::PopAndDestroy(&image);
       
   827 	
       
   828 	CleanupStack::PopAndDestroy();
       
   829 	TestCloseDriver();
       
   830 	}
       
   831 
       
   832 /**
       
   833 @SYMTestCaseID			GRAPHICS-RESOURCE-0038
       
   834 @SYMTestCaseDesc		Invalid map/unmap tests on individual images in a collection
       
   835 @SYMPREQ				PREQ39
       
   836 @SYMREQ					REQ9193
       
   837 @SYMREQ					REQ9214
       
   838 @SYMREQ					REQ9224 
       
   839 @SYMREQ					REQ9233  
       
   840 @SYMREQ					REQ9234
       
   841 @SYMFssID				SgImageCollection::OpenImage(TInt aIndex, RSgImage& aImage)\n
       
   842 						RSgImage::MapReadOnly(const TAny*&, TInt&) const\n
       
   843  						RSgImage::MapWriteOnly(TAny*&, TInt&)\n 
       
   844 						RSgImage::MapReadWrite(TAny*&, TInt&)\n 
       
   845 						RSgImage::Unmap()
       
   846 @SYMTestPriority		Critical
       
   847 @SYMTestType			Unit Test
       
   848 @SYMTestPurpose			To check the images in an image collection can map/unmap the same way as standalone images.
       
   849 @SYMTestActions			Initialise the graphics resource component. Initialise an image collection. Get individual 
       
   850 						images from the collection and perform various negative map/unmap tests on them.
       
   851 @SYMTestExpectedResults	The functions should behave in the same way as the tests defined previously for stand alone images.
       
   852 @SYMTestStatus			Defined 
       
   853  */	
       
   854 void CTSgImageCollectionGeneric::TestMapUnmapImagesInCollectionInvalidL()
       
   855 	{
       
   856 	TestOpenDriverL();
       
   857 	
       
   858 	//create a collection
       
   859 	TSgImageInfo info;
       
   860 	info.iSizeInPixels = TSize(8, 8);
       
   861 	info.iUsage = ESgUsageDirectGdiSource;
       
   862 	info.iPixelFormat = EUidPixelFormatRGB_565;
       
   863 	info.iCpuAccess = ESgCpuAccessReadWrite;
       
   864 	info.iShareable = ETrue;
       
   865 	RSgImageCollection collection;
       
   866 	CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
       
   867 	CleanupClosePushL(collection);
       
   868 	
       
   869 	const TAny* dataAddressRead;
       
   870 	TAny* dataAddressWrite;
       
   871 	TInt dataStride;
       
   872 	
       
   873 	//map twice
       
   874 	for(TInt i=0; i<KNumImagesInCollection; ++i)
       
   875 		{
       
   876 		RSgImage image;
       
   877 		TEST(KErrNone == collection.OpenImage(i, image));
       
   878 		TEST(KErrNone == image.MapReadOnly(dataAddressRead, dataStride));
       
   879 		TEST(KErrInUse == image.MapReadOnly(dataAddressRead, dataStride));
       
   880 		TEST(KErrNone == image.Unmap());
       
   881 		
       
   882 		TEST(KErrNone == image.MapWriteOnly(dataAddressWrite, dataStride));
       
   883 		TEST(KErrInUse == image.MapWriteOnly(dataAddressWrite, dataStride));
       
   884 		TEST(KErrNone == image.Unmap());
       
   885 		
       
   886 		TEST(KErrNone == image.MapReadWrite(dataAddressWrite, dataStride));
       
   887 		TEST(KErrInUse == image.MapReadWrite(dataAddressWrite, dataStride));
       
   888 		TEST(KErrNone == image.Unmap());
       
   889 		image.Close();
       
   890 		}
       
   891 	CleanupStack::PopAndDestroy();
       
   892 	
       
   893 	//call MapReadOnly() on the images in a collection created without CPU access
       
   894 	//flag ESgCpuAccessReadOnly or ESgCpuAccessReadWrite
       
   895 	info.iUsage = ESgUsageDirectGdiTarget;
       
   896 	info.iCpuAccess = ESgCpuAccessNone;
       
   897 	CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
       
   898 	CleanupClosePushL(collection);
       
   899 	for(TInt i=0; i<KNumImagesInCollection; ++i)
       
   900 		{
       
   901 		RSgImage image;
       
   902 		TEST(KErrNone == collection.OpenImage(i, image));
       
   903 		TEST(KErrAccessDenied == image.MapReadOnly(dataAddressRead, dataStride));
       
   904 		image.Close();
       
   905 		}
       
   906 	CleanupStack::PopAndDestroy();	
       
   907 	
       
   908 	info.iUsage = ESgUsageDirectGdiSource;
       
   909 	info.iCpuAccess = ESgCpuAccessWriteOnly;
       
   910 	CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
       
   911 	CleanupClosePushL(collection);
       
   912 	for(TInt i=0; i<KNumImagesInCollection; ++i)
       
   913 		{
       
   914 		RSgImage image;
       
   915 		TEST(KErrNone == collection.OpenImage(i, image));
       
   916 		TEST(KErrAccessDenied == image.MapReadOnly(dataAddressRead, dataStride));
       
   917 		image.Close();
       
   918 		}
       
   919 	CleanupStack::PopAndDestroy();	
       
   920 	
       
   921 	//call MapWriteOnly() on the images in a collection created without CPU access
       
   922 	//flag ESgCpuAccessWriteOnly or ESgCpuAccessReadWrite
       
   923 	info.iUsage = ESgUsageDirectGdiTarget;
       
   924 	info.iCpuAccess = ESgCpuAccessNone;
       
   925 	CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
       
   926 	CleanupClosePushL(collection);
       
   927 	for(TInt i=0; i<KNumImagesInCollection; ++i)
       
   928 		{
       
   929 		RSgImage image;
       
   930 		TEST(KErrNone == collection.OpenImage(i, image));
       
   931 		TEST(KErrAccessDenied == image.MapWriteOnly(dataAddressWrite, dataStride));
       
   932 		image.Close();
       
   933 		}
       
   934 	CleanupStack::PopAndDestroy();
       
   935 	
       
   936 	info.iCpuAccess = ESgCpuAccessReadOnly;
       
   937 	TInt err = collection.Create(info, KNumImagesInCollection);
       
   938 	if(KErrNotSupported != err)
       
   939 		{
       
   940 		User::LeaveIfError(err);
       
   941 		CleanupClosePushL(collection);
       
   942 		for(TInt i=0; i<KNumImagesInCollection; ++i)
       
   943 			{
       
   944 			RSgImage image;
       
   945 			TEST(KErrNone == collection.OpenImage(i, image));
       
   946 			TEST(KErrAccessDenied == image.MapWriteOnly(dataAddressWrite, dataStride));
       
   947 			image.Close();
       
   948 			}
       
   949 		CleanupStack::PopAndDestroy();
       
   950 		}	
       
   951 	else
       
   952 		{
       
   953 		INFO_PRINTF1(_L("Warning: skipping test MapWriteOnly() on read-only collection.\r\n"));
       
   954 		}
       
   955 	
       
   956 	//call MapReadWrite() on the images in a collection created without CPU access
       
   957 	//flag ESgCpuAccessReadWrite
       
   958 	info.iCpuAccess = ESgCpuAccessNone;
       
   959 	CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
       
   960 	CleanupClosePushL(collection);
       
   961 	for(TInt i=0; i<KNumImagesInCollection; ++i)
       
   962 		{
       
   963 		RSgImage image;
       
   964 		TEST(KErrNone == collection.OpenImage(i, image));
       
   965 		TEST(KErrAccessDenied == image.MapReadWrite(dataAddressWrite, dataStride));
       
   966 		image.Close();
       
   967 		}
       
   968 	CleanupStack::PopAndDestroy();
       
   969 
       
   970 	info.iCpuAccess = ESgCpuAccessReadOnly;
       
   971     err = collection.Create(info, KNumImagesInCollection);
       
   972     if(KErrNotSupported != err)
       
   973     	{
       
   974     	CleanupClosePushL(collection);
       
   975     	for(TInt i=0; i<KNumImagesInCollection; ++i)
       
   976     		{
       
   977     		RSgImage image;
       
   978     		TEST(KErrNone == collection.OpenImage(i, image));
       
   979     		TEST(KErrAccessDenied == image.MapReadWrite(dataAddressWrite, dataStride));
       
   980     		image.Close();
       
   981     		}
       
   982     	CleanupStack::PopAndDestroy();
       
   983     	}
       
   984     else
       
   985     	{
       
   986     	INFO_PRINTF1(_L("Warning: skipping test MapReadWrite() on read-only collection.\r\n"));
       
   987     	}
       
   988 	
       
   989     info.iUsage = ESgUsageDirectGdiSource;
       
   990     info.iCpuAccess = ESgCpuAccessWriteOnly;
       
   991     CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
       
   992 	CleanupClosePushL(collection);
       
   993 	for(TInt i=0; i<KNumImagesInCollection; ++i)
       
   994 		{
       
   995 		RSgImage image;
       
   996 		TEST(KErrNone == collection.OpenImage(i, image));
       
   997 		TEST(KErrAccessDenied == image.MapReadWrite(dataAddressWrite, dataStride));
       
   998 		image.Close();
       
   999 		}
       
  1000 	CleanupStack::PopAndDestroy();
       
  1001 
       
  1002 	TestCloseDriver();
       
  1003 	}
       
  1004 
       
  1005 void CTSgImageCollectionGeneric::DoMemoryTestsL()
       
  1006 	{
       
  1007 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  1008 	TestCreateImageCollectionL();
       
  1009 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  1010 	
       
  1011 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  1012 	TestGetImageCollectionSurfaceIdL();
       
  1013 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  1014 	
       
  1015 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  1016 	TestGetCollectionImageNumberL();
       
  1017 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  1018 	
       
  1019 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  1020 	TestGetImageInfoInCollectionL();
       
  1021 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  1022 	
       
  1023 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  1024 	TestOpenImageInCollectionL();
       
  1025 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  1026 	
       
  1027 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  1028 	TestMapImageInCollectionL();
       
  1029 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  1030 	
       
  1031 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  1032 	TestCreateMultipleImageCollectionL();
       
  1033 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  1034 	
       
  1035 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  1036 	TestCreateImageCollectionInvalidL();
       
  1037 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  1038 	
       
  1039 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  1040 	TestCreateMultipleImageCollectionsInvalidL();
       
  1041 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  1042 	
       
  1043 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  1044 	TestGetImageCollectionInfoInvalidL();
       
  1045 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  1046 	
       
  1047 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  1048 	TestOpenImageInCollectionInvalidL();
       
  1049 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  1050 	
       
  1051 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  1052 	TestMapUnmapImagesInCollectionInvalidL();
       
  1053 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  1054 	}
       
  1055 
       
  1056 /**
       
  1057 @SYMTestCaseID			GRAPHICS-RESOURCE-0068
       
  1058 @SYMTestCaseDesc		Calls RSgImageCollection::Close() with an invalid image collection handle
       
  1059 @SYMPREQ				PREQ39
       
  1060 @SYMREQ					REQ9214
       
  1061 @SYMFssID				RSgImageCollection::Close()\n 
       
  1062 @SYMTestPriority		Critical
       
  1063 @SYMTestType			Unit Test
       
  1064 @SYMTestPurpose			To ensure calling Close() with an invalid image collection handle will cause a panic.
       
  1065 @SYMTestActions			Initialise the graphics resource component and create an image collection in a second thread. 
       
  1066 						Declare another image collection and assign it to the current image collection handle. Close 
       
  1067 						the current image collection so the second image collection handle becomes invalid. Call 
       
  1068 						Close() on the second handle.
       
  1069 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 4(ESgPanicBadImageCollectionHandle).
       
  1070 @SYMTestStatus			Implemented 
       
  1071  */
       
  1072 void CTSgImageCollectionGeneric::TestPanicImageCollectionCloseInvalidHandleL()
       
  1073 	{
       
  1074 	TSgImageInfo info;
       
  1075 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCloseInvalidHandle, ETrue};
       
  1076  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1077 	_LIT(KTestName, "TestImageCollectionCloseInvalidHandleL");
       
  1078  	CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName);
       
  1079 	}
       
  1080 
       
  1081 /**
       
  1082 @SYMTestCaseID			GRAPHICS-RESOURCE-0069
       
  1083 @SYMTestCaseDesc		Calls RSgImageCollection::Close() with a non-null handle and an uninitialised driver
       
  1084 @SYMPREQ				PREQ39
       
  1085 @SYMREQ					REQ9214
       
  1086 @SYMFssID				RSgImageCollection::Close()\n 
       
  1087 @SYMTestPriority		Critical
       
  1088 @SYMTestType			Unit Test
       
  1089 @SYMTestPurpose			To ensure calling Close() with an invalid image collection handle will cause a panic.
       
  1090 @SYMTestActions			Initialise the graphics resource component and create an image collection in a second thread. 
       
  1091 						Declare another image collection and assign it to the current image collection handle. Close 
       
  1092 						the current image collection so the second image collection handle becomes invalid. Close the 
       
  1093 						graphics resource driver. Call Close() on the second handle.
       
  1094 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  1095 @SYMTestStatus			Implemented 
       
  1096  */
       
  1097 void CTSgImageCollectionGeneric::TestPanicImageCollectionCloseNoDriverL()
       
  1098 	{
       
  1099 	TSgImageInfo info;
       
  1100 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCloseNoDriver, ETrue};
       
  1101  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1102 	_LIT(KTestName, "TestImageCollectionCloseNoDriverL");
       
  1103  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  1104 	}
       
  1105 
       
  1106 /**
       
  1107 @SYMTestCaseID			GRAPHICS-RESOURCE-0070
       
  1108 @SYMTestCaseDesc		Calls RSgImageCollection::SurfaceId() with an invalid image collection handle
       
  1109 @SYMPREQ				PREQ39
       
  1110 @SYMREQ					REQ9214
       
  1111 @SYMFssID				RSgImageCollection::SurfaceId()\n 
       
  1112 @SYMTestPriority		Critical
       
  1113 @SYMTestType			Unit Test
       
  1114 @SYMTestPurpose			To ensure calling SurfaceId() with an invalid image collection handle will cause a panic.
       
  1115 @SYMTestActions			Initialise the graphics resource component and create an image collection in a second thread. 
       
  1116 						Declare another image collection and assign it to the current image collection handle. Close 
       
  1117 						the current image collection so the second image collection handle becomes invalid. Call 
       
  1118 						SurfaceId() on the second handle.
       
  1119 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 4(ESgPanicBadImageCollectionHandle).
       
  1120 @SYMTestStatus			Implemented 
       
  1121  */
       
  1122 void CTSgImageCollectionGeneric::TestPanicImageCollectionSurfaceIdInvalidHandleL()
       
  1123 	{
       
  1124 	TSgImageInfo info;
       
  1125 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionSurfaceIdInvalidHandle, ETrue};
       
  1126  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1127 	_LIT(KTestName, "TestImageCollectionSurfaceIdInvalidHandleL");
       
  1128  	CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName);
       
  1129 	}
       
  1130 
       
  1131 /**
       
  1132 @SYMTestCaseID			GRAPHICS-RESOURCE-0071
       
  1133 @SYMTestCaseDesc		Calls RSgImageCollection::SurfaceId() with a non-null handle and an uninitialised driver
       
  1134 @SYMPREQ				PREQ39
       
  1135 @SYMREQ					REQ9214
       
  1136 @SYMFssID				RSgImageCollection::SurfaceId()\n 
       
  1137 @SYMTestPriority		Critical
       
  1138 @SYMTestType			Unit Test
       
  1139 @SYMTestPurpose			To ensure calling SurfaceId() with an invalid image collection handle will cause a panic.
       
  1140 @SYMTestActions			Initialise the graphics resource component and create an image collection in a second thread. 
       
  1141 						Declare another image collection and assign it to the current image collection handle. Close 
       
  1142 						the current image collection so the second image collection handle becomes invalid. Close the 
       
  1143 						graphics resource driver. Call SurfaceId() on the second handle.
       
  1144 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  1145 @SYMTestStatus			Implemented 
       
  1146  */
       
  1147 void CTSgImageCollectionGeneric::TestPanicImageCollectionSurfaceIdNoDriverL()
       
  1148 	{
       
  1149 	TSgImageInfo info;
       
  1150 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionSurfaceIdNoDriver, ETrue};
       
  1151  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1152 	_LIT(KTestName, "TestImageCollectionSurfaceIdNoDriverL");
       
  1153  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  1154 	}
       
  1155 
       
  1156 /**
       
  1157 @SYMTestCaseID			GRAPHICS-RESOURCE-0072
       
  1158 @SYMTestCaseDesc		Calls RSgImageCollection::GetInfo() with an invalid image collection handle
       
  1159 @SYMPREQ				PREQ39
       
  1160 @SYMREQ					REQ9214
       
  1161 @SYMFssID				RSgImageCollection::GetInfo(TSgImageInfo&)\n 
       
  1162 @SYMTestPriority		Critical
       
  1163 @SYMTestType			Unit Test
       
  1164 @SYMTestPurpose			To ensure calling GetInfo() with an invalid image collection handle will cause a panic.
       
  1165 @SYMTestActions			Initialise the graphics resource component and create an image collection in a second thread. 
       
  1166 						Declare another image collection and assign it to the current image collection handle. Close 
       
  1167 						the current image collection so the second image collection handle becomes invalid. Call 
       
  1168 						GetInfo() on the second handle.
       
  1169 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 4(ESgPanicBadImageCollectionHandle).
       
  1170 @SYMTestStatus			Implemented 
       
  1171  */
       
  1172 void CTSgImageCollectionGeneric::TestPanicImageCollectionGetInfoInvalidHandleL()
       
  1173 	{
       
  1174 	TSgImageInfo info;
       
  1175 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionGetInfoInvalidHandle, ETrue};
       
  1176  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1177 	_LIT(KTestName, "TestImageCollectionGetInfoInvalidHandleL");
       
  1178  	CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName);
       
  1179 	}
       
  1180 
       
  1181 /**
       
  1182 @SYMTestCaseID			GRAPHICS-RESOURCE-0073
       
  1183 @SYMTestCaseDesc		Calls RSgImageCollection::GetInfo() with a non-null handle and an uninitialised driver
       
  1184 @SYMPREQ				PREQ39
       
  1185 @SYMREQ					REQ9214
       
  1186 @SYMFssID				RSgImageCollection::GetInfo(TSgImageInfo&)\n 
       
  1187 @SYMTestPriority		Critical
       
  1188 @SYMTestType			Unit Test
       
  1189 @SYMTestPurpose			To ensure calling GetInfo() with an invalid image collection handle will cause a panic.
       
  1190 @SYMTestActions			Initialise the graphics resource component and create an image collection in a second thread. 
       
  1191 						Declare another image collection and assign it to the current image collection handle. Close 
       
  1192 						the current image collection so the second image collection handle becomes invalid. Close the 
       
  1193 						graphics resource driver. Call GetInfo() on the second handle.
       
  1194 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  1195 @SYMTestStatus			Implemented 
       
  1196  */
       
  1197 void CTSgImageCollectionGeneric::TestPanicImageCollectionGetInfoNoDriverL()
       
  1198 	{
       
  1199 	TSgImageInfo info;
       
  1200 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionGetInfoNoDriver, ETrue};
       
  1201  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1202 	_LIT(KTestName, "TestImageCollectionGetInfoNoDriverL");
       
  1203  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  1204 	}
       
  1205 
       
  1206 /**
       
  1207 @SYMTestCaseID			GRAPHICS-RESOURCE-0074
       
  1208 @SYMTestCaseDesc		Calls RSgImageCollection::Count() with an invalid image collection handle
       
  1209 @SYMPREQ				PREQ39
       
  1210 @SYMREQ					REQ9214
       
  1211 @SYMFssID				RSgImageCollection::Count()\n 
       
  1212 @SYMTestPriority		Critical
       
  1213 @SYMTestType			Unit Test
       
  1214 @SYMTestPurpose			To ensure calling Count() with an invalid image collection handle will cause a panic.
       
  1215 @SYMTestActions			Initialise the graphics resource component and create an image collection in a second thread. 
       
  1216 						Declare another image collection and assign it to the current image collection handle. Close 
       
  1217 						the current image collection so the second image collection handle becomes invalid. Call 
       
  1218 						Count() on the second handle.
       
  1219 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 4(ESgPanicBadImageCollectionHandle).
       
  1220 @SYMTestStatus			Implemented 
       
  1221  */
       
  1222 void CTSgImageCollectionGeneric::TestPanicImageCollectionCountInvalidHandleL()
       
  1223 	{
       
  1224 	TSgImageInfo info;
       
  1225 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCountInvalidHandle, ETrue};
       
  1226  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1227 	_LIT(KTestName, "TestImageCollectionCountInvalidHandleL");
       
  1228  	CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName);
       
  1229 	}
       
  1230 
       
  1231 /**
       
  1232 @SYMTestCaseID			GRAPHICS-RESOURCE-0075
       
  1233 @SYMTestCaseDesc		Calls RSgImageCollection::Count() with a non-null handle and an uninitialised driver
       
  1234 @SYMPREQ				PREQ39
       
  1235 @SYMREQ					REQ9214
       
  1236 @SYMFssID				RSgImageCollection::Count()\n 
       
  1237 @SYMTestPriority		Critical
       
  1238 @SYMTestType			Unit Test
       
  1239 @SYMTestPurpose			To ensure calling Count() with an invalid image collection handle will cause a panic.
       
  1240 @SYMTestActions			Initialise the graphics resource component and create an image collection in a second thread. 
       
  1241 						Declare another image collection and assign it to the current image collection handle. Close 
       
  1242 						the current image collection so the second image collection handle becomes invalid. Close the 
       
  1243 						graphics resource driver. Call Count() on the second handle.
       
  1244 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  1245 @SYMTestStatus			Implemented 
       
  1246  */
       
  1247 void CTSgImageCollectionGeneric::TestPanicImageCollectionCountNoDriverL()
       
  1248 	{
       
  1249 	TSgImageInfo info;
       
  1250 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCountNoDriver, ETrue};
       
  1251  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1252 	_LIT(KTestName, "TestImageCollectionCountNoDriverL");
       
  1253  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  1254 	}
       
  1255 
       
  1256 /**
       
  1257 @SYMTestCaseID			GRAPHICS-RESOURCE-0076
       
  1258 @SYMTestCaseDesc		Calls RSgImageCollection::OpenImage() with an invalid image collection handle
       
  1259 @SYMPREQ				PREQ39
       
  1260 @SYMREQ					REQ9214
       
  1261 @SYMFssID				RSgImageCollection::OpenImage()\n 
       
  1262 @SYMTestPriority		Critical
       
  1263 @SYMTestType			Unit Test
       
  1264 @SYMTestPurpose			To ensure calling OpenImage() with an invalid image collection handle will cause a panic.
       
  1265 @SYMTestActions			Initialise the graphics resource component and create an image collection in a second thread. 
       
  1266 						Declare another image collection and assign it to the current image collection handle. Close 
       
  1267 						the current image collection so the second image collection handle becomes invalid. Call 
       
  1268 						OpenImage() on the second handle.
       
  1269 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 4(ESgPanicBadImageCollectionHandle).
       
  1270 @SYMTestStatus			Implemented 
       
  1271  */
       
  1272 void CTSgImageCollectionGeneric::TestPanicImageCollectionOpenImageInvalidHandleL()
       
  1273 	{
       
  1274 	TSgImageInfo info;
       
  1275 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionOpenImageInvalidHandle, ETrue};
       
  1276  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1277 	_LIT(KTestName, "TestImageCollectionOpenImageInvalidHandleL");
       
  1278  	CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName);
       
  1279 	}
       
  1280 
       
  1281 /**
       
  1282 @SYMTestCaseID			GRAPHICS-RESOURCE-0077
       
  1283 @SYMTestCaseDesc		Calls RSgImageCollection::OpenImage() with a non-null handle and an uninitialised driver
       
  1284 @SYMPREQ				PREQ39
       
  1285 @SYMREQ					REQ9214
       
  1286 @SYMFssID				RSgImageCollection::OpenImage()\n 
       
  1287 @SYMTestPriority		Critical
       
  1288 @SYMTestType			Unit Test
       
  1289 @SYMTestPurpose			To ensure calling OpenImage() with an invalid image collection handle will cause a panic.
       
  1290 @SYMTestActions			Initialise the graphics resource component and create an image collection in a second thread. 
       
  1291 						Declare another image collection and assign it to the current image collection handle. Close 
       
  1292 						the current image collection so the second image collection handle becomes invalid. Close the 
       
  1293 						graphics resource driver. Call OpenImage() on the second handle.
       
  1294 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  1295 @SYMTestStatus			Implemented 
       
  1296  */
       
  1297 void CTSgImageCollectionGeneric::TestPanicImageCollectionOpenImageNoDriverL()
       
  1298 	{
       
  1299 	TSgImageInfo info;
       
  1300 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionOpenImageNoDriver, ETrue};
       
  1301  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1302 	_LIT(KTestName, "TestImageCollectionOpenImageNoDriverL");
       
  1303  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  1304 	}
       
  1305 
       
  1306 /**
       
  1307 @SYMTestCaseID			GRAPHICS-RESOURCE-0086
       
  1308 @SYMTestCaseDesc		Creates an image collection when the driver was not initialised.
       
  1309 @SYMPREQ				PREQ39
       
  1310 @SYMREQ					REQ9214
       
  1311 @SYMFssID				RSgImageCollection::Create(const TSgImageInfo, TInt)\n
       
  1312 @SYMTestPriority		Critical
       
  1313 @SYMTestType			Unit Test
       
  1314 @SYMTestPurpose			To ensure calling RSgImageCollection::Create() with an uninitialised driver will cause a panic.
       
  1315 @SYMTestActions			Do not Initialise the graphics resource component and call RSgImageCollection::Create() in a second thread.
       
  1316 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  1317 @SYMTestStatus			Implemented 
       
  1318  */
       
  1319 void CTSgImageCollectionGeneric::TestPanicImageCollectionCreateNoDriver1L()
       
  1320 	{
       
  1321 	TSgImageInfo info;
       
  1322 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCreateNoDriver1, ETrue};
       
  1323  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1324 	_LIT(KTestName, "TestPanicImageCollectionCreateNoDriver1L");
       
  1325  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  1326 	}
       
  1327 
       
  1328 /**
       
  1329 @SYMTestCaseID			GRAPHICS-RESOURCE-0087
       
  1330 @SYMTestCaseDesc		Creates multiple image collections when the driver was not initialised.
       
  1331 @SYMPREQ				PREQ39
       
  1332 @SYMREQ					REQ9214
       
  1333 @SYMFssID				RSgImageCollection::Create(const TSgImageInfo[], TInt, RSgImageCollection[], TInt)\n
       
  1334 @SYMTestPriority		Critical
       
  1335 @SYMTestType			Unit Test
       
  1336 @SYMTestPurpose			To ensure calling RSgImageCollection::Create() with an uninitialised driver will cause a panic.
       
  1337 @SYMTestActions			Do not Initialise the graphics resource component and call RSgImageCollection::Create() in a second thread.
       
  1338 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  1339 @SYMTestStatus			Implemented 
       
  1340  */
       
  1341 void CTSgImageCollectionGeneric::TestPanicImageCollectionCreateNoDriver2L()
       
  1342 	{
       
  1343 	TSgImageInfo info;
       
  1344 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCreateNoDriver2, ETrue};
       
  1345  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1346 	_LIT(KTestName, "TestPanicImageCollectionCreateNoDriver2L");
       
  1347  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  1348 	}