os/graphics/egl/egltest/inc/egltest_surfacescaling.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/egl/egltest/inc/egltest_surfacescaling.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,266 @@
     1.4 +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +/**
    1.20 + @file
    1.21 + @test
    1.22 +*/
    1.23 +
    1.24 +#ifndef EGLTEST_SURFACESCALING_H
    1.25 +#define EGLTEST_SURFACESCALING_H
    1.26 +
    1.27 +#include "eglteststep.h"
    1.28 +#include <test/egltestcommonsession.h>
    1.29 +#include <test/graphicsscreencomparison.h>
    1.30 +
    1.31 +enum TEglTestScalingConfig
    1.32 +	{ 
    1.33 +	EWindowAttribs_NoScaling,
    1.34 +	EWindowAttribsColor16MU_Scaling 
    1.35 +	};
    1.36 +
    1.37 +static const EGLint KScalingConfigAttribs[2][17] =
    1.38 +	{
    1.39 +		{
    1.40 +		//Window - Scaling not supported
    1.41 +		EGL_BUFFER_SIZE,    	 0,
    1.42 +		EGL_RED_SIZE,			 0,
    1.43 +		EGL_GREEN_SIZE, 		 0,
    1.44 +		EGL_BLUE_SIZE,			 0,
    1.45 +		EGL_ALPHA_SIZE, 		 0,
    1.46 +		EGL_RENDERABLE_TYPE,	 EGL_OPENVG_BIT,
    1.47 +		EGL_SURFACE_TYPE,		 EGL_WINDOW_BIT,
    1.48 +		EGL_SURFACE_SCALING_NOK, EGL_FALSE,
    1.49 +		EGL_NONE
    1.50 +		},
    1.51 +		{
    1.52 +		//EColor16MU - Window - Scaling supported
    1.53 +		EGL_BUFFER_SIZE,    	 24,
    1.54 +		EGL_RED_SIZE,			 8,
    1.55 +		EGL_GREEN_SIZE, 		 8,
    1.56 +		EGL_BLUE_SIZE,			 8,
    1.57 +		EGL_ALPHA_SIZE,     	 0,
    1.58 +		EGL_RENDERABLE_TYPE,	 EGL_OPENVG_BIT,
    1.59 +		EGL_SURFACE_TYPE,		 EGL_WINDOW_BIT,
    1.60 +		EGL_SURFACE_SCALING_NOK, EGL_TRUE,
    1.61 +		EGL_NONE
    1.62 +		},
    1.63 +	};
    1.64 +
    1.65 +//base class for all surface scaling test cases
    1.66 +//all common functionality should go here
    1.67 +NONSHARABLE_CLASS(CEglTest_SurfaceScalingBase) : public CEglTestStep
    1.68 +    {
    1.69 +public:
    1.70 +    ~CEglTest_SurfaceScalingBase();
    1.71 +
    1.72 +protected:
    1.73 +    // from CTestStep
    1.74 +    TVerdict doTestStepPreambleL();
    1.75 +    TVerdict doTestStepPostambleL();
    1.76 +
    1.77 +    // helper methods
    1.78 +    void CheckBorderColorL(EGLint aExpectedRedChannelColor, EGLint aExpectedBlueChannelColor, EGLint aExpectedGreenChannelColor);
    1.79 +    void CheckScalingAttributesL(EGLint aExpectedSurfaceWidth, EGLint aExpectedSurfaceHeight, EGLint aExpectedExtentWidth, EGLint aExpectedExtentHeight, EGLint aExpectedOffsetX, EGLint aExpectedOffsetY);
    1.80 +    CFbsBitmap* CreateBitmapLC(const TSize& aSize, TInt aBorderTop, TInt aBorderBottom, TInt aBorderLeft, TInt aBorderRight, const TRgb& aBorderColor);
    1.81 +    void WritePixelsToSurfaceL(const CFbsBitmap& aBitmap);
    1.82 +    void CreateAndActivateWindowL(const TSize& aWindowSize);
    1.83 +    void CloseWindow();
    1.84 +
    1.85 +protected:
    1.86 +    CWsScreenDevice* iScreenDevice;
    1.87 +    RWindow iWindow;
    1.88 +    // surface scaling extension functions
    1.89 +    TFPtrEglQuerySurfaceScalingCapabilityNok iPfnEglQuerySurfaceScalingCapabilityNOK;
    1.90 +    TFPtrEglSetSurfaceScalingNok iPfnEglSetSurfaceScalingNOK;
    1.91 +    // surface scaling attributes
    1.92 +    TInt iWindowWidth;
    1.93 +    TInt iWindowHeight;
    1.94 +    TInt iSurfaceWidth;
    1.95 +    TInt iSurfaceHeight;
    1.96 +    TInt iExtentWidth;
    1.97 +    TInt iExtentHeight;
    1.98 +    TInt iOffsetX;
    1.99 +    TInt iOffsetY;
   1.100 +    TRgb iBorderColor;
   1.101 +    // surface scaling related attributes for reference bitmap
   1.102 +    TInt iBorderTop;
   1.103 +    TInt iBorderBottom;
   1.104 +    TInt iBorderLeft;
   1.105 +    TInt iBorderRight;
   1.106 +    // image comparison
   1.107 +    CTGraphicsScreenComparison* iImageComparison;
   1.108 +    // properties of the particular surface scaling implementation under testing
   1.109 +    TBool iAllScalable;
   1.110 +    TSize iScreenSize;
   1.111 +    };
   1.112 +
   1.113 +
   1.114 +// EGL Surface Scaling tests
   1.115 +_LIT(KSurfaceScaling_Positive, "SurfaceScaling_Positive");
   1.116 +NONSHARABLE_CLASS(CEglTest_SurfaceScaling_Positive) : public CEglTest_SurfaceScalingBase
   1.117 +    {
   1.118 +public:
   1.119 +    TVerdict doTestStepL();
   1.120 +    TVerdict doTestPartialStepL();
   1.121 +    };
   1.122 +
   1.123 +_LIT(KSurfaceScaling_WindowResize, "SurfaceScaling_WindowResize");
   1.124 +NONSHARABLE_CLASS(CEglTest_SurfaceScaling_WindowResize) : public CEglTest_SurfaceScalingBase
   1.125 +    {
   1.126 +public:
   1.127 +    TVerdict doTestStepL();
   1.128 +    TVerdict doTestPartialStepL();
   1.129 +    };
   1.130 +
   1.131 +_LIT(KSurfaceScaling_ExtentPositionChange, "SurfaceScaling_ExtentPositionChange");
   1.132 +NONSHARABLE_CLASS(CEglTest_SurfaceScaling_ExtentPositionChange) : public CEglTest_SurfaceScalingBase
   1.133 +    {
   1.134 +public:
   1.135 +    TVerdict doTestStepL();
   1.136 +    TVerdict doTestPartialStepL(const CFbsBitmap& aRefBitmap);
   1.137 +private:
   1.138 +    TInt iRefBitmapOffset;
   1.139 +    };
   1.140 +
   1.141 +_LIT(KSurfaceScaling_ExtentSizeChange, "SurfaceScaling_ExtentSizeChange");
   1.142 +NONSHARABLE_CLASS(CEglTest_SurfaceScaling_ExtentSizeChange) : public CEglTest_SurfaceScalingBase
   1.143 +    {
   1.144 +public:
   1.145 +    TVerdict doTestStepL();
   1.146 +    TVerdict doTestPartialStepL();
   1.147 +    };
   1.148 +
   1.149 +_LIT(KSurfaceScaling_SwapBuffers, "SurfaceScaling_SwapBuffers");
   1.150 +NONSHARABLE_CLASS(CEglTest_SurfaceScaling_SwapBuffers) : public CEglTest_SurfaceScalingBase
   1.151 +    {
   1.152 +public:
   1.153 +    TVerdict doTestStepL();
   1.154 +    TVerdict doTestPartialStepL();
   1.155 +    };
   1.156 +
   1.157 +_LIT(KSurfaceScaling_WindowSurface_Check, "SurfaceScaling_WindowSurface_Check");
   1.158 +NONSHARABLE_CLASS(CEglTest_SurfaceScaling_WindowSurface_Check) : public CEglTest_SurfaceScalingBase
   1.159 +    {
   1.160 +public:
   1.161 +    TVerdict doTestStepL();
   1.162 +    };
   1.163 +
   1.164 +_LIT(KSurfaceScaling_Negative_CreateWindowSurface, "SurfaceScaling_Negative_CreateWindowSurface");
   1.165 +NONSHARABLE_CLASS(CEglTest_SurfaceScaling_Negative_CreateWindowSurface) : public CEglTest_SurfaceScalingBase
   1.166 +    {
   1.167 +public:
   1.168 +    TVerdict doTestStepL();
   1.169 +    };
   1.170 +
   1.171 +_LIT(KSurfaceScaling_Negative_FixedSize_NonWindowSurface, "SurfaceScaling_Negative_FixedSize_NonWindowSurface");
   1.172 +NONSHARABLE_CLASS(CEglTest_SurfaceScaling_Negative_FixedSize_NonWindowSurface) : public CEglTest_SurfaceScalingBase
   1.173 +    {
   1.174 +public:
   1.175 +    TVerdict doTestStepL();
   1.176 +    };
   1.177 +
   1.178 +_LIT(KSurfaceScalingDefaultBorderColor, "SurfaceScalingDefaultBorderColor");
   1.179 +NONSHARABLE_CLASS(CEglTest_SurfaceScalingDefaultBorderColor) : public CEglTest_SurfaceScalingBase
   1.180 +    {
   1.181 +public:
   1.182 +    TVerdict doTestStepL();
   1.183 +    };
   1.184 +
   1.185 +_LIT(KSurfaceScalingModifyingBorderColor, "SurfaceScalingModifyingBorderColor");
   1.186 +NONSHARABLE_CLASS(CEglTest_SurfaceScalingModifyingBorderColor) : public CEglTest_SurfaceScalingBase
   1.187 +    {
   1.188 +public:
   1.189 +    TVerdict doTestStepL();
   1.190 +    };
   1.191 +
   1.192 +_LIT(KSurfaceScalingModifyingBorderColorNonFixed, "SurfaceScalingModifyingBorderColorNonFixed");
   1.193 +NONSHARABLE_CLASS(CEglTest_SurfaceScalingModifyingBorderColorNonFixed) : public CEglTest_SurfaceScalingBase
   1.194 +    {
   1.195 +public:
   1.196 +	TVerdict doTestStepL();
   1.197 +    };
   1.198 +
   1.199 +_LIT(KSurfaceScalingModifyingInvalidBorderColor, "SurfaceScalingModifyingInvalidBorderColor");
   1.200 +NONSHARABLE_CLASS(CEglTest_SurfaceScalingModifyingInvalidBorderColor) : public CEglTest_SurfaceScalingBase
   1.201 +    {
   1.202 +public:
   1.203 +    TVerdict doTestStepL();
   1.204 +    };
   1.205 +
   1.206 +_LIT(KSurfaceScalingModifyingExtent, "SurfaceScalingModifyingExtent");
   1.207 +NONSHARABLE_CLASS(CEglTest_SurfaceScalingModifyingExtent) : public CEglTest_SurfaceScalingBase
   1.208 +    {
   1.209 +public:
   1.210 +    TVerdict doTestStepL();
   1.211 +    };
   1.212 +
   1.213 +_LIT(KSurfaceScalingModifyingExtentNonFixed, "SurfaceScalingModifyingExtentNonFixed");
   1.214 +NONSHARABLE_CLASS(CEglTest_SurfaceScalingModifyingExtentNonFixed) : public CEglTest_SurfaceScalingBase
   1.215 +    {
   1.216 +public:
   1.217 +    TVerdict doTestStepL();
   1.218 +    };
   1.219 +
   1.220 +_LIT(KSurfaceScalingQuerySurface, "SurfaceScalingQuerySurface");
   1.221 +NONSHARABLE_CLASS(CEglTest_SurfaceScalingQuerySurface) : public CEglTest_SurfaceScalingBase
   1.222 +    {
   1.223 +public:
   1.224 +    TVerdict doTestStepL();
   1.225 +    };
   1.226 +
   1.227 +_LIT(KSurfaceScalingQuerySurfaceNonFixed, "SurfaceScalingQuerySurfaceNonFixed");
   1.228 +NONSHARABLE_CLASS(CEglTest_SurfaceScalingQuerySurfaceNonFixed) : public CEglTest_SurfaceScalingBase
   1.229 +    {
   1.230 +public:
   1.231 +    TVerdict doTestStepL();
   1.232 +    };
   1.233 +
   1.234 +_LIT(KSurfaceScalingCapability, "SurfaceScalingCapability");
   1.235 +NONSHARABLE_CLASS(CEglTest_SurfaceScalingCapability) : public CEglTest_SurfaceScalingBase
   1.236 +    {
   1.237 +public:
   1.238 +    TVerdict doTestStepL();
   1.239 +    };
   1.240 +
   1.241 +_LIT(KSurfaceScalingSet, "SurfaceScalingSet");
   1.242 +NONSHARABLE_CLASS(CEglTest_SurfaceScalingSet) : public CEglTest_SurfaceScalingBase
   1.243 +    {
   1.244 +public:
   1.245 +    TVerdict doTestStepL();
   1.246 +    };
   1.247 +
   1.248 +_LIT(KSurfaceScalingSetNonFixed, "SurfaceScalingSetNonFixed");
   1.249 +NONSHARABLE_CLASS(CEglTest_SurfaceScalingSetNonFixed) : public CEglTest_SurfaceScalingBase
   1.250 +    {
   1.251 +public:
   1.252 +    TVerdict doTestStepL();
   1.253 +    };
   1.254 +
   1.255 +_LIT(KSurfaceScalingSetInvalidAttributes, "SurfaceScalingSetInvalidAttributes");
   1.256 +NONSHARABLE_CLASS(CEglTest_SurfaceScalingSetInvalidAttributes) : public CEglTest_SurfaceScalingBase
   1.257 +    {
   1.258 +public:
   1.259 +    TVerdict doTestStepL();
   1.260 +    };
   1.261 +
   1.262 +_LIT(KSurfaceScalingNotInitialized, "SurfaceScalingNotInitialized");
   1.263 +NONSHARABLE_CLASS(CEglTest_SurfaceScalingNotInitialized) : public CEglTest_SurfaceScalingBase
   1.264 +    {
   1.265 +public:
   1.266 +    TVerdict doTestStepL();
   1.267 +    };
   1.268 +
   1.269 +#endif // EGLTEST_SURFACESCALING_H