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