sl@0: // Copyright (c) 2007-2009 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: #ifndef TGRAPHICSRESOURCETESTSTEPBASE_H sl@0: #define TGRAPHICSRESOURCETESTSTEPBASE_H sl@0: sl@0: #include "sgimage.h" sl@0: #include "sgimagecollection.h" sl@0: #include "sgresource.h" sl@0: #include "tgraphicsresourcemultiprocessthread.h" sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: sl@0: _LIT(KSgTestGenericPanicCategory, "SGRES"); sl@0: _LIT(KSgTestAdapterPanicCategory, "SGRES-ADAPTER"); sl@0: const TInt KMaxPixelFormats = 64; sl@0: sl@0: class CTSgTestStepBase : public CTTMSGraphicsStep sl@0: { sl@0: public: sl@0: CTSgTestStepBase(); sl@0: ~CTSgTestStepBase(); sl@0: IMPORT_C void testBooleanTrue(TBool aCondition, const TText8* aFile, TInt aLine); sl@0: protected: sl@0: // From CTestStep sl@0: virtual TVerdict doTestStepPreambleL(); sl@0: virtual TVerdict doTestStepPostambleL(); sl@0: sl@0: //common utility functions sl@0: void CreateImageL(RSgImage& aImage); sl@0: void CreateImageCollectionL(RSgImageCollection& aCollection); sl@0: TInt CreateSecondProcessAndDoTestL(const TDesC &aProcessName, TSgresTestInfo& aTestInfo); sl@0: TInt CreateSecondThreadAndDoTestL(TSgresTestInfo aTestInfo); sl@0: void CreateSecondThreadAndCheckPanicL(TSgresTestInfo aTestInfo, TInt aPanicCode, TExitCategoryName aExitCategory, const TDesC &aThreadName); sl@0: void CreateSecondProcessAndCheckPanicL(TSgresTestInfo aTestInfo, TInt aPanicCode, TExitCategoryName aExitCategory, const TDesC &aProcessName); sl@0: void CallGetPixelFormatsL(TSgCpuAccess aCpuAccess, TUint32 aUsage, TBool aShareable, TInt aScreenId); sl@0: void TestGetPixelFormatCompatibilityGuaranteesL(); sl@0: void CheckPixelFormatPresent(TUidPixelFormat aPixelFormat); sl@0: void TestOpenDriverL(); sl@0: void TestCloseDriver(); sl@0: static TBool CompareInfos(TSgImageInfo& info1, TSgImageInfo& info2); sl@0: static TInt SecondThreadStart(TAny* aInfo); sl@0: static void CloseDriverWhenLeave(TAny* aInfo); sl@0: void CheckErrorL(TInt aExpectedErrorCode, TInt aActualErrorCode, const TText8* aFile, TInt aLine); sl@0: sl@0: //OOM test functions sl@0: void TestOOM(); sl@0: virtual void DoMemoryTestsL(); sl@0: sl@0: protected: sl@0: RThread iSecondThread; sl@0: TBool iRunningOomTests; sl@0: private: sl@0: TInt iPixelFormatCount; sl@0: TUidPixelFormat iPixelFormatArray[KMaxPixelFormats]; sl@0: }; sl@0: sl@0: //common variables and functions sl@0: const TUint16 KImageData[] = { sl@0: 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0, sl@0: 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0, sl@0: 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0, sl@0: 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0, sl@0: 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0, sl@0: 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0, sl@0: 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0, sl@0: 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0 sl@0: }; sl@0: sl@0: const TInt KNumImagesInCollection = 10; sl@0: sl@0: #define TESTWITHFILENAMEANDLINENUMBERL(a, f, l) \ sl@0: {\ sl@0: testBooleanTrueL((a), f, l); \ sl@0: } sl@0: sl@0: #if defined(__WINS__) sl@0: _LIT(KSecondProcess, "tgraphicsresourcesecondprocess.exe"); sl@0: #elif defined(SYMBIAN_GRAPHICS_USE_GPU_MEMORY) sl@0: _LIT(KSecondProcess, "tgraphicsresourcesecondprocess_mbx.exe"); sl@0: #else sl@0: _LIT(KSecondProcess, "tgraphicsresourcesecondprocess_sw.exe"); sl@0: #endif sl@0: sl@0: _LIT(KSecondThread, "Test_GraphicsResource_SecondThread"); sl@0: _LIT(KSecondThreadSemaphore, "Second Thread Semaphore"); sl@0: sl@0: #endif