os/graphics/graphicsresourceservices/graphicsresource/test/tsgimagecollectiongeneric.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicsresourceservices/graphicsresource/test/tsgimagecollectiongeneric.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1348 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +/**
1.20 + @file
1.21 + @test
1.22 + @internalComponent - Internal Symbian test code
1.23 +*/
1.24 +
1.25 +#include "tsgimagecollectiongeneric.h"
1.26 +
1.27 +CTSgImageCollectionGeneric::CTSgImageCollectionGeneric()
1.28 + {
1.29 + INFO_PRINTF1(_L("Graphics resource component test - RSgImageCollection Generic Tests.\r\n"));
1.30 + }
1.31 +
1.32 +CTSgImageCollectionGeneric::~CTSgImageCollectionGeneric()
1.33 + {
1.34 + }
1.35 +
1.36 +/**
1.37 +Overrides of base class pure virtual
1.38 +Our implementation only gets called if the base class doTestStepPreambleL() did
1.39 +not leave. That being the case, the current test result value will be EPass.
1.40 +@leave Gets system wide error code
1.41 +@return TVerdict code
1.42 +*/
1.43 +TVerdict CTSgImageCollectionGeneric::doTestStepL()
1.44 + {
1.45 + SetTestStepID(_L("GRAPHICS-RESOURCE-0015"));
1.46 + INFO_PRINTF1(_L("Creation of image collections.\r\n"));
1.47 + TestCreateImageCollectionL();
1.48 + RecordTestResultL();
1.49 +
1.50 + SetTestStepID(_L("GRAPHICS-RESOURCE-0016"));
1.51 + INFO_PRINTF1(_L("Getting surface id of the image collection.\r\n"));
1.52 + TestGetImageCollectionSurfaceIdL();
1.53 + RecordTestResultL();
1.54 +
1.55 + SetTestStepID(_L("GRAPHICS-RESOURCE-0017"));
1.56 + INFO_PRINTF1(_L("Getting the number of images in an image collection.\r\n"));
1.57 + TestGetCollectionImageNumberL();
1.58 + RecordTestResultL();
1.59 +
1.60 + SetTestStepID(_L("GRAPHICS-RESOURCE-0018"));
1.61 + INFO_PRINTF1(_L("Getting information about the images in an image collection.\r\n"));
1.62 + TestGetImageInfoInCollectionL();
1.63 + RecordTestResultL();
1.64 +
1.65 + SetTestStepID(_L("GRAPHICS-RESOURCE-0019"));
1.66 + INFO_PRINTF1(_L("Getting image at a specific location in an image collection.\r\n"));
1.67 + TestOpenImageInCollectionL();
1.68 + RecordTestResultL();
1.69 +
1.70 + SetTestStepID(_L("GRAPHICS-RESOURCE-0020"));
1.71 + INFO_PRINTF1(_L("Mapping / Unmapping images in a collection.\r\n"));
1.72 + TestMapImageInCollectionL();
1.73 + RecordTestResultL();
1.74 +
1.75 + SetTestStepID(_L("GRAPHICS-RESOURCE-0021"));
1.76 + INFO_PRINTF1(_L("Creation of multiple image collections.\r\n"));
1.77 + TestCreateMultipleImageCollectionL();
1.78 + RecordTestResultL();
1.79 +
1.80 + SetTestStepID(_L("GRAPHICS-RESOURCE-0034"));
1.81 + INFO_PRINTF1(_L("Creation of the image collection with invalid parameters\r\n"));
1.82 + TestCreateImageCollectionInvalidL();
1.83 + RecordTestResultL();
1.84 +
1.85 + SetTestStepID(_L("GRAPHICS-RESOURCE-0035"));
1.86 + INFO_PRINTF1(_L("Creation of multiple image collections with invalid parameters.\r\n"));
1.87 + TestCreateMultipleImageCollectionsInvalidL();
1.88 + RecordTestResultL();
1.89 +
1.90 + SetTestStepID(_L("GRAPHICS-RESOURCE-0036"));
1.91 + INFO_PRINTF1(_L("Getting information about the images in an image collection under various invalid conditions.\r\n"));
1.92 + TestGetImageCollectionInfoInvalidL();
1.93 + RecordTestResultL();
1.94 +
1.95 + SetTestStepID(_L("GRAPHICS-RESOURCE-0037"));
1.96 + INFO_PRINTF1(_L("Opening images from a collection under various invalid conditions.\r\n"));
1.97 + TestOpenImageInCollectionInvalidL();
1.98 + RecordTestResultL();
1.99 +
1.100 + SetTestStepID(_L("GRAPHICS-RESOURCE-0038"));
1.101 + INFO_PRINTF1(_L("Invalid mapping/unmapping tests on individual images in a collection\r\n"));
1.102 + TestMapUnmapImagesInCollectionInvalidL();
1.103 + RecordTestResultL();
1.104 +
1.105 +#ifdef _DEBUG
1.106 +/**
1.107 +@SYMTestCaseID GRAPHICS-RESOURCE-0094
1.108 +*/
1.109 + SetTestStepID(_L("GRAPHICS-RESOURCE-0094"));
1.110 + INFO_PRINTF1(_L("RSgImageCollection generic out of memory tests.\r\n"));
1.111 + TestOOM();
1.112 + RecordTestResultL();
1.113 +
1.114 + SetTestStepID(_L("GRAPHICS-RESOURCE-0068"));
1.115 + INFO_PRINTF1(_L("RSgImageCollection generic panic test - Close() with invalid imagecollection handle\r\n"));
1.116 + TestPanicImageCollectionCloseInvalidHandleL();
1.117 + RecordTestResultL();
1.118 +
1.119 + SetTestStepID(_L("GRAPHICS-RESOURCE-0069"));
1.120 + INFO_PRINTF1(_L("RSgImageCollection generic panic test - Close() with non null imagecollection handle and uninitialised driver\r\n"));
1.121 + TestPanicImageCollectionCloseNoDriverL();
1.122 + RecordTestResultL();
1.123 +
1.124 + SetTestStepID(_L("GRAPHICS-RESOURCE-0070"));
1.125 + INFO_PRINTF1(_L("RSgImageCollection generic panic test - SurfaceId() with invalid imagecollection handle\r\n"));
1.126 + TestPanicImageCollectionSurfaceIdInvalidHandleL();
1.127 + RecordTestResultL();
1.128 +
1.129 + SetTestStepID(_L("GRAPHICS-RESOURCE-0071"));
1.130 + INFO_PRINTF1(_L("RSgImageCollection generic panic test - SurfaceId() with non null imagecollection handle and uninitialised driver\r\n"));
1.131 + TestPanicImageCollectionSurfaceIdNoDriverL();
1.132 + RecordTestResultL();
1.133 +
1.134 + SetTestStepID(_L("GRAPHICS-RESOURCE-0072"));
1.135 + INFO_PRINTF1(_L("RSgImageCollection generic panic test - GetInfo() with invalid imagecollection handle\r\n"));
1.136 + TestPanicImageCollectionGetInfoInvalidHandleL();
1.137 + RecordTestResultL();
1.138 +
1.139 + SetTestStepID(_L("GRAPHICS-RESOURCE-0073"));
1.140 + INFO_PRINTF1(_L("RSgImageCollection generic panic test - GetInfo() with non null imagecollection handle and uninitialised driver\r\n"));
1.141 + TestPanicImageCollectionGetInfoNoDriverL();
1.142 + RecordTestResultL();
1.143 +
1.144 + SetTestStepID(_L("GRAPHICS-RESOURCE-0074"));
1.145 + INFO_PRINTF1(_L("RSgImageCollection generic panic test - Count() with invalid imagecollection handle\r\n"));
1.146 + TestPanicImageCollectionCountInvalidHandleL();
1.147 + RecordTestResultL();
1.148 +
1.149 + SetTestStepID(_L("GRAPHICS-RESOURCE-0075"));
1.150 + INFO_PRINTF1(_L("RSgImageCollection generic panic test - Count() with non null imagecollection handle and uninitialised driver\r\n"));
1.151 + TestPanicImageCollectionCountNoDriverL();
1.152 + RecordTestResultL();
1.153 +
1.154 + SetTestStepID(_L("GRAPHICS-RESOURCE-0076"));
1.155 + INFO_PRINTF1(_L("RSgImageCollection generic panic test - OpenImage() with invalid imagecollection handle\r\n"));
1.156 + TestPanicImageCollectionOpenImageInvalidHandleL();
1.157 + RecordTestResultL();
1.158 +
1.159 + SetTestStepID(_L("GRAPHICS-RESOURCE-0077"));
1.160 + INFO_PRINTF1(_L("RSgImageCollection generic panic test - OpenImage() with non null imagecollection handle and uninitialised driver\r\n"));
1.161 + TestPanicImageCollectionOpenImageNoDriverL();
1.162 + RecordTestResultL();
1.163 +
1.164 + SetTestStepID(_L("GRAPHICS-RESOURCE-0086"));
1.165 + INFO_PRINTF1(_L("RSgImageCollection generic panic test - Create() a single image collection with an uninitialised driver\r\n"));
1.166 + TestPanicImageCollectionCreateNoDriver1L();
1.167 + RecordTestResultL();
1.168 +
1.169 + SetTestStepID(_L("GRAPHICS-RESOURCE-0086"));
1.170 + INFO_PRINTF1(_L("RSgImageCollection generic panic test - Create() multiple image collections with an uninitialised driver\r\n"));
1.171 + TestPanicImageCollectionCreateNoDriver2L();
1.172 + RecordTestResultL();
1.173 +#else
1.174 + INFO_PRINTF1(_L("Warning: Skipping the panic tests. \r\n"));
1.175 +#endif
1.176 + return TestStepResult();
1.177 + }
1.178 +
1.179 +
1.180 +/**
1.181 +@SYMTestCaseID GRAPHICS-RESOURCE-0015
1.182 +@SYMTestCaseDesc Creates an image collection.
1.183 +@SYMPREQ PREQ39
1.184 +@SYMREQ REQ9214
1.185 +@SYMREQ REQ9224
1.186 +@SYMREQ REQ9233
1.187 +@SYMREQ REQ9234
1.188 +@SYMFssID RSgImageCollection::Create(const TSgImageInfo&, TInt)\n
1.189 + RSgImageCollection::Close()
1.190 +@SYMTestPriority Critical
1.191 +@SYMTestType Unit Test
1.192 +@SYMTestPurpose To ensure the image collection can be created.
1.193 +@SYMTestActions Initialise the graphics resource component. Construct a TSgImageInfo object
1.194 + and Initialise all the member variables. Call Create() on the RSgImageCollection
1.195 + with the image info and number of images.
1.196 +@SYMTestExpectedResults The function should return KErrNone and memory for the image objects
1.197 + are successfully allocated.
1.198 +@SYMTestStatus Implemented
1.199 + */
1.200 +void CTSgImageCollectionGeneric::TestCreateImageCollectionL()
1.201 + {
1.202 + TestOpenDriverL();
1.203 + TSgImageInfo info;
1.204 + info.iSizeInPixels = TSize(8, 8);
1.205 + info.iUsage = ESgUsageDirectGdiTarget;
1.206 + info.iPixelFormat = EUidPixelFormatRGB_565;
1.207 +
1.208 + RSgImageCollection collection;
1.209 + TEST(collection.IsNull());
1.210 +
1.211 + CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
1.212 + CleanupClosePushL(collection);
1.213 + TEST(!collection.IsNull());
1.214 + TEST(1 == SgDriver::ResourceCount());
1.215 +
1.216 + CleanupStack::PopAndDestroy();
1.217 + TestCloseDriver();
1.218 + }
1.219 +
1.220 +/**
1.221 +@SYMTestCaseID GRAPHICS-RESOURCE-0016
1.222 +@SYMTestCaseDesc Gets the surface id of the image collection.
1.223 +@SYMPREQ PREQ39
1.224 +@SYMREQ REQ9214
1.225 +@SYMREQ REQ9215
1.226 +@SYMREQ REQ9224
1.227 +@SYMREQ REQ9233
1.228 +@SYMREQ REQ9234
1.229 +@SYMFssID RSgImageCollection::SurfaceId()\n
1.230 +@SYMTestPriority Critical
1.231 +@SYMTestType Unit Test
1.232 +@SYMTestPurpose To ensure the surface id of the image collection can be retrieved successfully.
1.233 +@SYMTestActions Initialise the graphics resource component. Create an image collection and call
1.234 + SurfaceId() on it.
1.235 +@SYMTestExpectedResults A non-null surface id should be returned.
1.236 +@SYMTestStatus Implemented
1.237 + */
1.238 +void CTSgImageCollectionGeneric::TestGetImageCollectionSurfaceIdL()
1.239 + {
1.240 + const TSurfaceId KNullSurfaceId = {0, 0, 0, 0};
1.241 + RSgImageCollection collection;
1.242 + TSurfaceId surfaceid = collection.SurfaceId();
1.243 + TEST(surfaceid == KNullSurfaceId);
1.244 + TestOpenDriverL();
1.245 + CreateImageCollectionL(collection);
1.246 + CleanupClosePushL(collection);
1.247 + surfaceid = collection.SurfaceId();
1.248 + TEST(!surfaceid.IsNull());
1.249 +
1.250 + CleanupStack::PopAndDestroy();
1.251 + TestCloseDriver();
1.252 + }
1.253 +
1.254 +/**
1.255 +@SYMTestCaseID GRAPHICS-RESOURCE-0017
1.256 +@SYMTestCaseDesc Gets the number of images in an image collection.
1.257 +@SYMPREQ PREQ39
1.258 +@SYMREQ REQ9214
1.259 +@SYMREQ REQ9224
1.260 +@SYMREQ REQ9233
1.261 +@SYMREQ REQ9234
1.262 +@SYMFssID RSgImageCollection::Count())\n
1.263 +@SYMTestPriority Critical
1.264 +@SYMTestType Unit Test
1.265 +@SYMTestPurpose To ensure the function returns the correct number of images.
1.266 +@SYMTestActions Initialise the graphics resource component. Declare an image collection. Call Count().
1.267 + Create an image collection. Call Count() again.
1.268 +@SYMTestExpectedResults First call should return zero. Second call should return the same value
1.269 + as the one passed to the function at creation time.
1.270 +@SYMTestStatus Implemented
1.271 + */
1.272 +void CTSgImageCollectionGeneric::TestGetCollectionImageNumberL()
1.273 + {
1.274 + RSgImageCollection collection;
1.275 + TInt number = collection.Count();
1.276 + TEST(0 == number);
1.277 + TestOpenDriverL();
1.278 + CreateImageCollectionL(collection);
1.279 + CleanupClosePushL(collection);
1.280 + number = collection.Count();
1.281 + TEST(KNumImagesInCollection == number);
1.282 + CleanupStack::PopAndDestroy();
1.283 + TestCloseDriver();
1.284 + }
1.285 +
1.286 +/**
1.287 +@SYMTestCaseID GRAPHICS-RESOURCE-0018
1.288 +@SYMTestCaseDesc Calls GetInfo() on an image collection.
1.289 +@SYMPREQ PREQ39
1.290 +@SYMREQ REQ9214
1.291 +@SYMREQ REQ9224
1.292 +@SYMREQ REQ9233
1.293 +@SYMREQ REQ9234
1.294 +@SYMFssID RSgImageCollection::GetInfo(TSgImageInfo&)\n
1.295 +@SYMTestPriority Critical
1.296 +@SYMTestType Unit Test
1.297 +@SYMTestPurpose To ensure the information about the images in a collection can be correctly returned.
1.298 +@SYMTestActions Initialise the graphics resource component. Construct a TSgImageInfo object and
1.299 + Initialise all the member variables. Create an image collection. Call GetInfo() and
1.300 + compare the returned TSgImageInfo object with the original one.
1.301 +@SYMTestExpectedResults The function should return KErrNone and the returned information should be the
1.302 + same as the old one.
1.303 +@SYMTestStatus Implemented
1.304 + */
1.305 +void CTSgImageCollectionGeneric::TestGetImageInfoInCollectionL()
1.306 + {
1.307 + TestOpenDriverL();
1.308 + TSgImageInfo info;
1.309 + info.iSizeInPixels = TSize(8, 8);
1.310 + info.iUsage = ESgUsageDirectGdiTarget;
1.311 + info.iPixelFormat = EUidPixelFormatRGB_565;
1.312 +
1.313 + RSgImageCollection collection;
1.314 + CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
1.315 + CleanupClosePushL(collection);
1.316 + TEST(!collection.IsNull());
1.317 +
1.318 + TSgImageInfo info2;
1.319 + TEST(KErrNone == collection.GetInfo(info2));
1.320 + TEST(CompareInfos(info, info2));
1.321 + CleanupStack::PopAndDestroy();
1.322 +
1.323 + //get info with user attributes
1.324 + TSgUserAttribute testAttributes[2] = {{0x00008888, 1}, {0x00009999, 2}};
1.325 + info.iUserAttributes = testAttributes;
1.326 + info.iUserAttributeCount = 2;
1.327 + CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
1.328 + CleanupClosePushL(collection);
1.329 + TSgImageInfo info3;
1.330 + TSgUserAttribute testAttributes2[2] = {{0x00008888, 0}, {0x00009999, 0}};
1.331 + info3.iUserAttributes = testAttributes2;
1.332 + info3.iUserAttributeCount = 2;
1.333 + TEST(KErrNone == collection.GetInfo(info3));
1.334 + TEST(CompareInfos(info, info3));
1.335 + CleanupStack::PopAndDestroy();
1.336 +
1.337 + TestCloseDriver();
1.338 + }
1.339 +
1.340 +/**
1.341 +@SYMTestCaseID GRAPHICS-RESOURCE-0019
1.342 +@SYMTestCaseDesc Gets image at a specific location in an image collection.
1.343 +@SYMPREQ PREQ39
1.344 +@SYMREQ REQ9214
1.345 +@SYMREQ REQ9224
1.346 +@SYMREQ REQ9233
1.347 +@SYMREQ REQ9234
1.348 +@SYMFssID RSgImageCollection::OpenImage()\n
1.349 +@SYMTestPriority Critical
1.350 +@SYMTestType Unit Test
1.351 +@SYMTestPurpose To ensure an image at a specific location can be returned.
1.352 +@SYMTestActions Initialise the graphics resource component. Create the image collection. Call OpenImage() to
1.353 + return all the images in order.
1.354 +@SYMTestExpectedResults All the images are returned successfully.
1.355 +@SYMTestStatus Implemented
1.356 + */
1.357 +void CTSgImageCollectionGeneric::TestOpenImageInCollectionL()
1.358 + {
1.359 + TestOpenDriverL();
1.360 + RSgImageCollection collection;
1.361 + CreateImageCollectionL(collection);
1.362 + CleanupClosePushL(collection);
1.363 +
1.364 + TSgImageInfo info1;
1.365 + collection.GetInfo(info1);
1.366 +
1.367 + for(TInt i=0; i<KNumImagesInCollection; ++i)
1.368 + {
1.369 + RSgImage image;
1.370 + CheckErrorL(KErrNone, collection.OpenImage(i, image), (TText8*)__FILE__, __LINE__);
1.371 + TSgImageInfo info2;
1.372 + CheckErrorL(KErrNone, image.GetInfo(info2), (TText8*)__FILE__, __LINE__);
1.373 + TEST(CompareInfos(info1, info2));
1.374 + image.Close();
1.375 + }
1.376 +
1.377 + CleanupStack::PopAndDestroy();
1.378 + TestCloseDriver();
1.379 + }
1.380 +
1.381 +/**
1.382 +@SYMTestCaseID GRAPHICS-RESOURCE-0020
1.383 +@SYMTestCaseDesc Maps and unmaps images in a collection.
1.384 +@SYMPREQ PREQ39
1.385 +@SYMREQ REQ9214
1.386 +@SYMREQ REQ9193
1.387 +@SYMREQ REQ9219
1.388 +@SYMREQ REQ9224
1.389 +@SYMREQ REQ9233
1.390 +@SYMREQ REQ9234
1.391 +@SYMFssID RSgImageCollection::OpenImage()\n
1.392 + RSgImage::MapReadOnly(const TAny*&, TInt&) const\n
1.393 + RSgImage::MapWriteOnly(TAny*&, TInt&)\n
1.394 + RSgImage::MapReadWrite(TAny*&, TInt&)\n
1.395 + RSgImage::Unmap ()\n
1.396 +@SYMTestPriority Critical
1.397 +@SYMTestType Unit Test
1.398 +@SYMTestPurpose To ensure individual images in an image collection can be mapped and unmapped.
1.399 +@SYMTestActions Initialise the graphics resource component. Create the image collection. Use the
1.400 + index operator to return all the images. Call MapXXX() and Unmap() functions on each
1.401 + of them.
1.402 +@SYMTestExpectedResults All the functions should return KErrNone.
1.403 +@SYMTestStatus Implemented
1.404 + */
1.405 +void CTSgImageCollectionGeneric::TestMapImageInCollectionL()
1.406 + {
1.407 + TestOpenDriverL();
1.408 + TSgImageInfo info;
1.409 + info.iSizeInPixels = TSize(8, 8);
1.410 + info.iUsage = ESgUsageDirectGdiSource;
1.411 + info.iPixelFormat = EUidPixelFormatRGB_565;
1.412 + info.iCpuAccess = ESgCpuAccessReadWrite;
1.413 +
1.414 + RSgImageCollection collection;
1.415 + CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
1.416 + CleanupClosePushL(collection);
1.417 + TEST(!collection.IsNull());
1.418 +
1.419 + TAny* dataAddress;
1.420 + TInt dataStride;
1.421 +
1.422 + for(TInt i=0; i<collection.Count(); ++i)
1.423 + {
1.424 + RSgImage image;
1.425 + CheckErrorL(KErrNone, collection.OpenImage(i, image), (TText8*)__FILE__, __LINE__);
1.426 + TSgImageInfo imageInfo;
1.427 + CheckErrorL(KErrNone, image.GetInfo(imageInfo), (TText8*)__FILE__, __LINE__);
1.428 +
1.429 + //test MapReadWrite
1.430 + TInt mapResult = image.MapReadWrite(dataAddress, dataStride);
1.431 + TEST(KErrNone == mapResult);
1.432 +
1.433 + if(KErrNone == mapResult)
1.434 + {
1.435 + //modify the image, set first line to blue
1.436 + for(TInt x = 0; x < imageInfo.iSizeInPixels.iWidth; ++x)
1.437 + {
1.438 + *(TUint16*)PtrAdd(dataAddress, sizeof(TUint16) * x) = 0x1F;
1.439 + }
1.440 +
1.441 + //check the modification
1.442 + for(TInt x = 0; x < imageInfo.iSizeInPixels.iWidth; ++x)
1.443 + {
1.444 + TUint16 pixelValue = *(TUint16*)PtrAdd(dataAddress, sizeof(TUint16) * x);
1.445 + if(pixelValue != 0x1F)
1.446 + {
1.447 + TEST(EFalse);
1.448 + break;
1.449 + }
1.450 + }
1.451 + }
1.452 + TEST(KErrNone == image.Unmap());
1.453 + image.Close();
1.454 + }
1.455 +
1.456 + CleanupStack::PopAndDestroy();
1.457 + TestCloseDriver();
1.458 + }
1.459 +
1.460 +/**
1.461 +@SYMTestCaseID GRAPHICS-RESOURCE-0021
1.462 +@SYMTestCaseDesc Creates multiple image collections.
1.463 +@SYMPREQ PREQ39
1.464 +@SYMREQ REQ9214
1.465 +@SYMREQ REQ9224
1.466 +@SYMREQ REQ9233
1.467 +@SYMREQ REQ9234
1.468 +@SYMFssID RSgImageCollection::Create(const TSgImageInfo&, TInt, RSgImageCollection*, TInt) \n
1.469 + RSgImageCollection::Close()
1.470 +@SYMTestPriority Critical
1.471 +@SYMTestType Unit Test
1.472 +@SYMTestPurpose To ensure multiple image collections can be created using the factory function.
1.473 +@SYMTestActions Initialise the graphics resource component. Construct multiple TSgImageInfo objects
1.474 + and Initialise all the member variables. Call the static Create() function.
1.475 +@SYMTestExpectedResults The function should return KErrNone and memory for the image objects
1.476 + are successfully allocated.
1.477 +@SYMTestStatus Implemented
1.478 + */
1.479 +void CTSgImageCollectionGeneric::TestCreateMultipleImageCollectionL()
1.480 + {
1.481 + TestOpenDriverL();
1.482 +
1.483 + TSgImageInfo infos[3];
1.484 + infos[0].iCpuAccess = ESgCpuAccessReadWrite;
1.485 + infos[0].iPixelFormat = EUidPixelFormatXRGB_8888;
1.486 + infos[0].iSizeInPixels = TSize(50, 50);
1.487 + infos[0].iUsage = ESgUsageDirectGdiSource;
1.488 +
1.489 + infos[1].iCpuAccess = ESgCpuAccessNone;
1.490 + infos[1].iPixelFormat = EUidPixelFormatRGB_565;
1.491 + infos[1].iSizeInPixels = TSize(120, 120);
1.492 + infos[1].iUsage = ESgUsageDirectGdiTarget|ESgUsageCompositionSource;
1.493 +
1.494 + infos[2].iCpuAccess = ESgCpuAccessNone;
1.495 + infos[2].iPixelFormat = EUidPixelFormatARGB_8888_PRE;
1.496 + infos[2].iSizeInPixels = TSize(200, 200);
1.497 + infos[2].iUsage = ESgUsageDirectGdiTarget|ESgUsageCompositionSource;
1.498 +
1.499 + RSgImageCollection collections[3];
1.500 + CheckErrorL(KErrNone, RSgImageCollection::Create(infos, KNumImagesInCollection, collections, 3), (TText8*)__FILE__, __LINE__);
1.501 + CleanupClosePushL(collections[0]);
1.502 + CleanupClosePushL(collections[1]);
1.503 + CleanupClosePushL(collections[2]);
1.504 +
1.505 + for(TInt i=0; i<3; ++i)
1.506 + {
1.507 + RSgImageCollection& collection = collections[i];
1.508 + TEST(!collection.IsNull());
1.509 +
1.510 + TSurfaceId surfaceid = collection.SurfaceId();
1.511 + TEST(!surfaceid.IsNull());
1.512 +
1.513 + TSgImageInfo info;
1.514 + TEST(KErrNone == collection.GetInfo(info));
1.515 + TSgImageInfo oldInfo = infos[i];
1.516 +
1.517 + TEST(CompareInfos(oldInfo, info));
1.518 +
1.519 + TInt imagecount = collection.Count();
1.520 + TEST(imagecount == KNumImagesInCollection);
1.521 +
1.522 + for (TInt j = 0; j < KNumImagesInCollection; ++j)
1.523 + {
1.524 + RSgImage image;
1.525 + CheckErrorL(KErrNone, collection.OpenImage(j, image), (TText8*)__FILE__, __LINE__);
1.526 + TEST(KErrNone == image.GetInfo(info));
1.527 + TEST(CompareInfos(oldInfo, info));
1.528 + image.Close();
1.529 + }
1.530 + }
1.531 +
1.532 + CleanupStack::PopAndDestroy(3);
1.533 + TestCloseDriver();
1.534 + }
1.535 +
1.536 +
1.537 +/**
1.538 +@SYMTestCaseID GRAPHICS-RESOURCE-0034
1.539 +@SYMTestCaseDesc Creates an image collection with invalid parameters
1.540 +@SYMPREQ PREQ39
1.541 +@SYMREQ REQ9214
1.542 +@SYMREQ REQ9224
1.543 +@SYMREQ REQ9233
1.544 +@SYMREQ REQ9234
1.545 +@SYMFssID RSgImageCollection::Create(const TSgImageInfo, TInt)\n
1.546 + RSgImageCollection::Close()
1.547 +@SYMTestPriority Critical
1.548 +@SYMTestType Unit Test
1.549 +@SYMTestPurpose To check for different creation errors.
1.550 +@SYMTestActions Initialise the graphics resource component. Call Create():\n
1.551 + \t 1. on a non-null RSgImageCollection object\n
1.552 + \t 2. with an invalid TSgImageInfo\n
1.553 + \t 3. with a negative or zero image count\n
1.554 + \t 4. with an unsupported TSgImageInfo\n
1.555 + \t 5. with an TSgImageInfo with a size info bigger than the system memory\n
1.556 + \t 6. with number of iUserAttributes more than KMaxHint(8)\n
1.557 +@SYMTestExpectedResults The function should return\n
1.558 + \t 1. KErrInUse\n
1.559 + \t 2. KErrArgument\n
1.560 + \t 3. KErrArgument\n
1.561 + \t 4. KErrNotSupported\n
1.562 + \t 5. KErrNoMemory\n
1.563 + \t 6. KErrOverflow
1.564 +@SYMTestStatus Implemented
1.565 + */
1.566 +void CTSgImageCollectionGeneric::TestCreateImageCollectionInvalidL()
1.567 + {
1.568 + TSgImageInfo info;
1.569 + info.iSizeInPixels = TSize(8, 8);
1.570 + info.iUsage = ESgUsageDirectGdiSource;
1.571 + info.iPixelFormat = EUidPixelFormatRGB_565;
1.572 + info.iCpuAccess = ESgCpuAccessReadWrite;
1.573 +
1.574 + RSgImageCollection collection;
1.575 + TestOpenDriverL();
1.576 + //non-empty handle
1.577 + CreateImageCollectionL(collection);
1.578 + CleanupClosePushL(collection);
1.579 + TEST(KErrInUse == collection.Create(info, KNumImagesInCollection));
1.580 + collection.Close();
1.581 +
1.582 + //invalid TSgImageInfo
1.583 + TSgImageInfo info1;
1.584 + info1.iSizeInPixels = TSize(-100, 100);
1.585 + info1.iPixelFormat = EUidPixelFormatRGB_565;
1.586 + info1.iCpuAccess = ESgCpuAccessReadWrite;
1.587 +
1.588 + TEST(KErrArgument == collection.Create(info1, KNumImagesInCollection));
1.589 + collection.Close();
1.590 +
1.591 + //negative or zero image count
1.592 +
1.593 + TEST(KErrArgument == collection.Create(info, 0));
1.594 + collection.Close();
1.595 +
1.596 + TEST(KErrArgument == collection.Create(info, -1));
1.597 + collection.Close();
1.598 +
1.599 + //unsupported TSgImageInfo
1.600 + TSgImageInfo info2;
1.601 + info2.iCpuAccess = ESgCpuAccessReadWrite;
1.602 + info2.iPixelFormat = EUidPixelFormatAP_88;
1.603 + info2.iSizeInPixels = TSize(10, 10);
1.604 + info2.iUsage = ESgUsageDirectGdiSource;
1.605 +
1.606 + TEST(KErrNotSupported == collection.Create(info2, KNumImagesInCollection));
1.607 + collection.Close();
1.608 +
1.609 + //number of iUserAttributes more than KMaxHint(8)
1.610 + TSgImageInfo info3;
1.611 + info3.iSizeInPixels = TSize(100, 100);
1.612 + info3.iPixelFormat = EUidPixelFormatRGB_565;
1.613 + info3.iCpuAccess = ESgCpuAccessNone;
1.614 + info3.iUsage = ESgUsageDirectGdiTarget;
1.615 + info3.iUserAttributes = new TSgUserAttribute[100];
1.616 + CleanupArrayDeletePushL(info3.iUserAttributes);
1.617 + info3.iUserAttributeCount = 100;
1.618 + TInt ret = collection.Create(info3, KNumImagesInCollection);
1.619 + if(iRunningOomTests)
1.620 + {
1.621 + TEST(KErrNoMemory == ret || KErrOverflow == ret);
1.622 + }
1.623 + else
1.624 + {
1.625 + TEST(KErrOverflow == ret);
1.626 + }
1.627 +
1.628 + CleanupStack::PopAndDestroy(2);
1.629 + TestCloseDriver();
1.630 + }
1.631 +
1.632 +/**
1.633 +@SYMTestCaseID GRAPHICS-RESOURCE-0035
1.634 +@SYMTestCaseDesc Creates multiple image collections with invalid parameters.
1.635 +@SYMPREQ PREQ39
1.636 +@SYMREQ REQ9214
1.637 +@SYMREQ REQ9217
1.638 +@SYMREQ REQ9224
1.639 +@SYMREQ REQ9233
1.640 +@SYMREQ REQ9234
1.641 +@SYMFssID RSgImageCollection::Create(const TSgImageInfo[], TInt, RSgImageCollection[], TInt)\n
1.642 + RSgImageCollection::Close()
1.643 +@SYMTestPriority Critical
1.644 +@SYMTestType Unit Test
1.645 +@SYMTestPurpose To check for different creation errors when creating multiple image collections.
1.646 +@SYMTestActions Initialise the graphics resource component. Call the static Create():\n
1.647 + \t 1. on an array of RSgImageCollection objects with at least one non-null
1.648 + RSgImageCollection object\n
1.649 + \t 2. with an array of TSgImageInfo objects with at least one invalid TSgImageInfo\n
1.650 + \t 3. with a negative or zero image count\n
1.651 + \t 4. with a negative or zero image collection count\n
1.652 + \t 5. with an array of TSgImageInfo objects with at least one unsupported TSgImageInfo\n
1.653 + \t 6. with an array of TSgImageInfo objects with at least one requesting immutable images\n
1.654 +@SYMTestExpectedResults The function should return\n
1.655 + \t 1. KErrInUse\n
1.656 + \t 2. KErrArgument\n
1.657 + \t 3. KErrArgument\n
1.658 + \t 4. KErrArgument\n
1.659 + \t 5. KErrNotSupported\n
1.660 + \t 6. KErrNotSupported
1.661 +@SYMTestStatus Partially Implemented
1.662 + */
1.663 +void CTSgImageCollectionGeneric::TestCreateMultipleImageCollectionsInvalidL()
1.664 + {
1.665 + //TSgImageInfo array
1.666 + TSgImageInfo info1;
1.667 + info1.iCpuAccess = ESgCpuAccessNone;
1.668 + info1.iPixelFormat = EUidPixelFormatXRGB_8888;
1.669 + info1.iSizeInPixels = TSize(50, 50);
1.670 + info1.iUsage = ESgUsageDirectGdiSource;
1.671 +
1.672 + TSgImageInfo info2;
1.673 + info2.iCpuAccess = ESgCpuAccessReadOnly;
1.674 + info2.iPixelFormat = EUidPixelFormatRGB_565;
1.675 + info2.iSizeInPixels = TSize(120, 120);
1.676 + info2.iUsage = ESgUsageScreenSource;
1.677 +
1.678 + TSgImageInfo info3;
1.679 + info3.iCpuAccess = ESgCpuAccessReadWrite;
1.680 + info3.iPixelFormat = EUidPixelFormatARGB_8888_PRE;
1.681 + info3.iSizeInPixels = TSize(200, 200);
1.682 + info3.iUsage = ESgUsageDirectGdiTarget;
1.683 +
1.684 + TSgImageInfo infos[] = {info1, info2, info3};
1.685 +
1.686 + //RSgImageCollection array
1.687 + const TInt numberOfCollections = 3;
1.688 + RSgImageCollection collections[numberOfCollections];
1.689 +
1.690 + TestOpenDriverL();
1.691 + //create with one of the image info being invalid
1.692 + infos[0].iSizeInPixels = TSize(-50, 50);
1.693 + TEST(KErrArgument == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, numberOfCollections));
1.694 + //reset
1.695 + infos[0].iSizeInPixels = TSize(50, 50);
1.696 +
1.697 + //create with one of the image collection array element being non-null
1.698 + CreateImageCollectionL(collections[0]);
1.699 + CleanupClosePushL(collections[0]);
1.700 + TEST(KErrInUse == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, numberOfCollections));
1.701 + //rest
1.702 + CleanupStack::PopAndDestroy();
1.703 +
1.704 + //create with a negative or zero image count
1.705 + TEST(KErrArgument == RSgImageCollection::Create(infos, 0, collections, numberOfCollections));
1.706 + TEST(KErrArgument == RSgImageCollection::Create(infos, -1, collections, numberOfCollections));
1.707 +
1.708 + //create with a negative or zero image collection count
1.709 + TEST(KErrArgument == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, 0));
1.710 + TEST(KErrArgument == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, -1));
1.711 +
1.712 + //create with one of the image info being unsupported
1.713 + infos[0].iPixelFormat = EUidPixelFormatAP_88;
1.714 + TEST(KErrNotSupported == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, numberOfCollections));
1.715 + //reset
1.716 + infos[0].iPixelFormat = EUidPixelFormatXRGB_8888;
1.717 +
1.718 + //create with some of the image info objects specifying constant images
1.719 + TEST(KErrNotSupported == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, numberOfCollections));
1.720 +
1.721 + //close all collections
1.722 + for(TInt i=0; i<numberOfCollections; ++i)
1.723 + {
1.724 + collections[i].Close();
1.725 + }
1.726 +
1.727 + TestCloseDriver();
1.728 + }
1.729 +
1.730 +/**
1.731 +@SYMTestCaseID GRAPHICS-RESOURCE-0036
1.732 +@SYMTestCaseDesc Calls GetInfo() on an image collection under various invalid conditions.
1.733 +@SYMPREQ PREQ39
1.734 +@SYMREQ REQ9214
1.735 +@SYMREQ REQ9224
1.736 +@SYMREQ REQ9233
1.737 +@SYMREQ REQ9234
1.738 +@SYMFssID RSgImageCollection::GetInfo(TSgImageInfo&)
1.739 +@SYMTestPriority Critical
1.740 +@SYMTestType Unit Test
1.741 +@SYMTestPurpose To check the correct error messages are returned when GetInfo() is called
1.742 + under various invalid conditions.
1.743 +@SYMTestActions Initialise the graphics resource component. Call GetInfo() on an image collection\n
1.744 + \t 1. that is uninitialised\n
1.745 + \t 2. TSgImageInfo has different user attributes Ids from the existing Ids.
1.746 +@SYMTestExpectedResults The function should return:\n
1.747 + \t 1. KErrBadHandle\n
1.748 + \t 2. KErrNotFound or KErrArgument
1.749 +@SYMTestStatus Implemented
1.750 + */
1.751 +void CTSgImageCollectionGeneric::TestGetImageCollectionInfoInvalidL()
1.752 + {
1.753 + TestOpenDriverL();
1.754 + //uninitialised collection
1.755 + RSgImageCollection collection;
1.756 + TSgImageInfo info;
1.757 + TEST(KErrBadHandle == collection.GetInfo(info));
1.758 +
1.759 + //TSgImageInfo has different user attributes Ids from the existing Ids.
1.760 + info.iSizeInPixels = TSize(8, 8);
1.761 + info.iUsage = ESgUsageDirectGdiTarget;
1.762 + info.iPixelFormat = EUidPixelFormatRGB_565;
1.763 + TSgUserAttribute testAttributes[] = {{0x00008888, 1}, {0x00009999, 2}};
1.764 + info.iUserAttributes = testAttributes;
1.765 + info.iUserAttributeCount = 2;
1.766 + CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
1.767 + CleanupClosePushL(collection);
1.768 + TSgImageInfo info3;
1.769 + TSgUserAttribute testAttributes2[1];
1.770 + info3.iUserAttributes = testAttributes2;
1.771 + info3.iUserAttributes[0].iUid = TUid::Uid(0x11111111);
1.772 + info3.iUserAttributeCount = 1;
1.773 + TInt result = collection.GetInfo(info3);
1.774 + TEST(KErrNotFound == result || KErrArgument == result);
1.775 + CleanupStack::PopAndDestroy();
1.776 +
1.777 + TestCloseDriver();
1.778 + }
1.779 +
1.780 +/**
1.781 +@SYMTestCaseID GRAPHICS-RESOURCE-0037
1.782 +@SYMTestCaseDesc Opens images from a collection under various invalid conditions.
1.783 +@SYMPREQ PREQ39
1.784 +@SYMREQ REQ9214
1.785 +@SYMREQ REQ9224
1.786 +@SYMREQ REQ9233
1.787 +@SYMREQ REQ9234
1.788 +@SYMFssID RSgImageCollection::OpenImage(TInt aIndex, RSgImage& aImage)
1.789 +@SYMTestPriority Critical
1.790 +@SYMTestType Unit Test
1.791 +@SYMTestPurpose To ensure correct error messages are returned when client tries to
1.792 + open an image inside an image collection under various invalid conditions.
1.793 +@SYMTestActions Initialise the graphics resource component. Call OpenImage():\n
1.794 + \t 1. on an uninitialised image collection\n
1.795 + \t 2. with a negative index\n
1.796 + \t 3. with an index that is bigger than the number of images in the collection\n
1.797 + \t 4. with non-null aImage\n
1.798 +@SYMTestExpectedResults The function should return:\n
1.799 + \t 1. KErrBadHandle\n
1.800 + \t 2. KErrArgument\n
1.801 + \t 3. KErrArgument\n
1.802 + \t 4. KErrInUse\n
1.803 +@SYMTestStatus Implemented
1.804 + */
1.805 +void CTSgImageCollectionGeneric::TestOpenImageInCollectionInvalidL()
1.806 + {
1.807 + TestOpenDriverL();
1.808 + RSgImageCollection collection;
1.809 + RSgImage image;
1.810 +
1.811 + //uninitialised image collection
1.812 + TEST(KErrBadHandle == collection.OpenImage(0, image));
1.813 +
1.814 + CreateImageCollectionL(collection);
1.815 + CleanupClosePushL(collection);
1.816 + //with a negative index
1.817 + TEST(KErrArgument == collection.OpenImage(-1, image));
1.818 + image.Close();
1.819 +
1.820 + //with an index that is bigger than the number of images in the collection
1.821 + TInt invalidIndex = collection.Count();
1.822 + TEST(KErrArgument == collection.OpenImage(invalidIndex, image));
1.823 + image.Close();
1.824 +
1.825 + //with non-null aImage handle
1.826 + CreateImageL(image);
1.827 + CleanupClosePushL(image);
1.828 + TEST(KErrInUse == collection.OpenImage(0, image));
1.829 + CleanupStack::PopAndDestroy(&image);
1.830 +
1.831 + CleanupStack::PopAndDestroy();
1.832 + TestCloseDriver();
1.833 + }
1.834 +
1.835 +/**
1.836 +@SYMTestCaseID GRAPHICS-RESOURCE-0038
1.837 +@SYMTestCaseDesc Invalid map/unmap tests on individual images in a collection
1.838 +@SYMPREQ PREQ39
1.839 +@SYMREQ REQ9193
1.840 +@SYMREQ REQ9214
1.841 +@SYMREQ REQ9224
1.842 +@SYMREQ REQ9233
1.843 +@SYMREQ REQ9234
1.844 +@SYMFssID SgImageCollection::OpenImage(TInt aIndex, RSgImage& aImage)\n
1.845 + RSgImage::MapReadOnly(const TAny*&, TInt&) const\n
1.846 + RSgImage::MapWriteOnly(TAny*&, TInt&)\n
1.847 + RSgImage::MapReadWrite(TAny*&, TInt&)\n
1.848 + RSgImage::Unmap()
1.849 +@SYMTestPriority Critical
1.850 +@SYMTestType Unit Test
1.851 +@SYMTestPurpose To check the images in an image collection can map/unmap the same way as standalone images.
1.852 +@SYMTestActions Initialise the graphics resource component. Initialise an image collection. Get individual
1.853 + images from the collection and perform various negative map/unmap tests on them.
1.854 +@SYMTestExpectedResults The functions should behave in the same way as the tests defined previously for stand alone images.
1.855 +@SYMTestStatus Defined
1.856 + */
1.857 +void CTSgImageCollectionGeneric::TestMapUnmapImagesInCollectionInvalidL()
1.858 + {
1.859 + TestOpenDriverL();
1.860 +
1.861 + //create a collection
1.862 + TSgImageInfo info;
1.863 + info.iSizeInPixels = TSize(8, 8);
1.864 + info.iUsage = ESgUsageDirectGdiSource;
1.865 + info.iPixelFormat = EUidPixelFormatRGB_565;
1.866 + info.iCpuAccess = ESgCpuAccessReadWrite;
1.867 + info.iShareable = ETrue;
1.868 + RSgImageCollection collection;
1.869 + CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
1.870 + CleanupClosePushL(collection);
1.871 +
1.872 + const TAny* dataAddressRead;
1.873 + TAny* dataAddressWrite;
1.874 + TInt dataStride;
1.875 +
1.876 + //map twice
1.877 + for(TInt i=0; i<KNumImagesInCollection; ++i)
1.878 + {
1.879 + RSgImage image;
1.880 + TEST(KErrNone == collection.OpenImage(i, image));
1.881 + TEST(KErrNone == image.MapReadOnly(dataAddressRead, dataStride));
1.882 + TEST(KErrInUse == image.MapReadOnly(dataAddressRead, dataStride));
1.883 + TEST(KErrNone == image.Unmap());
1.884 +
1.885 + TEST(KErrNone == image.MapWriteOnly(dataAddressWrite, dataStride));
1.886 + TEST(KErrInUse == image.MapWriteOnly(dataAddressWrite, dataStride));
1.887 + TEST(KErrNone == image.Unmap());
1.888 +
1.889 + TEST(KErrNone == image.MapReadWrite(dataAddressWrite, dataStride));
1.890 + TEST(KErrInUse == image.MapReadWrite(dataAddressWrite, dataStride));
1.891 + TEST(KErrNone == image.Unmap());
1.892 + image.Close();
1.893 + }
1.894 + CleanupStack::PopAndDestroy();
1.895 +
1.896 + //call MapReadOnly() on the images in a collection created without CPU access
1.897 + //flag ESgCpuAccessReadOnly or ESgCpuAccessReadWrite
1.898 + info.iUsage = ESgUsageDirectGdiTarget;
1.899 + info.iCpuAccess = ESgCpuAccessNone;
1.900 + CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
1.901 + CleanupClosePushL(collection);
1.902 + for(TInt i=0; i<KNumImagesInCollection; ++i)
1.903 + {
1.904 + RSgImage image;
1.905 + TEST(KErrNone == collection.OpenImage(i, image));
1.906 + TEST(KErrAccessDenied == image.MapReadOnly(dataAddressRead, dataStride));
1.907 + image.Close();
1.908 + }
1.909 + CleanupStack::PopAndDestroy();
1.910 +
1.911 + info.iUsage = ESgUsageDirectGdiSource;
1.912 + info.iCpuAccess = ESgCpuAccessWriteOnly;
1.913 + CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
1.914 + CleanupClosePushL(collection);
1.915 + for(TInt i=0; i<KNumImagesInCollection; ++i)
1.916 + {
1.917 + RSgImage image;
1.918 + TEST(KErrNone == collection.OpenImage(i, image));
1.919 + TEST(KErrAccessDenied == image.MapReadOnly(dataAddressRead, dataStride));
1.920 + image.Close();
1.921 + }
1.922 + CleanupStack::PopAndDestroy();
1.923 +
1.924 + //call MapWriteOnly() on the images in a collection created without CPU access
1.925 + //flag ESgCpuAccessWriteOnly or ESgCpuAccessReadWrite
1.926 + info.iUsage = ESgUsageDirectGdiTarget;
1.927 + info.iCpuAccess = ESgCpuAccessNone;
1.928 + CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
1.929 + CleanupClosePushL(collection);
1.930 + for(TInt i=0; i<KNumImagesInCollection; ++i)
1.931 + {
1.932 + RSgImage image;
1.933 + TEST(KErrNone == collection.OpenImage(i, image));
1.934 + TEST(KErrAccessDenied == image.MapWriteOnly(dataAddressWrite, dataStride));
1.935 + image.Close();
1.936 + }
1.937 + CleanupStack::PopAndDestroy();
1.938 +
1.939 + info.iCpuAccess = ESgCpuAccessReadOnly;
1.940 + TInt err = collection.Create(info, KNumImagesInCollection);
1.941 + if(KErrNotSupported != err)
1.942 + {
1.943 + User::LeaveIfError(err);
1.944 + CleanupClosePushL(collection);
1.945 + for(TInt i=0; i<KNumImagesInCollection; ++i)
1.946 + {
1.947 + RSgImage image;
1.948 + TEST(KErrNone == collection.OpenImage(i, image));
1.949 + TEST(KErrAccessDenied == image.MapWriteOnly(dataAddressWrite, dataStride));
1.950 + image.Close();
1.951 + }
1.952 + CleanupStack::PopAndDestroy();
1.953 + }
1.954 + else
1.955 + {
1.956 + INFO_PRINTF1(_L("Warning: skipping test MapWriteOnly() on read-only collection.\r\n"));
1.957 + }
1.958 +
1.959 + //call MapReadWrite() on the images in a collection created without CPU access
1.960 + //flag ESgCpuAccessReadWrite
1.961 + info.iCpuAccess = ESgCpuAccessNone;
1.962 + CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
1.963 + CleanupClosePushL(collection);
1.964 + for(TInt i=0; i<KNumImagesInCollection; ++i)
1.965 + {
1.966 + RSgImage image;
1.967 + TEST(KErrNone == collection.OpenImage(i, image));
1.968 + TEST(KErrAccessDenied == image.MapReadWrite(dataAddressWrite, dataStride));
1.969 + image.Close();
1.970 + }
1.971 + CleanupStack::PopAndDestroy();
1.972 +
1.973 + info.iCpuAccess = ESgCpuAccessReadOnly;
1.974 + err = collection.Create(info, KNumImagesInCollection);
1.975 + if(KErrNotSupported != err)
1.976 + {
1.977 + CleanupClosePushL(collection);
1.978 + for(TInt i=0; i<KNumImagesInCollection; ++i)
1.979 + {
1.980 + RSgImage image;
1.981 + TEST(KErrNone == collection.OpenImage(i, image));
1.982 + TEST(KErrAccessDenied == image.MapReadWrite(dataAddressWrite, dataStride));
1.983 + image.Close();
1.984 + }
1.985 + CleanupStack::PopAndDestroy();
1.986 + }
1.987 + else
1.988 + {
1.989 + INFO_PRINTF1(_L("Warning: skipping test MapReadWrite() on read-only collection.\r\n"));
1.990 + }
1.991 +
1.992 + info.iUsage = ESgUsageDirectGdiSource;
1.993 + info.iCpuAccess = ESgCpuAccessWriteOnly;
1.994 + CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
1.995 + CleanupClosePushL(collection);
1.996 + for(TInt i=0; i<KNumImagesInCollection; ++i)
1.997 + {
1.998 + RSgImage image;
1.999 + TEST(KErrNone == collection.OpenImage(i, image));
1.1000 + TEST(KErrAccessDenied == image.MapReadWrite(dataAddressWrite, dataStride));
1.1001 + image.Close();
1.1002 + }
1.1003 + CleanupStack::PopAndDestroy();
1.1004 +
1.1005 + TestCloseDriver();
1.1006 + }
1.1007 +
1.1008 +void CTSgImageCollectionGeneric::DoMemoryTestsL()
1.1009 + {
1.1010 + __UHEAP_MARK; SgDriver::AllocMarkStart();
1.1011 + TestCreateImageCollectionL();
1.1012 + __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1.1013 +
1.1014 + __UHEAP_MARK; SgDriver::AllocMarkStart();
1.1015 + TestGetImageCollectionSurfaceIdL();
1.1016 + __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1.1017 +
1.1018 + __UHEAP_MARK; SgDriver::AllocMarkStart();
1.1019 + TestGetCollectionImageNumberL();
1.1020 + __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1.1021 +
1.1022 + __UHEAP_MARK; SgDriver::AllocMarkStart();
1.1023 + TestGetImageInfoInCollectionL();
1.1024 + __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1.1025 +
1.1026 + __UHEAP_MARK; SgDriver::AllocMarkStart();
1.1027 + TestOpenImageInCollectionL();
1.1028 + __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1.1029 +
1.1030 + __UHEAP_MARK; SgDriver::AllocMarkStart();
1.1031 + TestMapImageInCollectionL();
1.1032 + __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1.1033 +
1.1034 + __UHEAP_MARK; SgDriver::AllocMarkStart();
1.1035 + TestCreateMultipleImageCollectionL();
1.1036 + __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1.1037 +
1.1038 + __UHEAP_MARK; SgDriver::AllocMarkStart();
1.1039 + TestCreateImageCollectionInvalidL();
1.1040 + __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1.1041 +
1.1042 + __UHEAP_MARK; SgDriver::AllocMarkStart();
1.1043 + TestCreateMultipleImageCollectionsInvalidL();
1.1044 + __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1.1045 +
1.1046 + __UHEAP_MARK; SgDriver::AllocMarkStart();
1.1047 + TestGetImageCollectionInfoInvalidL();
1.1048 + __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1.1049 +
1.1050 + __UHEAP_MARK; SgDriver::AllocMarkStart();
1.1051 + TestOpenImageInCollectionInvalidL();
1.1052 + __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1.1053 +
1.1054 + __UHEAP_MARK; SgDriver::AllocMarkStart();
1.1055 + TestMapUnmapImagesInCollectionInvalidL();
1.1056 + __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1.1057 + }
1.1058 +
1.1059 +/**
1.1060 +@SYMTestCaseID GRAPHICS-RESOURCE-0068
1.1061 +@SYMTestCaseDesc Calls RSgImageCollection::Close() with an invalid image collection handle
1.1062 +@SYMPREQ PREQ39
1.1063 +@SYMREQ REQ9214
1.1064 +@SYMFssID RSgImageCollection::Close()\n
1.1065 +@SYMTestPriority Critical
1.1066 +@SYMTestType Unit Test
1.1067 +@SYMTestPurpose To ensure calling Close() with an invalid image collection handle will cause a panic.
1.1068 +@SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1.1069 + Declare another image collection and assign it to the current image collection handle. Close
1.1070 + the current image collection so the second image collection handle becomes invalid. Call
1.1071 + Close() on the second handle.
1.1072 +@SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 4(ESgPanicBadImageCollectionHandle).
1.1073 +@SYMTestStatus Implemented
1.1074 + */
1.1075 +void CTSgImageCollectionGeneric::TestPanicImageCollectionCloseInvalidHandleL()
1.1076 + {
1.1077 + TSgImageInfo info;
1.1078 + TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCloseInvalidHandle, ETrue};
1.1079 + TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1.1080 + _LIT(KTestName, "TestImageCollectionCloseInvalidHandleL");
1.1081 + CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName);
1.1082 + }
1.1083 +
1.1084 +/**
1.1085 +@SYMTestCaseID GRAPHICS-RESOURCE-0069
1.1086 +@SYMTestCaseDesc Calls RSgImageCollection::Close() with a non-null handle and an uninitialised driver
1.1087 +@SYMPREQ PREQ39
1.1088 +@SYMREQ REQ9214
1.1089 +@SYMFssID RSgImageCollection::Close()\n
1.1090 +@SYMTestPriority Critical
1.1091 +@SYMTestType Unit Test
1.1092 +@SYMTestPurpose To ensure calling Close() with an invalid image collection handle will cause a panic.
1.1093 +@SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1.1094 + Declare another image collection and assign it to the current image collection handle. Close
1.1095 + the current image collection so the second image collection handle becomes invalid. Close the
1.1096 + graphics resource driver. Call Close() on the second handle.
1.1097 +@SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
1.1098 +@SYMTestStatus Implemented
1.1099 + */
1.1100 +void CTSgImageCollectionGeneric::TestPanicImageCollectionCloseNoDriverL()
1.1101 + {
1.1102 + TSgImageInfo info;
1.1103 + TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCloseNoDriver, ETrue};
1.1104 + TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1.1105 + _LIT(KTestName, "TestImageCollectionCloseNoDriverL");
1.1106 + CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
1.1107 + }
1.1108 +
1.1109 +/**
1.1110 +@SYMTestCaseID GRAPHICS-RESOURCE-0070
1.1111 +@SYMTestCaseDesc Calls RSgImageCollection::SurfaceId() with an invalid image collection handle
1.1112 +@SYMPREQ PREQ39
1.1113 +@SYMREQ REQ9214
1.1114 +@SYMFssID RSgImageCollection::SurfaceId()\n
1.1115 +@SYMTestPriority Critical
1.1116 +@SYMTestType Unit Test
1.1117 +@SYMTestPurpose To ensure calling SurfaceId() with an invalid image collection handle will cause a panic.
1.1118 +@SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1.1119 + Declare another image collection and assign it to the current image collection handle. Close
1.1120 + the current image collection so the second image collection handle becomes invalid. Call
1.1121 + SurfaceId() on the second handle.
1.1122 +@SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 4(ESgPanicBadImageCollectionHandle).
1.1123 +@SYMTestStatus Implemented
1.1124 + */
1.1125 +void CTSgImageCollectionGeneric::TestPanicImageCollectionSurfaceIdInvalidHandleL()
1.1126 + {
1.1127 + TSgImageInfo info;
1.1128 + TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionSurfaceIdInvalidHandle, ETrue};
1.1129 + TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1.1130 + _LIT(KTestName, "TestImageCollectionSurfaceIdInvalidHandleL");
1.1131 + CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName);
1.1132 + }
1.1133 +
1.1134 +/**
1.1135 +@SYMTestCaseID GRAPHICS-RESOURCE-0071
1.1136 +@SYMTestCaseDesc Calls RSgImageCollection::SurfaceId() with a non-null handle and an uninitialised driver
1.1137 +@SYMPREQ PREQ39
1.1138 +@SYMREQ REQ9214
1.1139 +@SYMFssID RSgImageCollection::SurfaceId()\n
1.1140 +@SYMTestPriority Critical
1.1141 +@SYMTestType Unit Test
1.1142 +@SYMTestPurpose To ensure calling SurfaceId() with an invalid image collection handle will cause a panic.
1.1143 +@SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1.1144 + Declare another image collection and assign it to the current image collection handle. Close
1.1145 + the current image collection so the second image collection handle becomes invalid. Close the
1.1146 + graphics resource driver. Call SurfaceId() on the second handle.
1.1147 +@SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
1.1148 +@SYMTestStatus Implemented
1.1149 + */
1.1150 +void CTSgImageCollectionGeneric::TestPanicImageCollectionSurfaceIdNoDriverL()
1.1151 + {
1.1152 + TSgImageInfo info;
1.1153 + TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionSurfaceIdNoDriver, ETrue};
1.1154 + TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1.1155 + _LIT(KTestName, "TestImageCollectionSurfaceIdNoDriverL");
1.1156 + CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
1.1157 + }
1.1158 +
1.1159 +/**
1.1160 +@SYMTestCaseID GRAPHICS-RESOURCE-0072
1.1161 +@SYMTestCaseDesc Calls RSgImageCollection::GetInfo() with an invalid image collection handle
1.1162 +@SYMPREQ PREQ39
1.1163 +@SYMREQ REQ9214
1.1164 +@SYMFssID RSgImageCollection::GetInfo(TSgImageInfo&)\n
1.1165 +@SYMTestPriority Critical
1.1166 +@SYMTestType Unit Test
1.1167 +@SYMTestPurpose To ensure calling GetInfo() with an invalid image collection handle will cause a panic.
1.1168 +@SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1.1169 + Declare another image collection and assign it to the current image collection handle. Close
1.1170 + the current image collection so the second image collection handle becomes invalid. Call
1.1171 + GetInfo() on the second handle.
1.1172 +@SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 4(ESgPanicBadImageCollectionHandle).
1.1173 +@SYMTestStatus Implemented
1.1174 + */
1.1175 +void CTSgImageCollectionGeneric::TestPanicImageCollectionGetInfoInvalidHandleL()
1.1176 + {
1.1177 + TSgImageInfo info;
1.1178 + TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionGetInfoInvalidHandle, ETrue};
1.1179 + TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1.1180 + _LIT(KTestName, "TestImageCollectionGetInfoInvalidHandleL");
1.1181 + CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName);
1.1182 + }
1.1183 +
1.1184 +/**
1.1185 +@SYMTestCaseID GRAPHICS-RESOURCE-0073
1.1186 +@SYMTestCaseDesc Calls RSgImageCollection::GetInfo() with a non-null handle and an uninitialised driver
1.1187 +@SYMPREQ PREQ39
1.1188 +@SYMREQ REQ9214
1.1189 +@SYMFssID RSgImageCollection::GetInfo(TSgImageInfo&)\n
1.1190 +@SYMTestPriority Critical
1.1191 +@SYMTestType Unit Test
1.1192 +@SYMTestPurpose To ensure calling GetInfo() with an invalid image collection handle will cause a panic.
1.1193 +@SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1.1194 + Declare another image collection and assign it to the current image collection handle. Close
1.1195 + the current image collection so the second image collection handle becomes invalid. Close the
1.1196 + graphics resource driver. Call GetInfo() on the second handle.
1.1197 +@SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
1.1198 +@SYMTestStatus Implemented
1.1199 + */
1.1200 +void CTSgImageCollectionGeneric::TestPanicImageCollectionGetInfoNoDriverL()
1.1201 + {
1.1202 + TSgImageInfo info;
1.1203 + TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionGetInfoNoDriver, ETrue};
1.1204 + TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1.1205 + _LIT(KTestName, "TestImageCollectionGetInfoNoDriverL");
1.1206 + CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
1.1207 + }
1.1208 +
1.1209 +/**
1.1210 +@SYMTestCaseID GRAPHICS-RESOURCE-0074
1.1211 +@SYMTestCaseDesc Calls RSgImageCollection::Count() with an invalid image collection handle
1.1212 +@SYMPREQ PREQ39
1.1213 +@SYMREQ REQ9214
1.1214 +@SYMFssID RSgImageCollection::Count()\n
1.1215 +@SYMTestPriority Critical
1.1216 +@SYMTestType Unit Test
1.1217 +@SYMTestPurpose To ensure calling Count() with an invalid image collection handle will cause a panic.
1.1218 +@SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1.1219 + Declare another image collection and assign it to the current image collection handle. Close
1.1220 + the current image collection so the second image collection handle becomes invalid. Call
1.1221 + Count() on the second handle.
1.1222 +@SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 4(ESgPanicBadImageCollectionHandle).
1.1223 +@SYMTestStatus Implemented
1.1224 + */
1.1225 +void CTSgImageCollectionGeneric::TestPanicImageCollectionCountInvalidHandleL()
1.1226 + {
1.1227 + TSgImageInfo info;
1.1228 + TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCountInvalidHandle, ETrue};
1.1229 + TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1.1230 + _LIT(KTestName, "TestImageCollectionCountInvalidHandleL");
1.1231 + CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName);
1.1232 + }
1.1233 +
1.1234 +/**
1.1235 +@SYMTestCaseID GRAPHICS-RESOURCE-0075
1.1236 +@SYMTestCaseDesc Calls RSgImageCollection::Count() with a non-null handle and an uninitialised driver
1.1237 +@SYMPREQ PREQ39
1.1238 +@SYMREQ REQ9214
1.1239 +@SYMFssID RSgImageCollection::Count()\n
1.1240 +@SYMTestPriority Critical
1.1241 +@SYMTestType Unit Test
1.1242 +@SYMTestPurpose To ensure calling Count() with an invalid image collection handle will cause a panic.
1.1243 +@SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1.1244 + Declare another image collection and assign it to the current image collection handle. Close
1.1245 + the current image collection so the second image collection handle becomes invalid. Close the
1.1246 + graphics resource driver. Call Count() on the second handle.
1.1247 +@SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
1.1248 +@SYMTestStatus Implemented
1.1249 + */
1.1250 +void CTSgImageCollectionGeneric::TestPanicImageCollectionCountNoDriverL()
1.1251 + {
1.1252 + TSgImageInfo info;
1.1253 + TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCountNoDriver, ETrue};
1.1254 + TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1.1255 + _LIT(KTestName, "TestImageCollectionCountNoDriverL");
1.1256 + CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
1.1257 + }
1.1258 +
1.1259 +/**
1.1260 +@SYMTestCaseID GRAPHICS-RESOURCE-0076
1.1261 +@SYMTestCaseDesc Calls RSgImageCollection::OpenImage() with an invalid image collection handle
1.1262 +@SYMPREQ PREQ39
1.1263 +@SYMREQ REQ9214
1.1264 +@SYMFssID RSgImageCollection::OpenImage()\n
1.1265 +@SYMTestPriority Critical
1.1266 +@SYMTestType Unit Test
1.1267 +@SYMTestPurpose To ensure calling OpenImage() with an invalid image collection handle will cause a panic.
1.1268 +@SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1.1269 + Declare another image collection and assign it to the current image collection handle. Close
1.1270 + the current image collection so the second image collection handle becomes invalid. Call
1.1271 + OpenImage() on the second handle.
1.1272 +@SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 4(ESgPanicBadImageCollectionHandle).
1.1273 +@SYMTestStatus Implemented
1.1274 + */
1.1275 +void CTSgImageCollectionGeneric::TestPanicImageCollectionOpenImageInvalidHandleL()
1.1276 + {
1.1277 + TSgImageInfo info;
1.1278 + TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionOpenImageInvalidHandle, ETrue};
1.1279 + TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1.1280 + _LIT(KTestName, "TestImageCollectionOpenImageInvalidHandleL");
1.1281 + CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName);
1.1282 + }
1.1283 +
1.1284 +/**
1.1285 +@SYMTestCaseID GRAPHICS-RESOURCE-0077
1.1286 +@SYMTestCaseDesc Calls RSgImageCollection::OpenImage() with a non-null handle and an uninitialised driver
1.1287 +@SYMPREQ PREQ39
1.1288 +@SYMREQ REQ9214
1.1289 +@SYMFssID RSgImageCollection::OpenImage()\n
1.1290 +@SYMTestPriority Critical
1.1291 +@SYMTestType Unit Test
1.1292 +@SYMTestPurpose To ensure calling OpenImage() with an invalid image collection handle will cause a panic.
1.1293 +@SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1.1294 + Declare another image collection and assign it to the current image collection handle. Close
1.1295 + the current image collection so the second image collection handle becomes invalid. Close the
1.1296 + graphics resource driver. Call OpenImage() on the second handle.
1.1297 +@SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
1.1298 +@SYMTestStatus Implemented
1.1299 + */
1.1300 +void CTSgImageCollectionGeneric::TestPanicImageCollectionOpenImageNoDriverL()
1.1301 + {
1.1302 + TSgImageInfo info;
1.1303 + TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionOpenImageNoDriver, ETrue};
1.1304 + TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1.1305 + _LIT(KTestName, "TestImageCollectionOpenImageNoDriverL");
1.1306 + CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
1.1307 + }
1.1308 +
1.1309 +/**
1.1310 +@SYMTestCaseID GRAPHICS-RESOURCE-0086
1.1311 +@SYMTestCaseDesc Creates an image collection when the driver was not initialised.
1.1312 +@SYMPREQ PREQ39
1.1313 +@SYMREQ REQ9214
1.1314 +@SYMFssID RSgImageCollection::Create(const TSgImageInfo, TInt)\n
1.1315 +@SYMTestPriority Critical
1.1316 +@SYMTestType Unit Test
1.1317 +@SYMTestPurpose To ensure calling RSgImageCollection::Create() with an uninitialised driver will cause a panic.
1.1318 +@SYMTestActions Do not Initialise the graphics resource component and call RSgImageCollection::Create() in a second thread.
1.1319 +@SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
1.1320 +@SYMTestStatus Implemented
1.1321 + */
1.1322 +void CTSgImageCollectionGeneric::TestPanicImageCollectionCreateNoDriver1L()
1.1323 + {
1.1324 + TSgImageInfo info;
1.1325 + TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCreateNoDriver1, ETrue};
1.1326 + TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1.1327 + _LIT(KTestName, "TestPanicImageCollectionCreateNoDriver1L");
1.1328 + CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
1.1329 + }
1.1330 +
1.1331 +/**
1.1332 +@SYMTestCaseID GRAPHICS-RESOURCE-0087
1.1333 +@SYMTestCaseDesc Creates multiple image collections when the driver was not initialised.
1.1334 +@SYMPREQ PREQ39
1.1335 +@SYMREQ REQ9214
1.1336 +@SYMFssID RSgImageCollection::Create(const TSgImageInfo[], TInt, RSgImageCollection[], TInt)\n
1.1337 +@SYMTestPriority Critical
1.1338 +@SYMTestType Unit Test
1.1339 +@SYMTestPurpose To ensure calling RSgImageCollection::Create() with an uninitialised driver will cause a panic.
1.1340 +@SYMTestActions Do not Initialise the graphics resource component and call RSgImageCollection::Create() in a second thread.
1.1341 +@SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
1.1342 +@SYMTestStatus Implemented
1.1343 + */
1.1344 +void CTSgImageCollectionGeneric::TestPanicImageCollectionCreateNoDriver2L()
1.1345 + {
1.1346 + TSgImageInfo info;
1.1347 + TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCreateNoDriver2, ETrue};
1.1348 + TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1.1349 + _LIT(KTestName, "TestPanicImageCollectionCreateNoDriver2L");
1.1350 + CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
1.1351 + }