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.
21 #ifndef EGLTESTCOMMONSTEP_H
22 #define EGLTESTCOMMONSTEP_H
24 #include <e32msgqueue.h>
26 #include <VG/openvg.h>
27 #ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
28 #include <sgresource/sgresource.h>
30 #include <graphics/sgresource.h>
31 #endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
32 #include <test/testexecuteserverbase.h>
33 #include <test/ttmsgraphicsstep.h>
34 #include <test/egltestcommonutils.h>
35 #include <test/egltestcommonsession.h>
37 const TInt KDefaultWindowGroupId = 200;
38 const TInt KMaxProcessNumber = 32;
39 const TInt KMaxThreadNumber = 100;
40 const TInt KNumSemaphore = 2;
44 struct TEglStepMessageBuffer
50 Abstract base class for Egl test steps
52 class CEglTestStep : public CTTMSGraphicsStep
54 friend class EglTestCommonProcess;
60 TInt iIdx; // << index for example used to identify the thread to semaphores
61 } iThreadInfos[KMaxThreadNumber];
66 enum TStatusId{ERendezvous, ELogin, ESize};
68 TRequestStatus iStatus[ESize];
74 TRequestStatus iStatus;
75 } iProcessStatus[KMaxProcessNumber];
78 IMPORT_C TVerdict doTestStepPreambleL();
79 IMPORT_C TVerdict doTestStepPostambleL();
80 IMPORT_C virtual ~CEglTestStep();
82 IMPORT_C void PartialInitialiseL(const TDesC& aStepName);
83 IMPORT_C void CleanAll();
84 IMPORT_C void CreateEglSessionL(TInt aIdx=0);
85 inline CTestEglSession* GetEglSess() {return iEglSess;};
88 IMPORT_C CEglTestStep();
91 void SetLoggerForProcessWrapperL();
96 IMPORT_C void OpenWsSessionL(TInt aGroupId);
97 IMPORT_C void CloseWsSession();
98 IMPORT_C void ConstructWindowL(RWindow& aWindow, const TRect& aRect);
99 IMPORT_C void PrintUsedPixelConfiguration();
100 IMPORT_C void PrintPixelFormat(TUidPixelFormat aFormat);
101 IMPORT_C void PrintVGImageFormat(VGImageFormat aAttr);
103 // Multi process test utils
104 IMPORT_C void Test_MultiProcessL(const TDesC& aTestDllName, TInt aProcessCount, const TDesC& aTestStepName);
105 IMPORT_C void Test_MultiProcessL(const TDesC& aTestDllName, TInt aProcessCount, const TDesC& aTestStepName, const TSgDrawableId& aSgId);
106 IMPORT_C void Test_MultiProcessL(const TDesC& aTestDllName, TInt aProcessCount, const TDesC& aTestStepName, const RArray<TSgDrawableId>& aSgIdList);
107 void CheckProcessStatusL(TInt aIndex, const TRequestStatus& aStatus, const RProcess& aProcess);
108 inline TInt ImageIndexFromProcessId(TInt aProcess, TInt aImageCount) {return (aProcess % aImageCount);}
110 // Multi threaded test utils
111 IMPORT_C void Test_MultiThreadL(TInt aThreadCount, TBool aWaitForCompletion);
112 IMPORT_C void Test_MultiThread_WaitL(TBool aCloseThreads, TThreadStatus::TStatusId aStatusId);
113 void CheckThreadStatusL(TInt aIndex, const TRequestStatus& aStatus, const RThread& aThread);
114 static TInt ThreadFunction(TAny* aSelf);
115 void ThreadFunctionL(TThreadInfo& aInfo);
117 IMPORT_C virtual void doThreadFunctionL(TInt aIdx);
118 IMPORT_C virtual void doThreadFunctionL(TInt aIdx,const TSgDrawableId& aSgId);
119 IMPORT_C void Rendezvous(TInt aIdx);
120 IMPORT_C virtual void doProcessFunctionL(TInt aIdx);
121 IMPORT_C virtual void doProcessFunctionL(TInt aIdx,const TSgDrawableId& aSgId);
124 IMPORT_C TBool CheckForExtensionL(TInt aExtensions, const TDesC& aExtensionName = KNullDesC);
125 IMPORT_C void GetDisplayL();
126 IMPORT_C void TerminateDisplayL();
128 virtual void ReceiveMessageFromClient(RMsgQueue<TEglStepMessageBuffer>& /*aMessageQueueClientProcParam*/) {}
130 // Session object as required for most tests
131 CTestEglSession* iEglSess;
133 // Whether to output verbose logging
134 TBool iVerboseLogging;
136 // Whether the test step needs to wait for thread completion during postamble
138 TBool iWaitForCompletionOnPostamble;
140 // The display is shared between threads.
143 RSemaphore iSemaphore[KNumSemaphore];
144 RArray<TThreadStatus> iThreadStatus;
146 // pixel formats the test is run
147 TUidPixelFormat iSourceFormat;
148 VGImageFormat iSurfaceFormat;
150 TInt iProcHandleMark;
151 TInt iThreadHandleMark;
152 TInt iProcHandleMarkEnd;
153 TInt iThreadHandleMarkEnd;
155 RWsSession iWsSession;
156 RWindowGroup iWindowGroup;
159 #endif // EGLTESTCOMMONSTEP_H