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