egl/egltest/inc/egltest_surfacescaling.h
changeset 121 d72fc2aace31
equal deleted inserted replaced
103:2717213c588a 121:d72fc2aace31
       
     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 /**
       
    17  @file
       
    18  @test
       
    19 */
       
    20 
       
    21 #ifndef EGLTEST_SURFACESCALING_H
       
    22 #define EGLTEST_SURFACESCALING_H
       
    23 
       
    24 #include "eglteststep.h"
       
    25 #include <test/egltestcommonsession.h>
       
    26 #include <test/graphicsscreencomparison.h>
       
    27 
       
    28 enum TEglTestScalingConfig
       
    29 	{ 
       
    30 	EWindowAttribs_NoScaling,
       
    31 	EWindowAttribsColor16MU_Scaling 
       
    32 	};
       
    33 
       
    34 static const EGLint KScalingConfigAttribs[2][17] =
       
    35 	{
       
    36 		{
       
    37 		//Window - Scaling not supported
       
    38 		EGL_BUFFER_SIZE,    	 0,
       
    39 		EGL_RED_SIZE,			 0,
       
    40 		EGL_GREEN_SIZE, 		 0,
       
    41 		EGL_BLUE_SIZE,			 0,
       
    42 		EGL_ALPHA_SIZE, 		 0,
       
    43 		EGL_RENDERABLE_TYPE,	 EGL_OPENVG_BIT,
       
    44 		EGL_SURFACE_TYPE,		 EGL_WINDOW_BIT,
       
    45 		EGL_SURFACE_SCALING_NOK, EGL_FALSE,
       
    46 		EGL_NONE
       
    47 		},
       
    48 		{
       
    49 		//EColor16MU - Window - Scaling supported
       
    50 		EGL_BUFFER_SIZE,    	 24,
       
    51 		EGL_RED_SIZE,			 8,
       
    52 		EGL_GREEN_SIZE, 		 8,
       
    53 		EGL_BLUE_SIZE,			 8,
       
    54 		EGL_ALPHA_SIZE,     	 0,
       
    55 		EGL_RENDERABLE_TYPE,	 EGL_OPENVG_BIT,
       
    56 		EGL_SURFACE_TYPE,		 EGL_WINDOW_BIT,
       
    57 		EGL_SURFACE_SCALING_NOK, EGL_TRUE,
       
    58 		EGL_NONE
       
    59 		},
       
    60 	};
       
    61 
       
    62 //base class for all surface scaling test cases
       
    63 //all common functionality should go here
       
    64 NONSHARABLE_CLASS(CEglTest_SurfaceScalingBase) : public CEglTestStep
       
    65     {
       
    66 public:
       
    67     ~CEglTest_SurfaceScalingBase();
       
    68 
       
    69 protected:
       
    70     // from CTestStep
       
    71     TVerdict doTestStepPreambleL();
       
    72     TVerdict doTestStepPostambleL();
       
    73 
       
    74     // helper methods
       
    75     void CheckBorderColorL(EGLint aExpectedRedChannelColor, EGLint aExpectedBlueChannelColor, EGLint aExpectedGreenChannelColor);
       
    76     void CheckScalingAttributesL(EGLint aExpectedSurfaceWidth, EGLint aExpectedSurfaceHeight, EGLint aExpectedExtentWidth, EGLint aExpectedExtentHeight, EGLint aExpectedOffsetX, EGLint aExpectedOffsetY);
       
    77     CFbsBitmap* CreateBitmapLC(const TSize& aSize, TInt aBorderTop, TInt aBorderBottom, TInt aBorderLeft, TInt aBorderRight, const TRgb& aBorderColor);
       
    78     void WritePixelsToSurfaceL(const CFbsBitmap& aBitmap);
       
    79     void CreateAndActivateWindowL(const TSize& aWindowSize);
       
    80     void CloseWindow();
       
    81 
       
    82 protected:
       
    83     CWsScreenDevice* iScreenDevice;
       
    84     RWindow iWindow;
       
    85     // surface scaling extension functions
       
    86     TFPtrEglQuerySurfaceScalingCapabilityNok iPfnEglQuerySurfaceScalingCapabilityNOK;
       
    87     TFPtrEglSetSurfaceScalingNok iPfnEglSetSurfaceScalingNOK;
       
    88     // surface scaling attributes
       
    89     TInt iWindowWidth;
       
    90     TInt iWindowHeight;
       
    91     TInt iSurfaceWidth;
       
    92     TInt iSurfaceHeight;
       
    93     TInt iExtentWidth;
       
    94     TInt iExtentHeight;
       
    95     TInt iOffsetX;
       
    96     TInt iOffsetY;
       
    97     TRgb iBorderColor;
       
    98     // surface scaling related attributes for reference bitmap
       
    99     TInt iBorderTop;
       
   100     TInt iBorderBottom;
       
   101     TInt iBorderLeft;
       
   102     TInt iBorderRight;
       
   103     // image comparison
       
   104     CTGraphicsScreenComparison* iImageComparison;
       
   105     // properties of the particular surface scaling implementation under testing
       
   106     TBool iAllScalable;
       
   107     TSize iScreenSize;
       
   108     };
       
   109 
       
   110 
       
   111 // EGL Surface Scaling tests
       
   112 _LIT(KSurfaceScaling_Positive, "SurfaceScaling_Positive");
       
   113 NONSHARABLE_CLASS(CEglTest_SurfaceScaling_Positive) : public CEglTest_SurfaceScalingBase
       
   114     {
       
   115 public:
       
   116     TVerdict doTestStepL();
       
   117     TVerdict doTestPartialStepL();
       
   118     };
       
   119 
       
   120 _LIT(KSurfaceScaling_WindowResize, "SurfaceScaling_WindowResize");
       
   121 NONSHARABLE_CLASS(CEglTest_SurfaceScaling_WindowResize) : public CEglTest_SurfaceScalingBase
       
   122     {
       
   123 public:
       
   124     TVerdict doTestStepL();
       
   125     TVerdict doTestPartialStepL();
       
   126     };
       
   127 
       
   128 _LIT(KSurfaceScaling_ExtentPositionChange, "SurfaceScaling_ExtentPositionChange");
       
   129 NONSHARABLE_CLASS(CEglTest_SurfaceScaling_ExtentPositionChange) : public CEglTest_SurfaceScalingBase
       
   130     {
       
   131 public:
       
   132     TVerdict doTestStepL();
       
   133     TVerdict doTestPartialStepL(const CFbsBitmap& aRefBitmap);
       
   134 private:
       
   135     TInt iRefBitmapOffset;
       
   136     };
       
   137 
       
   138 _LIT(KSurfaceScaling_ExtentSizeChange, "SurfaceScaling_ExtentSizeChange");
       
   139 NONSHARABLE_CLASS(CEglTest_SurfaceScaling_ExtentSizeChange) : public CEglTest_SurfaceScalingBase
       
   140     {
       
   141 public:
       
   142     TVerdict doTestStepL();
       
   143     TVerdict doTestPartialStepL();
       
   144     };
       
   145 
       
   146 _LIT(KSurfaceScaling_SwapBuffers, "SurfaceScaling_SwapBuffers");
       
   147 NONSHARABLE_CLASS(CEglTest_SurfaceScaling_SwapBuffers) : public CEglTest_SurfaceScalingBase
       
   148     {
       
   149 public:
       
   150     TVerdict doTestStepL();
       
   151     TVerdict doTestPartialStepL();
       
   152     };
       
   153 
       
   154 _LIT(KSurfaceScaling_WindowSurface_Check, "SurfaceScaling_WindowSurface_Check");
       
   155 NONSHARABLE_CLASS(CEglTest_SurfaceScaling_WindowSurface_Check) : public CEglTest_SurfaceScalingBase
       
   156     {
       
   157 public:
       
   158     TVerdict doTestStepL();
       
   159     };
       
   160 
       
   161 _LIT(KSurfaceScaling_Negative_CreateWindowSurface, "SurfaceScaling_Negative_CreateWindowSurface");
       
   162 NONSHARABLE_CLASS(CEglTest_SurfaceScaling_Negative_CreateWindowSurface) : public CEglTest_SurfaceScalingBase
       
   163     {
       
   164 public:
       
   165     TVerdict doTestStepL();
       
   166     };
       
   167 
       
   168 _LIT(KSurfaceScaling_Negative_FixedSize_NonWindowSurface, "SurfaceScaling_Negative_FixedSize_NonWindowSurface");
       
   169 NONSHARABLE_CLASS(CEglTest_SurfaceScaling_Negative_FixedSize_NonWindowSurface) : public CEglTest_SurfaceScalingBase
       
   170     {
       
   171 public:
       
   172     TVerdict doTestStepL();
       
   173     };
       
   174 
       
   175 _LIT(KSurfaceScalingDefaultBorderColor, "SurfaceScalingDefaultBorderColor");
       
   176 NONSHARABLE_CLASS(CEglTest_SurfaceScalingDefaultBorderColor) : public CEglTest_SurfaceScalingBase
       
   177     {
       
   178 public:
       
   179     TVerdict doTestStepL();
       
   180     };
       
   181 
       
   182 _LIT(KSurfaceScalingModifyingBorderColor, "SurfaceScalingModifyingBorderColor");
       
   183 NONSHARABLE_CLASS(CEglTest_SurfaceScalingModifyingBorderColor) : public CEglTest_SurfaceScalingBase
       
   184     {
       
   185 public:
       
   186     TVerdict doTestStepL();
       
   187     };
       
   188 
       
   189 _LIT(KSurfaceScalingModifyingBorderColorNonFixed, "SurfaceScalingModifyingBorderColorNonFixed");
       
   190 NONSHARABLE_CLASS(CEglTest_SurfaceScalingModifyingBorderColorNonFixed) : public CEglTest_SurfaceScalingBase
       
   191     {
       
   192 public:
       
   193 	TVerdict doTestStepL();
       
   194     };
       
   195 
       
   196 _LIT(KSurfaceScalingModifyingInvalidBorderColor, "SurfaceScalingModifyingInvalidBorderColor");
       
   197 NONSHARABLE_CLASS(CEglTest_SurfaceScalingModifyingInvalidBorderColor) : public CEglTest_SurfaceScalingBase
       
   198     {
       
   199 public:
       
   200     TVerdict doTestStepL();
       
   201     };
       
   202 
       
   203 _LIT(KSurfaceScalingModifyingExtent, "SurfaceScalingModifyingExtent");
       
   204 NONSHARABLE_CLASS(CEglTest_SurfaceScalingModifyingExtent) : public CEglTest_SurfaceScalingBase
       
   205     {
       
   206 public:
       
   207     TVerdict doTestStepL();
       
   208     };
       
   209 
       
   210 _LIT(KSurfaceScalingModifyingExtentNonFixed, "SurfaceScalingModifyingExtentNonFixed");
       
   211 NONSHARABLE_CLASS(CEglTest_SurfaceScalingModifyingExtentNonFixed) : public CEglTest_SurfaceScalingBase
       
   212     {
       
   213 public:
       
   214     TVerdict doTestStepL();
       
   215     };
       
   216 
       
   217 _LIT(KSurfaceScalingQuerySurface, "SurfaceScalingQuerySurface");
       
   218 NONSHARABLE_CLASS(CEglTest_SurfaceScalingQuerySurface) : public CEglTest_SurfaceScalingBase
       
   219     {
       
   220 public:
       
   221     TVerdict doTestStepL();
       
   222     };
       
   223 
       
   224 _LIT(KSurfaceScalingQuerySurfaceNonFixed, "SurfaceScalingQuerySurfaceNonFixed");
       
   225 NONSHARABLE_CLASS(CEglTest_SurfaceScalingQuerySurfaceNonFixed) : public CEglTest_SurfaceScalingBase
       
   226     {
       
   227 public:
       
   228     TVerdict doTestStepL();
       
   229     };
       
   230 
       
   231 _LIT(KSurfaceScalingCapability, "SurfaceScalingCapability");
       
   232 NONSHARABLE_CLASS(CEglTest_SurfaceScalingCapability) : public CEglTest_SurfaceScalingBase
       
   233     {
       
   234 public:
       
   235     TVerdict doTestStepL();
       
   236     };
       
   237 
       
   238 _LIT(KSurfaceScalingSet, "SurfaceScalingSet");
       
   239 NONSHARABLE_CLASS(CEglTest_SurfaceScalingSet) : public CEglTest_SurfaceScalingBase
       
   240     {
       
   241 public:
       
   242     TVerdict doTestStepL();
       
   243     };
       
   244 
       
   245 _LIT(KSurfaceScalingSetNonFixed, "SurfaceScalingSetNonFixed");
       
   246 NONSHARABLE_CLASS(CEglTest_SurfaceScalingSetNonFixed) : public CEglTest_SurfaceScalingBase
       
   247     {
       
   248 public:
       
   249     TVerdict doTestStepL();
       
   250     };
       
   251 
       
   252 _LIT(KSurfaceScalingSetInvalidAttributes, "SurfaceScalingSetInvalidAttributes");
       
   253 NONSHARABLE_CLASS(CEglTest_SurfaceScalingSetInvalidAttributes) : public CEglTest_SurfaceScalingBase
       
   254     {
       
   255 public:
       
   256     TVerdict doTestStepL();
       
   257     };
       
   258 
       
   259 _LIT(KSurfaceScalingNotInitialized, "SurfaceScalingNotInitialized");
       
   260 NONSHARABLE_CLASS(CEglTest_SurfaceScalingNotInitialized) : public CEglTest_SurfaceScalingBase
       
   261     {
       
   262 public:
       
   263     TVerdict doTestStepL();
       
   264     };
       
   265 
       
   266 #endif // EGLTEST_SURFACESCALING_H