121
|
1 |
// Copyright (c) 2010 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 OPENWFTEST_H
|
|
17 |
#define OPENWFTEST_H
|
|
18 |
|
|
19 |
// INCLUDES
|
|
20 |
#include <test/tefunit.h>
|
|
21 |
#include <w32std.h>
|
|
22 |
#include <graphics/symbianstream.h>
|
|
23 |
#include <graphics/surfacemanager.h>
|
|
24 |
#include <graphics/streammap.h>
|
|
25 |
#include <EGL/egl.h>
|
|
26 |
#include <graphics/eglsynchelper.h>
|
|
27 |
#include <WF/wfc.h>
|
|
28 |
#include "surfaceutility.h"
|
|
29 |
|
|
30 |
class CTestExecuteLogger;
|
|
31 |
class CSurfaceStream;
|
|
32 |
|
|
33 |
/* Color defines for openwf test.*/
|
|
34 |
#define KDarkRed TRgb(127,0,0,255)
|
|
35 |
#define KRed TRgb(255,0,0,255)
|
|
36 |
#define KGreen TRgb(0,255,0,255)
|
|
37 |
#define KBlue TRgb(0,0,255,255)
|
|
38 |
#define KCyan TRgb(0,255,255,255)
|
|
39 |
#define KMagenta TRgb(255,0,255,255)
|
|
40 |
#define KYellow TRgb(255,255,0,255)
|
|
41 |
#define KBrown TRgb(150,75,0,255)
|
|
42 |
#define KBlack TRgb(0,0,0,255)
|
|
43 |
#define KBlackAlpha0 TRgb(0,0,0,0)
|
|
44 |
#define KWhite TRgb(255,255,255,255)
|
|
45 |
#define KWhiteAlpha0 TRgb(255,255,255,0)
|
|
46 |
#define KGray TRgb(127,127,127,255)
|
|
47 |
#define KGrayHalfAlpha TRgb(127,127,127,127)
|
|
48 |
|
|
49 |
#define KMaxImagePathLength 100
|
|
50 |
#define KMaxTestNameLength 20
|
|
51 |
|
|
52 |
class CActiveNotification : public CActive
|
|
53 |
{
|
|
54 |
public:
|
|
55 |
static CActiveNotification* NewL(RSurfaceUpdateSession& aSurfaceUpdateSession,TBool aActivate);
|
|
56 |
~CActiveNotification();
|
|
57 |
void Activate();
|
|
58 |
// From CActive:
|
|
59 |
void RunL();
|
|
60 |
void DoCancel();
|
|
61 |
TInt RunError(TInt aError);
|
|
62 |
protected:
|
|
63 |
CActiveNotification();
|
|
64 |
void ConstructL(RSurfaceUpdateSession& aSurfaceUpdateSession);
|
|
65 |
private:
|
|
66 |
RSurfaceUpdateSession iSurfaceUpdateSession;
|
|
67 |
};
|
|
68 |
|
|
69 |
//Use instead of User::After
|
|
70 |
class CActiveWaiter : public CActive
|
|
71 |
{
|
|
72 |
public:
|
|
73 |
static CActiveWaiter* NewL();
|
|
74 |
~CActiveWaiter();
|
|
75 |
TInt Wait(TTimeIntervalMicroSeconds32 aDelay);
|
|
76 |
void StartWait(TTimeIntervalMicroSeconds32 aDelay);
|
|
77 |
// From CActive:
|
|
78 |
void RunL();
|
|
79 |
void DoCancel();
|
|
80 |
TInt RunError(TInt aError);
|
|
81 |
protected:
|
|
82 |
CActiveWaiter();
|
|
83 |
void ConstructL();
|
|
84 |
public:
|
|
85 |
TBool iRun;
|
|
86 |
protected:
|
|
87 |
RTimer iTimer;
|
|
88 |
};
|
|
89 |
|
|
90 |
/**
|
|
91 |
* COpenwfTest
|
|
92 |
*
|
|
93 |
*/
|
|
94 |
class COpenwfTest : public CTestFixture
|
|
95 |
{
|
|
96 |
public:
|
|
97 |
COpenwfTest();
|
|
98 |
~COpenwfTest();
|
|
99 |
|
|
100 |
virtual void SetupL();
|
|
101 |
virtual void TearDownL();
|
|
102 |
static CTestSuite* CreateSuiteL(const TDesC& aName);
|
|
103 |
|
|
104 |
enum TCacheAttribute
|
|
105 |
{
|
|
106 |
/** not CPU cached */
|
|
107 |
ENotCached = 0,
|
|
108 |
/** CPU cached */
|
|
109 |
ECached = 1,
|
|
110 |
/** Not listed */
|
|
111 |
ECacheNotlisted = 2
|
|
112 |
};
|
|
113 |
|
|
114 |
enum TContiguousFlag
|
|
115 |
{
|
|
116 |
ENonContiguous = 0,
|
|
117 |
EContiguous = 1,
|
|
118 |
EFlagNotListed = 2
|
|
119 |
};
|
|
120 |
|
|
121 |
enum TTestMode
|
|
122 |
{
|
|
123 |
EAutomatic = 0,
|
|
124 |
EManual = 1
|
|
125 |
};
|
|
126 |
|
|
127 |
private:
|
|
128 |
TBool AcquireOnScreenStream();
|
|
129 |
void ReleaseOnScreenStream();
|
|
130 |
TBool CheckOnScreenStreamRect(TRect aRect, const TRgb& aExpectedColor, TInt aTolerance);
|
|
131 |
TBool CheckRect(const TSurfaceId& aSurface, TInt aNumOfBuffer, TRect aRect,
|
|
132 |
const TRgb& aExpectedColor, TInt aTolerance);
|
|
133 |
TBool CheckOnScreenReferenceImage();
|
|
134 |
TBool SaveImage(const TSurfaceId& aSurfaceId, TInt aNumOfBuffer);
|
|
135 |
TInt WaitL(TTimeIntervalMicroSeconds32 aDelay); //aDelay in microseconds
|
|
136 |
TBool WaitForNotifications(TTimeIntervalMicroSeconds32 aMaxDelay,TInt aNotificatons);
|
|
137 |
void ReadIniData();
|
|
138 |
void TearDown();
|
|
139 |
void SetupEmptySceneL(TBool aAutonomous = ETrue);
|
|
140 |
|
|
141 |
// Fastpath positive tests
|
|
142 |
void GRAPHICS_OPENWFC_FASTPATH_0000L();
|
|
143 |
void GRAPHICS_OPENWFC_FASTPATH_0001L();
|
|
144 |
void GRAPHICS_OPENWFC_FASTPATH_0002L();
|
|
145 |
void GRAPHICS_OPENWFC_FASTPATH_0003L();
|
|
146 |
void GRAPHICS_OPENWFC_FASTPATH_0004L();
|
|
147 |
void GRAPHICS_OPENWFC_FASTPATH_0005L();
|
|
148 |
void GRAPHICS_OPENWFC_FASTPATH_0006L();
|
|
149 |
void GRAPHICS_OPENWFC_FASTPATH_0007L();
|
|
150 |
|
|
151 |
// Fastpath with notification tests
|
|
152 |
void FastpathNotificationsTestL(TBool aAutonomous);
|
|
153 |
void GRAPHICS_OPENWFC_FASTPATH_0010L();
|
|
154 |
void GRAPHICS_OPENWFC_FASTPATH_0011L();
|
|
155 |
void FastpathDispXNotificationsTestL(TBool aAutonomous);
|
|
156 |
void GRAPHICS_OPENWFC_FASTPATH_0012L();
|
|
157 |
void GRAPHICS_OPENWFC_FASTPATH_0013L();
|
|
158 |
|
|
159 |
// Fastpath negative tests
|
|
160 |
void GRAPHICS_OPENWFC_FASTPATH_0020L();
|
|
161 |
void GRAPHICS_OPENWFC_FASTPATH_0021L();
|
|
162 |
void GRAPHICS_OPENWFC_FASTPATH_0022L();
|
|
163 |
void GRAPHICS_OPENWFC_FASTPATH_0023L();
|
|
164 |
void GRAPHICS_OPENWFC_FASTPATH_0024L();
|
|
165 |
void GRAPHICS_OPENWFC_FASTPATH_0025L();
|
|
166 |
void GRAPHICS_OPENWFC_FASTPATH_0026L();
|
|
167 |
void GRAPHICS_OPENWFC_FASTPATH_0027L();
|
|
168 |
|
|
169 |
private:
|
|
170 |
TInt iFastpathableWidth;
|
|
171 |
TInt iFastpathableHeight;
|
|
172 |
TInt iStride;
|
|
173 |
TContiguousFlag iContiguous;
|
|
174 |
TUidPixelFormat iFastpathablePixelFormat;
|
|
175 |
TUidPixelFormat iNonFastpathablePixelFormat;
|
|
176 |
TInt iOffsetToFirstBuffer;
|
|
177 |
TInt iAlignment;
|
|
178 |
TBool iMappable;
|
|
179 |
TInt iMaxBuffers;
|
|
180 |
TInt iMinBuffers;
|
|
181 |
TCacheAttribute iCacheAttrib;
|
|
182 |
TInt iOffsetBetweenBuffers;
|
|
183 |
TInt iTestMode;
|
|
184 |
TBool iSaveImage;
|
|
185 |
TTimeIntervalMicroSeconds32 iCompositionPause; //delay in microseconds
|
|
186 |
TTimeIntervalMicroSeconds32 iManualPause; //delay for manual checking in microseconds
|
|
187 |
TBool iAllowManualPause; //some tests may not allow manual pauses
|
|
188 |
TInt iTolerance;
|
|
189 |
WFCint iDeviceId;
|
|
190 |
EGLSyncKHR iSync;
|
|
191 |
WFCDevice iDevice;
|
|
192 |
WFCContext iContext;
|
|
193 |
|
|
194 |
TRect iFullScreenTRect;
|
|
195 |
WFCint iFullScreenRect[4];
|
|
196 |
TRect iCenterTRect;
|
|
197 |
WFCint iCenterRect[4];
|
|
198 |
WFCint iHalfSizeRect[4];
|
|
199 |
|
|
200 |
CActiveScheduler* iScheduler;
|
|
201 |
EGLDisplay iEGLDisplay;
|
|
202 |
CSurfaceUtility* iUtility;
|
|
203 |
//TPtrC iDir;
|
|
204 |
TPtrC iImageDirectory;
|
|
205 |
TBufC<KMaxTestNameLength> iTestName;
|
|
206 |
TBuf<KMaxImagePathLength> iImageAddress;
|
|
207 |
TInt iImageCounter;
|
|
208 |
SymbianStreamType iOnScreenStream;
|
|
209 |
SymbianStreamBuffer iOnScreenBuffer;
|
|
210 |
};
|
|
211 |
|
|
212 |
#endif // OPENWFTEST_H
|