|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef TGRAPHICSRESOURCETESTSTEPBASE_H |
|
17 #define TGRAPHICSRESOURCETESTSTEPBASE_H |
|
18 |
|
19 #include "sgimage.h" |
|
20 #include "sgimagecollection.h" |
|
21 #include "sgresource.h" |
|
22 #include "tgraphicsresourcemultiprocessthread.h" |
|
23 #include <e32base.h> |
|
24 #include <test/testexecutestepbase.h> |
|
25 #include <graphics/sgimage_sw.h> |
|
26 #include <graphics/sgimage_chunk.h> |
|
27 #include <test/ttmsgraphicsstep.h> |
|
28 |
|
29 |
|
30 _LIT(KSgTestGenericPanicCategory, "SGRES"); |
|
31 _LIT(KSgTestAdapterPanicCategory, "SGRES-ADAPTER"); |
|
32 const TInt KMaxPixelFormats = 64; |
|
33 |
|
34 class CTSgTestStepBase : public CTTMSGraphicsStep |
|
35 { |
|
36 public: |
|
37 CTSgTestStepBase(); |
|
38 ~CTSgTestStepBase(); |
|
39 IMPORT_C void testBooleanTrue(TBool aCondition, const TText8* aFile, TInt aLine); |
|
40 protected: |
|
41 // From CTestStep |
|
42 virtual TVerdict doTestStepPreambleL(); |
|
43 virtual TVerdict doTestStepPostambleL(); |
|
44 |
|
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); |
|
61 |
|
62 //OOM test functions |
|
63 void TestOOM(); |
|
64 virtual void DoMemoryTestsL(); |
|
65 |
|
66 protected: |
|
67 RThread iSecondThread; |
|
68 TBool iRunningOomTests; |
|
69 private: |
|
70 TInt iPixelFormatCount; |
|
71 TUidPixelFormat iPixelFormatArray[KMaxPixelFormats]; |
|
72 }; |
|
73 |
|
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 |
|
84 }; |
|
85 |
|
86 const TInt KNumImagesInCollection = 10; |
|
87 |
|
88 #define TESTWITHFILENAMEANDLINENUMBERL(a, f, l) \ |
|
89 {\ |
|
90 testBooleanTrueL((a), f, l); \ |
|
91 } |
|
92 |
|
93 #if defined(__WINS__) |
|
94 _LIT(KSecondProcess, "tgraphicsresourcesecondprocess.exe"); |
|
95 #elif defined(SYMBIAN_GRAPHICS_USE_GPU_MEMORY) |
|
96 _LIT(KSecondProcess, "tgraphicsresourcesecondprocess_mbx.exe"); |
|
97 #else |
|
98 _LIT(KSecondProcess, "tgraphicsresourcesecondprocess_sw.exe"); |
|
99 #endif |
|
100 |
|
101 _LIT(KSecondThread, "Test_GraphicsResource_SecondThread"); |
|
102 _LIT(KSecondThreadSemaphore, "Second Thread Semaphore"); |
|
103 |
|
104 #endif |