os/graphics/graphicsresourceservices/graphicsresource/test/tsgimagecollectiongeneric.cpp
Update contrib.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 @internalComponent - Internal Symbian test code
22 #include "tsgimagecollectiongeneric.h"
24 CTSgImageCollectionGeneric::CTSgImageCollectionGeneric()
26 INFO_PRINTF1(_L("Graphics resource component test - RSgImageCollection Generic Tests.\r\n"));
29 CTSgImageCollectionGeneric::~CTSgImageCollectionGeneric()
34 Overrides of base class pure virtual
35 Our implementation only gets called if the base class doTestStepPreambleL() did
36 not leave. That being the case, the current test result value will be EPass.
37 @leave Gets system wide error code
40 TVerdict CTSgImageCollectionGeneric::doTestStepL()
42 SetTestStepID(_L("GRAPHICS-RESOURCE-0015"));
43 INFO_PRINTF1(_L("Creation of image collections.\r\n"));
44 TestCreateImageCollectionL();
47 SetTestStepID(_L("GRAPHICS-RESOURCE-0016"));
48 INFO_PRINTF1(_L("Getting surface id of the image collection.\r\n"));
49 TestGetImageCollectionSurfaceIdL();
52 SetTestStepID(_L("GRAPHICS-RESOURCE-0017"));
53 INFO_PRINTF1(_L("Getting the number of images in an image collection.\r\n"));
54 TestGetCollectionImageNumberL();
57 SetTestStepID(_L("GRAPHICS-RESOURCE-0018"));
58 INFO_PRINTF1(_L("Getting information about the images in an image collection.\r\n"));
59 TestGetImageInfoInCollectionL();
62 SetTestStepID(_L("GRAPHICS-RESOURCE-0019"));
63 INFO_PRINTF1(_L("Getting image at a specific location in an image collection.\r\n"));
64 TestOpenImageInCollectionL();
67 SetTestStepID(_L("GRAPHICS-RESOURCE-0020"));
68 INFO_PRINTF1(_L("Mapping / Unmapping images in a collection.\r\n"));
69 TestMapImageInCollectionL();
72 SetTestStepID(_L("GRAPHICS-RESOURCE-0021"));
73 INFO_PRINTF1(_L("Creation of multiple image collections.\r\n"));
74 TestCreateMultipleImageCollectionL();
77 SetTestStepID(_L("GRAPHICS-RESOURCE-0034"));
78 INFO_PRINTF1(_L("Creation of the image collection with invalid parameters\r\n"));
79 TestCreateImageCollectionInvalidL();
82 SetTestStepID(_L("GRAPHICS-RESOURCE-0035"));
83 INFO_PRINTF1(_L("Creation of multiple image collections with invalid parameters.\r\n"));
84 TestCreateMultipleImageCollectionsInvalidL();
87 SetTestStepID(_L("GRAPHICS-RESOURCE-0036"));
88 INFO_PRINTF1(_L("Getting information about the images in an image collection under various invalid conditions.\r\n"));
89 TestGetImageCollectionInfoInvalidL();
92 SetTestStepID(_L("GRAPHICS-RESOURCE-0037"));
93 INFO_PRINTF1(_L("Opening images from a collection under various invalid conditions.\r\n"));
94 TestOpenImageInCollectionInvalidL();
97 SetTestStepID(_L("GRAPHICS-RESOURCE-0038"));
98 INFO_PRINTF1(_L("Invalid mapping/unmapping tests on individual images in a collection\r\n"));
99 TestMapUnmapImagesInCollectionInvalidL();
104 @SYMTestCaseID GRAPHICS-RESOURCE-0094
106 SetTestStepID(_L("GRAPHICS-RESOURCE-0094"));
107 INFO_PRINTF1(_L("RSgImageCollection generic out of memory tests.\r\n"));
111 SetTestStepID(_L("GRAPHICS-RESOURCE-0068"));
112 INFO_PRINTF1(_L("RSgImageCollection generic panic test - Close() with invalid imagecollection handle\r\n"));
113 TestPanicImageCollectionCloseInvalidHandleL();
116 SetTestStepID(_L("GRAPHICS-RESOURCE-0069"));
117 INFO_PRINTF1(_L("RSgImageCollection generic panic test - Close() with non null imagecollection handle and uninitialised driver\r\n"));
118 TestPanicImageCollectionCloseNoDriverL();
121 SetTestStepID(_L("GRAPHICS-RESOURCE-0070"));
122 INFO_PRINTF1(_L("RSgImageCollection generic panic test - SurfaceId() with invalid imagecollection handle\r\n"));
123 TestPanicImageCollectionSurfaceIdInvalidHandleL();
126 SetTestStepID(_L("GRAPHICS-RESOURCE-0071"));
127 INFO_PRINTF1(_L("RSgImageCollection generic panic test - SurfaceId() with non null imagecollection handle and uninitialised driver\r\n"));
128 TestPanicImageCollectionSurfaceIdNoDriverL();
131 SetTestStepID(_L("GRAPHICS-RESOURCE-0072"));
132 INFO_PRINTF1(_L("RSgImageCollection generic panic test - GetInfo() with invalid imagecollection handle\r\n"));
133 TestPanicImageCollectionGetInfoInvalidHandleL();
136 SetTestStepID(_L("GRAPHICS-RESOURCE-0073"));
137 INFO_PRINTF1(_L("RSgImageCollection generic panic test - GetInfo() with non null imagecollection handle and uninitialised driver\r\n"));
138 TestPanicImageCollectionGetInfoNoDriverL();
141 SetTestStepID(_L("GRAPHICS-RESOURCE-0074"));
142 INFO_PRINTF1(_L("RSgImageCollection generic panic test - Count() with invalid imagecollection handle\r\n"));
143 TestPanicImageCollectionCountInvalidHandleL();
146 SetTestStepID(_L("GRAPHICS-RESOURCE-0075"));
147 INFO_PRINTF1(_L("RSgImageCollection generic panic test - Count() with non null imagecollection handle and uninitialised driver\r\n"));
148 TestPanicImageCollectionCountNoDriverL();
151 SetTestStepID(_L("GRAPHICS-RESOURCE-0076"));
152 INFO_PRINTF1(_L("RSgImageCollection generic panic test - OpenImage() with invalid imagecollection handle\r\n"));
153 TestPanicImageCollectionOpenImageInvalidHandleL();
156 SetTestStepID(_L("GRAPHICS-RESOURCE-0077"));
157 INFO_PRINTF1(_L("RSgImageCollection generic panic test - OpenImage() with non null imagecollection handle and uninitialised driver\r\n"));
158 TestPanicImageCollectionOpenImageNoDriverL();
161 SetTestStepID(_L("GRAPHICS-RESOURCE-0086"));
162 INFO_PRINTF1(_L("RSgImageCollection generic panic test - Create() a single image collection with an uninitialised driver\r\n"));
163 TestPanicImageCollectionCreateNoDriver1L();
166 SetTestStepID(_L("GRAPHICS-RESOURCE-0086"));
167 INFO_PRINTF1(_L("RSgImageCollection generic panic test - Create() multiple image collections with an uninitialised driver\r\n"));
168 TestPanicImageCollectionCreateNoDriver2L();
171 INFO_PRINTF1(_L("Warning: Skipping the panic tests. \r\n"));
173 return TestStepResult();
178 @SYMTestCaseID GRAPHICS-RESOURCE-0015
179 @SYMTestCaseDesc Creates an image collection.
185 @SYMFssID RSgImageCollection::Create(const TSgImageInfo&, TInt)\n
186 RSgImageCollection::Close()
187 @SYMTestPriority Critical
188 @SYMTestType Unit Test
189 @SYMTestPurpose To ensure the image collection can be created.
190 @SYMTestActions Initialise the graphics resource component. Construct a TSgImageInfo object
191 and Initialise all the member variables. Call Create() on the RSgImageCollection
192 with the image info and number of images.
193 @SYMTestExpectedResults The function should return KErrNone and memory for the image objects
194 are successfully allocated.
195 @SYMTestStatus Implemented
197 void CTSgImageCollectionGeneric::TestCreateImageCollectionL()
201 info.iSizeInPixels = TSize(8, 8);
202 info.iUsage = ESgUsageDirectGdiTarget;
203 info.iPixelFormat = EUidPixelFormatRGB_565;
205 RSgImageCollection collection;
206 TEST(collection.IsNull());
208 CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
209 CleanupClosePushL(collection);
210 TEST(!collection.IsNull());
211 TEST(1 == SgDriver::ResourceCount());
213 CleanupStack::PopAndDestroy();
218 @SYMTestCaseID GRAPHICS-RESOURCE-0016
219 @SYMTestCaseDesc Gets the surface id of the image collection.
226 @SYMFssID RSgImageCollection::SurfaceId()\n
227 @SYMTestPriority Critical
228 @SYMTestType Unit Test
229 @SYMTestPurpose To ensure the surface id of the image collection can be retrieved successfully.
230 @SYMTestActions Initialise the graphics resource component. Create an image collection and call
232 @SYMTestExpectedResults A non-null surface id should be returned.
233 @SYMTestStatus Implemented
235 void CTSgImageCollectionGeneric::TestGetImageCollectionSurfaceIdL()
237 const TSurfaceId KNullSurfaceId = {0, 0, 0, 0};
238 RSgImageCollection collection;
239 TSurfaceId surfaceid = collection.SurfaceId();
240 TEST(surfaceid == KNullSurfaceId);
242 CreateImageCollectionL(collection);
243 CleanupClosePushL(collection);
244 surfaceid = collection.SurfaceId();
245 TEST(!surfaceid.IsNull());
247 CleanupStack::PopAndDestroy();
252 @SYMTestCaseID GRAPHICS-RESOURCE-0017
253 @SYMTestCaseDesc Gets the number of images in an image collection.
259 @SYMFssID RSgImageCollection::Count())\n
260 @SYMTestPriority Critical
261 @SYMTestType Unit Test
262 @SYMTestPurpose To ensure the function returns the correct number of images.
263 @SYMTestActions Initialise the graphics resource component. Declare an image collection. Call Count().
264 Create an image collection. Call Count() again.
265 @SYMTestExpectedResults First call should return zero. Second call should return the same value
266 as the one passed to the function at creation time.
267 @SYMTestStatus Implemented
269 void CTSgImageCollectionGeneric::TestGetCollectionImageNumberL()
271 RSgImageCollection collection;
272 TInt number = collection.Count();
275 CreateImageCollectionL(collection);
276 CleanupClosePushL(collection);
277 number = collection.Count();
278 TEST(KNumImagesInCollection == number);
279 CleanupStack::PopAndDestroy();
284 @SYMTestCaseID GRAPHICS-RESOURCE-0018
285 @SYMTestCaseDesc Calls GetInfo() on an image collection.
291 @SYMFssID RSgImageCollection::GetInfo(TSgImageInfo&)\n
292 @SYMTestPriority Critical
293 @SYMTestType Unit Test
294 @SYMTestPurpose To ensure the information about the images in a collection can be correctly returned.
295 @SYMTestActions Initialise the graphics resource component. Construct a TSgImageInfo object and
296 Initialise all the member variables. Create an image collection. Call GetInfo() and
297 compare the returned TSgImageInfo object with the original one.
298 @SYMTestExpectedResults The function should return KErrNone and the returned information should be the
300 @SYMTestStatus Implemented
302 void CTSgImageCollectionGeneric::TestGetImageInfoInCollectionL()
306 info.iSizeInPixels = TSize(8, 8);
307 info.iUsage = ESgUsageDirectGdiTarget;
308 info.iPixelFormat = EUidPixelFormatRGB_565;
310 RSgImageCollection collection;
311 CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
312 CleanupClosePushL(collection);
313 TEST(!collection.IsNull());
316 TEST(KErrNone == collection.GetInfo(info2));
317 TEST(CompareInfos(info, info2));
318 CleanupStack::PopAndDestroy();
320 //get info with user attributes
321 TSgUserAttribute testAttributes[2] = {{0x00008888, 1}, {0x00009999, 2}};
322 info.iUserAttributes = testAttributes;
323 info.iUserAttributeCount = 2;
324 CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
325 CleanupClosePushL(collection);
327 TSgUserAttribute testAttributes2[2] = {{0x00008888, 0}, {0x00009999, 0}};
328 info3.iUserAttributes = testAttributes2;
329 info3.iUserAttributeCount = 2;
330 TEST(KErrNone == collection.GetInfo(info3));
331 TEST(CompareInfos(info, info3));
332 CleanupStack::PopAndDestroy();
338 @SYMTestCaseID GRAPHICS-RESOURCE-0019
339 @SYMTestCaseDesc Gets image at a specific location in an image collection.
345 @SYMFssID RSgImageCollection::OpenImage()\n
346 @SYMTestPriority Critical
347 @SYMTestType Unit Test
348 @SYMTestPurpose To ensure an image at a specific location can be returned.
349 @SYMTestActions Initialise the graphics resource component. Create the image collection. Call OpenImage() to
350 return all the images in order.
351 @SYMTestExpectedResults All the images are returned successfully.
352 @SYMTestStatus Implemented
354 void CTSgImageCollectionGeneric::TestOpenImageInCollectionL()
357 RSgImageCollection collection;
358 CreateImageCollectionL(collection);
359 CleanupClosePushL(collection);
362 collection.GetInfo(info1);
364 for(TInt i=0; i<KNumImagesInCollection; ++i)
367 CheckErrorL(KErrNone, collection.OpenImage(i, image), (TText8*)__FILE__, __LINE__);
369 CheckErrorL(KErrNone, image.GetInfo(info2), (TText8*)__FILE__, __LINE__);
370 TEST(CompareInfos(info1, info2));
374 CleanupStack::PopAndDestroy();
379 @SYMTestCaseID GRAPHICS-RESOURCE-0020
380 @SYMTestCaseDesc Maps and unmaps images in a collection.
388 @SYMFssID RSgImageCollection::OpenImage()\n
389 RSgImage::MapReadOnly(const TAny*&, TInt&) const\n
390 RSgImage::MapWriteOnly(TAny*&, TInt&)\n
391 RSgImage::MapReadWrite(TAny*&, TInt&)\n
393 @SYMTestPriority Critical
394 @SYMTestType Unit Test
395 @SYMTestPurpose To ensure individual images in an image collection can be mapped and unmapped.
396 @SYMTestActions Initialise the graphics resource component. Create the image collection. Use the
397 index operator to return all the images. Call MapXXX() and Unmap() functions on each
399 @SYMTestExpectedResults All the functions should return KErrNone.
400 @SYMTestStatus Implemented
402 void CTSgImageCollectionGeneric::TestMapImageInCollectionL()
406 info.iSizeInPixels = TSize(8, 8);
407 info.iUsage = ESgUsageDirectGdiSource;
408 info.iPixelFormat = EUidPixelFormatRGB_565;
409 info.iCpuAccess = ESgCpuAccessReadWrite;
411 RSgImageCollection collection;
412 CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
413 CleanupClosePushL(collection);
414 TEST(!collection.IsNull());
419 for(TInt i=0; i<collection.Count(); ++i)
422 CheckErrorL(KErrNone, collection.OpenImage(i, image), (TText8*)__FILE__, __LINE__);
423 TSgImageInfo imageInfo;
424 CheckErrorL(KErrNone, image.GetInfo(imageInfo), (TText8*)__FILE__, __LINE__);
427 TInt mapResult = image.MapReadWrite(dataAddress, dataStride);
428 TEST(KErrNone == mapResult);
430 if(KErrNone == mapResult)
432 //modify the image, set first line to blue
433 for(TInt x = 0; x < imageInfo.iSizeInPixels.iWidth; ++x)
435 *(TUint16*)PtrAdd(dataAddress, sizeof(TUint16) * x) = 0x1F;
438 //check the modification
439 for(TInt x = 0; x < imageInfo.iSizeInPixels.iWidth; ++x)
441 TUint16 pixelValue = *(TUint16*)PtrAdd(dataAddress, sizeof(TUint16) * x);
442 if(pixelValue != 0x1F)
449 TEST(KErrNone == image.Unmap());
453 CleanupStack::PopAndDestroy();
458 @SYMTestCaseID GRAPHICS-RESOURCE-0021
459 @SYMTestCaseDesc Creates multiple image collections.
465 @SYMFssID RSgImageCollection::Create(const TSgImageInfo&, TInt, RSgImageCollection*, TInt) \n
466 RSgImageCollection::Close()
467 @SYMTestPriority Critical
468 @SYMTestType Unit Test
469 @SYMTestPurpose To ensure multiple image collections can be created using the factory function.
470 @SYMTestActions Initialise the graphics resource component. Construct multiple TSgImageInfo objects
471 and Initialise all the member variables. Call the static Create() function.
472 @SYMTestExpectedResults The function should return KErrNone and memory for the image objects
473 are successfully allocated.
474 @SYMTestStatus Implemented
476 void CTSgImageCollectionGeneric::TestCreateMultipleImageCollectionL()
480 TSgImageInfo infos[3];
481 infos[0].iCpuAccess = ESgCpuAccessReadWrite;
482 infos[0].iPixelFormat = EUidPixelFormatXRGB_8888;
483 infos[0].iSizeInPixels = TSize(50, 50);
484 infos[0].iUsage = ESgUsageDirectGdiSource;
486 infos[1].iCpuAccess = ESgCpuAccessNone;
487 infos[1].iPixelFormat = EUidPixelFormatRGB_565;
488 infos[1].iSizeInPixels = TSize(120, 120);
489 infos[1].iUsage = ESgUsageDirectGdiTarget|ESgUsageCompositionSource;
491 infos[2].iCpuAccess = ESgCpuAccessNone;
492 infos[2].iPixelFormat = EUidPixelFormatARGB_8888_PRE;
493 infos[2].iSizeInPixels = TSize(200, 200);
494 infos[2].iUsage = ESgUsageDirectGdiTarget|ESgUsageCompositionSource;
496 RSgImageCollection collections[3];
497 CheckErrorL(KErrNone, RSgImageCollection::Create(infos, KNumImagesInCollection, collections, 3), (TText8*)__FILE__, __LINE__);
498 CleanupClosePushL(collections[0]);
499 CleanupClosePushL(collections[1]);
500 CleanupClosePushL(collections[2]);
502 for(TInt i=0; i<3; ++i)
504 RSgImageCollection& collection = collections[i];
505 TEST(!collection.IsNull());
507 TSurfaceId surfaceid = collection.SurfaceId();
508 TEST(!surfaceid.IsNull());
511 TEST(KErrNone == collection.GetInfo(info));
512 TSgImageInfo oldInfo = infos[i];
514 TEST(CompareInfos(oldInfo, info));
516 TInt imagecount = collection.Count();
517 TEST(imagecount == KNumImagesInCollection);
519 for (TInt j = 0; j < KNumImagesInCollection; ++j)
522 CheckErrorL(KErrNone, collection.OpenImage(j, image), (TText8*)__FILE__, __LINE__);
523 TEST(KErrNone == image.GetInfo(info));
524 TEST(CompareInfos(oldInfo, info));
529 CleanupStack::PopAndDestroy(3);
535 @SYMTestCaseID GRAPHICS-RESOURCE-0034
536 @SYMTestCaseDesc Creates an image collection with invalid parameters
542 @SYMFssID RSgImageCollection::Create(const TSgImageInfo, TInt)\n
543 RSgImageCollection::Close()
544 @SYMTestPriority Critical
545 @SYMTestType Unit Test
546 @SYMTestPurpose To check for different creation errors.
547 @SYMTestActions Initialise the graphics resource component. Call Create():\n
548 \t 1. on a non-null RSgImageCollection object\n
549 \t 2. with an invalid TSgImageInfo\n
550 \t 3. with a negative or zero image count\n
551 \t 4. with an unsupported TSgImageInfo\n
552 \t 5. with an TSgImageInfo with a size info bigger than the system memory\n
553 \t 6. with number of iUserAttributes more than KMaxHint(8)\n
554 @SYMTestExpectedResults The function should return\n
558 \t 4. KErrNotSupported\n
561 @SYMTestStatus Implemented
563 void CTSgImageCollectionGeneric::TestCreateImageCollectionInvalidL()
566 info.iSizeInPixels = TSize(8, 8);
567 info.iUsage = ESgUsageDirectGdiSource;
568 info.iPixelFormat = EUidPixelFormatRGB_565;
569 info.iCpuAccess = ESgCpuAccessReadWrite;
571 RSgImageCollection collection;
574 CreateImageCollectionL(collection);
575 CleanupClosePushL(collection);
576 TEST(KErrInUse == collection.Create(info, KNumImagesInCollection));
579 //invalid TSgImageInfo
581 info1.iSizeInPixels = TSize(-100, 100);
582 info1.iPixelFormat = EUidPixelFormatRGB_565;
583 info1.iCpuAccess = ESgCpuAccessReadWrite;
585 TEST(KErrArgument == collection.Create(info1, KNumImagesInCollection));
588 //negative or zero image count
590 TEST(KErrArgument == collection.Create(info, 0));
593 TEST(KErrArgument == collection.Create(info, -1));
596 //unsupported TSgImageInfo
598 info2.iCpuAccess = ESgCpuAccessReadWrite;
599 info2.iPixelFormat = EUidPixelFormatAP_88;
600 info2.iSizeInPixels = TSize(10, 10);
601 info2.iUsage = ESgUsageDirectGdiSource;
603 TEST(KErrNotSupported == collection.Create(info2, KNumImagesInCollection));
606 //number of iUserAttributes more than KMaxHint(8)
608 info3.iSizeInPixels = TSize(100, 100);
609 info3.iPixelFormat = EUidPixelFormatRGB_565;
610 info3.iCpuAccess = ESgCpuAccessNone;
611 info3.iUsage = ESgUsageDirectGdiTarget;
612 info3.iUserAttributes = new TSgUserAttribute[100];
613 CleanupArrayDeletePushL(info3.iUserAttributes);
614 info3.iUserAttributeCount = 100;
615 TInt ret = collection.Create(info3, KNumImagesInCollection);
618 TEST(KErrNoMemory == ret || KErrOverflow == ret);
622 TEST(KErrOverflow == ret);
625 CleanupStack::PopAndDestroy(2);
630 @SYMTestCaseID GRAPHICS-RESOURCE-0035
631 @SYMTestCaseDesc Creates multiple image collections with invalid parameters.
638 @SYMFssID RSgImageCollection::Create(const TSgImageInfo[], TInt, RSgImageCollection[], TInt)\n
639 RSgImageCollection::Close()
640 @SYMTestPriority Critical
641 @SYMTestType Unit Test
642 @SYMTestPurpose To check for different creation errors when creating multiple image collections.
643 @SYMTestActions Initialise the graphics resource component. Call the static Create():\n
644 \t 1. on an array of RSgImageCollection objects with at least one non-null
645 RSgImageCollection object\n
646 \t 2. with an array of TSgImageInfo objects with at least one invalid TSgImageInfo\n
647 \t 3. with a negative or zero image count\n
648 \t 4. with a negative or zero image collection count\n
649 \t 5. with an array of TSgImageInfo objects with at least one unsupported TSgImageInfo\n
650 \t 6. with an array of TSgImageInfo objects with at least one requesting immutable images\n
651 @SYMTestExpectedResults The function should return\n
656 \t 5. KErrNotSupported\n
657 \t 6. KErrNotSupported
658 @SYMTestStatus Partially Implemented
660 void CTSgImageCollectionGeneric::TestCreateMultipleImageCollectionsInvalidL()
664 info1.iCpuAccess = ESgCpuAccessNone;
665 info1.iPixelFormat = EUidPixelFormatXRGB_8888;
666 info1.iSizeInPixels = TSize(50, 50);
667 info1.iUsage = ESgUsageDirectGdiSource;
670 info2.iCpuAccess = ESgCpuAccessReadOnly;
671 info2.iPixelFormat = EUidPixelFormatRGB_565;
672 info2.iSizeInPixels = TSize(120, 120);
673 info2.iUsage = ESgUsageScreenSource;
676 info3.iCpuAccess = ESgCpuAccessReadWrite;
677 info3.iPixelFormat = EUidPixelFormatARGB_8888_PRE;
678 info3.iSizeInPixels = TSize(200, 200);
679 info3.iUsage = ESgUsageDirectGdiTarget;
681 TSgImageInfo infos[] = {info1, info2, info3};
683 //RSgImageCollection array
684 const TInt numberOfCollections = 3;
685 RSgImageCollection collections[numberOfCollections];
688 //create with one of the image info being invalid
689 infos[0].iSizeInPixels = TSize(-50, 50);
690 TEST(KErrArgument == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, numberOfCollections));
692 infos[0].iSizeInPixels = TSize(50, 50);
694 //create with one of the image collection array element being non-null
695 CreateImageCollectionL(collections[0]);
696 CleanupClosePushL(collections[0]);
697 TEST(KErrInUse == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, numberOfCollections));
699 CleanupStack::PopAndDestroy();
701 //create with a negative or zero image count
702 TEST(KErrArgument == RSgImageCollection::Create(infos, 0, collections, numberOfCollections));
703 TEST(KErrArgument == RSgImageCollection::Create(infos, -1, collections, numberOfCollections));
705 //create with a negative or zero image collection count
706 TEST(KErrArgument == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, 0));
707 TEST(KErrArgument == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, -1));
709 //create with one of the image info being unsupported
710 infos[0].iPixelFormat = EUidPixelFormatAP_88;
711 TEST(KErrNotSupported == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, numberOfCollections));
713 infos[0].iPixelFormat = EUidPixelFormatXRGB_8888;
715 //create with some of the image info objects specifying constant images
716 TEST(KErrNotSupported == RSgImageCollection::Create(infos, KNumImagesInCollection, collections, numberOfCollections));
718 //close all collections
719 for(TInt i=0; i<numberOfCollections; ++i)
721 collections[i].Close();
728 @SYMTestCaseID GRAPHICS-RESOURCE-0036
729 @SYMTestCaseDesc Calls GetInfo() on an image collection under various invalid conditions.
735 @SYMFssID RSgImageCollection::GetInfo(TSgImageInfo&)
736 @SYMTestPriority Critical
737 @SYMTestType Unit Test
738 @SYMTestPurpose To check the correct error messages are returned when GetInfo() is called
739 under various invalid conditions.
740 @SYMTestActions Initialise the graphics resource component. Call GetInfo() on an image collection\n
741 \t 1. that is uninitialised\n
742 \t 2. TSgImageInfo has different user attributes Ids from the existing Ids.
743 @SYMTestExpectedResults The function should return:\n
744 \t 1. KErrBadHandle\n
745 \t 2. KErrNotFound or KErrArgument
746 @SYMTestStatus Implemented
748 void CTSgImageCollectionGeneric::TestGetImageCollectionInfoInvalidL()
751 //uninitialised collection
752 RSgImageCollection collection;
754 TEST(KErrBadHandle == collection.GetInfo(info));
756 //TSgImageInfo has different user attributes Ids from the existing Ids.
757 info.iSizeInPixels = TSize(8, 8);
758 info.iUsage = ESgUsageDirectGdiTarget;
759 info.iPixelFormat = EUidPixelFormatRGB_565;
760 TSgUserAttribute testAttributes[] = {{0x00008888, 1}, {0x00009999, 2}};
761 info.iUserAttributes = testAttributes;
762 info.iUserAttributeCount = 2;
763 CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
764 CleanupClosePushL(collection);
766 TSgUserAttribute testAttributes2[1];
767 info3.iUserAttributes = testAttributes2;
768 info3.iUserAttributes[0].iUid = TUid::Uid(0x11111111);
769 info3.iUserAttributeCount = 1;
770 TInt result = collection.GetInfo(info3);
771 TEST(KErrNotFound == result || KErrArgument == result);
772 CleanupStack::PopAndDestroy();
778 @SYMTestCaseID GRAPHICS-RESOURCE-0037
779 @SYMTestCaseDesc Opens images from a collection under various invalid conditions.
785 @SYMFssID RSgImageCollection::OpenImage(TInt aIndex, RSgImage& aImage)
786 @SYMTestPriority Critical
787 @SYMTestType Unit Test
788 @SYMTestPurpose To ensure correct error messages are returned when client tries to
789 open an image inside an image collection under various invalid conditions.
790 @SYMTestActions Initialise the graphics resource component. Call OpenImage():\n
791 \t 1. on an uninitialised image collection\n
792 \t 2. with a negative index\n
793 \t 3. with an index that is bigger than the number of images in the collection\n
794 \t 4. with non-null aImage\n
795 @SYMTestExpectedResults The function should return:\n
796 \t 1. KErrBadHandle\n
800 @SYMTestStatus Implemented
802 void CTSgImageCollectionGeneric::TestOpenImageInCollectionInvalidL()
805 RSgImageCollection collection;
808 //uninitialised image collection
809 TEST(KErrBadHandle == collection.OpenImage(0, image));
811 CreateImageCollectionL(collection);
812 CleanupClosePushL(collection);
813 //with a negative index
814 TEST(KErrArgument == collection.OpenImage(-1, image));
817 //with an index that is bigger than the number of images in the collection
818 TInt invalidIndex = collection.Count();
819 TEST(KErrArgument == collection.OpenImage(invalidIndex, image));
822 //with non-null aImage handle
824 CleanupClosePushL(image);
825 TEST(KErrInUse == collection.OpenImage(0, image));
826 CleanupStack::PopAndDestroy(&image);
828 CleanupStack::PopAndDestroy();
833 @SYMTestCaseID GRAPHICS-RESOURCE-0038
834 @SYMTestCaseDesc Invalid map/unmap tests on individual images in a collection
841 @SYMFssID SgImageCollection::OpenImage(TInt aIndex, RSgImage& aImage)\n
842 RSgImage::MapReadOnly(const TAny*&, TInt&) const\n
843 RSgImage::MapWriteOnly(TAny*&, TInt&)\n
844 RSgImage::MapReadWrite(TAny*&, TInt&)\n
846 @SYMTestPriority Critical
847 @SYMTestType Unit Test
848 @SYMTestPurpose To check the images in an image collection can map/unmap the same way as standalone images.
849 @SYMTestActions Initialise the graphics resource component. Initialise an image collection. Get individual
850 images from the collection and perform various negative map/unmap tests on them.
851 @SYMTestExpectedResults The functions should behave in the same way as the tests defined previously for stand alone images.
852 @SYMTestStatus Defined
854 void CTSgImageCollectionGeneric::TestMapUnmapImagesInCollectionInvalidL()
858 //create a collection
860 info.iSizeInPixels = TSize(8, 8);
861 info.iUsage = ESgUsageDirectGdiSource;
862 info.iPixelFormat = EUidPixelFormatRGB_565;
863 info.iCpuAccess = ESgCpuAccessReadWrite;
864 info.iShareable = ETrue;
865 RSgImageCollection collection;
866 CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
867 CleanupClosePushL(collection);
869 const TAny* dataAddressRead;
870 TAny* dataAddressWrite;
874 for(TInt i=0; i<KNumImagesInCollection; ++i)
877 TEST(KErrNone == collection.OpenImage(i, image));
878 TEST(KErrNone == image.MapReadOnly(dataAddressRead, dataStride));
879 TEST(KErrInUse == image.MapReadOnly(dataAddressRead, dataStride));
880 TEST(KErrNone == image.Unmap());
882 TEST(KErrNone == image.MapWriteOnly(dataAddressWrite, dataStride));
883 TEST(KErrInUse == image.MapWriteOnly(dataAddressWrite, dataStride));
884 TEST(KErrNone == image.Unmap());
886 TEST(KErrNone == image.MapReadWrite(dataAddressWrite, dataStride));
887 TEST(KErrInUse == image.MapReadWrite(dataAddressWrite, dataStride));
888 TEST(KErrNone == image.Unmap());
891 CleanupStack::PopAndDestroy();
893 //call MapReadOnly() on the images in a collection created without CPU access
894 //flag ESgCpuAccessReadOnly or ESgCpuAccessReadWrite
895 info.iUsage = ESgUsageDirectGdiTarget;
896 info.iCpuAccess = ESgCpuAccessNone;
897 CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
898 CleanupClosePushL(collection);
899 for(TInt i=0; i<KNumImagesInCollection; ++i)
902 TEST(KErrNone == collection.OpenImage(i, image));
903 TEST(KErrAccessDenied == image.MapReadOnly(dataAddressRead, dataStride));
906 CleanupStack::PopAndDestroy();
908 info.iUsage = ESgUsageDirectGdiSource;
909 info.iCpuAccess = ESgCpuAccessWriteOnly;
910 CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
911 CleanupClosePushL(collection);
912 for(TInt i=0; i<KNumImagesInCollection; ++i)
915 TEST(KErrNone == collection.OpenImage(i, image));
916 TEST(KErrAccessDenied == image.MapReadOnly(dataAddressRead, dataStride));
919 CleanupStack::PopAndDestroy();
921 //call MapWriteOnly() on the images in a collection created without CPU access
922 //flag ESgCpuAccessWriteOnly or ESgCpuAccessReadWrite
923 info.iUsage = ESgUsageDirectGdiTarget;
924 info.iCpuAccess = ESgCpuAccessNone;
925 CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
926 CleanupClosePushL(collection);
927 for(TInt i=0; i<KNumImagesInCollection; ++i)
930 TEST(KErrNone == collection.OpenImage(i, image));
931 TEST(KErrAccessDenied == image.MapWriteOnly(dataAddressWrite, dataStride));
934 CleanupStack::PopAndDestroy();
936 info.iCpuAccess = ESgCpuAccessReadOnly;
937 TInt err = collection.Create(info, KNumImagesInCollection);
938 if(KErrNotSupported != err)
940 User::LeaveIfError(err);
941 CleanupClosePushL(collection);
942 for(TInt i=0; i<KNumImagesInCollection; ++i)
945 TEST(KErrNone == collection.OpenImage(i, image));
946 TEST(KErrAccessDenied == image.MapWriteOnly(dataAddressWrite, dataStride));
949 CleanupStack::PopAndDestroy();
953 INFO_PRINTF1(_L("Warning: skipping test MapWriteOnly() on read-only collection.\r\n"));
956 //call MapReadWrite() on the images in a collection created without CPU access
957 //flag ESgCpuAccessReadWrite
958 info.iCpuAccess = ESgCpuAccessNone;
959 CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
960 CleanupClosePushL(collection);
961 for(TInt i=0; i<KNumImagesInCollection; ++i)
964 TEST(KErrNone == collection.OpenImage(i, image));
965 TEST(KErrAccessDenied == image.MapReadWrite(dataAddressWrite, dataStride));
968 CleanupStack::PopAndDestroy();
970 info.iCpuAccess = ESgCpuAccessReadOnly;
971 err = collection.Create(info, KNumImagesInCollection);
972 if(KErrNotSupported != err)
974 CleanupClosePushL(collection);
975 for(TInt i=0; i<KNumImagesInCollection; ++i)
978 TEST(KErrNone == collection.OpenImage(i, image));
979 TEST(KErrAccessDenied == image.MapReadWrite(dataAddressWrite, dataStride));
982 CleanupStack::PopAndDestroy();
986 INFO_PRINTF1(_L("Warning: skipping test MapReadWrite() on read-only collection.\r\n"));
989 info.iUsage = ESgUsageDirectGdiSource;
990 info.iCpuAccess = ESgCpuAccessWriteOnly;
991 CheckErrorL(KErrNone, collection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
992 CleanupClosePushL(collection);
993 for(TInt i=0; i<KNumImagesInCollection; ++i)
996 TEST(KErrNone == collection.OpenImage(i, image));
997 TEST(KErrAccessDenied == image.MapReadWrite(dataAddressWrite, dataStride));
1000 CleanupStack::PopAndDestroy();
1005 void CTSgImageCollectionGeneric::DoMemoryTestsL()
1007 __UHEAP_MARK; SgDriver::AllocMarkStart();
1008 TestCreateImageCollectionL();
1009 __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1011 __UHEAP_MARK; SgDriver::AllocMarkStart();
1012 TestGetImageCollectionSurfaceIdL();
1013 __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1015 __UHEAP_MARK; SgDriver::AllocMarkStart();
1016 TestGetCollectionImageNumberL();
1017 __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1019 __UHEAP_MARK; SgDriver::AllocMarkStart();
1020 TestGetImageInfoInCollectionL();
1021 __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1023 __UHEAP_MARK; SgDriver::AllocMarkStart();
1024 TestOpenImageInCollectionL();
1025 __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1027 __UHEAP_MARK; SgDriver::AllocMarkStart();
1028 TestMapImageInCollectionL();
1029 __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1031 __UHEAP_MARK; SgDriver::AllocMarkStart();
1032 TestCreateMultipleImageCollectionL();
1033 __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1035 __UHEAP_MARK; SgDriver::AllocMarkStart();
1036 TestCreateImageCollectionInvalidL();
1037 __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1039 __UHEAP_MARK; SgDriver::AllocMarkStart();
1040 TestCreateMultipleImageCollectionsInvalidL();
1041 __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1043 __UHEAP_MARK; SgDriver::AllocMarkStart();
1044 TestGetImageCollectionInfoInvalidL();
1045 __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1047 __UHEAP_MARK; SgDriver::AllocMarkStart();
1048 TestOpenImageInCollectionInvalidL();
1049 __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1051 __UHEAP_MARK; SgDriver::AllocMarkStart();
1052 TestMapUnmapImagesInCollectionInvalidL();
1053 __UHEAP_MARKEND; SgDriver::AllocMarkEnd(0);
1057 @SYMTestCaseID GRAPHICS-RESOURCE-0068
1058 @SYMTestCaseDesc Calls RSgImageCollection::Close() with an invalid image collection handle
1061 @SYMFssID RSgImageCollection::Close()\n
1062 @SYMTestPriority Critical
1063 @SYMTestType Unit Test
1064 @SYMTestPurpose To ensure calling Close() with an invalid image collection handle will cause a panic.
1065 @SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1066 Declare another image collection and assign it to the current image collection handle. Close
1067 the current image collection so the second image collection handle becomes invalid. Call
1068 Close() on the second handle.
1069 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 4(ESgPanicBadImageCollectionHandle).
1070 @SYMTestStatus Implemented
1072 void CTSgImageCollectionGeneric::TestPanicImageCollectionCloseInvalidHandleL()
1075 TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCloseInvalidHandle, ETrue};
1076 TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1077 _LIT(KTestName, "TestImageCollectionCloseInvalidHandleL");
1078 CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName);
1082 @SYMTestCaseID GRAPHICS-RESOURCE-0069
1083 @SYMTestCaseDesc Calls RSgImageCollection::Close() with a non-null handle and an uninitialised driver
1086 @SYMFssID RSgImageCollection::Close()\n
1087 @SYMTestPriority Critical
1088 @SYMTestType Unit Test
1089 @SYMTestPurpose To ensure calling Close() with an invalid image collection handle will cause a panic.
1090 @SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1091 Declare another image collection and assign it to the current image collection handle. Close
1092 the current image collection so the second image collection handle becomes invalid. Close the
1093 graphics resource driver. Call Close() on the second handle.
1094 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
1095 @SYMTestStatus Implemented
1097 void CTSgImageCollectionGeneric::TestPanicImageCollectionCloseNoDriverL()
1100 TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCloseNoDriver, ETrue};
1101 TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1102 _LIT(KTestName, "TestImageCollectionCloseNoDriverL");
1103 CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
1107 @SYMTestCaseID GRAPHICS-RESOURCE-0070
1108 @SYMTestCaseDesc Calls RSgImageCollection::SurfaceId() with an invalid image collection handle
1111 @SYMFssID RSgImageCollection::SurfaceId()\n
1112 @SYMTestPriority Critical
1113 @SYMTestType Unit Test
1114 @SYMTestPurpose To ensure calling SurfaceId() with an invalid image collection handle will cause a panic.
1115 @SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1116 Declare another image collection and assign it to the current image collection handle. Close
1117 the current image collection so the second image collection handle becomes invalid. Call
1118 SurfaceId() on the second handle.
1119 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 4(ESgPanicBadImageCollectionHandle).
1120 @SYMTestStatus Implemented
1122 void CTSgImageCollectionGeneric::TestPanicImageCollectionSurfaceIdInvalidHandleL()
1125 TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionSurfaceIdInvalidHandle, ETrue};
1126 TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1127 _LIT(KTestName, "TestImageCollectionSurfaceIdInvalidHandleL");
1128 CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName);
1132 @SYMTestCaseID GRAPHICS-RESOURCE-0071
1133 @SYMTestCaseDesc Calls RSgImageCollection::SurfaceId() with a non-null handle and an uninitialised driver
1136 @SYMFssID RSgImageCollection::SurfaceId()\n
1137 @SYMTestPriority Critical
1138 @SYMTestType Unit Test
1139 @SYMTestPurpose To ensure calling SurfaceId() with an invalid image collection handle will cause a panic.
1140 @SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1141 Declare another image collection and assign it to the current image collection handle. Close
1142 the current image collection so the second image collection handle becomes invalid. Close the
1143 graphics resource driver. Call SurfaceId() on the second handle.
1144 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
1145 @SYMTestStatus Implemented
1147 void CTSgImageCollectionGeneric::TestPanicImageCollectionSurfaceIdNoDriverL()
1150 TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionSurfaceIdNoDriver, ETrue};
1151 TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1152 _LIT(KTestName, "TestImageCollectionSurfaceIdNoDriverL");
1153 CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
1157 @SYMTestCaseID GRAPHICS-RESOURCE-0072
1158 @SYMTestCaseDesc Calls RSgImageCollection::GetInfo() with an invalid image collection handle
1161 @SYMFssID RSgImageCollection::GetInfo(TSgImageInfo&)\n
1162 @SYMTestPriority Critical
1163 @SYMTestType Unit Test
1164 @SYMTestPurpose To ensure calling GetInfo() with an invalid image collection handle will cause a panic.
1165 @SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1166 Declare another image collection and assign it to the current image collection handle. Close
1167 the current image collection so the second image collection handle becomes invalid. Call
1168 GetInfo() on the second handle.
1169 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 4(ESgPanicBadImageCollectionHandle).
1170 @SYMTestStatus Implemented
1172 void CTSgImageCollectionGeneric::TestPanicImageCollectionGetInfoInvalidHandleL()
1175 TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionGetInfoInvalidHandle, ETrue};
1176 TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1177 _LIT(KTestName, "TestImageCollectionGetInfoInvalidHandleL");
1178 CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName);
1182 @SYMTestCaseID GRAPHICS-RESOURCE-0073
1183 @SYMTestCaseDesc Calls RSgImageCollection::GetInfo() with a non-null handle and an uninitialised driver
1186 @SYMFssID RSgImageCollection::GetInfo(TSgImageInfo&)\n
1187 @SYMTestPriority Critical
1188 @SYMTestType Unit Test
1189 @SYMTestPurpose To ensure calling GetInfo() with an invalid image collection handle will cause a panic.
1190 @SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1191 Declare another image collection and assign it to the current image collection handle. Close
1192 the current image collection so the second image collection handle becomes invalid. Close the
1193 graphics resource driver. Call GetInfo() on the second handle.
1194 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
1195 @SYMTestStatus Implemented
1197 void CTSgImageCollectionGeneric::TestPanicImageCollectionGetInfoNoDriverL()
1200 TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionGetInfoNoDriver, ETrue};
1201 TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1202 _LIT(KTestName, "TestImageCollectionGetInfoNoDriverL");
1203 CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
1207 @SYMTestCaseID GRAPHICS-RESOURCE-0074
1208 @SYMTestCaseDesc Calls RSgImageCollection::Count() with an invalid image collection handle
1211 @SYMFssID RSgImageCollection::Count()\n
1212 @SYMTestPriority Critical
1213 @SYMTestType Unit Test
1214 @SYMTestPurpose To ensure calling Count() with an invalid image collection handle will cause a panic.
1215 @SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1216 Declare another image collection and assign it to the current image collection handle. Close
1217 the current image collection so the second image collection handle becomes invalid. Call
1218 Count() on the second handle.
1219 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 4(ESgPanicBadImageCollectionHandle).
1220 @SYMTestStatus Implemented
1222 void CTSgImageCollectionGeneric::TestPanicImageCollectionCountInvalidHandleL()
1225 TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCountInvalidHandle, ETrue};
1226 TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1227 _LIT(KTestName, "TestImageCollectionCountInvalidHandleL");
1228 CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName);
1232 @SYMTestCaseID GRAPHICS-RESOURCE-0075
1233 @SYMTestCaseDesc Calls RSgImageCollection::Count() with a non-null handle and an uninitialised driver
1236 @SYMFssID RSgImageCollection::Count()\n
1237 @SYMTestPriority Critical
1238 @SYMTestType Unit Test
1239 @SYMTestPurpose To ensure calling Count() with an invalid image collection handle will cause a panic.
1240 @SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1241 Declare another image collection and assign it to the current image collection handle. Close
1242 the current image collection so the second image collection handle becomes invalid. Close the
1243 graphics resource driver. Call Count() on the second handle.
1244 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
1245 @SYMTestStatus Implemented
1247 void CTSgImageCollectionGeneric::TestPanicImageCollectionCountNoDriverL()
1250 TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCountNoDriver, ETrue};
1251 TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1252 _LIT(KTestName, "TestImageCollectionCountNoDriverL");
1253 CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
1257 @SYMTestCaseID GRAPHICS-RESOURCE-0076
1258 @SYMTestCaseDesc Calls RSgImageCollection::OpenImage() with an invalid image collection handle
1261 @SYMFssID RSgImageCollection::OpenImage()\n
1262 @SYMTestPriority Critical
1263 @SYMTestType Unit Test
1264 @SYMTestPurpose To ensure calling OpenImage() with an invalid image collection handle will cause a panic.
1265 @SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1266 Declare another image collection and assign it to the current image collection handle. Close
1267 the current image collection so the second image collection handle becomes invalid. Call
1268 OpenImage() on the second handle.
1269 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 4(ESgPanicBadImageCollectionHandle).
1270 @SYMTestStatus Implemented
1272 void CTSgImageCollectionGeneric::TestPanicImageCollectionOpenImageInvalidHandleL()
1275 TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionOpenImageInvalidHandle, ETrue};
1276 TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1277 _LIT(KTestName, "TestImageCollectionOpenImageInvalidHandleL");
1278 CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName);
1282 @SYMTestCaseID GRAPHICS-RESOURCE-0077
1283 @SYMTestCaseDesc Calls RSgImageCollection::OpenImage() with a non-null handle and an uninitialised driver
1286 @SYMFssID RSgImageCollection::OpenImage()\n
1287 @SYMTestPriority Critical
1288 @SYMTestType Unit Test
1289 @SYMTestPurpose To ensure calling OpenImage() with an invalid image collection handle will cause a panic.
1290 @SYMTestActions Initialise the graphics resource component and create an image collection in a second thread.
1291 Declare another image collection and assign it to the current image collection handle. Close
1292 the current image collection so the second image collection handle becomes invalid. Close the
1293 graphics resource driver. Call OpenImage() on the second handle.
1294 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
1295 @SYMTestStatus Implemented
1297 void CTSgImageCollectionGeneric::TestPanicImageCollectionOpenImageNoDriverL()
1300 TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionOpenImageNoDriver, ETrue};
1301 TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1302 _LIT(KTestName, "TestImageCollectionOpenImageNoDriverL");
1303 CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
1307 @SYMTestCaseID GRAPHICS-RESOURCE-0086
1308 @SYMTestCaseDesc Creates an image collection when the driver was not initialised.
1311 @SYMFssID RSgImageCollection::Create(const TSgImageInfo, TInt)\n
1312 @SYMTestPriority Critical
1313 @SYMTestType Unit Test
1314 @SYMTestPurpose To ensure calling RSgImageCollection::Create() with an uninitialised driver will cause a panic.
1315 @SYMTestActions Do not Initialise the graphics resource component and call RSgImageCollection::Create() in a second thread.
1316 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
1317 @SYMTestStatus Implemented
1319 void CTSgImageCollectionGeneric::TestPanicImageCollectionCreateNoDriver1L()
1322 TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCreateNoDriver1, ETrue};
1323 TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1324 _LIT(KTestName, "TestPanicImageCollectionCreateNoDriver1L");
1325 CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);
1329 @SYMTestCaseID GRAPHICS-RESOURCE-0087
1330 @SYMTestCaseDesc Creates multiple image collections when the driver was not initialised.
1333 @SYMFssID RSgImageCollection::Create(const TSgImageInfo[], TInt, RSgImageCollection[], TInt)\n
1334 @SYMTestPriority Critical
1335 @SYMTestType Unit Test
1336 @SYMTestPurpose To ensure calling RSgImageCollection::Create() with an uninitialised driver will cause a panic.
1337 @SYMTestActions Do not Initialise the graphics resource component and call RSgImageCollection::Create() in a second thread.
1338 @SYMTestExpectedResults The function should panic in the second thread with panic code SGRES 5 (ESgPanicNoDriver).
1339 @SYMTestStatus Implemented
1341 void CTSgImageCollectionGeneric::TestPanicImageCollectionCreateNoDriver2L()
1344 TSgresTestInfo threadInfo = {KSgNullDrawableId, info, 0, ESgresSecondThreadPanicImageCollectionCreateNoDriver2, ETrue};
1345 TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory);
1346 _LIT(KTestName, "TestPanicImageCollectionCreateNoDriver2L");
1347 CreateSecondThreadAndCheckPanicL(threadInfo, 5, exitCategoryName, KTestName);