graphicsresourceservices/graphicsresource/test/tsgimagegeneric.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 "tsgimagegeneric.h"
       
    23 #include <hal.h>
       
    24 #include <e32math.h>
       
    25 
       
    26 CTSgImageGeneric::CTSgImageGeneric()
       
    27 	{
       
    28 	INFO_PRINTF1(_L("Graphics resource component test - RSgImage Generic Tests.\r\n"));
       
    29 	}
       
    30 
       
    31 CTSgImageGeneric::~CTSgImageGeneric()
       
    32 	{
       
    33 	TInt count = iTestImages.Count();
       
    34 	for(TInt i=0; i<count; ++i)
       
    35 		{
       
    36 		iTestImages[i].Close();
       
    37 		}	
       
    38 	iTestImages.Reset();
       
    39 	}
       
    40 
       
    41 /** 
       
    42 Overrides of base class pure virtual
       
    43 Our implementation only gets called if the base class doTestStepPreambleL() did
       
    44 not leave. That being the case, the current test result value will be EPass.
       
    45 @leave Gets system wide error code
       
    46 @return TVerdict code
       
    47 */
       
    48 TVerdict CTSgImageGeneric::doTestStepL()
       
    49 	{
       
    50 	SetTestStepID(_L("GRAPHICS-RESOURCE-0003"));
       
    51 	INFO_PRINTF1(_L("Getting pixel formats supported on all platforms.\r\n"));
       
    52 	TestGetPixelFormatsL();
       
    53 	RecordTestResultL();	
       
    54 
       
    55 	SetTestStepID(_L("GRAPHICS-RESOURCE-0004"));
       
    56 	INFO_PRINTF1(_L("Create an uninitialised image.\r\n"));
       
    57 	TestCreateImageUninitializedL();
       
    58 	RecordTestResultL();
       
    59 		
       
    60 	SetTestStepID(_L("GRAPHICS-RESOURCE-0005"));
       
    61 	INFO_PRINTF1(_L("Create an image from a block of memory.\r\n"));
       
    62 	TestCreateImageL();
       
    63 	RecordTestResultL();
       
    64 	
       
    65 	SetTestStepID(_L("GRAPHICS-RESOURCE-0006"));
       
    66 	INFO_PRINTF1(_L("Create an image from an existing image.\r\n"));
       
    67 	TestCreateImageFromExistingImageL();
       
    68 	RecordTestResultL();
       
    69 		
       
    70 	SetTestStepID(_L("GRAPHICS-RESOURCE-0007"));
       
    71 	INFO_PRINTF1(_L("Getting information about the image.\r\n"));
       
    72 	TestGetImageInfoL();
       
    73 	RecordTestResultL();
       
    74 		
       
    75 	SetTestStepID(_L("GRAPHICS-RESOURCE-0008"));
       
    76 	INFO_PRINTF1(_L("Retrieving drawable id of an image.\r\n"));
       
    77 	TestGetImageDrawableIdL();
       
    78 	RecordTestResultL();
       
    79 		
       
    80 	SetTestStepID(_L("GRAPHICS-RESOURCE-0009"));
       
    81 	INFO_PRINTF1(_L("Mapping and unmapping an image from its creator process.\r\n"));
       
    82 	TestMapImageL();
       
    83 	RecordTestResultL();
       
    84 		
       
    85 	SetTestStepID(_L("GRAPHICS-RESOURCE-0010"));
       
    86 	INFO_PRINTF1(_L("Opening a handle to an image in both the current process and another process.\r\n"));
       
    87 	TestOpenImageL();
       
    88 	RecordTestResultL();
       
    89 	
       
    90 	SetTestStepID(_L("GRAPHICS-RESOURCE-0011"));
       
    91 	INFO_PRINTF1(_L("Opening a handle to an image with an open mode.\r\n"));
       
    92 	TestOpenImageInternalL();
       
    93 	RecordTestResultL();
       
    94 	
       
    95 	SetTestStepID(_L("GRAPHICS-RESOURCE-0044"));
       
    96 	INFO_PRINTF1(_L("Getting the available interfaces from an image.\r\n"));	
       
    97 	TestGetInterfaceL();
       
    98 	RecordTestResultL();
       
    99 
       
   100 	SetTestStepID(_L("GRAPHICS-RESOURCE-0024"));
       
   101 	INFO_PRINTF1(_L("Getting supported pixel formats with invalid parameters.\r\n"));
       
   102 	TestGetPixelFormatsInvalidL();
       
   103 	RecordTestResultL();
       
   104 
       
   105 	SetTestStepID(_L("GRAPHICS-RESOURCE-0025"));
       
   106 	INFO_PRINTF1(_L("Opening an image with different invalid parameters.\r\n"));
       
   107 	TestOpenImageInvalidL();
       
   108 	RecordTestResultL();
       
   109 
       
   110 	SetTestStepID(_L("GRAPHICS-RESOURCE-0026"));
       
   111 	INFO_PRINTF1(_L("Closing the handle to an image object multiple times.\r\n"));
       
   112 	TestCloseImageManyTimesL();
       
   113 	RecordTestResultL();
       
   114 
       
   115 	SetTestStepID(_L("GRAPHICS-RESOURCE-0027"));
       
   116 	INFO_PRINTF1(_L("Closing the handle to an image object without opening it.\r\n"));
       
   117 	TestCloseImageWithoutOpenL();
       
   118 	RecordTestResultL();
       
   119 
       
   120 	SetTestStepID(_L("GRAPHICS-RESOURCE-0028"));
       
   121 	INFO_PRINTF1(_L("Creating an image with various invalid parameters.\r\n"));
       
   122 	TestCreateImageInvalidL();
       
   123 	RecordTestResultL();
       
   124 
       
   125 	SetTestStepID(_L("GRAPHICS-RESOURCE-0039"));
       
   126 	INFO_PRINTF1(_L("Getting information about an invalid image.\r\n"));
       
   127 	TestGetInfoInvalidImageL();
       
   128 	RecordTestResultL();
       
   129 
       
   130 	SetTestStepID(_L("GRAPHICS-RESOURCE-0030"));
       
   131 	INFO_PRINTF1(_L("Mapping an image under various invalid conditions. \r\n"));
       
   132 	TestMapImageInvalidL();
       
   133 	RecordTestResultL();
       
   134 
       
   135 	SetTestStepID(_L("GRAPHICS-RESOURCE-0031"));
       
   136 	INFO_PRINTF1(_L("Unmapping an image under various invalid conditions.\r\n"));
       
   137 	TestUnmapImageInvalidL();
       
   138 	RecordTestResultL();
       
   139 	
       
   140 	SetTestStepID(_L("GRAPHICS-RESOURCE-0048"));
       
   141 	INFO_PRINTF1(_L("RSgImage generic stress test.\r\n"));
       
   142 	TestStress1L();
       
   143 	RecordTestResultL();
       
   144 	
       
   145 	SetTestStepID(_L("GRAPHICS-RESOURCE-0049"));
       
   146 	INFO_PRINTF1(_L("RSgImage generic multi-thread stress test.\r\n"));
       
   147 	TestStress2L();
       
   148 	RecordTestResultL();
       
   149 
       
   150 #ifdef _DEBUG
       
   151 /**
       
   152 @SYMTestCaseID			GRAPHICS-RESOURCE-0095
       
   153 */
       
   154 	SetTestStepID(_L("GRAPHICS-RESOURCE-0095"));
       
   155 	INFO_PRINTF1(_L("RSgImage generic Out of memory test.\r\n"));
       
   156 	TestOOM();
       
   157 	RecordTestResultL();
       
   158 	
       
   159 	SetTestStepID(_L("GRAPHICS-RESOURCE-0052"));
       
   160 	INFO_PRINTF1(_L("RSgImage generic panic test - GetInterface() with invalid image handle\r\n"));
       
   161 	TestPanicImageGetInterfaceInvalidHandleL();
       
   162 	RecordTestResultL();
       
   163 	
       
   164 	SetTestStepID(_L("GRAPHICS-RESOURCE-0052"));
       
   165 	INFO_PRINTF1(_L("RSgImage generic panic test - GetInterface() with non null image handle and uninitialised driver\r\n"));
       
   166 	TestPanicImageGetInterfaceNoDriverL();
       
   167 	RecordTestResultL();
       
   168 	
       
   169 	SetTestStepID(_L("GRAPHICS-RESOURCE-0053"));
       
   170 	INFO_PRINTF1(_L("RSgImage generic panic test - Close() with invalid image handle\r\n"));
       
   171 	TestPanicImageCloseInvalidHandleL();
       
   172 	RecordTestResultL();
       
   173 	
       
   174 	SetTestStepID(_L("GRAPHICS-RESOURCE-0054"));
       
   175 	INFO_PRINTF1(_L("RSgImage generic panic test - Close() with non null image handle and uninitialised driver\r\n"));
       
   176 	TestPanicImageCloseNoDriverL();
       
   177 	RecordTestResultL();
       
   178 	
       
   179 	SetTestStepID(_L("GRAPHICS-RESOURCE-0055"));
       
   180 	INFO_PRINTF1(_L("RSgImage generic panic test - Id() with invalid image handle\r\n"));
       
   181 	TestPanicImageIdInvalidHandleL();
       
   182 	RecordTestResultL();
       
   183 	
       
   184 	SetTestStepID(_L("GRAPHICS-RESOURCE-0056"));
       
   185 	INFO_PRINTF1(_L("RSgImage generic panic test - Id() with non null image handle and uninitialised driver\r\n"));
       
   186 	TestPanicImageIdNoDriverL();
       
   187 	RecordTestResultL();
       
   188 	
       
   189 	SetTestStepID(_L("GRAPHICS-RESOURCE-0057"));
       
   190 	INFO_PRINTF1(_L("RSgImage generic panic test - Create() with invalid image handle\r\n"));
       
   191 	TestPanicImageCreateInvalidHandleL();
       
   192 	RecordTestResultL();
       
   193 	
       
   194 	SetTestStepID(_L("GRAPHICS-RESOURCE-0058"));
       
   195 	INFO_PRINTF1(_L("RSgImage generic panic test - GetInfo() with invalid image handle\r\n"));
       
   196 	TestPanicImageGetInfoInvalidHandleL();
       
   197 	RecordTestResultL();
       
   198 	
       
   199 	SetTestStepID(_L("GRAPHICS-RESOURCE-0059"));
       
   200 	INFO_PRINTF1(_L("RSgImage generic panic test - GetInfo() with non null image handle and uninitialised driver\r\n"));
       
   201 	TestPanicImageGetInfoNoDriverL();
       
   202 	RecordTestResultL();
       
   203 	
       
   204 	SetTestStepID(_L("GRAPHICS-RESOURCE-0060"));
       
   205 	INFO_PRINTF1(_L("RSgImage generic panic test - MapReadOnly() with invalid image handle\r\n"));
       
   206 	TestPanicImageMapReadOnlyInvalidHandleL();
       
   207 	RecordTestResultL();
       
   208 	
       
   209 	SetTestStepID(_L("GRAPHICS-RESOURCE-0061"));
       
   210 	INFO_PRINTF1(_L("RSgImage generic panic test - MapReadOnly() with non null image handle and uninitialised driver\r\n"));
       
   211 	TestPanicImageMapReadOnlyNoDriverL();
       
   212 	RecordTestResultL();
       
   213 	
       
   214 	SetTestStepID(_L("GRAPHICS-RESOURCE-0062"));
       
   215 	INFO_PRINTF1(_L("RSgImage generic panic test - MapWriteOnly() with invalid image handle\r\n"));
       
   216 	TestPanicImageMapWriteOnlyInvalidHandleL();
       
   217 	RecordTestResultL();
       
   218 	
       
   219 	SetTestStepID(_L("GRAPHICS-RESOURCE-0063"));
       
   220 	INFO_PRINTF1(_L("RSgImage generic panic test - MapWriteOnly() with non null image handle and uninitialised driver\r\n"));
       
   221 	TestPanicImageMapWriteOnlyNoDriverL();
       
   222 	RecordTestResultL();
       
   223 	
       
   224 	SetTestStepID(_L("GRAPHICS-RESOURCE-0064"));
       
   225 	INFO_PRINTF1(_L("RSgImage generic panic test - MapReadWrite() with invalid image handle\r\n"));
       
   226 	TestPanicImageMapReadWriteInvalidHandleL();
       
   227 	RecordTestResultL();
       
   228 	
       
   229 	SetTestStepID(_L("GRAPHICS-RESOURCE-0065"));
       
   230 	INFO_PRINTF1(_L("RSgImage generic panic test - MapReadWrite() with non null image handle and uninitialised driver\r\n"));
       
   231 	TestPanicImageMapReadWriteNoDriverL();
       
   232 	RecordTestResultL();
       
   233 
       
   234 	SetTestStepID(_L("GRAPHICS-RESOURCE-0066"));
       
   235 	INFO_PRINTF1(_L("RSgImage generic panic test - Unmap() with invalid image handle\r\n"));
       
   236 	TestPanicImageUnmapInvalidHandleL();
       
   237 	RecordTestResultL();
       
   238 
       
   239 	SetTestStepID(_L("GRAPHICS-RESOURCE-0067"));
       
   240 	INFO_PRINTF1(_L("RSgImage generic panic test - Unmap() with non null image handle and uninitialised driver\r\n"));
       
   241 	TestPanicImageUnmapNoDriverL();
       
   242 	RecordTestResultL();
       
   243 	
       
   244 	SetTestStepID(_L("GRAPHICS-RESOURCE-0082"));
       
   245 	INFO_PRINTF1(_L("RSgImage generic panic test - Open() with an uninitialised driver\r\n"));
       
   246 	TestPanicImageOpenNoDriver1L();
       
   247 	RecordTestResultL();
       
   248 	
       
   249 	SetTestStepID(_L("GRAPHICS-RESOURCE-0093"));
       
   250 	INFO_PRINTF1(_L("RSgImage generic panic test - Open() with a mode flag with an uninitialised driver\r\n"));
       
   251 	TestPanicImageOpenNoDriver2L();
       
   252 	RecordTestResultL();
       
   253 	
       
   254 	SetTestStepID(_L("GRAPHICS-RESOURCE-0083"));
       
   255 	INFO_PRINTF1(_L("RSgImage generic panic test - Create() from memory with an uninitialised driver\r\n"));
       
   256 	TestPanicImageCreateNoDriver1L();
       
   257 	RecordTestResultL();
       
   258 	
       
   259 	SetTestStepID(_L("GRAPHICS-RESOURCE-0084"));
       
   260 	INFO_PRINTF1(_L("RSgImage generic panic test - Create() from existing image with an uninitialised driver\r\n"));
       
   261 	TestPanicImageCreateNoDriver2L();
       
   262 	RecordTestResultL();
       
   263 	
       
   264 	SetTestStepID(_L("GRAPHICS-RESOURCE-0085"));
       
   265 	INFO_PRINTF1(_L("RSgImage generic panic test - GetPixelFormats() with an uninitialised driver\r\n"));	
       
   266 	TestPanicImageGetPixelFormatsNoDriverL();
       
   267 	RecordTestResultL();
       
   268 	
       
   269 	SetTestStepID(_L("GRAPHICS-RESOURCE-0088"));
       
   270 	INFO_PRINTF1(_L("RSgImage generic panic test - DrawableType() with an uninitialised driver\r\n"));	
       
   271 	TestPanicImageDrawableTypeNoDriverL();
       
   272 	RecordTestResultL();
       
   273 	
       
   274 	SetTestStepID(_L("GRAPHICS-RESOURCE-0089"));
       
   275 	INFO_PRINTF1(_L("RSgImage generic panic test - DrawableType() with invalid image handle\r\n"));	
       
   276 	TestPanicImageDrawableTypeInvalidHandleL();
       
   277 	RecordTestResultL();
       
   278 #else
       
   279 	INFO_PRINTF1(_L("Warning: Skipping the panic tests in release build. \r\n"));
       
   280 #endif	
       
   281 	return TestStepResult();
       
   282 	}
       
   283 
       
   284 /**
       
   285 @SYMTestCaseID			GRAPHICS-RESOURCE-0003
       
   286 @SYMTestCaseDesc		Gets supported pixel formats on all platforms.
       
   287 @SYMPREQ				PREQ39
       
   288 @SYMREQ					REQ8809
       
   289 @SYMREQ					REQ9175
       
   290 @SYMREQ					REQ9224 
       
   291 @SYMREQ					REQ9233  
       
   292 @SYMREQ					REQ9234
       
   293 @SYMFssID				RSgImage::GetPixelFormats(const TSgImageInfo&, TUidPixelFormat*, TInt&)
       
   294 @SYMTestPriority		Critical
       
   295 @SYMTestType			Unit Test
       
   296 @SYMTestPurpose			To ensure all the available pixel formats are returned 
       
   297 						in the array and the actual number of pixel formats in
       
   298 						the input/output aCount parameter.
       
   299 @SYMTestActions			Initialise the graphics resource component. Construct a
       
   300 						TSgImageInfo object and Initialise the member variables.
       
   301 						Construct a TInt array of size\n
       
   302 						\t 1. NULL\n						
       
   303 						\t 2. greater than the number of supported pixel formats\n
       
   304 						\t 3. equal to the number of supported pixel formats\n
       
   305 						\t 4. less than the number of supported pixel formats
       
   306 @SYMTestExpectedResults	The function must return\n
       
   307 						\t 1. KErrNone\n
       
   308 						\t 2. KErrNone\n
       
   309 						\t 3. KErrNone\n
       
   310 						\t 4. KErrOverFlow\n
       
   311 						The supported pixel formats are populated into the array
       
   312 						and aCount stores the actual number of supported pixel formats.
       
   313 						The returned pixel formats should cover the pixel formats
       
   314 						in the image compatibility table that works on all platforms.
       
   315 @SYMTestStatus			Implemented 
       
   316  */
       
   317 void CTSgImageGeneric::TestGetPixelFormatsL()
       
   318 	{
       
   319 	TestOpenDriverL();
       
   320 	TSgImageInfo info;
       
   321 	info.iSizeInPixels = TSize(10, 10);
       
   322 	info.iCpuAccess = ESgCpuAccessNone;
       
   323 	info.iUsage = ESgUsageDirectGdiSource;
       
   324 	info.iShareable = EFalse;
       
   325 	info.iScreenId = 0;
       
   326 		
       
   327 	TInt numPixelFormats = 0;
       
   328 	//NULL array
       
   329 	CheckErrorL(KErrNone, RSgImage::GetPixelFormats(info, NULL, numPixelFormats), (TText8*)__FILE__, __LINE__);
       
   330 	TEST(numPixelFormats > 1);
       
   331 	
       
   332 	//array length bigger than available pixel formats
       
   333 	TInt count = numPixelFormats + 10;
       
   334 	TUidPixelFormat* pixelFormatArray = new(ELeave) TUidPixelFormat[count];
       
   335 	CleanupArrayDeletePushL(pixelFormatArray);
       
   336 	CheckErrorL(KErrNone, RSgImage::GetPixelFormats(info, pixelFormatArray, count), (TText8*)__FILE__, __LINE__);
       
   337 	TEST(count == numPixelFormats);
       
   338 	
       
   339 	info.iScreenId = -1;
       
   340 	CheckErrorL(KErrNone, RSgImage::GetPixelFormats(info, pixelFormatArray, count), (TText8*)__FILE__, __LINE__);
       
   341 	TEST(count == numPixelFormats);
       
   342 	
       
   343 	info.iScreenId = 0;	
       
   344 	CleanupStack::PopAndDestroy(pixelFormatArray);
       
   345 	//array length is equal to the supported pixel formats
       
   346 	count = numPixelFormats;
       
   347 	pixelFormatArray = new(ELeave) TUidPixelFormat[count];
       
   348 	CleanupArrayDeletePushL(pixelFormatArray);
       
   349 	
       
   350 	CheckErrorL(KErrNone, RSgImage::GetPixelFormats(info, pixelFormatArray, count), (TText8*)__FILE__, __LINE__);
       
   351 	TEST(count == numPixelFormats);
       
   352 	
       
   353 	CleanupStack::PopAndDestroy(pixelFormatArray);
       
   354 	//array length is smaller than the supported pixel formats
       
   355 	count = numPixelFormats - 1;
       
   356 	pixelFormatArray = new(ELeave) TUidPixelFormat[count];
       
   357 	CleanupArrayDeletePushL(pixelFormatArray);
       
   358 	TEST(KErrOverflow == RSgImage::GetPixelFormats(info, pixelFormatArray, count));
       
   359 	TEST(count == numPixelFormats);
       
   360 	CleanupStack::PopAndDestroy(pixelFormatArray);
       
   361 	
       
   362 	//check all the pixel formats returned are in the common compatibility guarantees table
       
   363 	TestGetPixelFormatCompatibilityGuaranteesL();
       
   364 	
       
   365 	//reset the array used by the GetPixelFormats function to prevent memory leaks
       
   366 	info.iCpuAccess = ESgCpuAccessReadWrite;
       
   367 	info.iScreenId = 100;
       
   368 	TEST(KErrNone == RSgImage::GetPixelFormats(info, NULL, count));
       
   369 	TEST(count == 0);
       
   370 	
       
   371 	TestCloseDriver();
       
   372 	}
       
   373 
       
   374 /**
       
   375 @SYMTestCaseID			GRAPHICS-RESOURCE-0004
       
   376 @SYMTestCaseDesc		Creates an uninitialised image.
       
   377 @SYMPREQ				PREQ39
       
   378 @SYMREQ					REQ8809
       
   379 @SYMREQ					REQ9175
       
   380 @SYMREQ					REQ9224 
       
   381 @SYMREQ					REQ9233  
       
   382 @SYMREQ					REQ9234
       
   383 @SYMFssID				RSgImage::Create(const TSgImageInfo&, const TAny*, TInt)\n 
       
   384 						RSgImage::IsNull()
       
   385 @SYMTestPriority		Critical
       
   386 @SYMTestType			Unit Test
       
   387 @SYMTestPurpose			To ensure an uninitialised image can be created.
       
   388 @SYMTestActions			Initialise the graphics resource component. Construct well-defined 
       
   389 						TSgImageInfo objects that work on all platforms. Create an image 
       
   390 						with a NULL base address for each of the TSgImageInfo object.
       
   391 @SYMTestExpectedResults	The function should return KErrNone in all cases. The created images
       
   392 						are uninitialised.
       
   393 @SYMTestStatus			Implemented 
       
   394  */	
       
   395 void CTSgImageGeneric::TestCreateImageUninitializedL()
       
   396 	{	
       
   397 	TestOpenDriverL();
       
   398 	TSgImageInfo info;
       
   399 	info.iSizeInPixels = TSize(100, 100);
       
   400 	info.iUsage = ESgUsageDirectGdiTarget;
       
   401 	info.iPixelFormat = EUidPixelFormatRGB_565;
       
   402 	
       
   403 	RSgImage image;	
       
   404 	CheckErrorL(KErrNone, image.Create(info, NULL, 0), (TText8*)__FILE__, __LINE__);
       
   405 	CleanupClosePushL(image);
       
   406 	
       
   407 	CleanupStack::PopAndDestroy();
       
   408 	TestCloseDriver();
       
   409 	}
       
   410 
       
   411 
       
   412 /**
       
   413 @SYMTestCaseID			GRAPHICS-RESOURCE-0005
       
   414 @SYMTestCaseDesc		Creates an image from a block of memory.
       
   415 @SYMPREQ				PREQ39
       
   416 @SYMREQ					REQ8809
       
   417 @SYMREQ					REQ9175
       
   418 @SYMREQ					REQ9224 
       
   419 @SYMREQ					REQ9233  
       
   420 @SYMREQ					REQ9234
       
   421 @SYMFssID				RSgImage::Create(const TSgImageInfo&, const TAny*, TInt)\n 
       
   422 						RSgImage::IsNull()
       
   423 @SYMTestPriority		Critical
       
   424 @SYMTestType			Unit Test
       
   425 @SYMTestPurpose			To ensure images can be created from a block of memory.
       
   426 @SYMTestActions			Initialise the graphics resource component. Construct well-defined 
       
   427 						TSgImageInfo objects that work on all platforms. Create a block of
       
   428 						memory with or without initialised data. Then create an image with 
       
   429 						the starting address of that memory.
       
   430 @SYMTestExpectedResults	The function should return KErrNone in all cases. The user data starting
       
   431 						at address aDataAddress will be populated into the new image.
       
   432 @SYMTestStatus			Implemented 
       
   433  */	
       
   434 void CTSgImageGeneric::TestCreateImageL()
       
   435 	{	
       
   436 	TestOpenDriverL();
       
   437 	TSgImageInfo info;
       
   438 	info.iSizeInPixels = TSize(8, 8);
       
   439 	info.iPixelFormat = EUidPixelFormatRGB_565;
       
   440 	info.iUsage = ESgUsageDirectGdiSource;
       
   441 	info.iShareable = ETrue;
       
   442 	
       
   443 	RSgImage image;
       
   444 	CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
   445 	CleanupClosePushL(image);
       
   446 	CleanupStack::PopAndDestroy();	
       
   447 #ifdef __WINS__	
       
   448 	//create an image with usage set to screen source
       
   449 	TSize screenSize;
       
   450 	if(HAL::Get(info.iScreenId, HALData::EDisplayXPixels, screenSize.iWidth) == KErrNone
       
   451 		&& HAL::Get(info.iScreenId, HALData::EDisplayYPixels, screenSize.iHeight) == KErrNone)
       
   452 		{
       
   453 		info.iUsage = ESgUsageScreenSource;
       
   454 		info.iScreenId = KSgScreenIdMain;
       
   455 		info.iSizeInPixels = TSize(screenSize.iWidth, screenSize.iHeight);
       
   456 		CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
   457 		CleanupClosePushL(image);
       
   458 		CleanupStack::PopAndDestroy();
       
   459 		
       
   460 		info.iSizeInPixels = TSize(screenSize.iHeight, screenSize.iWidth);
       
   461 		CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
   462 		CleanupClosePushL(image);
       
   463 		CleanupStack::PopAndDestroy();
       
   464 		}
       
   465 #endif	
       
   466 	//create an image with some user attributes
       
   467 	TSgUserAttribute testAttributes[] = {{0x00008888, 1}, {0x00009999, 2}};
       
   468 	info.iUserAttributes = testAttributes;
       
   469 	info.iUserAttributeCount = 2;
       
   470 	CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
   471 	CleanupClosePushL(image);
       
   472 	CleanupStack::PopAndDestroy();
       
   473 	
       
   474 	TestCloseDriver();
       
   475 	}
       
   476 
       
   477 /**
       
   478 @SYMTestCaseID			GRAPHICS-RESOURCE-0006
       
   479 @SYMTestCaseDesc		Creates an image from an existing image.
       
   480 @SYMPREQ				PREQ39
       
   481 @SYMREQ					REQ8809
       
   482 @SYMREQ					REQ9175
       
   483 @SYMREQ					REQ9192
       
   484 @SYMREQ					REQ9224 
       
   485 @SYMREQ					REQ9233  
       
   486 @SYMREQ					REQ9234
       
   487 @SYMFssID				RSgImage::Create(const TSgImageInfo&, const RSgImage&)
       
   488 @SYMTestPriority		Critical
       
   489 @SYMTestType			Unit Test
       
   490 @SYMTestPurpose			To ensure images can be created from existing images.
       
   491 @SYMTestActions			Initialise the graphics resource component. Create an image. Create another
       
   492 						image with the attributes of this image as the TSgImageInfo.
       
   493 @SYMTestExpectedResults	The function should return KErrNone. The new image should be identical to
       
   494 						the old one. 
       
   495 @SYMTestStatus			Implemented 
       
   496  */	
       
   497 void CTSgImageGeneric::TestCreateImageFromExistingImageL()
       
   498 	{
       
   499 	RSgImage image1;
       
   500 	RSgImage image2;
       
   501 	TSgImageInfo info;
       
   502 	
       
   503 	TestOpenDriverL();		
       
   504 	CreateImageL(image1);
       
   505 	CleanupClosePushL(image1);
       
   506 	TEST(KErrNone == image1.GetInfo(info));
       
   507 	CheckErrorL(KErrNone, image2.Create(info, image1), (TText8*)__FILE__, __LINE__);
       
   508 	CleanupClosePushL(image2);
       
   509 	TSgImageInfo info2;
       
   510 	TEST(KErrNone == image2.GetInfo(info2));
       
   511 	TEST(CompareInfos(info, info2));
       
   512 	CleanupStack::PopAndDestroy(2);
       
   513 	TestCloseDriver();
       
   514 	}
       
   515 
       
   516 
       
   517 /**
       
   518 @SYMTestCaseID			GRAPHICS-RESOURCE-0007
       
   519 @SYMTestCaseDesc		Calls GetInfo on an image.
       
   520 @SYMPREQ				PREQ39
       
   521 @SYMREQ					REQ8809
       
   522 @SYMREQ					REQ9175
       
   523 @SYMREQ					REQ9224 
       
   524 @SYMREQ					REQ9233  
       
   525 @SYMREQ					REQ9234
       
   526 @SYMFssID				RSgImage::GetInfo(TSgImageInfo&)
       
   527 @SYMTestPriority		Critical
       
   528 @SYMTestType			Unit Test
       
   529 @SYMTestPurpose			To ensure the information about the image is correct.
       
   530 @SYMTestActions			Initialise the graphics resource component. Construct a TSgImageInfo object
       
   531 						and Initialise all the member variables. Create images without and with
       
   532 						user attributes. Call GetInfo() and compare the resulting TSgImageInfo objects 
       
   533 						with the previous ones.
       
   534 @SYMTestExpectedResults	The function should return KErrNone. Information about the image object
       
   535 						is stored in the aInfo parameter. The retrieved TSgImageInfo objects should be 
       
   536 						identical to the original ones.
       
   537 @SYMTestStatus			Implemented 
       
   538  */	
       
   539 void CTSgImageGeneric::TestGetImageInfoL()
       
   540 	{
       
   541 	TestOpenDriverL();
       
   542 	TSgImageInfo info;
       
   543 	info.iPixelFormat = EUidPixelFormatRGB_565;
       
   544 	info.iSizeInPixels = TSize(100, 100);
       
   545 	info.iUsage = ESgUsageDirectGdiTarget;
       
   546 	
       
   547 	RSgImage image;
       
   548 	CheckErrorL(KErrNone, image.Create(info, NULL, 0), (TText8*)__FILE__, __LINE__);
       
   549 	CleanupClosePushL(image);
       
   550 	
       
   551 	TSgImageInfo info2;
       
   552 	TEST(KErrNone == image.GetInfo(info2));
       
   553 	TEST(CompareInfos(info, info2));
       
   554 	CleanupStack::PopAndDestroy();
       
   555 	
       
   556 	//get info of image with user attributes
       
   557 	TSgUserAttribute testAttributes[] = {{0x00008888, 1}, {0x00009999, 2}};
       
   558 	info.iUserAttributes = testAttributes;
       
   559 	info.iUserAttributeCount = 2;
       
   560 	CheckErrorL(KErrNone, image.Create(info, NULL, 0), (TText8*)__FILE__, __LINE__);
       
   561 	CleanupClosePushL(image);
       
   562 	TSgImageInfo info3;
       
   563 	TSgUserAttribute testAttributes2[2];
       
   564 	testAttributes2[0].iUid = TUid::Uid(0x00008888);
       
   565 	testAttributes2[1].iUid = TUid::Uid(0x00009999);
       
   566 	info3.iUserAttributes = testAttributes2;
       
   567 	info3.iUserAttributeCount = 2;
       
   568 	TEST(KErrNone == image.GetInfo(info3));
       
   569 	TEST(CompareInfos(info, info3));	
       
   570 	CleanupStack::PopAndDestroy();
       
   571 	
       
   572 	info.iShareable = ETrue;
       
   573 	CheckErrorL(KErrNone, image.Create(info, NULL, 0), (TText8*)__FILE__, __LINE__);
       
   574 	CleanupClosePushL(image);
       
   575 	TEST(KErrNone == image.GetInfo(info3));
       
   576 	TEST(CompareInfos(info, info3));
       
   577 	CleanupStack::PopAndDestroy();
       
   578 	
       
   579 	TestCloseDriver();
       
   580 	}
       
   581 
       
   582 /**
       
   583 @SYMTestCaseID			GRAPHICS-RESOURCE-0008
       
   584 @SYMTestCaseDesc		Retrieves drawable id and drawable type of an image.
       
   585 @SYMPREQ				PREQ39
       
   586 @SYMREQ					REQ8809
       
   587 @SYMREQ					REQ9175
       
   588 @SYMREQ					REQ9224 
       
   589 @SYMREQ					REQ9233  
       
   590 @SYMREQ					REQ9234
       
   591 @SYMFssID				RSgImage::Id()\n
       
   592 						RSgImage::DrawableType()
       
   593 @SYMTestPriority		Critical
       
   594 @SYMTestType			Unit Test
       
   595 @SYMTestPurpose			To ensure the globally unique drawable id of the image can be retrieved.
       
   596 @SYMTestActions			Initialise the graphics resource component. Create an image. Call
       
   597 						Id() to retrieve its drawable id.
       
   598 @SYMTestExpectedResults	A valid drawable id should be successfully returned.
       
   599 @SYMTestStatus			Implemented 
       
   600  */	
       
   601 void CTSgImageGeneric::TestGetImageDrawableIdL()
       
   602 	{	
       
   603 	RSgImage image;
       
   604 	TEST(KNullUid == image.DrawableType());
       
   605 	TSgDrawableId id = image.Id();
       
   606 	TEST(id == KSgNullDrawableId);
       
   607 	TestOpenDriverL();	
       
   608 	CreateImageL(image);
       
   609 	CleanupClosePushL(image);
       
   610 	id = image.Id();
       
   611 	TEST(id != KSgNullDrawableId);	
       
   612 	TEST(KSgImageTypeUid == image.DrawableType());
       
   613 
       
   614 	CleanupStack::PopAndDestroy();
       
   615 	TestCloseDriver();
       
   616 	}
       
   617 
       
   618 /**
       
   619 @SYMTestCaseID			GRAPHICS-RESOURCE-0009
       
   620 @SYMTestCaseDesc		Maps and unmaps an image from its creator process.
       
   621 @SYMPREQ				PREQ39
       
   622 @SYMREQ					REQ8809
       
   623 @SYMREQ					REQ9175
       
   624 @SYMREQ					REQ9193
       
   625 @SYMREQ					REQ9224 
       
   626 @SYMREQ					REQ9233  
       
   627 @SYMREQ					REQ9234
       
   628 @SYMFssID				RSgImage::MapReadOnly(const TAny*&, TInt&) const\n
       
   629  						RSgImage::MapWriteOnly(TAny*&, TInt&)\n 
       
   630 						RSgImage::MapReadWrite(TAny*&, TInt&)\n 
       
   631 						RSgImage::Unmap()
       
   632 						by its creator process.
       
   633 @SYMTestPriority		Critical
       
   634 @SYMTestType			Unit Test
       
   635 @SYMTestPurpose			To ensure an image can be successfully mapped and unmapped
       
   636 @SYMTestActions			Initialise the graphics resource component. Create mappable images
       
   637 						with different TSgImageInfo values. Call different map functions the Unmap()
       
   638 						function on each of them.
       
   639 @SYMTestExpectedResults	All the functions should return KErrNone.
       
   640 @SYMTestStatus			Implemented 
       
   641  */	
       
   642 void CTSgImageGeneric::TestMapImageL()
       
   643 	{
       
   644 	TestOpenDriverL();
       
   645 	RSgImage image;
       
   646 	TSgImageInfo info;
       
   647 	info.iSizeInPixels = TSize(8, 8);
       
   648 	info.iPixelFormat = EUidPixelFormatRGB_565;
       
   649 	info.iUsage = ESgUsageDirectGdiSource;
       
   650 	info.iCpuAccess = ESgCpuAccessReadOnly;
       
   651 	
       
   652 	CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
   653 	CleanupClosePushL(image);
       
   654 	
       
   655 	//test MapReadOnly
       
   656 	const TAny* dataAddress;
       
   657 	TInt dataStride;	
       
   658 	TInt mapResult = image.MapReadOnly(dataAddress, dataStride);
       
   659 	TEST(KErrNone == mapResult);
       
   660 	if(KErrNone == mapResult)
       
   661 		{
       
   662 		for (TInt y = 0; y < 8; ++y)
       
   663 			for (TInt x = 0; x < 8; ++x)
       
   664 				{
       
   665 				TUint16 pixelValue = *(TUint16*)PtrAdd(dataAddress, sizeof(TUint16) * x + dataStride * y);
       
   666 				if (pixelValue != 0x7E0)
       
   667 					{
       
   668 					TEST(EFalse);
       
   669 					break;
       
   670 					}
       
   671 				}
       
   672 		}
       
   673 	TEST(KErrNone == image.Unmap());
       
   674 	CleanupStack::PopAndDestroy(&image);
       
   675 	
       
   676 	//test MapWriteOnly
       
   677 	TAny* dataAddress1;
       
   678 	
       
   679 	info.iCpuAccess = ESgCpuAccessWriteOnly;
       
   680 	CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
   681 	CleanupClosePushL(image);
       
   682 	mapResult = image.MapWriteOnly(dataAddress1, dataStride);
       
   683 	TEST(KErrNone == mapResult);
       
   684 	//change the second line to red
       
   685 	if(KErrNone == mapResult)
       
   686 		{
       
   687 		for(TInt x = 0; x < 8; ++x)
       
   688 			{
       
   689 			*(TUint16*)PtrAdd(dataAddress1, sizeof(TUint16) * x + dataStride * 1) = 0xF800;
       
   690 			}
       
   691 		}
       
   692 	TEST(KErrNone == image.Unmap());
       
   693 	
       
   694 	//check if the modification is successful	
       
   695 	//create another image from the existing one and map it as read only
       
   696 	info.iCpuAccess = ESgCpuAccessReadOnly;
       
   697 	RSgImage image1;
       
   698 	CheckErrorL(KErrNone, image1.Create(info, image), (TText8*)__FILE__, __LINE__);
       
   699 	CleanupClosePushL(image1);
       
   700 	mapResult = image1.MapReadOnly(dataAddress, dataStride);
       
   701 	TEST(mapResult == KErrNone);
       
   702 	if(mapResult == KErrNone)
       
   703 		{
       
   704 		for(TInt x = 0; x < 8; ++x)
       
   705 			{
       
   706 			TUint16 pixelValue = *(TUint16*)PtrAdd(dataAddress, sizeof(TUint16) * x + dataStride * 1);
       
   707 			if(pixelValue != 0xF800)
       
   708 				{
       
   709 				TEST(EFalse);
       
   710 				break;
       
   711 				}
       
   712 			}
       
   713 		}
       
   714 	
       
   715 	TEST(KErrNone == image1.Unmap());
       
   716 	CleanupStack::PopAndDestroy(2, &image);
       
   717 	
       
   718 	//test MapReadWrite
       
   719 	info.iCpuAccess = ESgCpuAccessReadWrite;
       
   720 	CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
   721 	CleanupClosePushL(image);
       
   722 	mapResult = image.MapReadWrite(dataAddress1, dataStride);
       
   723 	TEST(KErrNone == mapResult);
       
   724 	
       
   725 	if(KErrNone == mapResult)
       
   726 		{
       
   727 		//modify the image, set first line to blue
       
   728 		for(TInt x = 0; x < 8; ++x)
       
   729 			{
       
   730 			*(TUint16*)PtrAdd(dataAddress1, sizeof(TUint16) * x) = 0x1F;
       
   731 			}
       
   732 		
       
   733 		//check the modification
       
   734 		for(TInt x = 0; x < 8; ++x)
       
   735 			{
       
   736 			TUint16 pixelValue = *(TUint16*)PtrAdd(dataAddress1, sizeof(TUint16) * x);
       
   737 			if(pixelValue != 0x1F)
       
   738 				{
       
   739 				TEST(EFalse);
       
   740 				break;
       
   741 				}
       
   742 			}
       
   743 		}
       
   744 	
       
   745 	TEST(KErrNone == image.Unmap());	
       
   746 	CleanupStack::PopAndDestroy();
       
   747 	TestCloseDriver();
       
   748 	}
       
   749 
       
   750 /**
       
   751 @SYMTestCaseID			GRAPHICS-RESOURCE-0010
       
   752 @SYMTestCaseDesc		Opens a handle to an image in both the current process and another process.
       
   753 @SYMPREQ				PREQ39
       
   754 @SYMREQ					REQ8809
       
   755 @SYMREQ					REQ9175
       
   756 @SYMREQ					REQ9224 
       
   757 @SYMREQ					REQ9233  
       
   758 @SYMREQ					REQ9234
       
   759 @SYMFssID				RSgImage::Open(const TSgDrawableId&)
       
   760 @SYMTestPriority		Critical
       
   761 @SYMTestType			Unit Test
       
   762 @SYMTestPurpose			To ensure image can be opened in both a second thread in the current 
       
   763 						process and another process.
       
   764 @SYMTestActions			Initialise the graphics resource component. Create a shareable image and
       
   765 						a non-shareable image. Open() the image in the second thread in the current 
       
   766 						process and in another process.
       
   767 						Check various image attributes.
       
   768 @SYMTestExpectedResults	The function must return KErrNone in both cases.
       
   769 @SYMTestStatus			Implemented 
       
   770  */	
       
   771 void CTSgImageGeneric::TestOpenImageL()
       
   772 	{	
       
   773 	TestOpenDriverL();
       
   774 	
       
   775 	//shareable image
       
   776 	RSgImage image1;
       
   777 	TSgImageInfo info1;
       
   778 	info1.iSizeInPixels = TSize(8, 8);
       
   779 	info1.iUsage = ESgUsageDirectGdiSource;
       
   780 	info1.iPixelFormat = EUidPixelFormatRGB_565;
       
   781 	info1.iCpuAccess = ESgCpuAccessReadWrite;
       
   782 	info1.iShareable = ETrue;
       
   783 	CheckErrorL(KErrNone, image1.Create(info1, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
   784 	CleanupClosePushL(image1);
       
   785 	
       
   786 	//non-shareable image
       
   787 	RSgImage image2;
       
   788 	TSgImageInfo info2;
       
   789 	info2.iSizeInPixels = TSize(8, 8);
       
   790 	info2.iUsage = ESgUsageDirectGdiSource;
       
   791 	info2.iPixelFormat = EUidPixelFormatRGB_565;
       
   792 	info2.iCpuAccess = ESgCpuAccessReadWrite;
       
   793 	info2.iShareable = EFalse;	
       
   794 	CheckErrorL(KErrNone, image2.Create(info2, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
   795 	CleanupClosePushL(image2);
       
   796 	
       
   797 	const TSgDrawableId id1 = image1.Id();
       
   798 	const TSgDrawableId id2 = image2.Id();	
       
   799 	
       
   800 	//opening image in the current thread
       
   801 	RSgImage image3;
       
   802 	TEST(KErrNone == image3.Open(id1));
       
   803 	image3.Close();
       
   804 	TEST(KErrNone == image3.Open(id2));
       
   805 	image3.Close();
       
   806 	
       
   807 	//opening image in a second thread in the current process
       
   808 	TSgresTestInfo threadInfo = {id1, info1, 0, ESgresSecondThreadOpenImage};
       
   809 	TInt testResult = CreateSecondThreadAndDoTestL(threadInfo);	
       
   810 	// Test the results from the second thread
       
   811 	User::LeaveIfError(testResult);
       
   812 	TEST(testResult & EFirstTestPassed);
       
   813 	TEST(testResult & ESecondTestPassed);
       
   814 	TEST(testResult & EThirdTestPassed);
       
   815 	TEST(testResult & EFourthTestPassed);
       
   816 	TEST(testResult & EFifthTestPassed);
       
   817 	
       
   818 	threadInfo.iDrawableId = id2;
       
   819 	threadInfo.iImageInfo = info2;
       
   820 	testResult = CreateSecondThreadAndDoTestL(threadInfo);	
       
   821 	// Test the results from the second thread
       
   822 	User::LeaveIfError(testResult);
       
   823 	TEST(testResult & EFirstTestPassed);
       
   824 	TEST(testResult & ESecondTestPassed);
       
   825 	TEST(testResult & EThirdTestPassed);
       
   826 	TEST(testResult & EFourthTestPassed);
       
   827 	TEST(testResult & EFifthTestPassed);
       
   828 		
       
   829 	//opening image in a second process	
       
   830 	TSgresTestInfo processInfo = {id1, info1, 0, ESgresSecondProcessOpenImage};
       
   831 	testResult = CreateSecondProcessAndDoTestL(KSecondProcess, processInfo);	
       
   832 	User::LeaveIfError(testResult);
       
   833 	TEST(testResult & EFirstTestPassed);	
       
   834 	TEST(testResult & ESecondTestPassed);
       
   835 	TEST(testResult & EThirdTestPassed);
       
   836 	TEST(testResult & EFourthTestPassed);
       
   837 
       
   838 	CleanupStack::PopAndDestroy(2, &image1);
       
   839 	TestCloseDriver();
       
   840 	}
       
   841 
       
   842 class MFake
       
   843 	{
       
   844 public:
       
   845 	enum { EInterfaceUid = 0x88888888 };
       
   846 	};
       
   847 
       
   848 /**
       
   849 @SYMTestCaseID			GRAPHICS-RESOURCE-0011
       
   850 @SYMTestCaseDesc		Opens a handle to an image with mode flags.
       
   851 @SYMPREQ				PREQ39
       
   852 @SYMREQ					REQ8809
       
   853 @SYMREQ					REQ9175
       
   854 @SYMREQ					REQ9224 
       
   855 @SYMREQ					REQ9233  
       
   856 @SYMREQ					REQ9234
       
   857 @SYMFssID				RSgImage::Open(const TSgDrawableId&, TUint32)
       
   858 @SYMTestPriority		Critical
       
   859 @SYMTestType			Unit Test
       
   860 @SYMTestPurpose			To ensure image can be opened with mode flags.
       
   861 @SYMTestActions			Initialise the graphics resource component. Create an image and
       
   862 						call Open() on the image with flag ESgDoNotRestrictUsage. Call
       
   863 						GetInfo() on the opened image and check the usage bit. Declare another
       
   864 						image object and call Open() on it with the Id of the previously
       
   865 						opened handle and without mode flags. Call GetInfo() on this image
       
   866 						and check the usage bit.
       
   867 @SYMTestExpectedResults	Both infos should contain all the possible usages supported by
       
   868  						the underlying implementation.						
       
   869 @SYMTestStatus			Implemented 
       
   870  */	
       
   871 void CTSgImageGeneric::TestOpenImageInternalL()
       
   872 	{
       
   873 	TestOpenDriverL();
       
   874 	
       
   875 	//shareable image
       
   876 	RSgImage shareableImage;
       
   877 	TSgImageInfo shareableInfo;
       
   878 	shareableInfo.iSizeInPixels = TSize(8, 8);
       
   879 	shareableInfo.iUsage = ESgUsageDirectGdiSource;
       
   880 	shareableInfo.iPixelFormat = EUidPixelFormatRGB_565;
       
   881 	shareableInfo.iCpuAccess = ESgCpuAccessReadWrite;
       
   882 	shareableInfo.iShareable = ETrue;	
       
   883 	CheckErrorL(KErrNone, shareableImage.Create(shareableInfo, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
   884 	CleanupClosePushL(shareableImage);
       
   885 		
       
   886 	RSgImage image1;
       
   887 	CheckErrorL(KErrNone, image1.Open(shareableImage.Id(), ESgDoNotRestrictUsage), (TText8*)__FILE__, __LINE__);
       
   888 	CleanupClosePushL(image1);
       
   889 	TSgImageInfo info1;
       
   890 	image1.GetInfo(info1);	
       
   891 	TEST(ESgUsageDirectGdiSource | info1.iUsage);
       
   892 	TEST(ESgUsageCompositionSource | info1.iUsage);
       
   893 	TEST(ESgUsageOpenGlesTexture2D | info1.iUsage);
       
   894 	TEST(ESgUsageOpenGles2Texture2D | info1.iUsage);
       
   895 	TEST(ESgUsageOpenVgImage | info1.iUsage);
       
   896 	
       
   897 	RSgImage image2;
       
   898 	CheckErrorL(KErrNone, image2.Open(image1.Id()), (TText8*)__FILE__, __LINE__);
       
   899 	CleanupClosePushL(image2);
       
   900 	TSgImageInfo info2;
       
   901 	image2.GetInfo(info2);
       
   902 	TEST(ESgUsageDirectGdiSource | info2.iUsage);
       
   903 	TEST(ESgUsageCompositionSource | info2.iUsage);
       
   904 	TEST(ESgUsageOpenGlesTexture2D | info2.iUsage);
       
   905 	TEST(ESgUsageOpenGles2Texture2D | info2.iUsage);
       
   906 	TEST(ESgUsageOpenVgImage | info2.iUsage);
       
   907 	
       
   908 	//non-shareable image
       
   909 	RSgImage nonshareableImage;
       
   910 	TSgImageInfo nonshareableInfo;
       
   911 	nonshareableInfo.iSizeInPixels = TSize(8, 8);
       
   912 	nonshareableInfo.iUsage = ESgUsageDirectGdiSource;
       
   913 	nonshareableInfo.iPixelFormat = EUidPixelFormatRGB_565;
       
   914 	nonshareableInfo.iCpuAccess = ESgCpuAccessReadWrite;
       
   915 	nonshareableInfo.iShareable = EFalse;	
       
   916 	CheckErrorL(KErrNone, nonshareableImage.Create(nonshareableInfo, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
   917 	CleanupClosePushL(nonshareableImage);
       
   918 	
       
   919 	RSgImage image3;
       
   920 	CheckErrorL(KErrNone, image3.Open(nonshareableImage.Id(), ESgDoNotRestrictUsage), (TText8*)__FILE__, __LINE__);
       
   921 	CleanupClosePushL(image3);
       
   922 	TSgImageInfo info3;
       
   923 	image3.GetInfo(info3);	
       
   924 	TEST(ESgUsageDirectGdiSource | info3.iUsage);
       
   925 	TEST(ESgUsageCompositionSource | info3.iUsage);
       
   926 	TEST(ESgUsageOpenGlesTexture2D | info3.iUsage);
       
   927 	TEST(ESgUsageOpenGles2Texture2D | info3.iUsage);
       
   928 	TEST(ESgUsageOpenVgImage | info3.iUsage);
       
   929 	
       
   930 	RSgImage image4;
       
   931 	CheckErrorL(KErrNone, image4.Open(image3.Id()), (TText8*)__FILE__, __LINE__);
       
   932 	CleanupClosePushL(image4);
       
   933 	TSgImageInfo info4;
       
   934 	image4.GetInfo(info4);
       
   935 	TEST(ESgUsageDirectGdiSource | info4.iUsage);
       
   936 	TEST(ESgUsageCompositionSource | info4.iUsage);
       
   937 	TEST(ESgUsageOpenGlesTexture2D | info4.iUsage);
       
   938 	TEST(ESgUsageOpenGles2Texture2D | info4.iUsage);
       
   939 	TEST(ESgUsageOpenVgImage | info4.iUsage);
       
   940 	
       
   941 	CleanupStack::PopAndDestroy(6, &shareableImage);
       
   942 	TestCloseDriver();
       
   943 	}
       
   944 
       
   945 /**
       
   946 @SYMTestCaseID			GRAPHICS-RESOURCE-0044
       
   947 @SYMTestCaseDesc		Gets the interfaces implemented by CSgImageImpl class.
       
   948 @SYMPREQ				PREQ39
       
   949 @SYMREQ					REQ8809
       
   950 @SYMREQ					REQ9175
       
   951 @SYMREQ					REQ9224 
       
   952 @SYMREQ					REQ9233  
       
   953 @SYMREQ					REQ9234
       
   954 @SYMFssID				RSgImage::Create(const TSgImageInfo&, const TAny*, TInt)\n 
       
   955 						RSgImage::GetInterface()
       
   956 @SYMTestPriority		Critical
       
   957 @SYMTestType			Unit Test
       
   958 @SYMTestPurpose			To ensure the extension interfaces supported by RSgImage can be
       
   959 						returned. 
       
   960 @SYMTestActions			Initialise the graphics resource component. Create an image. Call
       
   961 						GetInterface() to return the MSgImage_Sw and MSgImage_Chunk interfaces.
       
   962 						Perform various operations on the interfaces. Declare a fake interface
       
   963 						MFake and call GetInterface() on the image handle.
       
   964 @SYMTestExpectedResults	The operations on the MSgImage_Sw and MSgImage_Chunk interfaces should
       
   965 						succeed. Trying to get the MFake interface should return KErrExtensionNotSupported.
       
   966 @SYMTestStatus			Implemented 
       
   967  */
       
   968 void CTSgImageGeneric::TestGetInterfaceL()
       
   969 	{
       
   970 	TestOpenDriverL();
       
   971 	
       
   972 	TSgImageInfo info;
       
   973 	info.iSizeInPixels = TSize(8, 8);
       
   974 	info.iUsage = ESgUsageDirectGdiSource;
       
   975 	info.iPixelFormat = EUidPixelFormatRGB_565;
       
   976 	info.iCpuAccess = ESgCpuAccessReadWrite;
       
   977 	info.iShareable = ETrue;
       
   978 	
       
   979 	RSgImage image;	
       
   980 	MSgImage_Sw* swInterface = NULL;
       
   981 	TEST(KErrBadHandle == image.GetInterface(swInterface));
       
   982 	
       
   983 	CheckErrorL(KErrNone, image.Create(info, NULL, 0), (TText8*)__FILE__, __LINE__);
       
   984 	CleanupClosePushL(image);
       
   985 	
       
   986 	// check TSgDrawableId is not NULL
       
   987 	TSgDrawableId id = image.Id();
       
   988 	TEST(KSgNullDrawableId != id);
       
   989 	
       
   990 	TAny* dataAddress1 = NULL;
       
   991 	TInt dataStride1 = 0;
       
   992 	TInt result1 = image.GetInterface(swInterface);
       
   993 	TEST(KErrNone == result1);
       
   994 	if(KErrNone == result1)
       
   995 		{		
       
   996 		// Fill the image with 0xF0
       
   997 		TInt sizeInBytes = 8 * 8 * 2;
       
   998 		TESTL(swInterface->BeginDataAccess(ESgCpuAccessNone) == KErrArgument);
       
   999 		TEST(swInterface->BeginDataAccess(ESgCpuAccessWriteOnly) == KErrNone);
       
  1000 		dataAddress1 = swInterface->DataAddress();
       
  1001 		dataStride1 = swInterface->DataStride();
       
  1002 		Mem::Fill(dataAddress1, sizeInBytes, 0xF0);
       
  1003 		TEST(swInterface->EndDataAccess() == KErrNone);
       
  1004 		
       
  1005 		//Map the image as read only and check if the previous operation is successful
       
  1006 		const TAny* dataAddressRead;
       
  1007 		TInt dataStride2;	
       
  1008 		TInt mapResult = image.MapReadOnly(dataAddressRead, dataStride2);
       
  1009 		TEST(KErrNone == mapResult);
       
  1010 		TEST(dataAddress1 == dataAddressRead);
       
  1011 		TEST(dataStride1 == dataStride2);
       
  1012 		if(KErrNone == mapResult)
       
  1013 			{
       
  1014 			for (TInt y = 0; y < 8; ++y)
       
  1015 				for (TInt x = 0; x < 8; ++x)
       
  1016 					{
       
  1017 					TUint16 pixelValue = *(TUint16*)PtrAdd(dataAddressRead, sizeof(TUint16) * x + dataStride2 * y);
       
  1018 					if (pixelValue != 0xF0F0)
       
  1019 						{
       
  1020 						TEST(EFalse);
       
  1021 						break;
       
  1022 						}
       
  1023 					}
       
  1024 			}
       
  1025 		TEST(KErrNone == image.Unmap());
       
  1026 		}
       
  1027 	
       
  1028 	MSgImage_Chunk* smChunk = NULL;
       
  1029 	TInt result2 = image.GetInterface(smChunk);
       
  1030 	TEST(KErrNone == result2);
       
  1031 	if(KErrNone == result2)
       
  1032 		{
       
  1033 		TAny* address = PtrAdd(smChunk->DataChunk().Base(), smChunk->DataOffset());
       
  1034 		TInt datastride = smChunk->DataStride();
       
  1035 		if(KErrNone == result1)
       
  1036 			{
       
  1037 			TEST(address == dataAddress1);
       
  1038 			TEST(datastride == dataStride1);
       
  1039 			}
       
  1040 		}
       
  1041 	
       
  1042 	//fake interface
       
  1043 	MFake* smFake = NULL;
       
  1044 	TEST(KErrExtensionNotSupported == image.GetInterface(smFake));
       
  1045 	
       
  1046 	CleanupStack::PopAndDestroy();
       
  1047 	TestCloseDriver();
       
  1048 	}
       
  1049 
       
  1050 /**
       
  1051 @SYMTestCaseID			GRAPHICS-RESOURCE-0024
       
  1052 @SYMTestCaseDesc		Gets supported pixel formats with invalid parameters.
       
  1053 @SYMPREQ				PREQ39
       
  1054 @SYMREQ					REQ8809
       
  1055 @SYMREQ					REQ9175
       
  1056 @SYMREQ					REQ9224 
       
  1057 @SYMREQ					REQ9233  
       
  1058 @SYMREQ					REQ9234
       
  1059 @SYMFssID				RSgImage::GetPixelFormats(const TSgImageInfo&, TUidPixelFormat*, TInt&)
       
  1060 @SYMTestPriority		Critical
       
  1061 @SYMTestType			Unit Test
       
  1062 @SYMTestPurpose			To ensure the correct error messages are returned when user tries to
       
  1063 						call GetPixelFormats() with invalid parameters.
       
  1064 @SYMTestActions			Initialise the graphics resource component. Call RSgImage::GetPixelFormats with:\n
       
  1065 						\t 1. invalid TSgImageInfo object, it could be any combinations of the following:\n
       
  1066 						\t \t negative width or height\n
       
  1067 						\t \t mutability incompatible with the specified CPU access and usage\n
       
  1068 						\t \t screen id < -1\n
       
  1069 						\t \t usage flag ESgUsageScreenSource with screen id -1\n
       
  1070 						\t 2. invalid aCount
       
  1071 @SYMTestExpectedResults	The function should return KErrArgument in both cases.
       
  1072 @SYMTestStatus			Implemented 
       
  1073  */	
       
  1074 void CTSgImageGeneric::TestGetPixelFormatsInvalidL()
       
  1075 	{
       
  1076 	TSgImageInfo info1;
       
  1077 	TInt count = 0;
       
  1078 	
       
  1079 	TestOpenDriverL();
       
  1080 	//negative width
       
  1081 	info1.iSizeInPixels = TSize(-100, 100);
       
  1082 	TEST(KErrArgument == RSgImage::GetPixelFormats(info1, NULL, count));
       
  1083 	
       
  1084 	//negative height
       
  1085 	TSgImageInfo info2;
       
  1086 	info2.iSizeInPixels = TSize(100, -100);
       
  1087 	TEST(KErrArgument == RSgImage::GetPixelFormats(info2, NULL, count));
       
  1088 	
       
  1089 	//invalid or non-existent screen id
       
  1090 	TSgImageInfo info5;
       
  1091 	info5.iSizeInPixels = TSize(8, 8);
       
  1092 	info5.iUsage = ESgUsageScreenSource;
       
  1093 	info5.iCpuAccess = ESgCpuAccessReadWrite;
       
  1094 	info5.iScreenId = -2;
       
  1095 	TEST(KErrArgument == RSgImage::GetPixelFormats(info5, NULL, count));
       
  1096 	info5.iScreenId = 100;
       
  1097 	TEST(KErrNone == RSgImage::GetPixelFormats(info5, NULL, count));
       
  1098 	TEST(count == 0);
       
  1099 	
       
  1100 	//usage flag ESgUsageScreenSource with screen id -1
       
  1101 	TSgImageInfo info6;
       
  1102 	info6.iSizeInPixels = TSize(8, 8);
       
  1103 	info6.iScreenId = -1;
       
  1104 	info6.iUsage = ESgUsageScreenSource;
       
  1105 	TEST(KErrArgument == RSgImage::GetPixelFormats(info6, NULL, count));
       
  1106 	
       
  1107 	//negative aCount
       
  1108 	TSgImageInfo info7;
       
  1109 	info7.iCpuAccess = ESgCpuAccessNone;
       
  1110 	info7.iShareable = EFalse;
       
  1111 	info7.iSizeInPixels = TSize(10, 10);
       
  1112 	CheckErrorL(KErrNone, RSgImage::GetPixelFormats(info7, NULL, count), (TText8*)__FILE__, __LINE__);
       
  1113 	
       
  1114 	if(count > 0)
       
  1115 		{
       
  1116 		TUidPixelFormat* pixelFormatArray = new(ELeave) TUidPixelFormat[count];
       
  1117 		if(!pixelFormatArray)
       
  1118 			{
       
  1119 			User::Leave(KErrNoMemory);
       
  1120 			}
       
  1121 		CleanupStack::PushL(pixelFormatArray);
       
  1122 		count = -100;
       
  1123 		TEST(KErrArgument == RSgImage::GetPixelFormats(info7, pixelFormatArray, count));
       
  1124 		
       
  1125 		CleanupStack::PopAndDestroy(pixelFormatArray);
       
  1126 		}
       
  1127 	
       
  1128 	//reset the array used by the GetPixelFormats function to prevent memory leaks
       
  1129 	TSgImageInfo info8;
       
  1130 	info8.iSizeInPixels = TSize(10, 10);
       
  1131 	info8.iCpuAccess = ESgCpuAccessReadWrite;
       
  1132 	info8.iUsage = ESgUsageDirectGdiSource;
       
  1133 	info8.iShareable = EFalse;
       
  1134 	info8.iScreenId = 100;
       
  1135 	TEST(KErrNone == RSgImage::GetPixelFormats(info8, NULL, count));
       
  1136 	TEST(count == 0);
       
  1137 	
       
  1138 	TestCloseDriver();
       
  1139 	}
       
  1140 
       
  1141 /**
       
  1142 @SYMTestCaseID			GRAPHICS-RESOURCE-0025
       
  1143 @SYMTestCaseDesc		Opens an image with different invalid parameters.
       
  1144 @SYMPREQ				PREQ39
       
  1145 @SYMREQ					REQ8809
       
  1146 @SYMREQ					REQ9175
       
  1147 @SYMREQ					REQ9224 
       
  1148 @SYMREQ					REQ9233  
       
  1149 @SYMREQ					REQ9234
       
  1150 @SYMFssID				RSgImage::Open(const TSgDrawableId&)
       
  1151 @SYMTestPriority		Critical
       
  1152 @SYMTestType			Unit Test
       
  1153 @SYMTestPurpose			To check correct error messages are returned when opening image with 
       
  1154 						different invalid parameters.
       
  1155 @SYMTestActions			Initialise the graphics resource component. Construct an RSgImage object. 
       
  1156 						Call the Open() function in both the current process and another process with:\n
       
  1157 						\t 1. a non-null RSgImage handle\n
       
  1158 						\t 2. null drawable id\n
       
  1159 						\t 3. fake drawable id\n
       
  1160 						\t 4. a non-sharable RSgImage handle
       
  1161 						Do the same tests in a second thread and a second process.
       
  1162 @SYMTestExpectedResults	The function should return:\n
       
  1163 						\t 1. KErrInUse\n
       
  1164 						\t 2. KErrArgument\n
       
  1165 						\t 3. KErrNotFound\n
       
  1166 						\t 4. KErrNone in the same process and KErrPermissionDenied or KErrNotFound in the second process
       
  1167 @SYMTestStatus			Implemented 
       
  1168  */	
       
  1169 void CTSgImageGeneric::TestOpenImageInvalidL()
       
  1170 	{	
       
  1171 	TestOpenDriverL();
       
  1172 	//create a non-sharable image
       
  1173 	TSgImageInfo info;
       
  1174 	info.iSizeInPixels = TSize(8, 8);
       
  1175 	info.iUsage = ESgUsageDirectGdiTarget;
       
  1176 	info.iPixelFormat = EUidPixelFormatRGB_565;
       
  1177 	info.iShareable = EFalse;
       
  1178 	
       
  1179 	RSgImage image;
       
  1180 	CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
  1181 	CleanupClosePushL(image);
       
  1182 	const TSgDrawableId id = image.Id();
       
  1183 	
       
  1184 	//same thread
       
  1185 	//  non-empty handle
       
  1186 	RSgImage image1;
       
  1187 	CreateImageL(image1);
       
  1188 	CleanupClosePushL(image1);
       
  1189 	TEST(KErrInUse == image1.Open(id));
       
  1190 	image1.Close();
       
  1191 	
       
  1192 	//  null drawable id
       
  1193 	CheckErrorL(KErrArgument, image1.Open(KSgNullDrawableId), (TText8*)__FILE__, __LINE__);
       
  1194 	image1.Close();
       
  1195 	
       
  1196 	//  non-existing drawable id
       
  1197 	TSgDrawableId fakeid = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
       
  1198 	CheckErrorL(KErrNotFound, image1.Open(fakeid), (TText8*)__FILE__, __LINE__);
       
  1199 	image1.Close();
       
  1200 	
       
  1201 	//  open a non-sharable image
       
  1202 	TEST(KErrNone == image1.Open(id));
       
  1203 	image1.Close();
       
  1204 	
       
  1205 	//different thread in the same process
       
  1206 	TSgresTestInfo threadInfo = {id, info, 0, ESgresSecondThreadOpenImageInvalid};
       
  1207 	TInt testResult = CreateSecondThreadAndDoTestL(threadInfo);
       
  1208 	User::LeaveIfError(testResult);
       
  1209 	// Test the results from the second thread
       
  1210 	TEST(testResult & EFirstTestPassed);
       
  1211 	TEST(testResult & ESecondTestPassed);
       
  1212 	TEST(testResult & EThirdTestPassed);
       
  1213 	TEST(testResult & EFourthTestPassed);
       
  1214 	TEST(testResult & EFifthTestPassed);
       
  1215 	
       
  1216 	//different process	
       
  1217 	TSgresTestInfo processInfo = {id, info, 0, ESgresSecondProcessOpenImageInvalid};
       
  1218 	testResult = CreateSecondProcessAndDoTestL(KSecondProcess, processInfo);	
       
  1219 	User::LeaveIfError(testResult);
       
  1220 	TEST(testResult & EFirstTestPassed);	
       
  1221 	TEST(testResult & ESecondTestPassed);
       
  1222 	TEST(testResult & EThirdTestPassed);
       
  1223 	TEST(testResult & EFourthTestPassed);	
       
  1224 	TEST(testResult & EFifthTestPassed);
       
  1225 		
       
  1226 	CleanupStack::PopAndDestroy(2);
       
  1227 	TestCloseDriver();
       
  1228 	}
       
  1229 
       
  1230 /**
       
  1231 @SYMTestCaseID			GRAPHICS-RESOURCE-0026
       
  1232 @SYMTestCaseDesc		Closes an image multiple times.
       
  1233 @SYMPREQ				PREQ39
       
  1234 @SYMREQ					REQ8809
       
  1235 @SYMREQ					REQ9175
       
  1236 @SYMREQ					REQ9224 
       
  1237 @SYMREQ					REQ9233  
       
  1238 @SYMREQ					REQ9234
       
  1239 @SYMFssID				RSgImage::Close()
       
  1240 @SYMTestPriority		Critical
       
  1241 @SYMTestType			Unit Test
       
  1242 @SYMTestPurpose			To check calling Close() multiple times after Open() does not cause
       
  1243 						errors or panics.
       
  1244 @SYMTestActions			Initialise the graphics resource component. Create an image and then
       
  1245 						call Close() three times on it.
       
  1246 @SYMTestExpectedResults	The function should not cause any errors or panics.
       
  1247 @SYMTestStatus			Implemented 
       
  1248  */
       
  1249 void CTSgImageGeneric::TestCloseImageManyTimesL()
       
  1250 	{
       
  1251 	TestOpenDriverL();
       
  1252 	RSgImage image;
       
  1253 	CreateImageL(image);
       
  1254 	
       
  1255 	image.Close();
       
  1256 	image.Close();
       
  1257 	image.Close();
       
  1258 	
       
  1259 	TestCloseDriver();
       
  1260 	}
       
  1261 
       
  1262 
       
  1263 /**
       
  1264 @SYMTestCaseID			GRAPHICS-RESOURCE-0027
       
  1265 @SYMTestCaseDesc		Closes an image object without opening it.
       
  1266 @SYMPREQ				PREQ39
       
  1267 @SYMREQ					REQ8809
       
  1268 @SYMREQ					REQ9175
       
  1269 @SYMREQ					REQ9224 
       
  1270 @SYMREQ					REQ9233  
       
  1271 @SYMREQ					REQ9234
       
  1272 @SYMFssID				RSgImage::Close ()
       
  1273 @SYMTestPriority		Critical
       
  1274 @SYMTestType			Unit Test
       
  1275 @SYMTestPurpose			To check Close() does nothing if the image is not already opened.
       
  1276 @SYMTestActions			Initialise the graphics resource component. Declare an RSgImage object and
       
  1277 						call Close() on it.
       
  1278 @SYMTestExpectedResults	The function should not cause any errors or panics.
       
  1279 @SYMTestStatus			Implemented 
       
  1280  */	
       
  1281 void CTSgImageGeneric::TestCloseImageWithoutOpenL()
       
  1282 	{	
       
  1283 	TestOpenDriverL();
       
  1284 	RSgImage image;
       
  1285 	image.Close();
       
  1286 	TestCloseDriver();
       
  1287 	}
       
  1288 
       
  1289 /**
       
  1290 @SYMTestCaseID			GRAPHICS-RESOURCE-0028
       
  1291 @SYMTestCaseDesc		Creates an image with various invalid parameters.
       
  1292 @SYMPREQ				PREQ39
       
  1293 @SYMREQ					REQ8809
       
  1294 @SYMREQ					REQ9175
       
  1295 @SYMREQ					REQ9192
       
  1296 @SYMREQ					REQ9224 
       
  1297 @SYMREQ					REQ9233  
       
  1298 @SYMREQ					REQ9234
       
  1299 @SYMFssID				RSgImage::Create(const TSgImageInfo&, const TAny*, TInt)\n 
       
  1300 						RSgImage::Create(const TSgImageInfo, const RSgImage&)
       
  1301 @SYMTestPriority		Critical
       
  1302 @SYMTestType			Unit Test
       
  1303 @SYMTestPurpose			To check the function returns the correct error messages when the parameters
       
  1304 						are invalid.
       
  1305 @SYMTestActions			Initialise the graphics resource component. Construct a TSgImageInfo object 
       
  1306 						and Initialise the all the member variables with random values. Call the appropriate 
       
  1307 						Create() function with:\n
       
  1308 						\t 1. invalid TSgImageInfo\n
       
  1309 						\t 2. unsupported TSgImageInfo\n
       
  1310 						\t 3. the creating RSgImage handle is not null\n
       
  1311 						\t 4. the aSgImage handle is null\n
       
  1312 						\t 5. the size and pixel format in TSgImageInfo is not the same as that of aSgImage\n
       
  1313 						\t 6. number of iUserAttributes is more than KMaxHint (8)\n
       
  1314 @SYMTestExpectedResults	The function should return\n
       
  1315 						\t 1. KErrArgument\n
       
  1316 						\t 2. KErrNotSupported\n
       
  1317 						\t 3. KErrInUse\n
       
  1318 						\t 4. KErrArgument\n
       
  1319 						\t 5. KErrNotSupported\n
       
  1320 						\t 6. KErrOverflow\n
       
  1321 @SYMTestStatus			Implemented 
       
  1322  */	
       
  1323 void CTSgImageGeneric::TestCreateImageInvalidL()
       
  1324 	{
       
  1325 	TestOpenDriverL();
       
  1326 	RSgImage image;
       
  1327 	
       
  1328 	//invalid info 1 - invalid size
       
  1329 	TSgImageInfo info1;
       
  1330 	info1.iSizeInPixels = TSize(-100, 100);
       
  1331 	TEST(KErrArgument == image.Create(info1, NULL, 0));
       
  1332 	
       
  1333 	//invalid info 2 - const image with writable cpu access flag
       
  1334 	info1.iUsage = ESgUsageDirectGdiSource;
       
  1335 	info1.iCpuAccess = ESgCpuAccessReadWrite;
       
  1336 	TEST(KErrArgument == image.Create(info1, NULL, 0));
       
  1337 	
       
  1338 	//invalid info 3 - the image is used as a screen source but screen id is set to -1
       
  1339 	info1.iUsage = ESgUsageScreenSource;
       
  1340 	info1.iScreenId = KSgScreenIdAny;
       
  1341 	TEST(KErrArgument == image.Create(info1, NULL, 0));
       
  1342 	
       
  1343 	//invalid info 4 - incorrect user attribute count
       
  1344 	info1.iScreenId = KSgScreenIdMain;
       
  1345 	TSgUserAttribute KTestAttributes[] = {{0x00008888, 1}, {0x00009999, 2}};
       
  1346 	info1.iUserAttributes = KTestAttributes;
       
  1347 	info1.iUserAttributeCount = 0;
       
  1348 	TEST(KErrArgument == image.Create(info1, NULL, 0));
       
  1349 	
       
  1350 	//unsupported info 1 - unsupported pixel format
       
  1351 	TSgImageInfo info2;
       
  1352 	info2.iSizeInPixels = TSize(10, 10);
       
  1353 	info2.iUsage = ESgUsageDirectGdiTarget;
       
  1354 	info2.iPixelFormat = EUidPixelFormatAP_88;
       
  1355 	TEST(KErrNotSupported == image.Create(info2, NULL, 0));
       
  1356 
       
  1357 	//unsupported info 2 - usage set to screen source and size is not the same as screen size
       
  1358 	info2.iUsage = ESgUsageScreenSource|ESgUsageDirectGdiTarget;
       
  1359 	info2.iSizeInPixels = TSize(9999, 8888);
       
  1360 	TEST(KErrNotSupported == image.Create(info2, NULL, 0));
       
  1361 
       
  1362 #ifdef __WINS__
       
  1363 	TSize screenSize;
       
  1364 	if(HAL::Get(info2.iScreenId, HALData::EDisplayXPixels, screenSize.iWidth) == KErrNone
       
  1365 		&& HAL::Get(info2.iScreenId, HALData::EDisplayYPixels, screenSize.iHeight) == KErrNone)
       
  1366 		{
       
  1367 		info2.iUsage = ESgUsageScreenSource;
       
  1368 		info2.iScreenId = KSgScreenIdMain;
       
  1369 		info2.iCpuAccess = ESgCpuAccessReadWrite;
       
  1370 		info2.iSizeInPixels = TSize(screenSize.iWidth + 10, screenSize.iHeight);
       
  1371 		TEST(KErrNotSupported == image.Create(info2, NULL, 0));
       
  1372 		
       
  1373 		info2.iSizeInPixels = TSize(screenSize.iWidth, screenSize.iHeight + 10);
       
  1374 		TEST(KErrNotSupported == image.Create(info2, NULL, 0));
       
  1375 		
       
  1376 		info2.iSizeInPixels = TSize(screenSize.iHeight, screenSize.iWidth + 10);
       
  1377 		TEST(KErrNotSupported == image.Create(info2, NULL, 0));
       
  1378 		}	
       
  1379 #endif
       
  1380 	
       
  1381 	//non-null handle
       
  1382 	CreateImageL(image);
       
  1383 	CleanupClosePushL(image);
       
  1384 	TSgImageInfo info3;
       
  1385 	info3.iSizeInPixels = TSize(8, 8);
       
  1386 	info3.iUsage = ESgUsageDirectGdiSource;
       
  1387 	info3.iPixelFormat = EUidPixelFormatRGB_565;
       
  1388 	info3.iCpuAccess = ESgCpuAccessReadWrite;
       
  1389 	TInt ret = image.Create(info3, NULL, 0);	
       
  1390 	TEST(KErrInUse == ret);
       
  1391 	
       
  1392 	//non-null handle: create from an existing image
       
  1393 	RSgImage image1;
       
  1394 	CreateImageL(image1);
       
  1395 	CleanupClosePushL(image1);
       
  1396 	TEST(KErrInUse == image1.Create(info3, image));
       
  1397 	CleanupStack::PopAndDestroy();
       
  1398 	
       
  1399 	//null existing image handle
       
  1400 	RSgImage image2;
       
  1401 	TEST(image2.IsNull());
       
  1402 	TEST(KErrArgument == image1.Create(info3, image2));
       
  1403 		
       
  1404 	//the size and pixel format in TSgImageInfo is not the same as that of aSgImage
       
  1405 	TSgImageInfo info4;
       
  1406 	info4.iSizeInPixels = TSize(100, 100);
       
  1407 	info4.iUsage = ESgUsageDirectGdiSource;
       
  1408 	info4.iCpuAccess = ESgCpuAccessReadWrite;
       
  1409 	TEST(KErrNotSupported == image1.Create(info4, image));
       
  1410 	
       
  1411 	info4.iSizeInPixels = info3.iSizeInPixels;
       
  1412 	info4.iPixelFormat = EUidPixelFormatXRGB_8888;
       
  1413 	TEST(KErrNotSupported == image1.Create(info4, image));
       
  1414 	
       
  1415 	//number of iUserAttributes more than KMaxHint(8)
       
  1416 	TSgImageInfo info5;
       
  1417 	info5.iSizeInPixels = TSize(100, 100);
       
  1418 	info5.iPixelFormat = EUidPixelFormatRGB_565;
       
  1419 	info5.iCpuAccess = ESgCpuAccessNone;
       
  1420 	info5.iUsage = ESgUsageDirectGdiTarget;
       
  1421 	info5.iShareable = ETrue;
       
  1422 	TSgUserAttribute testAttributes[] = {{0x00008888, 1}, {0x00009999, 2}};
       
  1423 	info5.iUserAttributes = testAttributes;
       
  1424 	info5.iUserAttributeCount = 100;	
       
  1425 	CheckErrorL(KErrOverflow, image1.Create(info5, NULL, 0), (TText8*)__FILE__, __LINE__);
       
  1426 	
       
  1427 	CleanupStack::PopAndDestroy(&image);
       
  1428 	TestCloseDriver();
       
  1429 	}
       
  1430 
       
  1431 /**
       
  1432 @SYMTestCaseID			GRAPHICS-RESOURCE-0039
       
  1433 @SYMTestCaseDesc		Calls GetInfo() on an invalid image.
       
  1434 @SYMPREQ				PREQ39
       
  1435 @SYMREQ					REQ8809
       
  1436 @SYMREQ					REQ9175
       
  1437 @SYMREQ					REQ9224 
       
  1438 @SYMREQ					REQ9233  
       
  1439 @SYMREQ					REQ9234
       
  1440 @SYMFssID				RSgImage::GetInfo(TSgImageInfo&)
       
  1441 @SYMTestPriority		Critical
       
  1442 @SYMTestType			Unit Test
       
  1443 @SYMTestPurpose			To check the correct error is returned when the client tries to get 
       
  1444 						information on an invalid image.
       
  1445 @SYMTestActions			Initialise the graphics resource component. Call GetInfo on an image:\n
       
  1446 						\t 1. that is not initialised\n
       
  1447 						\t 2. TSgImageInfo has different user attributes Ids from the existing Ids.
       
  1448 @SYMTestExpectedResults	The function should return:\n
       
  1449 						\t 1. KErrBadHandle\n
       
  1450 						\t 2. KErrNotFound or KErrArgument
       
  1451 @SYMTestStatus			Implemented 
       
  1452  */	
       
  1453 void CTSgImageGeneric::TestGetInfoInvalidImageL()
       
  1454 	{
       
  1455 	TestOpenDriverL();	
       
  1456 	RSgImage image;
       
  1457 	TSgImageInfo info;
       
  1458 	
       
  1459 	//uninitialised image
       
  1460 	TEST(KErrBadHandle == image.GetInfo(info));
       
  1461 	
       
  1462 	//TSgImageInfo has different user attributes Ids from the existing Ids.
       
  1463 	info.iPixelFormat = EUidPixelFormatRGB_565;
       
  1464 	info.iSizeInPixels = TSize(100, 100);
       
  1465 	info.iUsage = ESgUsageDirectGdiTarget;
       
  1466 	TSgUserAttribute testAttributes[] = {{0x00008888, 1}, {0x00009999, 2}};
       
  1467 	info.iUserAttributes = testAttributes;
       
  1468 	info.iUserAttributeCount = 2;
       
  1469 	CheckErrorL(KErrNone, image.Create(info, NULL, 0), (TText8*)__FILE__, __LINE__);
       
  1470 	CleanupClosePushL(image);
       
  1471 	TSgImageInfo info2;
       
  1472 	TSgUserAttribute testAttributes2[1];
       
  1473 	info2.iUserAttributes = testAttributes2;
       
  1474 	info2.iUserAttributes[0].iUid = TUid::Uid(0x11111111);
       
  1475 	info2.iUserAttributeCount = 1;
       
  1476 	TInt result = image.GetInfo(info2);
       
  1477 	TEST(KErrNotFound == result || KErrArgument == result);
       
  1478 	TEST(!CompareInfos(info, info2));
       
  1479 	
       
  1480 	CleanupStack::PopAndDestroy();
       
  1481 	TestCloseDriver();
       
  1482 	}
       
  1483 
       
  1484 /**
       
  1485 @SYMTestCaseID			GRAPHICS-RESOURCE-0030
       
  1486 @SYMTestCaseDesc		Maps an image under various invalid conditions. 
       
  1487 @SYMPREQ				PREQ39
       
  1488 @SYMREQ					REQ8809
       
  1489 @SYMREQ					REQ9175
       
  1490 @SYMREQ					REQ9193
       
  1491 @SYMREQ					REQ9224 
       
  1492 @SYMREQ					REQ9233  
       
  1493 @SYMREQ					REQ9234
       
  1494 @SYMFssID				RSgImage::MapReadOnly(const TAny*&, TInt&) const\n 
       
  1495 						RSgImage::MapWriteOnly(TAny*&, TInt&)\n 
       
  1496 						RSgImage::MapReadWrite(TAny*&, TInt&)
       
  1497 @SYMTestPriority		Critical
       
  1498 @SYMTestType			Unit Test
       
  1499 @SYMTestPurpose			To check the correct error messages are returned when different map
       
  1500 						functions are called under various invalid conditions.
       
  1501 @SYMTestActions			Initialise the graphics resource component. \n
       
  1502 						\t 1. call any map function on an uninitialised RSgImage\n
       
  1503 						\t 2. call any map function twice\n
       
  1504 						\t 3. call MapReadOnly() on an RSgImage created without CPU access
       
  1505 						flag ESgCpuAccessReadOnly or ESgCpuAccessReadWrite\n
       
  1506 						\t 4. call MapWriteOnly() on an RSgImage created without CPU access
       
  1507 						flag ESgCpuAccessWriteOnly or ESgCpuAccessReadWrite\n
       
  1508 						\t 5. call MapReadWrite() on an RSgImage created without CPU access
       
  1509 						flag ESgCpuAccessReadWrite\n
       
  1510 						\t 6. call any map function in a second process
       
  1511 @SYMTestExpectedResults	The function should return:\n
       
  1512 						\t 1. KErrBadHandle\n
       
  1513 						\t 2. KErrInUse\n
       
  1514 						\t 3. KErrAccessDenied\n
       
  1515 						\t 4. KErrAccessDenied\n
       
  1516 						\t 5. KErrAccessDenied\n
       
  1517 						\t 6. KErrPermissionDenied
       
  1518 @SYMTestStatus			Implemented 
       
  1519  */	
       
  1520 void CTSgImageGeneric::TestMapImageInvalidL()
       
  1521 	{
       
  1522 	TestOpenDriverL();
       
  1523 	RSgImage image;
       
  1524 	const TAny* dataAddressRead;
       
  1525 	TAny* dataAddressWrite;
       
  1526 	TInt dataStride;
       
  1527 	
       
  1528 	//an uninitialised image
       
  1529 	TEST(KErrBadHandle == image.MapReadOnly(dataAddressRead, dataStride));
       
  1530 	TEST(KErrBadHandle == image.MapWriteOnly(dataAddressWrite, dataStride));
       
  1531 	TEST(KErrBadHandle == image.MapReadWrite(dataAddressWrite, dataStride));
       
  1532 	
       
  1533 	//map twice
       
  1534 	RSgImage image1;
       
  1535 	CreateImageL(image1);
       
  1536 	CleanupClosePushL(image1);
       
  1537 	TEST(KErrNone == image1.MapReadOnly(dataAddressRead, dataStride));
       
  1538 	TEST(KErrInUse == image1.MapReadOnly(dataAddressRead, dataStride));
       
  1539 	TEST(KErrNone == image1.Unmap());
       
  1540 	
       
  1541 	TEST(KErrNone == image1.MapWriteOnly(dataAddressWrite, dataStride));
       
  1542 	TEST(KErrInUse == image1.MapWriteOnly(dataAddressWrite, dataStride));
       
  1543 	TEST(KErrNone == image1.Unmap());
       
  1544 	
       
  1545 	TEST(KErrNone == image1.MapReadWrite(dataAddressWrite, dataStride));
       
  1546 	TEST(KErrInUse == image1.MapReadWrite(dataAddressWrite, dataStride));
       
  1547 	TEST(KErrNone == image1.Unmap());
       
  1548 	
       
  1549 	CleanupStack::PopAndDestroy();	
       
  1550 	
       
  1551 	//  Initialise image
       
  1552 	TSgImageInfo info;
       
  1553 	info.iSizeInPixels = TSize(8, 8);
       
  1554 	info.iUsage = ESgUsageDirectGdiSource;
       
  1555 	info.iPixelFormat = EUidPixelFormatRGB_565;
       
  1556 	info.iCpuAccess = ESgCpuAccessReadWrite;
       
  1557 	info.iShareable = ETrue;
       
  1558 	CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
  1559 	CleanupClosePushL(image);
       
  1560 	TEST(KErrNone == image.MapReadWrite(dataAddressWrite, dataStride)); //first time should pass
       
  1561 	TEST(KErrInUse == image.MapReadWrite(dataAddressWrite, dataStride)); //second time should fail
       
  1562 	TEST(KErrNone == image.Unmap());
       
  1563 	image.Close();
       
  1564 	
       
  1565 	//call MapReadOnly() on an RSgImage created without CPU access
       
  1566 	//flag ESgCpuAccessReadOnly or ESgCpuAccessReadWrite
       
  1567 	info.iCpuAccess = ESgCpuAccessNone;
       
  1568 	CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
  1569 	TEST(KErrAccessDenied == image.MapReadOnly(dataAddressRead, dataStride));
       
  1570 	image.Close();
       
  1571 	
       
  1572 	info.iCpuAccess = ESgCpuAccessWriteOnly;
       
  1573 	CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
  1574 	TEST(KErrAccessDenied == image.MapReadOnly(dataAddressRead, dataStride));
       
  1575 	image.Close();
       
  1576 	
       
  1577 	//call MapWriteOnly() on an RSgImage created without CPU access
       
  1578 	//flag ESgCpuAccessWriteOnly or ESgCpuAccessReadWrite
       
  1579 	info.iCpuAccess = ESgCpuAccessNone;
       
  1580 	CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
  1581 	TEST(KErrAccessDenied == image.MapWriteOnly(dataAddressWrite, dataStride));
       
  1582 	image.Close();
       
  1583 	
       
  1584 	info.iCpuAccess = ESgCpuAccessReadOnly;
       
  1585 	CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
  1586 	TEST(KErrAccessDenied == image.MapWriteOnly(dataAddressWrite, dataStride));
       
  1587 	image.Close();
       
  1588 	
       
  1589 	//call MapReadWrite() on an RSgImage created without CPU access
       
  1590 	//flag ESgCpuAccessReadWrite
       
  1591 	info.iCpuAccess = ESgCpuAccessNone;
       
  1592 	CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
  1593 	TEST(KErrAccessDenied == image.MapReadWrite(dataAddressWrite, dataStride));
       
  1594 	image.Close();
       
  1595 	
       
  1596 	info.iCpuAccess = ESgCpuAccessReadOnly;
       
  1597 	CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
  1598 	TEST(KErrAccessDenied == image.MapReadWrite(dataAddressWrite, dataStride));
       
  1599 	image.Close();
       
  1600 	
       
  1601 	info.iCpuAccess = ESgCpuAccessWriteOnly;
       
  1602 	CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
  1603 	TEST(KErrAccessDenied == image.MapReadWrite(dataAddressWrite, dataStride));
       
  1604 	image.Close();
       
  1605 	
       
  1606 	info.iCpuAccess = ESgCpuAccessReadWrite;
       
  1607 	CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
  1608 	
       
  1609 	//call map in a second thread in the current process - should succeed
       
  1610 	TSgresTestInfo threadInfo = {image.Id(), info, 0, ESgresSecondThreadMapImage};	
       
  1611 	TInt testResult = CreateSecondThreadAndDoTestL(threadInfo);
       
  1612 	User::LeaveIfError(testResult);
       
  1613 	TEST(testResult & EFirstTestPassed);
       
  1614 	TEST(testResult & ESecondTestPassed);
       
  1615 	TEST(testResult & EThirdTestPassed);
       
  1616 	TEST(testResult & EFourthTestPassed);
       
  1617 	TEST(testResult & EFifthTestPassed);
       
  1618 	TEST(testResult & ESixthTestPassed);
       
  1619 	TEST(testResult & ESeventhTestPassed);
       
  1620 	
       
  1621 	//call map in a non-owner process
       
  1622 	TSgresTestInfo processInfo = {image.Id(), info, 0, ESgresSecondProcessMapImage};
       
  1623 	testResult = CreateSecondProcessAndDoTestL(KSecondProcess, processInfo);	
       
  1624 	User::LeaveIfError(testResult);	
       
  1625 	TEST(testResult & EFirstTestPassed);
       
  1626 	TEST(testResult & ESecondTestPassed);
       
  1627 	TEST(testResult & EThirdTestPassed);
       
  1628 	TEST(testResult & EFourthTestPassed);
       
  1629 	TEST(testResult & EFifthTestPassed);
       
  1630 	
       
  1631 	CleanupStack::PopAndDestroy();
       
  1632 	TestCloseDriver();
       
  1633 	}
       
  1634 
       
  1635 /**
       
  1636 @SYMTestCaseID			GRAPHICS-RESOURCE-0031
       
  1637 @SYMTestCaseDesc		Unmaps an image under various invalid conditions.
       
  1638 @SYMPREQ				PREQ39
       
  1639 @SYMREQ					REQ8809
       
  1640 @SYMREQ					REQ9175
       
  1641 @SYMREQ					REQ9193
       
  1642 @SYMREQ					REQ9224 
       
  1643 @SYMREQ					REQ9233  
       
  1644 @SYMREQ					REQ9234
       
  1645 @SYMFssID				RSgImage::MapReadOnly(const TAny*&, TInt&) const\n 
       
  1646 						RSgImage::MapWriteOnly(TAny*&, TInt&)\n 
       
  1647 						RSgImage::MapReadWrite(TAny*&, TInt&)\n 
       
  1648 						RSgImage::Unmap()
       
  1649 @SYMTestPriority		Critical
       
  1650 @SYMTestType			Unit Test
       
  1651 @SYMTestPurpose			To check the correct error messages are returned when the Unmap()
       
  1652 						function is called under various invalid conditions.
       
  1653 @SYMTestActions			Initialise the graphics resource component.\n
       
  1654 						\t 1. call Unmap() on an uninitialised image object\n
       
  1655 						\t 2. create an image with CPU access flag ESgCpuAccessNone and then unmap it\n
       
  1656 						\t 3. call Unmap() on an image that was not mapped.\n
       
  1657 						\t 4. call Unmap() on a mapped image in a second thread in the same process.\n
       
  1658 						\t 5. call Unmap() on an image in a non-owner process
       
  1659 @SYMTestExpectedResults	The function should return:\n
       
  1660 						\t 1. KErrBadHandle\n
       
  1661 						\t 2. KErrGeneral\n
       
  1662 						\t 3. KErrGeneral\n
       
  1663 						\t 4. KErrNone\n
       
  1664 						\t 5. KErrGeneral
       
  1665 @SYMTestStatus			Implemented 
       
  1666  */	
       
  1667 void CTSgImageGeneric::TestUnmapImageInvalidL()
       
  1668 	{
       
  1669 	TestOpenDriverL();
       
  1670 	RSgImage image;
       
  1671 	
       
  1672 	//unitialized image
       
  1673 	TEST(KErrBadHandle == image.Unmap());
       
  1674 	
       
  1675 	//create an image
       
  1676 	TSgImageInfo info;
       
  1677 	info.iSizeInPixels = TSize(8, 8);
       
  1678 	info.iUsage = ESgUsageDirectGdiSource;
       
  1679 	info.iPixelFormat = EUidPixelFormatRGB_565;
       
  1680 	info.iShareable = ETrue;
       
  1681 	info.iCpuAccess = ESgCpuAccessReadWrite;
       
  1682 	const TAny* dataAddressRead;
       
  1683 	TInt dataStride;
       
  1684 	CheckErrorL(KErrNone, image.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
       
  1685 	CleanupClosePushL(image);
       
  1686 	
       
  1687 	//call on an unmapped image
       
  1688 	TEST(KErrGeneral == image.Unmap());
       
  1689 	
       
  1690 	//map in the current thread and try to unmap in another thread in the current process
       
  1691 	//should fail	
       
  1692 	TEST(KErrNone == image.MapReadOnly(dataAddressRead, dataStride));	
       
  1693 	TSgDrawableId id = image.Id();
       
  1694 	TSgImageInfo imageinfo;
       
  1695 	image.GetInfo(imageinfo);
       
  1696 	
       
  1697 	TSgresTestInfo threadInfo = {id, imageinfo, 0, ESgresSecondThreadUnmapImage};
       
  1698 	TInt testResult = CreateSecondThreadAndDoTestL(threadInfo);
       
  1699 	User::LeaveIfError(testResult);
       
  1700 	TEST(testResult & EFirstTestPassed);
       
  1701 	TEST(testResult & ESecondTestPassed);
       
  1702 	
       
  1703 	//image should already be unmapped
       
  1704 	TEST(KErrGeneral == image.Unmap());
       
  1705 	
       
  1706 	//map in the current thread and try to unmap in another process
       
  1707 	//should fail
       
  1708 	TEST(KErrNone == image.MapReadOnly(dataAddressRead, dataStride));	
       
  1709 	TSgresTestInfo processInfo = {id, imageinfo, 0, ESgresSecondProcessUnmapImage};
       
  1710 	testResult = CreateSecondProcessAndDoTestL(KSecondProcess, processInfo);	
       
  1711 	User::LeaveIfError(testResult);
       
  1712 	TEST(testResult & EFirstTestPassed);	
       
  1713 	TEST(testResult & ESecondTestPassed);
       
  1714 	
       
  1715 	//image should still be mapped
       
  1716 	TEST(KErrNone == image.Unmap());
       
  1717 	
       
  1718 	CleanupStack::PopAndDestroy();
       
  1719 	TestCloseDriver();
       
  1720 	}
       
  1721 
       
  1722 /**
       
  1723 @SYMTestCaseID			GRAPHICS-RESOURCE-0048
       
  1724 @SYMTestCaseDesc		RSgImage stress tests
       
  1725 @SYMPREQ				PREQ39
       
  1726 @SYMREQ					REQ8809
       
  1727 @SYMREQ					REQ9175
       
  1728 @SYMREQ					REQ9224 
       
  1729 @SYMREQ					REQ9233  
       
  1730 @SYMREQ					REQ9234
       
  1731 @SYMFssID				RSgImage::Create(const TSgImageInfo&, const TAny*, TInt)\n
       
  1732 						RSgImage::Close() 
       
  1733 @SYMTestPriority		Critical
       
  1734 @SYMTestType			Unit Test
       
  1735 @SYMTestPurpose			To ensure creating and destroying RSgImage multiple times work well.
       
  1736 @SYMTestActions			Create images 1000 times but only store KMaxImagesInArray of them 
       
  1737 						at one time in an RArray. When a new image is to be added to the 
       
  1738 						array, a random image from the array is removed.
       
  1739 @SYMTestExpectedResults	There should be no panics or leaves.
       
  1740 @SYMTestStatus			Implemented 
       
  1741  */
       
  1742 void CTSgImageGeneric::TestStress1L()
       
  1743 	{
       
  1744 	TestOpenDriverL();
       
  1745 	TSgImageInfo info;
       
  1746 	info.iPixelFormat = EUidPixelFormatRGB_565;
       
  1747 	info.iSizeInPixels = TSize(100, 100);
       
  1748 	info.iUsage = ESgUsageDirectGdiTarget;
       
  1749 	
       
  1750 	TInt KMaxImagesInArray =40;
       
  1751 	TInt64 seed = 0;
       
  1752 	for (TInt count = 1000; count > 0; --count)
       
  1753 		{
       
  1754 		RSgImage image;
       
  1755 		CheckErrorL(KErrNone, image.Create(info, NULL, 0), (TText8*)__FILE__, __LINE__);
       
  1756 		CleanupClosePushL(image);
       
  1757 		iTestImages.AppendL(image);
       
  1758 		CleanupStack::Pop();
       
  1759 		if (iTestImages.Count() >= KMaxImagesInArray)
       
  1760 			{
       
  1761 			TInt i = Math::Rand(seed) % KMaxImagesInArray;
       
  1762 			iTestImages[i].Close();
       
  1763 			iTestImages.Remove(i);
       
  1764 			}
       
  1765 		}
       
  1766 	TInt count = iTestImages.Count();
       
  1767 	for(TInt i=0; i<count; ++i)
       
  1768 		{
       
  1769 		iTestImages[i].Close();
       
  1770 		}	
       
  1771 	iTestImages.Reset();
       
  1772 	TestCloseDriver();
       
  1773 	}
       
  1774 
       
  1775 /**
       
  1776 @SYMTestCaseID			GRAPHICS-RESOURCE-0049
       
  1777 @SYMTestCaseDesc		RSgImage multiple threads open and close stress tests
       
  1778 @SYMPREQ				PREQ39
       
  1779 @SYMREQ					REQ8809
       
  1780 @SYMREQ					REQ9175
       
  1781 @SYMREQ					REQ9224 
       
  1782 @SYMREQ					REQ9233  
       
  1783 @SYMREQ					REQ9234
       
  1784 @SYMFssID				RSgImage::Open(const TSgDrawableId&)\n
       
  1785 						RSgImage::Close() 
       
  1786 @SYMTestPriority		Critical
       
  1787 @SYMTestType			Unit Test
       
  1788 @SYMTestPurpose			To ensure opening and destroying RSgImage multiple times and randomly
       
  1789 						in other threads work well.
       
  1790 @SYMTestActions			Create an image in the main thread. In a loop of 1000 times, randomly select
       
  1791 						one of the five threads and either open or close the image depending on the 
       
  1792 						state of the thread.
       
  1793 @SYMTestExpectedResults	There should be no panics or leaves.
       
  1794 @SYMTestStatus			Implemented 
       
  1795  */
       
  1796 void CTSgImageGeneric::TestStress2L()
       
  1797 	{
       
  1798 	TestOpenDriverL();
       
  1799 	RSgImage image;
       
  1800 	CreateImageL(image);
       
  1801 	CleanupClosePushL(image);
       
  1802 	const TSgDrawableId id = image.Id();
       
  1803 	
       
  1804 	TSgImageInfo info;
       
  1805 	TEST(KErrNone == image.GetInfo(info));
       
  1806 	TSgresTestInfo threadInfo = {id, info, 0, ESgresMultipleThreadStressTest, EFalse};
       
  1807 	
       
  1808 	//create a semaphore
       
  1809 	RSemaphore sem;
       
  1810 	User::LeaveIfError(sem.CreateGlobal(KSecondThreadSemaphore, 0, EOwnerThread));
       
  1811 	CleanupClosePushL(sem);
       
  1812 	
       
  1813 	//create threads
       
  1814 	const TInt KNoOfThreads = 5;
       
  1815 	RArray<RThread> threads;
       
  1816 	_LIT(KMultipleThreadName, "Multiple Threads Stress Test Thread ");
       
  1817 	for (TInt i = 0; i < KNoOfThreads; ++i)
       
  1818 		{
       
  1819 		TBuf<50> threadName(KMultipleThreadName);
       
  1820 		threadName.AppendNum(i);
       
  1821 		RThread thread;
       
  1822 		User::LeaveIfError(thread.Create(threadName, SecondThreadStart, KDefaultStackSize, &User::Heap(), &threadInfo));
       
  1823 		thread.SetPriority(EPriorityLess);
       
  1824 		threads.AppendL(thread);
       
  1825 		}
       
  1826 	// run threads
       
  1827 	for (TInt i = 0; i < KNoOfThreads; ++i)
       
  1828 		{
       
  1829 		threads[i].Resume();
       
  1830 		}
       
  1831 	// wait for the threads to terminate processing
       
  1832 	for (TInt i = 0; i < KNoOfThreads; ++i)
       
  1833 		{
       
  1834 		sem.Wait();
       
  1835 		}
       
  1836 	for (TInt i = 0; i < KNoOfThreads; ++i)
       
  1837 		{
       
  1838 		threads[i].Close();
       
  1839 		}
       
  1840 	CleanupStack::PopAndDestroy(2); // image, sem
       
  1841 	TestCloseDriver();
       
  1842 	}
       
  1843 
       
  1844 /**
       
  1845 @SYMTestCaseID			GRAPHICS-RESOURCE-0051
       
  1846 @SYMTestCaseDesc		Calls RSgImage::GetInterface() with an invalid image handle
       
  1847 @SYMPREQ				PREQ39
       
  1848 @SYMREQ					REQ8809
       
  1849 @SYMREQ					REQ9175
       
  1850 @SYMFssID				RSgImage::GetInterface(TUid, TAny*&)\n 
       
  1851 @SYMTestPriority		Critical
       
  1852 @SYMTestType			Unit Test
       
  1853 @SYMTestPurpose			To ensure calling GetInterface() with an invalid image handle will cause a panic.
       
  1854 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  1855 						Declare another image and assign it to the current image handle. Close the current
       
  1856 						image so the second image handle becomes invalid. Call GetInterface() on the second
       
  1857 						handle.
       
  1858 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 2(ESgPanicBadDrawableHandle).
       
  1859 @SYMTestStatus			Implemented 
       
  1860  */
       
  1861 void CTSgImageGeneric::TestPanicImageGetInterfaceInvalidHandleL()
       
  1862 	{
       
  1863 	TSgImageInfo info;
       
  1864 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageGetInterfaceInvalidHandle, ETrue};
       
  1865  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1866 	_LIT(KTestName, "TestImageGetInterfaceInvalidHandleLThread");
       
  1867  	CreateSecondThreadAndCheckPanicL(threadInfo, 2, exitCategoryName, KTestName);
       
  1868 	}
       
  1869 
       
  1870 /**
       
  1871 @SYMTestCaseID			GRAPHICS-RESOURCE-0052
       
  1872 @SYMTestCaseDesc		Calls RSgImage::GetInterface() with a non-null handle and an uninitialised driver
       
  1873 @SYMPREQ				PREQ39
       
  1874 @SYMREQ					REQ8809
       
  1875 @SYMREQ					REQ9175
       
  1876 @SYMFssID				RSgImage::GetInterface(TUid, TAny*&)\n 
       
  1877 @SYMTestPriority		Critical
       
  1878 @SYMTestType			Unit Test
       
  1879 @SYMTestPurpose			To ensure calling GetInterface() with a non-null handle and an uninitialised driver will cause a panic.
       
  1880 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  1881 						Declare another image and assign it to the current image handle. Close the current
       
  1882 						image so the second image handle becomes invalid. Close the graphics resource driver.
       
  1883 						Call GetInterface() on the second handle.
       
  1884 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  1885 @SYMTestStatus			Implemented 
       
  1886  */
       
  1887 void CTSgImageGeneric::TestPanicImageGetInterfaceNoDriverL()
       
  1888 	{	
       
  1889 	TSgImageInfo info;
       
  1890 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageGetInterfaceNoDriver, ETrue};
       
  1891  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1892 	_LIT(KTestName, "TestImageGetInterfaceNoDriverL");
       
  1893  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  1894 	}
       
  1895 
       
  1896 /**
       
  1897 @SYMTestCaseID			GRAPHICS-RESOURCE-0053
       
  1898 @SYMTestCaseDesc		Calls RSgImage::Close() with an invalid image handle
       
  1899 @SYMPREQ				PREQ39
       
  1900 @SYMREQ					REQ8809
       
  1901 @SYMREQ					REQ9175
       
  1902 @SYMFssID				RSgImage::Close()\n 
       
  1903 @SYMTestPriority		Critical
       
  1904 @SYMTestType			Unit Test
       
  1905 @SYMTestPurpose			To ensure calling Close() with an invalid image handle will cause a panic.
       
  1906 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  1907 						Declare another image and assign it to the current image handle. Close the current
       
  1908 						image so the second image handle becomes invalid. Call Close() on the second handle.
       
  1909 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 2(ESgPanicBadDrawableHandle).
       
  1910 @SYMTestStatus			Implemented 
       
  1911  */
       
  1912 void CTSgImageGeneric::TestPanicImageCloseInvalidHandleL()
       
  1913 	{
       
  1914 	TSgImageInfo info;
       
  1915 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCloseInvalidHandle, ETrue};
       
  1916  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1917 	_LIT(KTestName, "TestImageCloseInvalidHandleL");
       
  1918  	CreateSecondThreadAndCheckPanicL(threadInfo, 2, exitCategoryName, KTestName);
       
  1919 	}
       
  1920 
       
  1921 /**
       
  1922 @SYMTestCaseID			GRAPHICS-RESOURCE-0054
       
  1923 @SYMTestCaseDesc		Calls RSgImage::Close() with a non-null handle and an uninitialised driver
       
  1924 @SYMPREQ				PREQ39
       
  1925 @SYMREQ					REQ8809
       
  1926 @SYMREQ					REQ9175
       
  1927 @SYMFssID				RSgImage::Close()\n 
       
  1928 @SYMTestPriority		Critical
       
  1929 @SYMTestType			Unit Test
       
  1930 @SYMTestPurpose			To ensure calling Close() with a non-null handle and an uninitialised driver will cause a panic.
       
  1931 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  1932 						Declare another image and assign it to the current image handle. Close the current
       
  1933 						image so the second image handle becomes invalid. Close the graphics resource driver.
       
  1934 						Call Close() on the second handle.
       
  1935 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  1936 @SYMTestStatus			Implemented 
       
  1937  */
       
  1938 void CTSgImageGeneric::TestPanicImageCloseNoDriverL()
       
  1939 	{
       
  1940 	TSgImageInfo info;
       
  1941 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCloseNoDriver, ETrue};
       
  1942  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1943 	_LIT(KTestName, "TestImageCloseNoDriverL");
       
  1944  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  1945 	}
       
  1946 
       
  1947 /**
       
  1948 @SYMTestCaseID			GRAPHICS-RESOURCE-0055
       
  1949 @SYMTestCaseDesc		Calls RSgImage::Id() with an invalid image handle
       
  1950 @SYMPREQ				PREQ39
       
  1951 @SYMREQ					REQ8809
       
  1952 @SYMREQ					REQ9175
       
  1953 @SYMFssID				RSgImage::Id()\n 
       
  1954 @SYMTestPriority		Critical
       
  1955 @SYMTestType			Unit Test
       
  1956 @SYMTestPurpose			To ensure calling Id() with an invalid image handle will cause a panic.
       
  1957 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  1958 						Declare another image and assign it to the current image handle. Close the current
       
  1959 						image so the second image handle becomes invalid. Call Id() on the second
       
  1960 						handle.
       
  1961 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 2(ESgPanicBadDrawableHandle).
       
  1962 @SYMTestStatus			Implemented 
       
  1963  */
       
  1964 void CTSgImageGeneric::TestPanicImageIdInvalidHandleL()
       
  1965 	{
       
  1966 	TSgImageInfo info;
       
  1967 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageIdInvalidHandle, ETrue};
       
  1968  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1969 	_LIT(KTestName, "TestImageIdInvalidHandleL");
       
  1970  	CreateSecondThreadAndCheckPanicL(threadInfo, 2, exitCategoryName, KTestName);
       
  1971 	}
       
  1972 
       
  1973 /**
       
  1974 @SYMTestCaseID			GRAPHICS-RESOURCE-0056
       
  1975 @SYMTestCaseDesc		Calls RSgImage::Id() with a non-null handle and an uninitialised driver
       
  1976 @SYMPREQ				PREQ39
       
  1977 @SYMREQ					REQ8809
       
  1978 @SYMREQ					REQ9175
       
  1979 @SYMFssID				RSgImage::Id()\n 
       
  1980 @SYMTestPriority		Critical
       
  1981 @SYMTestType			Unit Test
       
  1982 @SYMTestPurpose			To ensure calling Id() with a non-null handle and an uninitialised driver will cause a panic.
       
  1983 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  1984 						Declare another image and assign it to the current image handle. Close the current
       
  1985 						image so the second image handle becomes invalid. Close the graphics resource driver.
       
  1986 						Call Id() on the second handle.
       
  1987 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  1988 @SYMTestStatus			Implemented 
       
  1989  */
       
  1990 void CTSgImageGeneric::TestPanicImageIdNoDriverL()
       
  1991 	{
       
  1992 	TSgImageInfo info;
       
  1993 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageIdNoDriver, ETrue};
       
  1994  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  1995 	_LIT(KTestName, "TestImageIdNoDriverL");
       
  1996  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  1997 	}
       
  1998 
       
  1999 /**
       
  2000 @SYMTestCaseID			GRAPHICS-RESOURCE-0057
       
  2001 @SYMTestCaseDesc		Calls RSgImage::Create() with an invalid image handle
       
  2002 @SYMPREQ				PREQ39
       
  2003 @SYMREQ					REQ8809
       
  2004 @SYMREQ					REQ9175
       
  2005 @SYMREQ					REQ9192
       
  2006 @SYMFssID				RSgImage::Create(const TSgImageInfo&, const RSgImage&)\n 
       
  2007 @SYMTestPriority		Critical
       
  2008 @SYMTestType			Unit Test
       
  2009 @SYMTestPurpose			To ensure calling Create() with an invalid image handle will cause a panic.
       
  2010 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  2011 						Declare another image and assign it to the current image handle. Close the current
       
  2012 						image so the second image handle becomes invalid. Call Create() on the second
       
  2013 						handle.
       
  2014 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 2(ESgPanicBadDrawableHandle).
       
  2015 @SYMTestStatus			Implemented 
       
  2016  */
       
  2017 void CTSgImageGeneric::TestPanicImageCreateInvalidHandleL()
       
  2018 	{
       
  2019 	TSgImageInfo info;
       
  2020 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCreateInvalidHandle, ETrue};
       
  2021  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2022 	_LIT(KTestName, "TestImageCreateInvalidHandleL");
       
  2023  	CreateSecondThreadAndCheckPanicL(threadInfo, 3, exitCategoryName, KTestName);
       
  2024 	}
       
  2025 
       
  2026 /**
       
  2027 @SYMTestCaseID			GRAPHICS-RESOURCE-0058
       
  2028 @SYMTestCaseDesc		Calls RSgImage::GetInfo() with an invalid image handle
       
  2029 @SYMPREQ				PREQ39
       
  2030 @SYMREQ					REQ8809
       
  2031 @SYMREQ					REQ9175
       
  2032 @SYMFssID				RSgImage::GetInfo(TSgImageInfo&)\n 
       
  2033 @SYMTestPriority		Critical
       
  2034 @SYMTestType			Unit Test
       
  2035 @SYMTestPurpose			To ensure calling GetInfo() with an invalid image handle will cause a panic.
       
  2036 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  2037 						Declare another image and assign it to the current image handle. Close the current
       
  2038 						image so the second image handle becomes invalid. Call GetInfo() on the second
       
  2039 						handle.
       
  2040 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 2(ESgPanicBadDrawableHandle).
       
  2041 @SYMTestStatus			Implemented 
       
  2042  */
       
  2043 void CTSgImageGeneric::TestPanicImageGetInfoInvalidHandleL()
       
  2044 	{
       
  2045 	TSgImageInfo info;
       
  2046 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageGetInfoInvalidHandle, ETrue};
       
  2047  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2048 	_LIT(KTestName, "TestImageGetInfoInvalidHandleL");
       
  2049  	CreateSecondThreadAndCheckPanicL(threadInfo, 3, exitCategoryName, KTestName);
       
  2050 	}
       
  2051 
       
  2052 /**
       
  2053 @SYMTestCaseID			GRAPHICS-RESOURCE-0059
       
  2054 @SYMTestCaseDesc		Calls RSgImage::GetInfo() with a non-null handle and an uninitialised driver
       
  2055 @SYMPREQ				PREQ39
       
  2056 @SYMREQ					REQ8809
       
  2057 @SYMREQ					REQ9175
       
  2058 @SYMFssID				SgImage::GetInfo(TSgImageInfo&)\n 
       
  2059 @SYMTestPriority		Critical
       
  2060 @SYMTestType			Unit Test
       
  2061 @SYMTestPurpose			To ensure calling GetInfo() with a non-null handle and an uninitialised driver will cause a panic.
       
  2062 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  2063 						Declare another image and assign it to the current image handle. Close the current
       
  2064 						image so the second image handle becomes invalid. Close the graphics resource driver.
       
  2065 						Call GetInfo() on the second handle.
       
  2066 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  2067 @SYMTestStatus			Implemented 
       
  2068  */
       
  2069 void CTSgImageGeneric::TestPanicImageGetInfoNoDriverL()
       
  2070 	{
       
  2071 	TSgImageInfo info;
       
  2072 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageGetInfoNoDriver, ETrue};
       
  2073  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2074 	_LIT(KTestName, "TestImageGetInfoNoDriverL");
       
  2075  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  2076 	}
       
  2077 
       
  2078 /**
       
  2079 @SYMTestCaseID			GRAPHICS-RESOURCE-0060
       
  2080 @SYMTestCaseDesc		Calls RSgImage::MapReadOnly with an invalid image handle
       
  2081 @SYMPREQ				PREQ39
       
  2082 @SYMREQ					REQ8809
       
  2083 @SYMREQ					REQ9175
       
  2084 @SYMREQ					REQ9193
       
  2085 @SYMFssID				RSgImage::MapReadOnly(const TAny*&, TInt&) const\n 
       
  2086 @SYMTestPriority		Critical
       
  2087 @SYMTestType			Unit Test
       
  2088 @SYMTestPurpose			To ensure calling MapReadOnly() with an invalid image handle will cause a panic.
       
  2089 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  2090 						Declare another image and assign it to the current image handle. Close the current
       
  2091 						image so the second image handle becomes invalid. Call MapReadOnly() on the second
       
  2092 						handle.
       
  2093 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 2(ESgPanicBadDrawableHandle).
       
  2094 @SYMTestStatus			Implemented 
       
  2095  */
       
  2096 void CTSgImageGeneric::TestPanicImageMapReadOnlyInvalidHandleL()
       
  2097 	{
       
  2098 	TSgImageInfo info;
       
  2099 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageMapReadOnlyInvalidHandle, ETrue};
       
  2100  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2101 	_LIT(KTestName, "TestImageMapReadOnlyInvalidHandleL");
       
  2102  	CreateSecondThreadAndCheckPanicL(threadInfo, 3, exitCategoryName, KTestName);
       
  2103 	}
       
  2104 
       
  2105 /**
       
  2106 @SYMTestCaseID			GRAPHICS-RESOURCE-0061
       
  2107 @SYMTestCaseDesc		Calls RSgImage::MapReadOnly with a non-null handle and an uninitialised driver
       
  2108 @SYMPREQ				PREQ39
       
  2109 @SYMREQ					REQ8809
       
  2110 @SYMREQ					REQ9175
       
  2111 @SYMREQ					REQ9193
       
  2112 @SYMFssID				RSgImage::MapReadOnly(const TAny*&, TInt&) const\n 
       
  2113 @SYMTestPriority		Critical
       
  2114 @SYMTestType			Unit Test
       
  2115 @SYMTestPurpose			To ensure calling MapReadOnly() with a non-null handle and an uninitialised driver will cause a panic.
       
  2116 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  2117 						Declare another image and assign it to the current image handle. Close the current
       
  2118 						image so the second image handle becomes invalid. Close the graphics resource driver.
       
  2119 						Call MapReadOnly() on the second handle.
       
  2120 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  2121 @SYMTestStatus			Implemented 
       
  2122  */
       
  2123 void CTSgImageGeneric::TestPanicImageMapReadOnlyNoDriverL()
       
  2124 	{
       
  2125 	TSgImageInfo info;
       
  2126 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageMapReadOnlyNoDriver, ETrue};
       
  2127  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2128 	_LIT(KTestName, "TestImageMapReadOnlyNoDriverL");
       
  2129  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  2130 	}
       
  2131 
       
  2132 /**
       
  2133 @SYMTestCaseID			GRAPHICS-RESOURCE-0062
       
  2134 @SYMTestCaseDesc		Calls RSgImage::MapWriteOnly() with an invalid image handle
       
  2135 @SYMPREQ				PREQ39
       
  2136 @SYMREQ					REQ8809
       
  2137 @SYMREQ					REQ9175
       
  2138 @SYMREQ					REQ9193
       
  2139 @SYMFssID				RSgImage::MapWriteOnly(TAny*&, TInt&)\n 
       
  2140 @SYMTestPriority		Critical
       
  2141 @SYMTestType			Unit Test
       
  2142 @SYMTestPurpose			To ensure calling MapWriteOnly() with an invalid image handle will cause a panic.
       
  2143 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  2144 						Declare another image and assign it to the current image handle. Close the current
       
  2145 						image so the second image handle becomes invalid. Call MapWriteOnly() on the second
       
  2146 						handle.
       
  2147 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 2(ESgPanicBadDrawableHandle).
       
  2148 @SYMTestStatus			Implemented 
       
  2149  */
       
  2150 void CTSgImageGeneric::TestPanicImageMapWriteOnlyInvalidHandleL()
       
  2151 	{
       
  2152 	TSgImageInfo info;
       
  2153 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageMapWriteOnlyInvalidHandle, ETrue};
       
  2154  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2155 	_LIT(KTestName, "TestImageMapWriteOnlyInvalidHandleL");
       
  2156  	CreateSecondThreadAndCheckPanicL(threadInfo, 3, exitCategoryName, KTestName);
       
  2157 	}
       
  2158 
       
  2159 /**
       
  2160 @SYMTestCaseID			GRAPHICS-RESOURCE-0063
       
  2161 @SYMTestCaseDesc		Calls RSgImage::MapWriteOnly() with a non-null handle and an uninitialised driver
       
  2162 @SYMPREQ				PREQ39
       
  2163 @SYMREQ					REQ8809
       
  2164 @SYMREQ					REQ9175
       
  2165 @SYMREQ					REQ9193
       
  2166 @SYMFssID				RSgImage::MapWriteOnly(TAny*&, TInt&)\n 
       
  2167 @SYMTestPriority		Critical
       
  2168 @SYMTestType			Unit Test
       
  2169 @SYMTestPurpose			To ensure calling MapWriteOnly() with a non-null handle and an uninitialised driver will cause a panic.
       
  2170 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  2171 						Declare another image and assign it to the current image handle. Close the current
       
  2172 						image so the second image handle becomes invalid. Close the graphics resource driver.
       
  2173 						Call MapWriteOnly() on the second handle.
       
  2174 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  2175 @SYMTestStatus			Implemented 
       
  2176  */
       
  2177 void CTSgImageGeneric::TestPanicImageMapWriteOnlyNoDriverL()
       
  2178 	{
       
  2179 	TSgImageInfo info;
       
  2180 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageMapWriteOnlyNoDriver, ETrue};
       
  2181  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2182 	_LIT(KTestName, "TestImageMapWriteOnlyNoDriverL");
       
  2183  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  2184 	}
       
  2185 
       
  2186 /**
       
  2187 @SYMTestCaseID			GRAPHICS-RESOURCE-0064
       
  2188 @SYMTestCaseDesc		Calls RSgImage::MapReadWrite() with an invalid image handle
       
  2189 @SYMPREQ				PREQ39
       
  2190 @SYMREQ					REQ8809
       
  2191 @SYMREQ					REQ9175
       
  2192 @SYMREQ					REQ9193
       
  2193 @SYMFssID				RSgImage::MapReadWrite(TAny*&, TInt&)\n 
       
  2194 @SYMTestPriority		Critical
       
  2195 @SYMTestType			Unit Test
       
  2196 @SYMTestPurpose			To ensure calling MapReadWrite() with an invalid image handle will cause a panic.
       
  2197 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  2198 						Declare another image and assign it to the current image handle. Close the current
       
  2199 						image so the second image handle becomes invalid. Call MapReadWrite() on the second
       
  2200 						handle.
       
  2201 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 2(ESgPanicBadDrawableHandle).
       
  2202 @SYMTestStatus			Implemented 
       
  2203  */
       
  2204 void CTSgImageGeneric::TestPanicImageMapReadWriteInvalidHandleL()
       
  2205 	{
       
  2206 	TSgImageInfo info;
       
  2207 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageMapReadWriteInvalidHandle, ETrue};
       
  2208  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2209 	_LIT(KTestName, "TestImageMapReadWriteInvalidHandleL");
       
  2210  	CreateSecondThreadAndCheckPanicL(threadInfo, 3, exitCategoryName, KTestName);
       
  2211 	}
       
  2212 
       
  2213 /**
       
  2214 @SYMTestCaseID			GRAPHICS-RESOURCE-0065
       
  2215 @SYMTestCaseDesc		Calls RSgImage::MapReadWrite() with a non-null handle and an uninitialised driver
       
  2216 @SYMPREQ				PREQ39
       
  2217 @SYMREQ					REQ8809
       
  2218 @SYMREQ					REQ9175
       
  2219 @SYMREQ					REQ9193
       
  2220 @SYMFssID				RSgImage::MapReadWrite(TAny*&, TInt&)\n 
       
  2221 @SYMTestPriority		Critical
       
  2222 @SYMTestType			Unit Test
       
  2223 @SYMTestPurpose			To ensure calling MapReadWrite() with a non-null handle and an uninitialised driver will cause a panic.
       
  2224 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  2225 						Declare another image and assign it to the current image handle. Close the current
       
  2226 						image so the second image handle becomes invalid. Close the graphics resource driver.
       
  2227 						Call MapReadWrite() on the second handle.
       
  2228 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  2229 @SYMTestStatus			Implemented 
       
  2230  */
       
  2231 void CTSgImageGeneric::TestPanicImageMapReadWriteNoDriverL()
       
  2232 	{
       
  2233 	TSgImageInfo info;
       
  2234 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageMapReadWriteNoDriver, ETrue};
       
  2235  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2236 	_LIT(KTestName, "TestImageMapReadWriteNoDriverL");
       
  2237  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  2238 	}
       
  2239 
       
  2240 /**
       
  2241 @SYMTestCaseID			GRAPHICS-RESOURCE-0066
       
  2242 @SYMTestCaseDesc		Calls RSgImage::Unmap() with an invalid image handle
       
  2243 @SYMPREQ				PREQ39
       
  2244 @SYMREQ					REQ8809
       
  2245 @SYMREQ					REQ9175
       
  2246 @SYMREQ					REQ9193
       
  2247 @SYMFssID				RSgImage::Unmap()\n 
       
  2248 @SYMTestPriority		Critical
       
  2249 @SYMTestType			Unit Test
       
  2250 @SYMTestPurpose			To ensure calling Unmap() with an invalid image handle will cause a panic.
       
  2251 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  2252 						Declare another image and assign it to the current image handle. Close the current
       
  2253 						image so the second image handle becomes invalid. Call Unmap() on the second
       
  2254 						handle.
       
  2255 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 2(ESgPanicBadDrawableHandle).
       
  2256 @SYMTestStatus			Implemented 
       
  2257  */
       
  2258 void CTSgImageGeneric::TestPanicImageUnmapInvalidHandleL()
       
  2259 	{
       
  2260 	TSgImageInfo info;
       
  2261 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageUnmapInvalidHandle, ETrue};
       
  2262  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2263 	_LIT(KTestName, "TestImageUnmapInvalidHandleL");
       
  2264  	CreateSecondThreadAndCheckPanicL(threadInfo, 3, exitCategoryName, KTestName);
       
  2265 	}
       
  2266 
       
  2267 /**
       
  2268 @SYMTestCaseID			GRAPHICS-RESOURCE-0067
       
  2269 @SYMTestCaseDesc		Calls RSgImage::Unmap() with a non-null handle and an uninitialised driver
       
  2270 @SYMPREQ				PREQ39
       
  2271 @SYMREQ					REQ8809
       
  2272 @SYMREQ					REQ9175
       
  2273 @SYMFssID				RSgImage::Unmap()\n 
       
  2274 @SYMTestPriority		Critical
       
  2275 @SYMTestType			Unit Test
       
  2276 @SYMTestPurpose			To ensure calling Unmap() with a non-null handle and an uninitialised driver will cause a panic.
       
  2277 @SYMTestActions			Initialise the graphics resource component and create an image in a second thread. 
       
  2278 						Declare another image and assign it to the current image handle. Close the current
       
  2279 						image so the second image handle becomes invalid. Close the graphics resource driver.
       
  2280 						Call Unmap() on the second handle.
       
  2281 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  2282 @SYMTestStatus			Implemented 
       
  2283  */
       
  2284 void CTSgImageGeneric::TestPanicImageUnmapNoDriverL()
       
  2285 	{
       
  2286 	TSgImageInfo info;
       
  2287 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageUnmapNoDriver, ETrue};
       
  2288  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2289 	_LIT(KTestName, "TestImageUnmapNoDriverL");
       
  2290  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  2291 	}
       
  2292 
       
  2293 /**
       
  2294 @SYMTestCaseID			GRAPHICS-RESOURCE-0082
       
  2295 @SYMTestCaseDesc		Calls RSgImage::Open() when the driver was not initialised.
       
  2296 @SYMPREQ				PREQ39
       
  2297 @SYMREQ					REQ8809
       
  2298 @SYMREQ					REQ9175
       
  2299 @SYMFssID				RSgImage::Open(const TSgDrawableId&, TUint32)\n 
       
  2300 @SYMTestPriority		Critical
       
  2301 @SYMTestType			Unit Test
       
  2302 @SYMTestPurpose			To ensure calling RSgImage::Open() with an uninitialised driver will cause a panic.
       
  2303 @SYMTestActions			Do not Initialise the graphics resource component and call RSgImage::Open() in a second thread.
       
  2304 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  2305 @SYMTestStatus			Implemented 
       
  2306  */
       
  2307 void CTSgImageGeneric::TestPanicImageOpenNoDriver1L()
       
  2308 	{
       
  2309 	TSgImageInfo info;
       
  2310 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageOpenNoDriver1, ETrue};
       
  2311  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2312 	_LIT(KTestName, "TestPanicImageOpenNoDriverL");
       
  2313  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  2314 	}
       
  2315 
       
  2316 /**
       
  2317 @SYMTestCaseID			GRAPHICS-RESOURCE-0083
       
  2318 @SYMTestCaseDesc		Creates an image from memory when the driver was not initialised.
       
  2319 @SYMPREQ				PREQ39
       
  2320 @SYMREQ					REQ8809
       
  2321 @SYMREQ					REQ9175
       
  2322 @SYMFssID				RSgImage::Create(const TSgImageInfo&, const TAny*, TInt)\n 
       
  2323 @SYMTestPriority		Critical
       
  2324 @SYMTestType			Unit Test
       
  2325 @SYMTestPurpose			To ensure calling RSgImage::Create() with an uninitialised driver will cause a panic.
       
  2326 @SYMTestActions			Do not Initialise the graphics resource component and call RSgImage::Open() in a second thread.
       
  2327 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  2328 @SYMTestStatus			Implemented 
       
  2329  */
       
  2330 void CTSgImageGeneric::TestPanicImageCreateNoDriver1L()
       
  2331 	{
       
  2332 	TSgImageInfo info;
       
  2333 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCreateNoDriver1, ETrue};
       
  2334  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2335 	_LIT(KTestName, "TestPanicImageCreateNoDriver1L");
       
  2336  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  2337 	}
       
  2338 
       
  2339 /**
       
  2340 @SYMTestCaseID			GRAPHICS-RESOURCE-0084
       
  2341 @SYMTestCaseDesc		Creates an image from an existing image when the driver was not initialised.
       
  2342 @SYMPREQ				PREQ39
       
  2343 @SYMREQ					REQ8809
       
  2344 @SYMREQ					REQ9175
       
  2345 @SYMFssID				RSgImage::Create(const TSgImageInfo&, const RSgImage&)\n 
       
  2346 @SYMTestPriority		Critical
       
  2347 @SYMTestType			Unit Test
       
  2348 @SYMTestPurpose			To ensure calling RSgImage::Create() with an uninitialised driver will cause a panic.
       
  2349 @SYMTestActions			Do not Initialise the graphics resource component and call RSgImage::Open() in a second thread.
       
  2350 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  2351 @SYMTestStatus			Implemented 
       
  2352  */
       
  2353 void CTSgImageGeneric::TestPanicImageCreateNoDriver2L()
       
  2354 	{
       
  2355 	TSgImageInfo info;
       
  2356 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCreateNoDriver2, ETrue};
       
  2357  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2358 	_LIT(KTestName, "TestPanicImageCreateNoDriver2L");
       
  2359  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  2360 	}
       
  2361 
       
  2362 /**
       
  2363 @SYMTestCaseID			GRAPHICS-RESOURCE-0085
       
  2364 @SYMTestCaseDesc		Calls RSgImage::GetPixelFormats() when the driver was not initialised.
       
  2365 @SYMPREQ				PREQ39
       
  2366 @SYMREQ					REQ8809
       
  2367 @SYMREQ					REQ9175
       
  2368 @SYMFssID				RSgImage::GetPixelFormats(const TSgImageInfo&, TUidPixelFormat*, TInt&) \n
       
  2369 @SYMTestPriority		Critical
       
  2370 @SYMTestType			Unit Test
       
  2371 @SYMTestPurpose			To ensure calling RSgImage::GetPixelFormats() with an uninitialised driver will cause a panic.
       
  2372 @SYMTestActions			Do not Initialise the graphics resource component and call RSgImage::GetPixelFormats() in a second thread.
       
  2373 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  2374 @SYMTestStatus			Implemented 
       
  2375  */
       
  2376 void CTSgImageGeneric::TestPanicImageGetPixelFormatsNoDriverL()
       
  2377 	{
       
  2378 	TSgImageInfo info;
       
  2379 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageGetPixelFormatsNoDriver, ETrue};
       
  2380  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2381 	_LIT(KTestName, "TestPanicImageGetPixelFormatsNoDriverL");
       
  2382  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  2383 	}
       
  2384 
       
  2385 /**
       
  2386 @SYMTestCaseID			GRAPHICS-RESOURCE-0093
       
  2387 @SYMTestCaseDesc		Calls RSgImage::Open() with mode flags when the driver was not initialised.
       
  2388 @SYMPREQ				PREQ39
       
  2389 @SYMREQ					REQ8809
       
  2390 @SYMREQ					REQ9175
       
  2391 @SYMFssID				RSgImage::Open(const TSgDrawableId&, TUint32)\n 
       
  2392 @SYMTestPriority		Critical
       
  2393 @SYMTestType			Unit Test
       
  2394 @SYMTestPurpose			To ensure calling RSgImage::Open() with an uninitialised driver will cause a panic.
       
  2395 @SYMTestActions			Do not Initialise the graphics resource component and call RSgImage::Open() in a second thread.
       
  2396 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  2397 @SYMTestStatus			Implemented 
       
  2398  */
       
  2399 void CTSgImageGeneric::TestPanicImageOpenNoDriver2L()
       
  2400 	{
       
  2401 	TSgImageInfo info;
       
  2402 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageOpenNoDriver2, ETrue};
       
  2403  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2404 	_LIT(KTestName, "TestPanicImageOpenNoDriverL");
       
  2405  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  2406 	}
       
  2407 
       
  2408 /**
       
  2409 @SYMTestCaseID			GRAPHICS-RESOURCE-0088
       
  2410 @SYMTestCaseDesc		Calls RSgImage::DrawableType() when the driver was not initialised.
       
  2411 @SYMPREQ				PREQ39
       
  2412 @SYMREQ					REQ8809
       
  2413 @SYMREQ					REQ9175
       
  2414 @SYMFssID				RSgImage::DrawableType()\n 
       
  2415 @SYMTestPriority		Critical
       
  2416 @SYMTestType			Unit Test
       
  2417 @SYMTestPurpose			To ensure calling RSgImage::DrawableType() with an uninitialised driver will cause a panic.
       
  2418 @SYMTestActions			Do not Initialise the graphics resource component and call RSgImage::DrawableType() in a second thread.
       
  2419 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
       
  2420 @SYMTestStatus			Implemented 
       
  2421  */
       
  2422 void CTSgImageGeneric::TestPanicImageDrawableTypeNoDriverL()
       
  2423 	{
       
  2424 	TSgImageInfo info;
       
  2425 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageDrawableTypeInvalidHandle, ETrue};
       
  2426  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2427 	_LIT(KTestName, "TestPanicImageOpenNoDriverL");
       
  2428  	CreateSecondThreadAndCheckPanicL(threadInfo, 2, exitCategoryName, KTestName);
       
  2429 	}
       
  2430 
       
  2431 /**
       
  2432 @SYMTestCaseID			GRAPHICS-RESOURCE-0089
       
  2433 @SYMTestCaseDesc		Calls RSgImage::DrawableType() with an invalid image handle
       
  2434 @SYMPREQ				PREQ39
       
  2435 @SYMREQ					REQ8809
       
  2436 @SYMREQ					REQ9175
       
  2437 @SYMFssID				RSgImage::DrawableType()\n 
       
  2438 @SYMTestPriority		Critical
       
  2439 @SYMTestType			Unit Test
       
  2440 @SYMTestPurpose			To ensure calling RSgImage::DrawableType() with an uninitialised driver will cause a panic.
       
  2441 @SYMTestActions			Do not Initialise the graphics resource component and call RSgImage::DrawableType() in a second thread.
       
  2442 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES SGRES 2(ESgPanicBadDrawableHandle).
       
  2443 @SYMTestStatus			Implemented 
       
  2444  */
       
  2445 void CTSgImageGeneric::TestPanicImageDrawableTypeInvalidHandleL()
       
  2446 	{
       
  2447 	TSgImageInfo info;
       
  2448 	TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageDrawableTypeNoDriver, ETrue};
       
  2449  	TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
       
  2450 	_LIT(KTestName, "TestPanicImageOpenNoDriverL");
       
  2451  	CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
       
  2452 	}
       
  2453 
       
  2454 void CTSgImageGeneric::DoMemoryTestsL()
       
  2455 	{
       
  2456 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2457 	TestGetPixelFormatsL();
       
  2458 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2459 	
       
  2460 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2461 	TestCreateImageUninitializedL();
       
  2462 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2463 	
       
  2464 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2465 	TestCreateImageL();
       
  2466 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2467 	
       
  2468 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2469 	TestCreateImageFromExistingImageL();
       
  2470 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2471 	
       
  2472 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2473 	TestGetImageInfoL();
       
  2474 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2475 	
       
  2476 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2477 	TestGetImageDrawableIdL(); 
       
  2478 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2479 	
       
  2480 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2481 	TestMapImageL();
       
  2482 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2483 	
       
  2484 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2485 	TestOpenImageL();
       
  2486 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2487 	
       
  2488 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2489 	TestGetInterfaceL();
       
  2490 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2491 	
       
  2492 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2493 	TestGetPixelFormatsInvalidL();
       
  2494 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2495 	
       
  2496 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2497 	TestOpenImageInvalidL();
       
  2498 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2499 	
       
  2500 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2501 	TestCloseImageManyTimesL();
       
  2502 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2503 	
       
  2504 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2505 	TestCloseImageWithoutOpenL();
       
  2506 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2507 	
       
  2508 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2509 	TestCreateImageInvalidL();
       
  2510 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2511 	
       
  2512 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2513 	TestGetInfoInvalidImageL();
       
  2514 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2515 	
       
  2516 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2517 	TestMapImageInvalidL();
       
  2518 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2519 	
       
  2520 	__UHEAP_MARK; SgDriver::AllocMarkStart();
       
  2521 	TestUnmapImageInvalidL();
       
  2522 	__UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
       
  2523 	}