os/graphics/egl/egltest/endpointtestsuite/automated/tsrc/egltest_endpointattrib_local.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 
    13 
    14 /**
    15  @file
    16  @test
    17  @internalComponent - Internal Symbian test code
    18 */
    19 
    20 #include "egltest_endpointattrib.h"
    21 
    22 const TInt KBadAttribValue = EGL_BAD_ATTRIBUTE;  // Use error code as a "invalid attribute value".
    23 
    24 // For testing flexibility of the concept. Not actually used in the testcode at this point in time.
    25 static const TTestCase KAttribBadParameterCases[] =
    26 {
    27     {
    28         TESTIDS("551A"),
    29         CASETITLE("Functional: Negative: eglGetEndpointAttribNOK with Bad Parameters: bad display is error code when getting attributes"),
    30         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
    31         {
    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 },
    50         { EFinishedCase }
    51         },
    52     },
    53     {
    54         TESTIDS("551B"),
    55         CASETITLE("Functional: Negative: eglGetEndpointAttribNOK with Bad Parameters: bad parameter is error code when requesting invalid attribute"),
    56         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
    57         {
    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 },
    64         { EFinishedCase }
    65         },
    66     },
    67     // SetEndpointAttrib tests.
    68     {
    69         TESTIDS("552A"),
    70         CASETITLE("Functional: Negative: eglSetEndpointAttribNOK with Bad Parameters: bad display is error code when setting endpoint ready"),
    71         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
    72         {
    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 },
    83         { EFinishedCase }
    84         },
    85     },
    86     {
    87         TESTIDS("552B"),
    88         CASETITLE("Functional: Negative: eglSetEndpointAttribNOK with Bad Parameters: bad display is error code when setting endpoint delay"),
    89         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
    90         {
    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 },
   100         { EFinishedCase }
   101         },
   102     },
   103     {
   104         TESTIDS("552C"),
   105         CASETITLE("Functional: Negative: eglSetEndpointAttribNOK with Bad Parameters: bad endpoint is error code when setting endpoint delay"),
   106         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
   107         {
   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 },
   114         { EFinishedCase }
   115         },
   116     },
   117     {
   118         TESTIDS("552D"),
   119         CASETITLE("Functional: Negative: eglSetEndpointAttribNOK with Bad Parameters: bad parameter is error code when setting invalid attribute"),
   120         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
   121         {
   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 },
   130         { EFinishedCase }
   131         },
   132     },
   133     {
   134         TESTIDS("552E"),
   135         CASETITLE("Functional: Negative: eglSetEndpointAttribNOK with Bad Parameters: bad parameter is error code when setting EGL_ENDPOINT_READY_NOK"),
   136         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
   137         {
   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 },
   144         { EFinishedCase }
   145         },
   146     },
   147 };
   148 
   149 static const TTestCase KAttribPositiveCases[] =
   150 {
   151     {
   152         TESTIDS("543A"),
   153         CASETITLE("Functional: Positive: eglGetEndpointAttribNOK with Valid Parameters: check that EGL_ENDPOINT_READY_NOK returns EGL_FALSE when not ready"),
   154         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
   155         {
   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 },
   162         { EFinishedCase }
   163         },
   164     },
   165     {
   166         TESTIDS("543B"),
   167         CASETITLE("Functional: Positive: eglGetEndpointAttribNOK with Valid Parameters: check that EGL_ENDPOINT_READY_NOK returns EGL_TRUE when ready"),
   168         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
   169         {
   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 },
   178         { EFinishedCase }
   179         },
   180     },
   181     {
   182         TESTIDS("543C"),
   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),
   185         {
   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 },
   198         { EFinishedCase }
   199         },
   200     },
   201     {
   202         TESTIDS("543D"),
   203         CASETITLE("Functional: Positive: eglGetEndpointAttribNOK with Valid Parameters: check that EGL_DELAY_NOK returns 0 for a new endpoint"),
   204         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
   205         {
   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 },
   214         { EFinishedCase }
   215         },
   216     },
   217     // SetEndpointAttribute tests.
   218     {
   219         TESTIDS("544A"),
   220         CASETITLE("Functional: Positive: eglSetEndpointAttribNOK with Valid Parameters: set EGL_DELAY_NOK"),
   221         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
   222         {
   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 },
   235         { EFinishedCase }
   236         },
   237     },
   238     {
   239         TESTIDS("544B"),
   240         CASETITLE("Functional: Positive: eglSetEndpointAttribNOK with Valid Parameters: set EGL_DELAY_NOK, then set again to a different value"),
   241         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
   242         {
   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 },
   252         { EFinishedCase }
   253         },
   254     },
   255     {
   256         TESTIDS("544C"),
   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),
   259         {
   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 },
   271         { EFinishedCase }
   272         },
   273     },
   274     {
   275         TESTIDS("544D"),
   276         CASETITLE("Functional: Positive: eglSetEndpointAttribNOK with Valid Parameters: set EGL_DELAY_NOK on two endpoints, with different values"),
   277         SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow),
   278         {
   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 },
   291         { EFinishedCase }
   292         },
   293     },
   294     {
   295         TESTIDS("544E"),
   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),
   298         {
   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 },
   315         { EFinishedCase }
   316         },
   317     },
   318 };
   319 
   320 static const TTestCases KTestCases[] =
   321 {
   322         TestCase(KAttribPositiveCases),
   323         TestCase(KAttribBadParameterCases),
   324 };
   325 
   326 const TInt KNumberTestCases = sizeof(KTestCases) / sizeof(KTestCases[0]);
   327 
   328 CEglTest_LocalTestStep_EndpointAttrib::CEglTest_LocalTestStep_EndpointAttrib():
   329     CEgltest_Local_Engine(KTestCases, KNumberTestCases)
   330     {
   331     }