os/graphics/graphicsresourceservices/graphicsresource/test/tgraphicsresourceteststepbase.h
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.
16 #ifndef TGRAPHICSRESOURCETESTSTEPBASE_H
17 #define TGRAPHICSRESOURCETESTSTEPBASE_H
20 #include "sgimagecollection.h"
21 #include "sgresource.h"
22 #include "tgraphicsresourcemultiprocessthread.h"
24 #include <test/testexecutestepbase.h>
25 #include <graphics/sgimage_sw.h>
26 #include <graphics/sgimage_chunk.h>
27 #include <test/ttmsgraphicsstep.h>
30 _LIT(KSgTestGenericPanicCategory, "SGRES");
31 _LIT(KSgTestAdapterPanicCategory, "SGRES-ADAPTER");
32 const TInt KMaxPixelFormats = 64;
34 class CTSgTestStepBase : public CTTMSGraphicsStep
39 IMPORT_C void testBooleanTrue(TBool aCondition, const TText8* aFile, TInt aLine);
42 virtual TVerdict doTestStepPreambleL();
43 virtual TVerdict doTestStepPostambleL();
45 //common utility functions
46 void CreateImageL(RSgImage& aImage);
47 void CreateImageCollectionL(RSgImageCollection& aCollection);
48 TInt CreateSecondProcessAndDoTestL(const TDesC &aProcessName, TSgresTestInfo& aTestInfo);
49 TInt CreateSecondThreadAndDoTestL(TSgresTestInfo aTestInfo);
50 void CreateSecondThreadAndCheckPanicL(TSgresTestInfo aTestInfo, TInt aPanicCode, TExitCategoryName aExitCategory, const TDesC &aThreadName);
51 void CreateSecondProcessAndCheckPanicL(TSgresTestInfo aTestInfo, TInt aPanicCode, TExitCategoryName aExitCategory, const TDesC &aProcessName);
52 void CallGetPixelFormatsL(TSgCpuAccess aCpuAccess, TUint32 aUsage, TBool aShareable, TInt aScreenId);
53 void TestGetPixelFormatCompatibilityGuaranteesL();
54 void CheckPixelFormatPresent(TUidPixelFormat aPixelFormat);
55 void TestOpenDriverL();
56 void TestCloseDriver();
57 static TBool CompareInfos(TSgImageInfo& info1, TSgImageInfo& info2);
58 static TInt SecondThreadStart(TAny* aInfo);
59 static void CloseDriverWhenLeave(TAny* aInfo);
60 void CheckErrorL(TInt aExpectedErrorCode, TInt aActualErrorCode, const TText8* aFile, TInt aLine);
64 virtual void DoMemoryTestsL();
67 RThread iSecondThread;
68 TBool iRunningOomTests;
70 TInt iPixelFormatCount;
71 TUidPixelFormat iPixelFormatArray[KMaxPixelFormats];
74 //common variables and functions
75 const TUint16 KImageData[] = {
76 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
77 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
78 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
79 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
80 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
81 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
82 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
83 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0
86 const TInt KNumImagesInCollection = 10;
88 #define TESTWITHFILENAMEANDLINENUMBERL(a, f, l) \
90 testBooleanTrueL((a), f, l); \
94 _LIT(KSecondProcess, "tgraphicsresourcesecondprocess.exe");
95 #elif defined(SYMBIAN_GRAPHICS_USE_GPU_MEMORY)
96 _LIT(KSecondProcess, "tgraphicsresourcesecondprocess_mbx.exe");
98 _LIT(KSecondProcess, "tgraphicsresourcesecondprocess_sw.exe");
101 _LIT(KSecondThread, "Test_GraphicsResource_SecondThread");
102 _LIT(KSecondThreadSemaphore, "Second Thread Semaphore");