os/graphics/egl/egltest/endpointtestsuite/automated/tsrc/egltest_endpointattrib_local.cpp
Update contrib.
     1 // Copyright (c) 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.
 
    17  @internalComponent - Internal Symbian test code
 
    20 #include "egltest_endpointattrib.h"
 
    22 const TInt KBadAttribValue = EGL_BAD_ATTRIBUTE;  // Use error code as a "invalid attribute value".
 
    24 // For testing flexibility of the concept. Not actually used in the testcode at this point in time.
 
    25 static const TTestCase KAttribBadParameterCases[] =
 
    29         CASETITLE("Functional: Negative: eglGetEndpointAttribNOK with Bad Parameters: bad display is error code when getting attributes"),
 
    30         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
 
    32         { EInitializeCase,      0,              EGL_SUCCESS },
 
    33         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
 
    34         { ECreateEndpointCase,  0,              EGL_SUCCESS },
 
    35         { EGetAttribCase,       EUseBadDisplay, EGL_BAD_DISPLAY, 0, 0, EGL_ENDPOINT_READY_NOK, 0},
 
    36         // Use bad endpoint with bad display - should give bad display.
 
    37         { EGetAttribCase,       EUseBadEndpoint | EUseBadDisplay,
 
    38                 EGL_BAD_DISPLAY, 0, 0, EGL_ENDPOINT_READY_NOK, 0},
 
    39         { EGetAttribCase,       EUseBadEndpoint,
 
    40                 EGL_BAD_ENDPOINT_NOK, 0, 0, EGL_ENDPOINT_READY_NOK, 0},
 
    41         { EGetAttribCase,       EUseBadDisplay, EGL_BAD_DISPLAY, 0, 0, EGL_DELAY_NOK, 0 },
 
    42         // Use bad endpoint with bad display - should give bad display.
 
    43         { EGetAttribCase,       EUseBadEndpoint | EUseBadDisplay,
 
    44                 EGL_BAD_DISPLAY, 0, 0, EGL_DELAY_NOK, 0},
 
    45         { EGetAttribCase,       EUseBadEndpoint,EGL_BAD_ENDPOINT_NOK, 0, 0, EGL_DELAY_NOK, 0},
 
    46         { EGetAttribCase,       EUseBadDisplay, EGL_BAD_DISPLAY, 0, 0, KBadAttribValue, 0},
 
    47         { EGetAttribCase,       EExpectError,   EGL_BAD_PARAMETER, 0, 0, KBadAttribValue, 0},
 
    48         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
 
    49         { ETerminateCase,       0,              EGL_SUCCESS },
 
    55         CASETITLE("Functional: Negative: eglGetEndpointAttribNOK with Bad Parameters: bad parameter is error code when requesting invalid attribute"),
 
    56         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
 
    58         { EInitializeCase,      0,              EGL_SUCCESS },
 
    59         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
 
    60         { ECreateEndpointCase,  0,              EGL_SUCCESS },
 
    61         // First check that bad display is issued even when the attribute is bad.
 
    62         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
 
    63         { ETerminateCase,       0,              EGL_SUCCESS },
 
    67     // SetEndpointAttrib tests.
 
    70         CASETITLE("Functional: Negative: eglSetEndpointAttribNOK with Bad Parameters: bad display is error code when setting endpoint ready"),
 
    71         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
 
    73         { EInitializeCase,      0,              EGL_SUCCESS },
 
    74         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
 
    75         { ECreateEndpointCase,  0,              EGL_SUCCESS },
 
    76         { ESetAttribCase,       EUseBadDisplay, EGL_BAD_DISPLAY, 0, 0, EGL_ENDPOINT_READY_NOK, 0},
 
    77         { ESetAttribCase,       EUseBadDisplay, EGL_BAD_DISPLAY, 0, 0, EGL_ENDPOINT_READY_NOK, 0},
 
    78         // Use bad endpoint with bad display - should give bad display.
 
    79         { ESetAttribCase,       EUseBadEndpoint | EUseBadDisplay,
 
    80                 EGL_BAD_DISPLAY, 0, 0, EGL_ENDPOINT_READY_NOK, 0},
 
    81         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
 
    82         { ETerminateCase,       0,              EGL_SUCCESS },
 
    88         CASETITLE("Functional: Negative: eglSetEndpointAttribNOK with Bad Parameters: bad display is error code when setting endpoint delay"),
 
    89         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
 
    91         { EInitializeCase,      0,              EGL_SUCCESS },
 
    92         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
 
    93         { ECreateEndpointCase,  0,              EGL_SUCCESS },
 
    94         { ESetAttribCase,       EUseBadDisplay, EGL_BAD_DISPLAY, 0, 0, EGL_DELAY_NOK, 0 },
 
    95         // Use bad endpoint with bad display - should give bad display.
 
    96         { ESetAttribCase,       EUseBadEndpoint | EUseBadDisplay,
 
    97                 EGL_BAD_DISPLAY, 0, 0, EGL_DELAY_NOK, 0},
 
    98         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
 
    99         { ETerminateCase,       0,              EGL_SUCCESS },
 
   105         CASETITLE("Functional: Negative: eglSetEndpointAttribNOK with Bad Parameters: bad endpoint is error code when setting endpoint delay"),
 
   106         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
 
   108         { EInitializeCase,      0,              EGL_SUCCESS },
 
   109         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
 
   110         { ECreateEndpointCase,  0,              EGL_SUCCESS },
 
   111         { ESetAttribCase,       EUseBadEndpoint,EGL_BAD_ENDPOINT_NOK, 0, 0, EGL_DELAY_NOK, 0},
 
   112         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
 
   113         { ETerminateCase,       0,              EGL_SUCCESS },
 
   119         CASETITLE("Functional: Negative: eglSetEndpointAttribNOK with Bad Parameters: bad parameter is error code when setting invalid attribute"),
 
   120         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
 
   122         { EInitializeCase,      0,              EGL_SUCCESS },
 
   123         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
 
   124         { ECreateEndpointCase,  0,              EGL_SUCCESS },
 
   125         // First check that bad display is issued even when the attribute is bad.
 
   126         { ESetAttribCase,       EUseBadDisplay, EGL_BAD_DISPLAY, 0, 0, KBadAttribValue, 0},
 
   127         { ESetAttribCase,       EExpectError,   EGL_BAD_PARAMETER, 0, 0, KBadAttribValue, 0},
 
   128         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
 
   129         { ETerminateCase,       0,              EGL_SUCCESS },
 
   135         CASETITLE("Functional: Negative: eglSetEndpointAttribNOK with Bad Parameters: bad parameter is error code when setting EGL_ENDPOINT_READY_NOK"),
 
   136         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
 
   138         { EInitializeCase,      0,              EGL_SUCCESS },
 
   139         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
 
   140         { ECreateEndpointCase,  0,              EGL_SUCCESS },
 
   141         { ESetAttribCase,       EExpectError,   EGL_BAD_PARAMETER, 0, 0, EGL_ENDPOINT_READY_NOK, 0},
 
   142         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
 
   143         { ETerminateCase,       0,              EGL_SUCCESS },
 
   149 static const TTestCase KAttribPositiveCases[] =
 
   153         CASETITLE("Functional: Positive: eglGetEndpointAttribNOK with Valid Parameters: check that EGL_ENDPOINT_READY_NOK returns EGL_FALSE when not ready"),
 
   154         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
 
   156         { EInitializeCase,      0,              EGL_SUCCESS },
 
   157         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
 
   158         { ECreateEndpointCase,  0,              EGL_SUCCESS },
 
   159         { EGetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_ENDPOINT_READY_NOK, EGL_FALSE },
 
   160         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
 
   161         { ETerminateCase,       0,              EGL_SUCCESS },
 
   167         CASETITLE("Functional: Positive: eglGetEndpointAttribNOK with Valid Parameters: check that EGL_ENDPOINT_READY_NOK returns EGL_TRUE when ready"),
 
   168         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
 
   170         { EInitializeCase,      0,              EGL_SUCCESS },
 
   171         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
 
   172         { ECreateEndpointCase,  0,              EGL_SUCCESS },
 
   173         { EDrawContentCase,     0,              EGL_SUCCESS },
 
   174         { EContentUpdateCase,   0,              EGL_SUCCESS },
 
   175         { EGetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_ENDPOINT_READY_NOK, EGL_TRUE },
 
   176         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
 
   177         { ETerminateCase,       0,              EGL_SUCCESS },
 
   183         CASETITLE("Functional: Positive: eglGetEndpointAttribNOK with Valid Parameters: Two endpoints, check EGL_ENDPOINT_READY_NOK returns EGL_TRUE for one but not other endpoint"),
 
   184         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
 
   186         { EInitializeCase,      0,              EGL_SUCCESS },
 
   187         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
 
   188         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 1, EUnalignedPixelSizeSurface },
 
   189         { ECreateEndpointCase,  0,              EGL_SUCCESS },
 
   190         { ECreateEndpointCase,  0,              EGL_SUCCESS, 1 },
 
   191         { EDrawContentCase,     0,              EGL_SUCCESS },
 
   192         { EContentUpdateCase,   0,              EGL_SUCCESS },
 
   193         { EGetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_ENDPOINT_READY_NOK, EGL_TRUE },
 
   194         { EGetAttribCase,       0,              EGL_SUCCESS, 1, 0, EGL_ENDPOINT_READY_NOK, EGL_FALSE },
 
   195         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
 
   196         { EDestroyEndpointCase, 0,              EGL_SUCCESS, 1 },
 
   197         { ETerminateCase,       0,              EGL_SUCCESS },
 
   203         CASETITLE("Functional: Positive: eglGetEndpointAttribNOK with Valid Parameters: check that EGL_DELAY_NOK returns 0 for a new endpoint"),
 
   204         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
 
   206         { EInitializeCase,      0,              EGL_SUCCESS },
 
   207         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
 
   208         { ECreateEndpointCase,  0,              EGL_SUCCESS },
 
   209         { EDrawContentCase,     0,              EGL_SUCCESS },
 
   210         { EContentUpdateCase,   0,              EGL_SUCCESS },
 
   211         { EGetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 0 },
 
   212         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
 
   213         { ETerminateCase,       0,              EGL_SUCCESS },
 
   217     // SetEndpointAttribute tests.
 
   220         CASETITLE("Functional: Positive: eglSetEndpointAttribNOK with Valid Parameters: set EGL_DELAY_NOK"),
 
   221         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
 
   223         { EInitializeCase,      0,              EGL_SUCCESS },
 
   224         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
 
   225         { ECreateEndpointCase,  0,              EGL_SUCCESS },
 
   226         { EDrawContentCase,     0,              EGL_SUCCESS },
 
   227         { EContentUpdateCase,   0,              EGL_SUCCESS },
 
   228         { ESetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 },
 
   229         { EGetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 },
 
   230         // Check that we can set a relatively large value, 250 ms, and that it remains.
 
   231         { ESetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 250000 },
 
   232         { EGetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 250000 },
 
   233         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
 
   234         { ETerminateCase,       0,              EGL_SUCCESS },
 
   240         CASETITLE("Functional: Positive: eglSetEndpointAttribNOK with Valid Parameters: set EGL_DELAY_NOK, then set again to a different value"),
 
   241         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
 
   243         { EInitializeCase,      0,              EGL_SUCCESS },
 
   244         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
 
   245         { ECreateEndpointCase,  0,              EGL_SUCCESS },
 
   246         { ESetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 },
 
   247         { EGetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 },
 
   248         { ESetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 208 },
 
   249         { EGetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 208 },
 
   250         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
 
   251         { ETerminateCase,       0,              EGL_SUCCESS },
 
   257         CASETITLE("Functional: Positive: eglSetEndpointAttribNOK with Valid Parameters: set EGL_DELAY_NOK, then with draw/update between set and get, then set again"),
 
   258         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
 
   260         { EInitializeCase,      0,              EGL_SUCCESS },
 
   261         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
 
   262         { ECreateEndpointCase,  0,              EGL_SUCCESS },
 
   263         { ESetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 },
 
   264         { EDrawContentCase,     0,              EGL_SUCCESS },
 
   265         { EContentUpdateCase,   0,              EGL_SUCCESS },
 
   266         { EGetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 },
 
   267         { ESetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 208 },
 
   268         { EGetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 208 },
 
   269         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
 
   270         { ETerminateCase,       0,              EGL_SUCCESS },
 
   276         CASETITLE("Functional: Positive: eglSetEndpointAttribNOK with Valid Parameters: set EGL_DELAY_NOK on two endpoints, with different values"),
 
   277         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
 
   279         { EInitializeCase,      0,              EGL_SUCCESS },
 
   280         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
 
   281         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 1, EUnalignedPixelSizeSurface },
 
   282         { ECreateEndpointCase,  0,              EGL_SUCCESS, 0, 0 },
 
   283         { ECreateEndpointCase,  0,              EGL_SUCCESS, 1, 1 },
 
   284         { ESetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 },
 
   285         { ESetAttribCase,       0,              EGL_SUCCESS, 1, 0, EGL_DELAY_NOK, 208 },
 
   286         { EGetAttribCase,       0,              EGL_SUCCESS, 1, 0, EGL_DELAY_NOK, 208 },
 
   287         { EGetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 },
 
   288         { EDestroyEndpointCase, 0,              EGL_SUCCESS, 1, 1 },
 
   289         { EDestroyEndpointCase, 0,              EGL_SUCCESS, 0, 0 },
 
   290         { ETerminateCase,       0,              EGL_SUCCESS },
 
   296         CASETITLE("Functional: Positive: eglSetEndpointAttribNOK with Valid Parameters: set EGL_DELAY_NOK on two endpoints, with different values, and swapping buffers between"),
 
   297         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
 
   299         { EInitializeCase,      0,              EGL_SUCCESS },
 
   300         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
 
   301         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 1, EUnalignedPixelSizeSurface },
 
   302         { ECreateEndpointCase,  0,              EGL_SUCCESS, 0, 0 },
 
   303         { ECreateEndpointCase,  0,              EGL_SUCCESS, 1, 1 },
 
   304         { ESetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 },
 
   305         { ESetAttribCase,       0,              EGL_SUCCESS, 1, 0, EGL_DELAY_NOK, 208 },
 
   306         { EDrawContentCase,     0,              EGL_SUCCESS },
 
   307         { EContentUpdateCase,   0,              EGL_SUCCESS },
 
   308         { EGetAttribCase,       0,              EGL_SUCCESS, 1, 0, EGL_DELAY_NOK, 208 },
 
   309         { EGetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 },
 
   310         { EGetAttribCase,       0,              EGL_SUCCESS, 1, 0, EGL_ENDPOINT_READY_NOK, EGL_FALSE },
 
   311         { EGetAttribCase,       0,              EGL_SUCCESS, 0, 0, EGL_ENDPOINT_READY_NOK, EGL_TRUE },
 
   312         { EDestroyEndpointCase, 0,              EGL_SUCCESS, 1, 1 },
 
   313         { EDestroyEndpointCase, 0,              EGL_SUCCESS, 0, 0 },
 
   314         { ETerminateCase,       0,              EGL_SUCCESS },
 
   320 static const TTestCases KTestCases[] =
 
   322         TestCase(KAttribPositiveCases),
 
   323         TestCase(KAttribBadParameterCases),
 
   326 const TInt KNumberTestCases = sizeof(KTestCases) / sizeof(KTestCases[0]);
 
   328 CEglTest_LocalTestStep_EndpointAttrib::CEglTest_LocalTestStep_EndpointAttrib():
 
   329     CEgltest_Local_Engine(KTestCases, KNumberTestCases)