os/graphics/egl/egltest/endpointtestsuite/automated/tsrc/egltest_endpointcreate_local.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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_endpointcreate.h"
    21 
    22 /**
    23 @SYMTestCaseID GRAPHICS-EGL-0406
    24 
    25 @SYMTestPriority 1
    26 
    27 @SYMPREQ 2670
    28 
    29 @SYMREQ 13245
    30 
    31 @SYMTestCaseDesc
    32 Test the beahviour of eglCreateEndpointNOK and eglDestroyEndpoint with good and bad parameters.
    33 
    34 @SYMTestActions
    35 Create a number of surfaces
    36 For each test case in a loop
    37     *   Send a commands with parameters to the windows server process test render stage to
    38         perform operations. These parameters include any error codes which should be
    39         generated.  The remote side checks the error code if any, and returns the result to the
    40         local side engine (test application), which sets the verdict of the test .
    41     *   Log any failures
    42 If the procedure was successful release all the resources and check the heap for memory leaks.
    43 No memory or handle leaks.
    44 
    45 @SYMTestExpectedResults
    46 If an error is generated, the value EGL_NO_ENDPOINT_NOK is returned.
    47 If dpy is not the handle of a valid EGLDisplay object, the error EGL_BAD_DISPLAY is generated.
    48 If type is not EGL_ENDPOINT_TYPE_CONSUMER_NOK, error EGL_BAD_PARAMETER is generated.
    49 If source is not a pointer to a valid TSurfaceId, the error EGL_BAD_PARAMETER is generated.
    50 If source_type is not EGL_TSURFACEID_NOK, the error EGL_BAD_PARAMETER is generated.
    51 If attrib_list is not NULL or empty, the error EGL_BAD_PARAMETER is generated.
    52 */
    53 
    54 static const TTestCase KCreatePositiveCases[] =
    55 {
    56     {
    57         TESTIDS("541A, 542A"),
    58         CASETITLE("Functional: Positive: eglCreateEndpointNOK & eglDestroyEndpointNOK with Valid Parameters: Create and destroy one endpoint"),
    59         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
    60         {
    61         { EInitializeCase,      0,              EGL_SUCCESS },
    62         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
    63         { ECreateEndpointCase,  0,              EGL_SUCCESS },
    64         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
    65         { ETerminateCase,       0,              EGL_SUCCESS },
    66         { EFinishedCase }
    67         },
    68     },
    69     {
    70         TESTIDS("541B, 542B"),
    71         CASETITLE("Functional: Positive: eglCreateEndpointNOK & eglDestroyEndpointNOK with Valid Parameters: Create and destroy two endpoints, sequential"),
    72         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
    73         {
    74         { EInitializeCase,      0,              EGL_SUCCESS },
    75         { ECreateSurfaceCase,   0,              EGL_SUCCESS },
    76         { ECreateEndpointCase,  0,              EGL_SUCCESS, 0, EStandardSurface },
    77         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
    78         { ECreateEndpointCase,  0,              EGL_SUCCESS },
    79         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
    80         { ETerminateCase,       0,              EGL_SUCCESS },
    81         { EFinishedCase }
    82         },
    83     },
    84     {
    85         TESTIDS("541C, 542C"),
    86         CASETITLE("Functional: Positive: eglCreateEndpointNOK & eglDestroyEndpointNOK with Valid Parameters: Create and destroy three endpoints, parallel, destroy in order"),
    87         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
    88         {
    89         { EInitializeCase,      0,              EGL_SUCCESS },
    90         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
    91         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 1, EStandardSurface },
    92         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 2, EStandardSurface },
    93         { ECreateEndpointCase,  0,              EGL_SUCCESS, 0, 0 },
    94         { ECreateEndpointCase,  0,              EGL_SUCCESS, 1, 1 },
    95         { ECreateEndpointCase,  0,              EGL_SUCCESS, 2, 2 },
    96         { EDestroyEndpointCase, 0,              EGL_SUCCESS, 0, 0 },
    97         { EDestroyEndpointCase, 0,              EGL_SUCCESS, 1, 1 },
    98         { EDestroyEndpointCase, 0,              EGL_SUCCESS, 2, 2 },
    99         { ETerminateCase,       0,              EGL_SUCCESS },
   100         { EFinishedCase }
   101         },
   102     },
   103     {
   104         TESTIDS("541D, 542D"),
   105         CASETITLE("Functional: Positive: eglCreateEndpointNOK & eglDestroyEndpointNOK with Valid Parameters: Create and destroy three endpoints, parallel, destroy reverse order"),
   106         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   107         {
   108         { EInitializeCase,      0,              EGL_SUCCESS },
   109         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
   110         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 1, EStandardSurface },
   111         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 2, EStandardSurface },
   112         { ECreateEndpointCase,  0,              EGL_SUCCESS, 0, 0 },
   113         { ECreateEndpointCase,  0,              EGL_SUCCESS, 1, 1 },
   114         { ECreateEndpointCase,  0,              EGL_SUCCESS, 2, 2 },
   115         { EDestroyEndpointCase, 0,              EGL_SUCCESS, 2, 2 },
   116         { EDestroyEndpointCase, 0,              EGL_SUCCESS, 1, 1 },
   117         { EDestroyEndpointCase, 0,              EGL_SUCCESS, 0, 0 },
   118         { ETerminateCase,       0,              EGL_SUCCESS },
   119         { EFinishedCase }
   120         },
   121     },
   122     {
   123         TESTIDS("541E, 542E"),
   124         CASETITLE("Functional: Positive: eglCreateEndpointNOK & eglDestroyEndpointNOK with Valid Parameters: Create and destroy three endpoints, parallel, destroy out of order"),
   125         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   126         {
   127         { EInitializeCase,      0,              EGL_SUCCESS },
   128         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
   129         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 1, EStandardSurface },
   130         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 2, EStandardSurface },
   131         { ECreateEndpointCase,  0,              EGL_SUCCESS, 0, 0 },
   132         { ECreateEndpointCase,  0,              EGL_SUCCESS, 1, 1 },
   133         { ECreateEndpointCase,  0,              EGL_SUCCESS, 2, 2 },
   134         { EDestroyEndpointCase, 0,              EGL_SUCCESS, 2, 2 },
   135         { EDestroyEndpointCase, 0,              EGL_SUCCESS, 0, 0 },
   136         { EDestroyEndpointCase, 0,              EGL_SUCCESS, 1, 1 },
   137         { ETerminateCase,       0,              EGL_SUCCESS },
   138         { EFinishedCase }
   139         },
   140     },
   141     {
   142         TESTIDS("541F"),
   143         CASETITLE("Functional: Positive: eglCreateEndpointNOK & eglTerminate with Valid Parameters: Create one endpoint then terminate EGL"),
   144         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   145         {
   146         { EInitializeCase,      0,              EGL_SUCCESS },
   147         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
   148         { ECreateEndpointCase,  0,              EGL_SUCCESS },
   149         { ETerminateCase,       0,              EGL_SUCCESS },
   150         { EFinishedCase }
   151         },
   152     },
   153     {
   154         TESTIDS("541G"),
   155         CASETITLE("Functional: Positive: eglCreateEndpointNOK & eglTerminate with Valid Parameters: Create three endpoints then terminate EGL"),
   156         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   157         {
   158         { EInitializeCase,      0,              EGL_SUCCESS },
   159         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
   160         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 1, EStandardSurface },
   161         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 2, EStandardSurface },
   162         { ECreateEndpointCase,  0,              EGL_SUCCESS, 0, 0 },
   163         { ECreateEndpointCase,  0,              EGL_SUCCESS, 1, 1 },
   164         { ECreateEndpointCase,  0,              EGL_SUCCESS, 2, 2 },
   165         { ETerminateCase,       0,              EGL_SUCCESS },
   166         { EFinishedCase }
   167         },
   168     },
   169 };
   170 
   171 static const TTestCase KCreateBadParameterCases[] =
   172 {
   173     {
   174         TESTIDS("549A"),
   175         CASETITLE("Functional: Negative: eglCreateEndpointNOK with Bad parameters: Create with bad display and various other bad parameters"),
   176         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   177         {
   178         { EInitializeCase,      0,              EGL_SUCCESS },
   179         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
   180         { ECreateEndpointCase,  EUseBadDisplay, EGL_BAD_DISPLAY },
   181         { ECreateEndpointCase,  EUseBadDisplay | EUseBadEndpointType, EGL_BAD_DISPLAY },
   182         { ECreateEndpointCase,  EUseBadDisplay | EUseBadSourceType, EGL_BAD_DISPLAY },
   183         { ECreateEndpointCase,  EUseBadDisplay | EUseBadSourceType | EUseBadEndpointType, EGL_BAD_DISPLAY },
   184         { ECreateEndpointCase,  EUseBadEndpointType, EGL_BAD_PARAMETER },
   185         { ECreateEndpointCase,  EUseBadSourceType, EGL_BAD_PARAMETER },
   186         { ETerminateCase,       0,              EGL_SUCCESS },
   187         { EFinishedCase }
   188         },
   189     },
   190     {
   191         TESTIDS("549B"),
   192         CASETITLE("Functional: Negative: eglCreateEndpointNOK with Bad parameters: Create with bad attributes"),
   193         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   194         {
   195         { EInitializeCase,      0,                EGL_SUCCESS },
   196         { ECreateSurfaceCase,   0,                EGL_SUCCESS, 0, EBadAttribSurface },
   197         { ECreateEndpointCase,  EUseBadDisplay,   EGL_BAD_DISPLAY },
   198         { ECreateEndpointCase,  EUseBadDisplay | EUseBadEndpointType, EGL_BAD_DISPLAY },
   199         { ECreateEndpointCase,  EUseBadDisplay | EUseBadSourceType, EGL_BAD_DISPLAY },
   200         { ECreateEndpointCase,  EUseBadDisplay | EUseBadSourceType | EUseBadEndpointType, EGL_BAD_DISPLAY },
   201         // Now, try with correct parameters aside from the attribute set - this should give us bad parameter.
   202         { ECreateEndpointCase,  EExpectError, EGL_BAD_PARAMETER },
   203         { ETerminateCase,       0,                EGL_SUCCESS },
   204         { EFinishedCase }
   205         },
   206     },
   207     {
   208         TESTIDS("549C"),
   209         CASETITLE("Functional: Negative: eglCreateEndpointNOK with Bad parameters: Create with bad surfaceid"),
   210         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   211         {
   212             { EInitializeCase,      0,                EGL_SUCCESS },
   213             { ECreateSurfaceCase,   0,                EGL_SUCCESS },
   214             // Check that bad display takes precedence over bad surface!
   215             { ECreateEndpointCase,  EUseBadDisplay | EUseBadSurfaceId, EGL_BAD_DISPLAY },
   216             { ECreateEndpointCase,  EUseBadSurfaceId, EGL_BAD_PARAMETER },
   217             // Now create an endpoint to see that nothing got messed up.
   218             { ECreateEndpointCase,  0,                EGL_SUCCESS },
   219             { EDestroyEndpointCase, 0,                EGL_SUCCESS },
   220             { ETerminateCase,       0,                EGL_SUCCESS },
   221             { EFinishedCase }
   222         }
   223     },
   224 };
   225 
   226 // Note that some cases of "destroy" are tested as part of AcquireImage tests - they are
   227 // borderline between the two functions, e.g. destroy when an image is acquired.
   228 // Also, destroyendpoint is tested in the streaming tests, for the case where endstreaming
   229 // is not performed before the destroyendpoint.
   230 static const TTestCase KCreateNegativeCases[] =
   231 {
   232     {
   233         TESTIDS("549D"),
   234         CASETITLE("Functional: Negative: eglCreateEndpointNOK with Bad parameters: check that creating an endpoint twice gives correct error"),
   235         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   236         {
   237         { EInitializeCase,      0,                EGL_SUCCESS },
   238         { ECreateSurfaceCase,   0,                EGL_SUCCESS, 0, EStandardSurface },
   239         { ECreateEndpointCase,  0,                EGL_SUCCESS },
   240         { ECreateEndpointCase,  EExpectError,     EGL_BAD_PARAMETER },
   241         { EDestroyEndpointCase, 0,                EGL_SUCCESS },
   242         { ETerminateCase,       0,                EGL_SUCCESS },
   243         { EFinishedCase }
   244         },
   245     },
   246 };
   247 
   248 static const TTestCase KDestroyBadParameterCases[] =
   249 {
   250     {
   251         TESTIDS("550A"),
   252         CASETITLE("Functional: Negative: eglDestroyEndpointNOK with Bad parameters: check various trivial bad parameters"),
   253         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   254         {
   255         { EInitializeCase,      0,              EGL_SUCCESS },
   256         { EDestroyEndpointCase, EUseBadDisplay, EGL_BAD_DISPLAY },
   257         { EDestroyEndpointCase, EUseBadDisplay, EGL_BAD_DISPLAY },
   258         // Now use bad endpoint WITH bad display - should give bad display.
   259         { EDestroyEndpointCase, EUseBadDisplay | EUseBadEndpoint, EGL_BAD_DISPLAY },
   260         // And bad endpoint on it's own, should give bad-endpoint.
   261         { EDestroyEndpointCase, EUseBadEndpoint, EGL_BAD_ENDPOINT_NOK },
   262         { ETerminateCase,       0,              EGL_SUCCESS },
   263         { EFinishedCase }
   264         },
   265     },
   266 };
   267 
   268 static const TTestCase KDestroyNegativeCases[] =
   269 {
   270     {
   271         TESTIDS("550B"),
   272         CASETITLE("Functional: Negative: eglDestroyEndpointNOK with Bad parameters: check that destroying the endpoint twice gives correct error"),
   273         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   274         {
   275         { EInitializeCase,      0,                EGL_SUCCESS },
   276         { ECreateSurfaceCase,   0,                EGL_SUCCESS, 0, EStandardSurface },
   277         { ECreateEndpointCase,  0,                EGL_SUCCESS },
   278         { EDestroyEndpointCase, 0,                EGL_SUCCESS },
   279         { EDestroyEndpointCase, EExpectError,     EGL_BAD_ENDPOINT_NOK },
   280         { ETerminateCase,       0,                EGL_SUCCESS },
   281         { EFinishedCase }
   282         },
   283     },
   284 };
   285 
   286 
   287 static const TTestCase KDestroyEndpointClosesAllReferences[] =
   288 {
   289     {
   290         TESTIDS("564A"),
   291         CASETITLE("Functional: General: eglDestroyEndpoint closes all references: try to begin streaming after destroy endpoint"),
   292         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   293         {
   294         { EInitializeCase,      0,              EGL_SUCCESS },
   295         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
   296         { ECreateEndpointCase,  0,              EGL_SUCCESS },
   297         { EDrawContentCase,     0,              EGL_SUCCESS },
   298         { EContentUpdateCase,   0,              EGL_SUCCESS },
   299         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
   300         { EBeginStreamingCase,  EExpectError,   EGL_BAD_ENDPOINT_NOK },
   301         { EAcquireImageCase,    EExpectError,   EGL_BAD_ENDPOINT_NOK },
   302         { ETerminateCase,       0,              EGL_SUCCESS },
   303         { EFinishedCase }
   304         },
   305     },
   306     {
   307         TESTIDS("564B"),
   308         CASETITLE("Functional: General: eglDestroyEndpoint closes all references: try to create vg image from egl image after destroy endpoint"),
   309         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   310         {
   311         { EInitializeCase,      0,              EGL_SUCCESS },
   312         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
   313         { ECreateEndpointCase,  0,              EGL_SUCCESS },
   314         { EDrawContentCase,     0,              EGL_SUCCESS },
   315         { EContentUpdateCase,   0,              EGL_SUCCESS },
   316         { EBeginStreamingCase,  0,              EGL_SUCCESS },
   317         { EAcquireImageCase,    0,              EGL_SUCCESS },
   318         { ECompareImageCase,    0,              EGL_SUCCESS },
   319         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
   320         { ECreateVgImageCase,   EExpectError,   EFalse },
   321         { ETerminateCase,       0,              EGL_SUCCESS },
   322         { EFinishedCase }
   323         },
   324     },
   325 };
   326 
   327 static const TTestCases KTestCases[] =
   328 {
   329         TestCase(KCreatePositiveCases),
   330         TestCase(KCreateBadParameterCases),
   331         TestCase(KCreateNegativeCases),
   332         // Note: No positive tests for destroy - that is already done as part of
   333         // the positive create tests.
   334         TestCase(KDestroyBadParameterCases),
   335         TestCase(KDestroyNegativeCases),
   336         TestCase(KDestroyEndpointClosesAllReferences),
   337 };
   338 
   339 const TInt KNumberTestCases = sizeof(KTestCases) / sizeof(KTestCases[0]);
   340 
   341 CEglTest_LocalTestStep_EndpointCreate::CEglTest_LocalTestStep_EndpointCreate():
   342     CEgltest_Local_Engine(KTestCases, KNumberTestCases)
   343     {
   344     }