sl@0: // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent - Graphics Resource API Conformance Test Suite sl@0: */ sl@0: sl@0: sl@0: #include "tsgimagegeneric.h" sl@0: sl@0: #include sl@0: sl@0: CTSgImageGeneric::CTSgImageGeneric(TBool aConformanceTests) : sl@0: CTSgTestStepBase(aConformanceTests) sl@0: { sl@0: INFO_PRINTF1(_L("Graphics resource component test - RSgImage Generic Tests.\r\n")); sl@0: } sl@0: sl@0: CTSgImageGeneric::~CTSgImageGeneric() sl@0: { sl@0: DestroyImages(); sl@0: } sl@0: sl@0: void CTSgImageGeneric::DestroyImages() sl@0: { sl@0: TInt count = iTestImages.Count(); sl@0: for(TInt i=0; i. Check the array size. sl@0: 2. Retrieve pixel formats when using an invalid usage bit value. sl@0: 3. Retrieve pixel formats supporting OpenGL ES. sl@0: 4. Retrieve pixel formats supporting OpenGL ES 2. sl@0: 5. Ensure the mandated pixel formats are available sl@0: @SYMTestExpectedResults The function must return: sl@0: 1. KErrNone sl@0: 2. KErrNone, but zero entries in the returned array. sl@0: 3. KErrNone, and a non-zero array size. sl@0: 4. KErrNone, and a non-zero array size. sl@0: 5. The returned pixel formats should cover the pixel formats sl@0: in the image compatibility table that works on all platforms. sl@0: */ sl@0: void CTSgImageGeneric::TestGetPixelFormatsL() sl@0: { sl@0: TestOpenDriverL(); sl@0: sl@0: //Retrieve the pixel formats sl@0: RArray pixelFormatArray; sl@0: CheckErrorL(KErrNone, RSgImage::GetPixelFormats(ESgUsageBitOpenVgImage, pixelFormatArray), (TText8*)__FILE__, __LINE__); sl@0: TEST(pixelFormatArray.Count() > 0); sl@0: pixelFormatArray.Reset(); sl@0: sl@0: // invalid usage bit sl@0: const TInt KInvalidUsageBit = 0x1000; sl@0: CheckErrorL(KErrNone, RSgImage::GetPixelFormats(KInvalidUsageBit, pixelFormatArray), (TText8*)__FILE__, __LINE__); sl@0: TEST(pixelFormatArray.Count() == 0); sl@0: pixelFormatArray.Reset(); sl@0: sl@0: //check all the pixel formats returned are in the common compatibility guarantees table sl@0: TestGetPixelFormatCompatibilityGuaranteesL(); sl@0: sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0004 sl@0: @SYMTestCaseDesc Creates an uninitialised image. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Create(const TSgImageInfo&, const TAny*, TInt) sl@0: RSgImage::IsNull() sl@0: @SYMTestPriority Critical sl@0: @SYMTestType UT sl@0: @SYMTestPurpose To ensure an uninitialised image can be created. sl@0: @SYMTestActions Initialise the graphics resource component. sl@0: Construct a well-defined TSgImageInfo object to work on all platforms. sl@0: Create an image with a NULL base address for the TSgImageInfo object. sl@0: @SYMTestExpectedResults Create() should return KErrNone in all cases. sl@0: The image data in the created images is uninitialised. sl@0: */ sl@0: void CTSgImageGeneric::TestCreateImageUninitializedL() sl@0: { sl@0: TestOpenDriverL(); sl@0: TSgImageInfo info; sl@0: info.iSizeInPixels = TSize(100, 100); sl@0: info.iUsage = ESgUsageBitOpenVgImage; sl@0: info.iPixelFormat = EUidPixelFormatRGB_565; sl@0: sl@0: RSgImage image; sl@0: CheckErrorL(KErrNone, image.Create(info, NULL, 0), (TText8*)__FILE__, __LINE__); sl@0: TEST(!image.IsNull()); sl@0: image.Close(); sl@0: sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0005 sl@0: @SYMTestCaseDesc Creates an image from a block of memory. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Create(const TSgImageInfo&, const TAny*, TInt) sl@0: RSgImage::IsNull() sl@0: @SYMTestPriority Critical sl@0: @SYMTestType UT sl@0: @SYMTestPurpose To ensure images can be created from a block of memory. sl@0: @SYMTestActions Initialise the graphics resource component. sl@0: Construct well-defined TSgImageInfo objects that work on all platforms. sl@0: Create a block of memory with or without initialised data. sl@0: Then create an image with the starting address of that memory. sl@0: @SYMTestExpectedResults The function should return KErrNone in all cases. sl@0: The user data starting at address aDataAddress will be populated into the new image. sl@0: */ sl@0: void CTSgImageGeneric::TestCreateImageL() sl@0: { sl@0: TestOpenDriverL(); sl@0: TSgImageInfo info; sl@0: info.iSizeInPixels = TSize(8, 8); sl@0: info.iPixelFormat = EUidPixelFormatRGB_565; sl@0: info.iUsage = ESgUsageBitOpenVgImage; sl@0: sl@0: RSgImage image; sl@0: CheckErrorL(KErrNone, image.Create(info, KCrossImageData, KCrossImageDataStride), (TText8*)__FILE__, __LINE__); sl@0: TEST(!image.IsNull()); sl@0: image.Close(); sl@0: sl@0: //Ensure that it is possible to create an image of at least 2048x2048 sl@0: RSgImage image2; sl@0: TSgImageInfo info2; sl@0: info2.iSizeInPixels = TSize(2048, 2048); sl@0: info2.iPixelFormat = EUidPixelFormatXRGB_8888; sl@0: info2.iUsage = ESgUsageBitOpenVgImage; sl@0: sl@0: TEST(KErrNone == image2.Create(info2)); sl@0: image2.Close(); sl@0: sl@0: info2.iSizeInPixels = TSize(KDiagonalImageSize, KDiagonalImageSize); sl@0: // This should create an image with a green diagonal from top-left to bottom-right on white background sl@0: TEST(KErrNone == image.Create(info2, iDiagonalImageData, KDiagonalImageDataStride)); sl@0: image.Close(); sl@0: // This should create an image with a green diagonal from top-right to bottom-left on white background sl@0: TEST(KErrNone == image.Create(info2, iDiagonalImageData, -KDiagonalImageDataStride)); sl@0: image.Close(); sl@0: sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0011 sl@0: @SYMTestCaseDesc Creates an uninitialised image in all mandatory pixel formats. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Create(const TSgImageInfo&, const TAny*, TInt) sl@0: @SYMTestPriority High sl@0: @SYMTestType UT sl@0: @SYMTestPurpose To ensure all mandatory image pixel formats are supported. sl@0: @SYMTestActions Initialise the graphics resource component. sl@0: Create an image with a NULL base address for each mandatory pixel sl@0: format of Graphics Resource implementations. sl@0: @SYMTestExpectedResults The function should return KErrNone in all cases. sl@0: */ sl@0: void CTSgImageGeneric::TestCreateImageAllPixelFormatsL() sl@0: { sl@0: TestOpenDriverL(); sl@0: sl@0: RSgImage image; sl@0: const TSize KImageSize = TSize(8, 8); sl@0: const TUint32 KImageUsage = ESgUsageBitOpenVgImage; sl@0: TInt err = KErrNone; sl@0: sl@0: err = image.Create(TSgImageInfo(KImageSize, EUidPixelFormatA_8, KImageUsage), NULL, 0); sl@0: TESTE(err == KErrNone, err); sl@0: TEST(!image.IsNull()); sl@0: image.Close(); sl@0: sl@0: err = image.Create(TSgImageInfo(KImageSize, EUidPixelFormatRGB_565, KImageUsage), NULL, 0); sl@0: TESTE(err == KErrNone, err); sl@0: TEST(!image.IsNull()); sl@0: image.Close(); sl@0: sl@0: err = image.Create(TSgImageInfo(KImageSize, EUidPixelFormatXRGB_8888, KImageUsage), NULL, 0); sl@0: TESTE(err == KErrNone, err); sl@0: TEST(!image.IsNull()); sl@0: image.Close(); sl@0: sl@0: err = image.Create(TSgImageInfo(KImageSize, EUidPixelFormatARGB_8888, KImageUsage), NULL, 0); sl@0: TESTE(err == KErrNone, err); sl@0: TEST(!image.IsNull()); sl@0: image.Close(); sl@0: sl@0: err = image.Create(TSgImageInfo(KImageSize, EUidPixelFormatARGB_8888_PRE, KImageUsage), NULL, 0); sl@0: TESTE(err == KErrNone, err); sl@0: TEST(!image.IsNull()); sl@0: image.Close(); sl@0: sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0006 sl@0: @SYMTestCaseDesc Creates an image from an existing image. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Create(const TSgImageInfo&, const RSgImage&) sl@0: @SYMTestPriority Critical sl@0: @SYMTestType UT sl@0: @SYMTestPurpose To ensure images can be created from existing images. sl@0: @SYMTestActions Initialise the graphics resource component. sl@0: Create an image. sl@0: Create another image with the attributes of this image as the TSgImageInfo. sl@0: @SYMTestExpectedResults The function should return KErrNone. sl@0: The new image should be identical to the old one. sl@0: */ sl@0: void CTSgImageGeneric::TestCreateImageFromExistingImageL() sl@0: { sl@0: RSgImage image1; sl@0: RSgImage image2; sl@0: TSgImageInfo info; sl@0: info.iUsage = ESgUsageBitOpenVgImage; sl@0: sl@0: TestOpenDriverL(); sl@0: CreateImageL(image1); sl@0: CleanupClosePushL(image1); sl@0: TEST(KErrNone == image1.GetInfo(info)); sl@0: sl@0: info.iUsage = ESgUsageBitOpenVgImage; sl@0: CheckErrorL(KErrNone, image2.Create(info, image1), (TText8*)__FILE__, __LINE__); sl@0: CleanupClosePushL(image2); sl@0: TSgImageInfo info2; sl@0: TEST(KErrNone == image2.GetInfo(info2)); sl@0: TEST(CompareInfos(info, info2)); sl@0: CleanupStack::PopAndDestroy(2); sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0007 sl@0: @SYMTestCaseDesc Calls GetInfo on an image. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::GetInfo(TSgImageInfo&) sl@0: @SYMTestPriority Critical sl@0: @SYMTestType UT sl@0: @SYMTestPurpose To ensure the information about the image is correct. sl@0: @SYMTestActions Initialise the graphics resource component. sl@0: Construct a TSgImageInfo object and initialise all the member variables. sl@0: Call GetInfo() and compare the resulting TSgImageInfo objects with previous ones. sl@0: @SYMTestExpectedResults The function should return KErrNone. sl@0: Information about the image object is stored in the aInfo parameter. sl@0: The retrieved TSgImageInfo objects should be identical to the original ones. sl@0: */ sl@0: void CTSgImageGeneric::TestGetImageInfoL() sl@0: { sl@0: TestOpenDriverL(); sl@0: TSgImageInfo info; sl@0: info.iPixelFormat = EUidPixelFormatRGB_565; sl@0: info.iSizeInPixels = TSize(100, 100); sl@0: info.iUsage = ESgUsageBitOpenVgImage; sl@0: sl@0: RSgImage image; sl@0: CheckErrorL(KErrNone, image.Create(info, NULL, 0), (TText8*)__FILE__, __LINE__); sl@0: CleanupClosePushL(image); sl@0: sl@0: TSgImageInfo info2; sl@0: TEST(KErrNone == image.GetInfo(info2)); sl@0: TEST(CompareInfos(info, info2)); sl@0: CleanupStack::PopAndDestroy(); sl@0: sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0008 sl@0: @SYMTestCaseDesc Retrieves drawable id and drawable type of an image. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Id() sl@0: RSgImage::DrawableType() sl@0: @SYMTestPriority Critical sl@0: @SYMTestType UT sl@0: @SYMTestPurpose To ensure the globally unique drawable id of the image can be retrieved. sl@0: @SYMTestActions Initialise the graphics resource component. Create an image. Call sl@0: Id() to retrieve its drawable id. sl@0: @SYMTestExpectedResults A valid drawable id should be successfully returned when the image has been opened. sl@0: KSgNullDrawableId should be returned if it has not; the default drawable type should sl@0: be KNullUid. sl@0: */ sl@0: void CTSgImageGeneric::TestGetImageDrawableIdL() sl@0: { sl@0: RSgImage image; sl@0: TEST(KNullUid == image.DrawableType()); sl@0: TSgDrawableId id = image.Id(); sl@0: TEST(id == KSgNullDrawableId); sl@0: TestOpenDriverL(); sl@0: sl@0: CreateImageL(image); sl@0: id = image.Id(); sl@0: TEST(id != KSgNullDrawableId); sl@0: TEST(KSgImageTypeUid == image.DrawableType()); sl@0: sl@0: image.Close(); sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0010 sl@0: @SYMTestCaseDesc Opens a handle to an image in both the current process and another process. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Open(const TSgDrawableId&) sl@0: @SYMTestPriority Critical sl@0: @SYMTestType UT sl@0: @SYMTestPurpose To ensure image can be opened in both a second thread in the current sl@0: process and another process. sl@0: @SYMTestActions Initialise the graphics resource component. Create an image and call sl@0: Open() on the image in the second thread in the current process and in sl@0: another process. To ensure they are correct compare their Id and attributes. sl@0: @SYMTestExpectedResults The function must return KErrNone in all cases. sl@0: */ sl@0: void CTSgImageGeneric::TestOpenImageL() sl@0: { sl@0: TestOpenDriverL(); sl@0: sl@0: RSgImage image1; sl@0: TSgImageInfo info1; sl@0: info1.iSizeInPixels = TSize(8, 8); sl@0: info1.iUsage = ESgUsageBitOpenVgImage; sl@0: info1.iPixelFormat = EUidPixelFormatRGB_565; sl@0: CheckErrorL(KErrNone, image1.Create(info1, KCrossImageData, KCrossImageDataStride), (TText8*)__FILE__, __LINE__); sl@0: sl@0: const TSgDrawableId id1 = image1.Id(); sl@0: sl@0: //opening image in the current thread sl@0: RSgImage image2; sl@0: TEST(KErrNone == image2.Open(id1)); sl@0: TEST(image1.Id() == image2.Id()); sl@0: sl@0: TSgImageInfo getInfo1; sl@0: TSgImageInfo getInfo2; sl@0: sl@0: image1.GetInfo(getInfo1); sl@0: image2.GetInfo(getInfo2); sl@0: sl@0: TEST(CompareInfos(info1, getInfo1)); sl@0: TEST(getInfo1.iPixelFormat == getInfo2.iPixelFormat sl@0: && getInfo1.iSizeInPixels == getInfo2.iSizeInPixels sl@0: && getInfo1.iUsage == getInfo2.iUsage); sl@0: sl@0: if (iEnableConformanceTests) sl@0: { sl@0: //opening image in a second thread in the current process sl@0: TSgThreadTestInfo threadInfo(id1, info1, ESgresSecondThreadOpenImage); sl@0: TInt testResult = 0; sl@0: TRAPD(err, testResult = CreateSecondThreadAndDoTestL(threadInfo)); sl@0: TEST(err == KErrNone); sl@0: TEST(testResult >= 0); sl@0: sl@0: // Test the results from the second thread sl@0: TEST(testResult & EFirstTestPassed); sl@0: TEST(testResult & ESecondTestPassed); sl@0: TEST(testResult & EThirdTestPassed); sl@0: TEST(testResult & EFourthTestPassed); sl@0: TEST(testResult & EFifthTestPassed); sl@0: TEST(testResult & ESixthTestPassed); sl@0: TEST(testResult & ESeventhTestPassed); sl@0: TEST(testResult & EEighthTestPassed); sl@0: sl@0: //opening image in a second process sl@0: TSgProcessTestInfo processInfo(id1, getInfo1, ESgresSecondProcessOpenImage); sl@0: TRAP(err, testResult = CreateSecondProcessAndDoTestL(KSecondProcess, processInfo)); sl@0: TEST(err == KErrNone); sl@0: TEST(testResult >= 0); sl@0: sl@0: TEST(testResult & EFirstTestPassed); sl@0: TEST(testResult & ESecondTestPassed); sl@0: TEST(testResult & EThirdTestPassed); sl@0: TEST(testResult & EFourthTestPassed); sl@0: TEST(testResult & EFifthTestPassed); sl@0: TEST(testResult & ESixthTestPassed); sl@0: TEST(testResult & ESeventhTestPassed); sl@0: } sl@0: sl@0: image1.Close(); sl@0: image2.Close(); sl@0: sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: /** sl@0: Fake RSgImage extension interface used in negative RSgImage::GetInterface() Tests sl@0: */ sl@0: class MFake sl@0: { sl@0: public: sl@0: enum { EInterfaceUid = 0x88888888 }; sl@0: }; sl@0: sl@0: class MFakeNullUid sl@0: { sl@0: public: sl@0: enum { EInterfaceUid = KNullUidValue}; sl@0: }; sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0044 sl@0: @SYMTestCaseDesc Gets an invalid/unsupported image extension interface sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Create(const TSgImageInfo&, const TAny*, TInt) sl@0: RSgImage::GetInterface() sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure the correct error code is returned when attempting sl@0: to retrieve an invalid RSgImage extension interface. sl@0: @SYMTestActions Initialise the graphics resource component. Create an image. sl@0: 1. Declare an unsupported interface MFake and pass to GetInterface(). sl@0: 2. Declare an interface MFakeNullUid which has a null uid and pass to GetInterface(). sl@0: @SYMTestExpectedResults 1. GetInterface() should return KErrExtensionNotSupported. sl@0: 2. GetInterface() should return KErrArgument since null uids are not acceptable. sl@0: */ sl@0: void CTSgImageGeneric::TestGetInterfaceL() sl@0: { sl@0: TestOpenDriverL(); sl@0: sl@0: TSgImageInfo info; sl@0: info.iSizeInPixels = TSize(8, 8); sl@0: info.iUsage = ESgUsageBitOpenVgImage; sl@0: info.iPixelFormat = EUidPixelFormatRGB_565; sl@0: sl@0: RSgImage image; sl@0: sl@0: //fake interface sl@0: MFake* smFake = reinterpret_cast(1); sl@0: MFake* smFake2 = reinterpret_cast(1); sl@0: sl@0: //Check Calls to Get Interface on Null Image Handle sl@0: TEST(KErrBadHandle == image.GetInterface(smFake)); sl@0: TEST(KErrBadHandle == image.GetInterface(smFake2)); sl@0: TEST(!smFake); sl@0: TEST(!smFake2); sl@0: sl@0: CheckErrorL(KErrNone, image.Create(info, NULL, 0), (TText8*)__FILE__, __LINE__); sl@0: sl@0: // check TSgDrawableId is not NULL sl@0: TSgDrawableId id = image.Id(); sl@0: TEST(KSgNullDrawableId != id); sl@0: sl@0: smFake = reinterpret_cast(1); sl@0: smFake2 = reinterpret_cast(1); sl@0: sl@0: TEST(KErrExtensionNotSupported == image.GetInterface(smFake)); sl@0: TEST(!smFake); sl@0: sl@0: TEST(KErrExtensionNotSupported == image.GetInterface(smFake2)); sl@0: TEST(!smFake2); sl@0: sl@0: // null interface uid sl@0: MFakeNullUid* smFake3 = NULL; sl@0: TEST(KErrArgument == image.GetInterface(smFake3)); sl@0: TEST(!smFake3); sl@0: sl@0: image.Close(); sl@0: sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0024 sl@0: @SYMTestCaseDesc Gets supported pixel formats with invalid parameters. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::GetPixelFormats(TUint32, RArray, sl@0: const TSgAttributeArrayBase*) sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure the correct error messages are returned when user tries to sl@0: call GetPixelFormats() with invalid parameters. sl@0: @SYMTestActions Initialise the graphics resource component. Call RSgImage::GetPixelFormats with: sl@0: 1. Usage of 0 sl@0: 2. Invalid attribute array sl@0: 3. Valid arguments sl@0: 4. Pixel formats array is not empty sl@0: @SYMTestExpectedResults RSgImage::GetPixelFormats() should return: sl@0: 1. KErrArgument sl@0: 2. KErrNotSupported sl@0: 3. KErrNone sl@0: 4. KErrArgument sl@0: */ sl@0: void CTSgImageGeneric::TestGetPixelFormatsInvalidL() sl@0: { sl@0: RArray pixelFormats; sl@0: CleanupClosePushL(pixelFormats); sl@0: TSgAttributeArray<1> attribArray; sl@0: attribArray[0].iUid = KNullUid; sl@0: attribArray[0].iValue = 0; sl@0: TEST(attribArray.Count() == 1); sl@0: sl@0: TestOpenDriverL(); sl@0: sl@0: TEST(KErrArgument == RSgImage::GetPixelFormats(0, pixelFormats)); sl@0: pixelFormats.Reset(); sl@0: sl@0: TEST(KErrNotSupported == RSgImage::GetPixelFormats(ESgUsageBitOpenVgImage, pixelFormats, &attribArray)); sl@0: pixelFormats.Reset(); sl@0: sl@0: TEST(KErrNone == RSgImage::GetPixelFormats(ESgUsageBitOpenVgImage, pixelFormats)); sl@0: TEST(pixelFormats.Count() > 0); sl@0: //Don't reset pixel formats for next test sl@0: sl@0: TEST(KErrArgument == RSgImage::GetPixelFormats(ESgUsageBitOpenVgImage, pixelFormats)); sl@0: pixelFormats.Reset(); sl@0: sl@0: TestCloseDriver(); sl@0: CleanupStack::PopAndDestroy(&pixelFormats); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0025 sl@0: @SYMTestCaseDesc Opens an image with different invalid and valid parameters. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Open(const TSgDrawableId&) sl@0: @SYMTestPriority Medium sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to check correct error messages are returned when opening sl@0: image with different invalid parameters. sl@0: @SYMTestActions Initialise the graphics resource component. Construct an RSgImage object. sl@0: Call the Open() function in both the current process and another process with: sl@0: 1. a non-null RSgImage handle sl@0: 2. null drawable id sl@0: 3. fake drawable id sl@0: 4. a valid RSgImage handle sl@0: Do the same tests in a second thread and a second process. sl@0: @SYMTestExpectedResults The function should return: sl@0: 1. KErrInUse sl@0: 2. KErrArgument sl@0: 3. KErrNotFound sl@0: 4. KErrNone sl@0: */ sl@0: void CTSgImageGeneric::TestOpenImageInvalidL() sl@0: { sl@0: TestOpenDriverL(); sl@0: //create a non-sharable image sl@0: TSgImageInfo info; sl@0: info.iSizeInPixels = TSize(8, 8); sl@0: info.iUsage = ESgUsageBitOpenVgImage; sl@0: info.iPixelFormat = EUidPixelFormatRGB_565; sl@0: sl@0: RSgImage image; sl@0: CheckErrorL(KErrNone, image.Create(info, KCrossImageData, KCrossImageDataStride), (TText8*)__FILE__, __LINE__); sl@0: CleanupClosePushL(image); sl@0: const TSgDrawableId id = image.Id(); sl@0: sl@0: //Attempt to create the image again using the same object sl@0: TEST(KErrInUse == image.Create(info, KCrossImageData, KCrossImageDataStride)); sl@0: sl@0: //same thread sl@0: // non-empty handle sl@0: RSgImage image1; sl@0: CreateImageL(image1); sl@0: CleanupClosePushL(image1); sl@0: TEST(KErrInUse == image1.Open(id)); sl@0: image1.Close(); sl@0: sl@0: // non-existing drawable id sl@0: TSgDrawableId fakeid = {0xFFFFFFFFFFFFFFFFU}; sl@0: CheckErrorL(KErrNotFound, image1.Open(fakeid), (TText8*)__FILE__, __LINE__); sl@0: image1.Close(); sl@0: sl@0: if (iEnableConformanceTests) sl@0: { sl@0: //different thread in the same process sl@0: TSgThreadTestInfo threadInfo(id, info, ESgresSecondThreadOpenImageInvalid); sl@0: TInt testResult = 0; sl@0: TRAPD(err, testResult = CreateSecondThreadAndDoTestL(threadInfo)); sl@0: TEST(testResult >= 0); sl@0: // Test the results from the second thread sl@0: TEST(testResult & EFirstTestPassed); sl@0: TEST(testResult & ESecondTestPassed); sl@0: TEST(testResult & EThirdTestPassed); sl@0: TEST(testResult & EFourthTestPassed); sl@0: TEST(testResult & EFifthTestPassed); sl@0: sl@0: //different process sl@0: TSgProcessTestInfo processInfo(id, info, ESgresSecondProcessOpenImageInvalid); sl@0: TRAP(err, testResult = CreateSecondProcessAndDoTestL(KSecondProcess, processInfo)); sl@0: TEST(testResult >= 0); sl@0: TEST(testResult & EFirstTestPassed); sl@0: TEST(testResult & ESecondTestPassed); sl@0: TEST(testResult & EThirdTestPassed); sl@0: TEST(testResult & EFourthTestPassed); sl@0: TEST(testResult & EFifthTestPassed); sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(2); sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0026 sl@0: @SYMTestCaseDesc Closes an image multiple times. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Close() sl@0: @SYMTestPriority High sl@0: @SYMTestType UT sl@0: @SYMTestPurpose To check calling Close() multiple times after Open() does not cause sl@0: errors or panics. sl@0: @SYMTestActions Initialise the graphics resource component. Create an image and then sl@0: call Close() three times on it. sl@0: @SYMTestExpectedResults The function should not cause any errors or panics. sl@0: */ sl@0: void CTSgImageGeneric::TestCloseImageManyTimesL() sl@0: { sl@0: TestOpenDriverL(); sl@0: RSgImage image; sl@0: CreateImageL(image); sl@0: TEST(!image.IsNull()); sl@0: sl@0: image.Close(); sl@0: TEST(image.IsNull()); sl@0: image.Close(); sl@0: TEST(image.IsNull()); sl@0: image.Close(); sl@0: TEST(image.IsNull()); sl@0: sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0027 sl@0: @SYMTestCaseDesc Closes an image object without opening it. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Close() sl@0: @SYMTestPriority Medium sl@0: @SYMTestType UT sl@0: @SYMTestPurpose To check Close() does nothing if the image is not already opened. sl@0: @SYMTestActions Initialise the graphics resource component. Declare an RSgImage object and sl@0: call Close() on it. sl@0: @SYMTestExpectedResults The function should not cause any errors or panics. sl@0: */ sl@0: void CTSgImageGeneric::TestCloseImageWithoutOpenL() sl@0: { sl@0: TestOpenDriverL(); sl@0: RSgImage image; sl@0: TEST(image.IsNull()); sl@0: image.Close(); sl@0: TEST(image.IsNull()); sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0028 sl@0: @SYMTestCaseDesc Creates an image with various invalid parameters. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Create(const TSgImageInfo&, const TAny*, TInt, const TSgAttributeArrayBase* = NULL) sl@0: RSgImage::Create(const TSgImageInfo&, const RSgImage&, const TSgAttributeArrayBase* = NULL) sl@0: @SYMTestPriority Medium sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to check the function returns the correct error messages when sl@0: the parameters are invalid. sl@0: @SYMTestActions Initialise the graphics resource component. Construct a TSgImageInfo object sl@0: and initialise the all the member variables with random values. Call the appropriate sl@0: Create() function with: sl@0: 1. invalid TSgImageInfo.iSizeInPixels sl@0: 2. unsupported TSgImageInfo Pixel Format sl@0: 3. the creating RSgImage handle is not null sl@0: 4. the aSgImage handle is null sl@0: 5. the size and pixel format in TSgImageInfo is not the same as that of aSgImage sl@0: 6. the pixel stride specified is 0 when bitmap data is given sl@0: @SYMTestExpectedResults The function should return sl@0: 1. KErrArgument or KErrNotSupported for the overload taking an RSgImage sl@0: 2. KErrNotSupported sl@0: 3. KErrInUse sl@0: 4. KErrArgument sl@0: 5. KErrNotSupported sl@0: 6. KErrArgument sl@0: */ sl@0: void CTSgImageGeneric::TestCreateImageInvalidL() sl@0: { sl@0: TestOpenDriverL(); sl@0: RSgImage image; sl@0: sl@0: RSgImage validImage; sl@0: TSgImageInfo validInfo(TSize(8,8), EUidPixelFormatRGB_565, ESgUsageBitOpenVgImage); sl@0: TEST(KErrNone == validImage.Create(validInfo, KCrossImageData, KCrossImageDataStride)); sl@0: sl@0: //invalid info 1 - invalid width sl@0: TSgImageInfo info1(TSize(-100,100), EUidPixelFormatRGB_565, ESgUsageBitOpenVgImage); sl@0: TEST(KErrArgument == image.Create(info1, NULL, 0)); sl@0: image.Close(); sl@0: TEST(KErrArgument == image.Create(info1, KCrossImageData, KCrossImageDataStride)); sl@0: image.Close(); sl@0: //invalid height sl@0: info1.iSizeInPixels = TSize(100, -100); sl@0: TEST(KErrArgument == image.Create(info1, NULL, 0)); sl@0: image.Close(); sl@0: //Sizes don't match sl@0: TEST(KErrNotSupported == image.Create(info1, validImage)); sl@0: image.Close(); sl@0: sl@0: info1.iSizeInPixels = TSize(0,0); sl@0: TEST(KErrArgument == image.Create(info1, NULL, 0)); sl@0: image.Close(); sl@0: TEST(KErrArgument == image.Create(info1, KCrossImageData, KCrossImageDataStride)); sl@0: image.Close(); sl@0: //Sizes don't match sl@0: TEST(KErrNotSupported == image.Create(info1, validImage)); sl@0: image.Close(); sl@0: sl@0: //Invalid usage sl@0: info1.iUsage = KMaxTUint32; sl@0: info1.iSizeInPixels = TSize(8,8); sl@0: TEST(KErrNotSupported == image.Create(info1, KCrossImageData, KCrossImageDataStride)); sl@0: image.Close(); sl@0: TEST(KErrNotSupported == image.Create(info1, validImage)); sl@0: image.Close(); sl@0: sl@0: //unsupported info 1 - invalid pixel format sl@0: TSgImageInfo info2; sl@0: info2.iSizeInPixels = TSize(8, 8); sl@0: info2.iUsage = ESgUsageBitOpenVgImage; sl@0: info2.iPixelFormat = EUidPixelFormatUnknown; sl@0: TEST(KErrArgument == image.Create(info2, NULL, 0)); sl@0: image.Close(); sl@0: TEST(KErrArgument == image.Create(info2, KCrossImageData, KCrossImageDataStride)); sl@0: image.Close(); sl@0: sl@0: //unsupported info 2 - large image size sl@0: info2.iPixelFormat = ESgPixelFormatRGB_565; sl@0: info2.iSizeInPixels = TSize(40000, 100); sl@0: TEST(KErrTooBig == image.Create(info2, NULL, 0)); sl@0: info2.iSizeInPixels = TSize(100, 40000); sl@0: TEST(KErrTooBig == image.Create(info2, NULL, 0)); sl@0: image.Close(); sl@0: sl@0: //non-null handle sl@0: CreateImageL(image); sl@0: TSgImageInfo info3; sl@0: info3.iSizeInPixels = TSize(8, 8); sl@0: info3.iUsage = ESgUsageBitOpenVgImage; sl@0: info3.iPixelFormat = ESgPixelFormatRGB_565; sl@0: sl@0: TInt ret = image.Create(info3, NULL, 16); sl@0: TEST(KErrInUse == ret); sl@0: sl@0: //non-null handle: create from an existing image sl@0: RSgImage image1; sl@0: CreateImageL(image1); sl@0: TEST(KErrInUse == image1.Create(info3, image)); sl@0: image1.Close(); sl@0: sl@0: //null existing image handle sl@0: RSgImage image2; sl@0: TEST(image2.IsNull()); sl@0: TEST(KErrArgument == image1.Create(info3, image2)); sl@0: sl@0: //the size and pixel format in TSgImageInfo is not the same as that of aSgImage sl@0: TSgImageInfo info4(TSize(100,100), ESgPixelFormatARGB_8888, ESgUsageBitOpenVgImage); sl@0: TEST(KErrNotSupported == image1.Create(info4, image)); sl@0: sl@0: image1.GetInfo(info3); sl@0: info4.iSizeInPixels = info3.iSizeInPixels; sl@0: info4.iPixelFormat = ESgPixelFormatXRGB_8888; sl@0: TEST(KErrNotSupported == image1.Create(info4, image)); sl@0: sl@0: image.Close(); sl@0: image1.Close(); sl@0: sl@0: TSgImageInfo info5(TSize(8,8), ESgPixelFormatRGB_565, ESgUsageBitOpenVgImage); sl@0: sl@0: TSgAttributeArray<1> attribArray; sl@0: attribArray[0].iUid = KNullUid; sl@0: attribArray[0].iValue = 0; sl@0: sl@0: TEST(KErrNotSupported == image1.Create(info5, KCrossImageData, KCrossImageDataStride, &attribArray)); sl@0: image1.Close(); sl@0: sl@0: //Stride of 0 sl@0: TEST(KErrArgument == image1.Create(info5, KCrossImageData, 0)); sl@0: image1.Close(); sl@0: sl@0: validImage.Close(); sl@0: sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0039 sl@0: @SYMTestCaseDesc Calls GetInfo() on an invalid image. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::GetInfo(TSgImageInfo&) sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to check the correct error is returned when the client sl@0: tries to get information on an invalid image. sl@0: @SYMTestActions Initialise the graphics resource component. sl@0: Call GetInfo() on an image that is not initialised. sl@0: @SYMTestExpectedResults GetInfo() should return KErrBadHandle sl@0: */ sl@0: void CTSgImageGeneric::TestGetInfoImageInvalidL() sl@0: { sl@0: TestOpenDriverL(); sl@0: RSgImage image; sl@0: TSgImageInfo info(TSize(5,5), ESgPixelFormatARGB_8888, ESgUsageBitOpenVgImage); sl@0: sl@0: //uninitialised image sl@0: TEST(KErrBadHandle == image.GetInfo(info)); sl@0: sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0092 sl@0: @SYMTestCaseDesc Calls GetAttribute() on an invalid image. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::GetAttribute(TUid, TInt&) sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to check the correct error is returned when the client sl@0: tries to get attributes on an invalid image. sl@0: @SYMTestActions Initialise the graphics resource component. sl@0: Call GetInfo on an image that is not initialised. sl@0: @SYMTestExpectedResults GetAttribute() should return KErrBadHandle sl@0: */ sl@0: void CTSgImageGeneric::TestGetAttributesImageInvalidL() sl@0: { sl@0: TestOpenDriverL(); sl@0: RSgImage image; sl@0: TSgImageInfo info(TSize(5,5), ESgPixelFormatARGB_8888, ESgUsageBitOpenVgImage); sl@0: sl@0: TUid uid = {0x12345678}; sl@0: TInt val = 0; sl@0: TEST(KErrBadHandle == image.GetAttribute(uid, val)); sl@0: sl@0: image.Close(); sl@0: sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0100 sl@0: @SYMTestCaseDesc Creates images using negative and invalid data strides. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Create(TUid, TInt&) sl@0: @SYMTestPriority Medium sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Positive test for using negative data strides. sl@0: Negative test for using invalid data strides. sl@0: @SYMTestActions Initialise the graphics resource component. sl@0: 1. Create an image with a data stride that is smaller than the width sl@0: of the image. sl@0: 2. Create an image with a pointer to bitmap data, but 0 data stride. sl@0: 3. Create an image with a negative data stride equal to the width sl@0: of the image. sl@0: 4. Create an image with a negative data stride less than the width sl@0: of the image. sl@0: @SYMTestExpectedResults 1. Create() should return KErrArgument. sl@0: 2. Create() should return KErrArgument. sl@0: 3. Create() should successfully create the image and return KErrNone. sl@0: 4. Create() should return KErrArgument. sl@0: */ sl@0: void CTSgImageGeneric::TestCreateImageDataStrideL() sl@0: { sl@0: TestOpenDriverL(); sl@0: sl@0: RSgImage image; sl@0: TSgImageInfo info1(TSize(8,8), EUidPixelFormatRGB_565, ESgUsageBitOpenVgImage); sl@0: sl@0: TEST(KErrArgument == image.Create(info1, KCrossImageData, KCrossImageDataStride-1)); sl@0: image.Close(); sl@0: TEST(KErrArgument == image.Create(info1, KCrossImageData, 0)); sl@0: image.Close(); sl@0: sl@0: TEST(KErrNone == image.Create(info1, KCrossImageData, -KCrossImageDataStride)); sl@0: image.Close(); sl@0: sl@0: TEST(KErrArgument == image.Create(info1, KCrossImageData, -KCrossImageDataStride+1)); sl@0: image.Close(); sl@0: sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0048 sl@0: @SYMTestCaseDesc RSgImage stress tests sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Create(const TSgImageInfo&, const TAny*, TInt) sl@0: RSgImage::Close() sl@0: @SYMTestPriority Medium sl@0: @SYMTestType CT sl@0: @SYMTestPurpose To ensure creating and destroying RSgImage multiple times work well. sl@0: @SYMTestActions Create images 1000 times but only store KMaxImagesInArray of them sl@0: at one time in an RArray. When a new image is to be added to the sl@0: array, a random image from the array is removed. sl@0: @SYMTestExpectedResults There should be no panics or leaves. sl@0: */ sl@0: void CTSgImageGeneric::TestStress1L() sl@0: { sl@0: TestOpenDriverL(); sl@0: TSgImageInfo info; sl@0: info.iPixelFormat = EUidPixelFormatRGB_565; sl@0: info.iSizeInPixels = TSize(100, 100); sl@0: info.iUsage = ESgUsageBitOpenVgImage; sl@0: sl@0: TInt KMaxImagesInArray =40; sl@0: TInt64 seed = 0; sl@0: for (TInt count = 1000; count > 0; --count) sl@0: { sl@0: RSgImage image; sl@0: CheckErrorL(KErrNone, image.Create(info, NULL, 0), (TText8*)__FILE__, __LINE__); sl@0: CleanupClosePushL(image); sl@0: iTestImages.AppendL(image); sl@0: CleanupStack::Pop(); sl@0: if (iTestImages.Count() >= KMaxImagesInArray) sl@0: { sl@0: TInt i = Math::Rand(seed) % KMaxImagesInArray; sl@0: iTestImages[i].Close(); sl@0: iTestImages.Remove(i); sl@0: } sl@0: } sl@0: TInt count = iTestImages.Count(); sl@0: for(TInt i=0; i threads; sl@0: _LIT(KMultipleThreadName, "Multiple Threads Stress Test Thread "); sl@0: for (TInt i = 0; i < KNoOfThreads; ++i) sl@0: { sl@0: TBuf<50> threadName(KMultipleThreadName); sl@0: threadName.AppendNum(i); sl@0: RThread thread; sl@0: User::LeaveIfError(thread.Create(threadName, SgTestSecondThread::ThreadStart, KDefaultStackSize, KSecondThreadMinHeapSize, KSecondThreadMaxHeapSize, &threadInfo)); sl@0: thread.SetPriority(EPriorityLess); sl@0: threads.AppendL(thread); sl@0: } sl@0: // run threads sl@0: for (TInt i = 0; i < KNoOfThreads; ++i) sl@0: { sl@0: threads[i].Resume(); sl@0: } sl@0: // wait for the threads to terminate processing sl@0: for (TInt i = 0; i < KNoOfThreads; ++i) sl@0: { sl@0: sem.Wait(); sl@0: } sl@0: for (TInt i = 0; i < KNoOfThreads; ++i) sl@0: { sl@0: threads[i].Close(); sl@0: } sl@0: CleanupStack::PopAndDestroy(2, &image); // image, sem sl@0: TestCloseDriver(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0051 sl@0: @SYMTestCaseDesc Calls RSgImage::GetInterface() with an invalid image handle sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::GetInterface(TUid, TAny*&) sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling GetInterface() with an invalid image handle sl@0: will cause a panic. sl@0: @SYMTestActions Initialise the graphics resource component and create an image in a second thread. sl@0: Declare another image and assign it to the current image handle. Close the current sl@0: image so the second image handle becomes invalid. Call GetInterface() on the sl@0: second handle. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 3(ESgPanicBadDrawableHandle). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageGetInterfaceInvalidHandleL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicImageGetInterfaceInvalidHandle); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "TestImageGetInterfaceInvalidHandleLThread"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 3, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0052 sl@0: @SYMTestCaseDesc Calls RSgImage::GetInterface() with a non-null handle and an uninitialised driver sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::GetInterface(TUid, TAny*&) sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling GetInterface() with a non-null handle and an sl@0: uninitialised driver will cause a panic. sl@0: @SYMTestActions Initialise the graphics resource component and create an image in a second thread. sl@0: Declare another image and assign it to the current image handle. Close the current sl@0: image so the second image handle becomes invalid. Close the graphics resource driver. sl@0: Call GetInterface() on the second handle. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 1 (ESgPanicNoDriver). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageGetInterfaceNoDriverL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicImageGetInterfaceNoDriver); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "TestImageGetInterfaceNoDriverL"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 1, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0053 sl@0: @SYMTestCaseDesc Calls RSgImage::Close() with an invalid image handle sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Close() sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling Close() with an invalid image handle will sl@0: cause a panic. sl@0: @SYMTestActions Initialise the graphics resource component and create an image in a second thread. sl@0: Declare another image and assign it to the current image handle. Close the current sl@0: image so the second image handle becomes invalid. Call Close() on the second handle. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 3(ESgPanicBadDrawableHandle). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageCloseInvalidHandleL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicImageCloseInvalidHandle); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "TestImageCloseInvalidHandleL"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 3, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0054 sl@0: @SYMTestCaseDesc Calls RSgImage::Close() with a non-null handle and an uninitialised driver sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Close() sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling Close() with a non-null handle and an sl@0: uninitialised driver will cause a panic. sl@0: @SYMTestActions Initialise the graphics resource component and create an image in a second thread. sl@0: Declare another image and assign it to the current image handle. Close the current sl@0: image so the second image handle becomes invalid. Close the graphics resource driver. sl@0: Call Close() on the second handle. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 1 (ESgPanicNoDriver). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageCloseNoDriverL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicImageCloseNoDriver); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "TestImageCloseNoDriverL"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 1, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0055 sl@0: @SYMTestCaseDesc Calls RSgImage::Id() with an invalid image handle sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Id() sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling Id() with an invalid image handle will sl@0: cause a panic. sl@0: @SYMTestActions Initialise the graphics resource component and create an image in a second thread. sl@0: Declare another image and assign it to the current image handle. Close the current sl@0: image so the second image handle becomes invalid. Call Id() on the second sl@0: handle. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 3(ESgPanicBadDrawableHandle). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageIdInvalidHandleL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicImageIdInvalidHandle); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "TestImageIdInvalidHandleL"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 3, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0056 sl@0: @SYMTestCaseDesc Calls RSgImage::Id() with a non-null handle and an uninitialised driver sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Id() sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling Id() with a non-null handle and an sl@0: uninitialised driver will cause a panic. sl@0: @SYMTestActions Initialise the graphics resource component and create an image in a second thread. sl@0: Declare another image and assign it to the current image handle. Close the current sl@0: image so the second image handle becomes invalid. Close the graphics resource driver. sl@0: Call Id() on the second handle. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 1 (ESgPanicNoDriver). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageIdNoDriverL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicImageIdNoDriver); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "TestImageIdNoDriverL"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 1, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0057 sl@0: @SYMTestCaseDesc Calls RSgImage::Create() with an invalid image handle sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Create(const TSgImageInfo&, const RSgImage&) sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling Create() with an invalid image handle will sl@0: cause a panic. sl@0: @SYMTestActions Initialise the graphics resource component and create an image in a second thread. sl@0: Declare another image and assign it to the current image handle. Close the current sl@0: image so the second image handle becomes invalid. Call Create() on the second sl@0: handle. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 3(ESgPanicBadDrawableHandle). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageCreateInvalidHandleL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicImageCreateInvalidHandle); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "TestImageCreateInvalidHandleL"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 3, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0058 sl@0: @SYMTestCaseDesc Calls RSgImage::GetInfo() with an invalid image handle sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::GetInfo(TSgImageInfo&) sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling GetInfo() with an invalid image handle will sl@0: cause a panic. sl@0: @SYMTestActions Initialise the graphics resource component and create an image in a second thread. sl@0: Declare another image and assign it to the current image handle. Close the current sl@0: image so the second image handle becomes invalid. Call GetInfo() on the second sl@0: handle. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 3(ESgPanicBadDrawableHandle). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageGetInfoInvalidHandleL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicImageGetInfoInvalidHandle); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "TestImageGetInfoInvalidHandleL"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 3, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0059 sl@0: @SYMTestCaseDesc Calls RSgImage::GetInfo() with a non-null handle and an uninitialised driver sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID SgImage::GetInfo(TSgImageInfo&) sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling GetInfo() with a non-null handle and an sl@0: uninitialised driver will cause a panic. sl@0: @SYMTestActions Initialise the graphics resource component and create an image in a second thread. sl@0: Declare another image and assign it to the current image handle. Close the current sl@0: image so the second image handle becomes invalid. Close the graphics resource driver. sl@0: Call GetInfo() on the second handle. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 1 (ESgPanicNoDriver). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageGetInfoNoDriverL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicImageGetInfoNoDriver); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "TestImageGetInfoNoDriverL"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 1, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0082 sl@0: @SYMTestCaseDesc Calls RSgImage::Open() when the driver was not initialised. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Open(const TSgDrawableId&, TUint32) sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling RSgImage::Open() with an uninitialised driver sl@0: will cause a panic. sl@0: @SYMTestActions Do not initialise the graphics resource component and call RSgImage::Open() sl@0: in a second thread. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 1 (ESgPanicNoDriver). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageOpenNoDriverL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicImageOpenNoDriver); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "TestPanicImageOpenNoDriverL"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 1, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0083 sl@0: @SYMTestCaseDesc Creates an image from memory when the driver was not initialised. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Create(const TSgImageInfo&, const TAny*, TInt) sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling RSgImage::Create() with an uninitialised sl@0: driver will cause a panic. sl@0: @SYMTestActions Do not initialise the graphics resource component and call RSgImage::Open() sl@0: in a second thread. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 1 (ESgPanicNoDriver). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageCreateNoDriver1L() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicImageCreateNoDriver1); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "TestPanicImageCreateNoDriver1L"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 1, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0084 sl@0: @SYMTestCaseDesc Creates an image from an existing image when the driver was not initialised. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::Create(const TSgImageInfo&, const RSgImage&) sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling RSgImage::Create() with an uninitialised driver sl@0: will cause a panic. sl@0: @SYMTestActions Do not initialise the graphics resource component and call RSgImage::Open() in sl@0: a second thread. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 1 (ESgPanicNoDriver). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageCreateNoDriver2L() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicImageCreateNoDriver2); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "TestPanicImageCreateNoDriver2L"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 1, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0088 sl@0: @SYMTestCaseDesc Calls RSgImage::DrawableType() when the driver was not initialised. sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::DrawableType() sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling RSgImage::DrawableType() with an uninitialised sl@0: driver will cause a panic. sl@0: @SYMTestActions Do not initialise the graphics resource component and call RSgImage::DrawableType() sl@0: in a second thread. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 1 (ESgPanicNoDriver). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageDrawableTypeNoDriverL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicImageDrawableTypeNoDriver); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "TestPanicImageOpenNoDriverL"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 1, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0089 sl@0: @SYMTestCaseDesc Calls RSgImage::DrawableType() with an invalid image handle sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::DrawableType() sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling RSgImage::DrawableType() with an uninitialised sl@0: driver will cause a panic. sl@0: @SYMTestActions Do not initialise the graphics resource component and call RSgImage::DrawableType() sl@0: in a second thread. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 3 (ESgPanicBadDrawableHandle). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageDrawableTypeInvalidHandleL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicImageDrawableTypeInvalidHandle); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "TestPanicImageOpenNoDriverL"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 3, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0090 sl@0: @SYMTestCaseDesc Calls RSgImage::DrawableType() with an invalid image handle sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::GetAttribute() sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling RSgImage::GetAttribute() with an invalid handle sl@0: will cause a panic. sl@0: @SYMTestActions Initialise the graphics resource component and call RSgImage::GetAttribute() sl@0: in a second thread with an invalid handle. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 3 (ESgPanicBadDrawableHandle). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageGetAttributeInvalidHandleL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicImageGetAttributeInvalidHandle); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "TestPanicImageGetAttributeInvalidHandleL"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 3, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0091 sl@0: @SYMTestCaseDesc Calls RSgImage::GetAttribute() with no open driver sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgImage::GetAttribute() sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling RSgImage::GetAttribute() with an uninitialised sl@0: driver will cause a panic. sl@0: @SYMTestActions Do not initialise the graphics resource component and call RSgImage::GetAttribute() sl@0: in a second thread. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 1 (ESgPanicNoDriver). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageGetAttributeNoDriverL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicImageGetAttributeNoDriver); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "TestPanicImageGetAttributeNoDriverL"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 1, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0097 sl@0: @SYMTestCaseDesc Access out of bound TSgAttibuteArray index sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID TSgAttributeArray sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling an out of bound index on a TSgAttributeArray sl@0: will cause a panic. sl@0: @SYMTestActions Create a TSgAttributeArray of size 5 and attempt to access an element higher sl@0: than the size. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 4 (ESgPanicBadAttributeArrayIndex). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageAttributeArrayInvalidIndexL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicAttributeArrayInvalidIndex); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "AttributeArrayInvalidIndexL"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0098 sl@0: @SYMTestCaseDesc Access out of bound TSgAttibuteArray index sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID TSgAttributeArray sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure calling an out of bound index on a TSgAttributeArray sl@0: will cause a panic. sl@0: @SYMTestActions Create a TSgAttributeArray of size 5 and attempt to access an element higher sl@0: than the size. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 4 (ESgPanicBadAttributeArrayIndex). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicImageAttributeArrayInvalidIndex2L() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadPanicAttributeArrayInvalidIndex2); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: _LIT(KTestName, "AttributeArrayInvalidIndexL"); sl@0: CreateSecondThreadAndCheckPanicL(threadInfo, 4, exitCategoryName, KTestName); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0101 sl@0: @SYMTestCaseDesc Close an RSgDriver with open resources sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgDriver sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose Negative test to ensure closing a driver with open resources will cause a panic. sl@0: @SYMTestActions Create an RSgImage on an open driver, then close the driver. sl@0: @SYMTestExpectedResults Should panic in the second thread with panic code SGRES 2 (ESgPanicUnclosedResources). sl@0: */ sl@0: void CTSgImageGeneric::TestPanicDriverCloseOpenResourcesL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgProcessTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondProcessPanicDriverCloseOpenResources); sl@0: TExitCategoryName exitCategoryName(KSgTestGenericPanicCategory); sl@0: CreateSecondProcessAndCheckPanicL(threadInfo, 2, exitCategoryName, KSecondProcess); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0102 sl@0: @SYMTestCaseDesc Open/Close RSgDriver and Create/Close RSgImage in separate threads sl@0: @SYMPREQ PREQ2637 sl@0: @SYMFssID RSgDriver, RSgImage sl@0: @SYMTestPriority High sl@0: @SYMTestType UT sl@0: @SYMTestPurpose To ensure that it is possible to Open/Close the RSgDriver from sl@0: a separate thread, and to ensure that it is possible to Create/Open/Close sl@0: RSgImages from a seperate thread. sl@0: @SYMTestActions 1. Declare a RSgDriver, and pass to another thread to open. sl@0: 2. Declare a RSgImage, and pass to another thread to create. sl@0: 3. Pass created RSgImage to another thread to Open(). sl@0: 4. Pass the image to another thread to Close(). sl@0: 5. Pass the RSgDriver to another thread to Close() sl@0: @SYMTestExpectedResults All steps to succeed with no errors reported. sl@0: */ sl@0: void CTSgImageGeneric::TestCreateOpenCloseImageAndDriverInSecondThreadL() sl@0: { sl@0: TSgImageInfo info(TSize(),0,0); sl@0: TSgThreadTestInfo threadInfo(KSgNullDrawableId, info, ESgresSecondThreadOpenPassedDriver); sl@0: sl@0: RSgDriver driver; sl@0: threadInfo.iSgDriver = &driver; sl@0: sl@0: RSgImage image; sl@0: threadInfo.iSgImage = ℑ sl@0: sl@0: //Open the driver in another thread sl@0: TEST(CreateSecondThreadAndDoTestL(threadInfo)==0); sl@0: sl@0: //Create the image in a thread sl@0: threadInfo.iTestCase = ESgresSecondThreadCreatePassedImage; sl@0: TEST(CreateSecondThreadAndDoTestL(threadInfo)==0); sl@0: sl@0: //Now try opening the image in another thread sl@0: RSgImage image2; sl@0: threadInfo.iTestCase = ESgresSecondThreadOpenPassedImage; sl@0: threadInfo.iDrawableId = image.Id(); sl@0: threadInfo.iSgImage = &image2; sl@0: TEST(CreateSecondThreadAndDoTestL(threadInfo)==0); sl@0: sl@0: //Close the "Opened" image in another thread sl@0: threadInfo.iTestCase = ESgresSecondThreadClosePassedImage; sl@0: TEST(CreateSecondThreadAndDoTestL(threadInfo)==0); sl@0: sl@0: //Close the "Created" image in another thread sl@0: threadInfo.iTestCase = ESgresSecondThreadClosePassedImage; sl@0: threadInfo.iSgImage = ℑ sl@0: TEST(CreateSecondThreadAndDoTestL(threadInfo)==0); sl@0: sl@0: //Close the driver in another thread sl@0: threadInfo.iTestCase = ESgresSecondThreadClosePassedDriver; sl@0: TEST(CreateSecondThreadAndDoTestL(threadInfo)==0); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-RESOURCE-0104 sl@0: @SYMTestCaseDesc Open a RSgImage using multiple threads. sl@0: @SYMDEF ou1cimx1#197357 sl@0: @SYMFssID RSgImage sl@0: @SYMTestPriority Low sl@0: @SYMTestType UT sl@0: @SYMTestPurpose To show that images can be opened safely when used with multiple threads in sl@0: separate processes. sl@0: @SYMTestActions 1. Process A, creates an RSgImage sl@0: 2. Process B, creates a secondary thread, which creates a handle to the image sl@0: created in A. sl@0: 3. Process B, primary thread opens a handle to the same image. sl@0: 4. Process B, secondary thread closes the handle and terminates thread. sl@0: 5. Process B, primary thread waits for thread cleanup, then attempts to sl@0: access the data of the image by creating a copy of it. sl@0: @SYMTestExpectedResults All steps to succeed with no errors reported. sl@0: */ sl@0: void CTSgImageGeneric::TestOpenImageMultithreadedL() sl@0: { sl@0: TestOpenDriverL(); sl@0: RSgImage image; sl@0: CreateImageL(image); sl@0: CleanupClosePushL(image); sl@0: sl@0: TSgImageInfo info; sl@0: TInt err = image.GetInfo(info); sl@0: TESTE(err == KErrNone, err); sl@0: sl@0: TSgProcessTestInfo processInfo(image.Id(), info, ESgresSecondProcessOpenImageMultithreaded); sl@0: TInt testResult = 0; sl@0: TRAP(err, testResult = CreateSecondProcessAndDoTestL(KSecondProcess, processInfo)); sl@0: TESTE(err == KErrNone, err); sl@0: TEST(testResult & EFirstTestPassed); sl@0: TEST(testResult & ESecondTestPassed); sl@0: TEST(testResult <= (EFirstTestPassed | ESecondTestPassed)); sl@0: sl@0: CleanupStack::PopAndDestroy(1); // image sl@0: TestCloseDriver(); sl@0: }