os/graphics/egl/egltest/endpointtestsuite/automated/tsrc/egltest_endpointcreate_local.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/egl/egltest/endpointtestsuite/automated/tsrc/egltest_endpointcreate_local.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,344 @@
     1.4 +// Copyright (c) 2009 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 +
    1.17 +/**
    1.18 + @file
    1.19 + @test
    1.20 + @internalComponent - Internal Symbian test code
    1.21 +*/
    1.22 +
    1.23 +#include "egltest_endpointcreate.h"
    1.24 +
    1.25 +/**
    1.26 +@SYMTestCaseID GRAPHICS-EGL-0406
    1.27 +
    1.28 +@SYMTestPriority 1
    1.29 +
    1.30 +@SYMPREQ 2670
    1.31 +
    1.32 +@SYMREQ 13245
    1.33 +
    1.34 +@SYMTestCaseDesc
    1.35 +Test the beahviour of eglCreateEndpointNOK and eglDestroyEndpoint with good and bad parameters.
    1.36 +
    1.37 +@SYMTestActions
    1.38 +Create a number of surfaces
    1.39 +For each test case in a loop
    1.40 +    *   Send a commands with parameters to the windows server process test render stage to
    1.41 +        perform operations. These parameters include any error codes which should be
    1.42 +        generated.  The remote side checks the error code if any, and returns the result to the
    1.43 +        local side engine (test application), which sets the verdict of the test .
    1.44 +    *   Log any failures
    1.45 +If the procedure was successful release all the resources and check the heap for memory leaks.
    1.46 +No memory or handle leaks.
    1.47 +
    1.48 +@SYMTestExpectedResults
    1.49 +If an error is generated, the value EGL_NO_ENDPOINT_NOK is returned.
    1.50 +If dpy is not the handle of a valid EGLDisplay object, the error EGL_BAD_DISPLAY is generated.
    1.51 +If type is not EGL_ENDPOINT_TYPE_CONSUMER_NOK, error EGL_BAD_PARAMETER is generated.
    1.52 +If source is not a pointer to a valid TSurfaceId, the error EGL_BAD_PARAMETER is generated.
    1.53 +If source_type is not EGL_TSURFACEID_NOK, the error EGL_BAD_PARAMETER is generated.
    1.54 +If attrib_list is not NULL or empty, the error EGL_BAD_PARAMETER is generated.
    1.55 +*/
    1.56 +
    1.57 +static const TTestCase KCreatePositiveCases[] =
    1.58 +{
    1.59 +    {
    1.60 +        TESTIDS("541A, 542A"),
    1.61 +        CASETITLE("Functional: Positive: eglCreateEndpointNOK & eglDestroyEndpointNOK with Valid Parameters: Create and destroy one endpoint"),
    1.62 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
    1.63 +        {
    1.64 +        { EInitializeCase,      0,              EGL_SUCCESS },
    1.65 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
    1.66 +        { ECreateEndpointCase,  0,              EGL_SUCCESS },
    1.67 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS },
    1.68 +        { ETerminateCase,       0,              EGL_SUCCESS },
    1.69 +        { EFinishedCase }
    1.70 +        },
    1.71 +    },
    1.72 +    {
    1.73 +        TESTIDS("541B, 542B"),
    1.74 +        CASETITLE("Functional: Positive: eglCreateEndpointNOK & eglDestroyEndpointNOK with Valid Parameters: Create and destroy two endpoints, sequential"),
    1.75 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
    1.76 +        {
    1.77 +        { EInitializeCase,      0,              EGL_SUCCESS },
    1.78 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS },
    1.79 +        { ECreateEndpointCase,  0,              EGL_SUCCESS, 0, EStandardSurface },
    1.80 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS },
    1.81 +        { ECreateEndpointCase,  0,              EGL_SUCCESS },
    1.82 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS },
    1.83 +        { ETerminateCase,       0,              EGL_SUCCESS },
    1.84 +        { EFinishedCase }
    1.85 +        },
    1.86 +    },
    1.87 +    {
    1.88 +        TESTIDS("541C, 542C"),
    1.89 +        CASETITLE("Functional: Positive: eglCreateEndpointNOK & eglDestroyEndpointNOK with Valid Parameters: Create and destroy three endpoints, parallel, destroy in order"),
    1.90 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
    1.91 +        {
    1.92 +        { EInitializeCase,      0,              EGL_SUCCESS },
    1.93 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
    1.94 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 1, EStandardSurface },
    1.95 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 2, EStandardSurface },
    1.96 +        { ECreateEndpointCase,  0,              EGL_SUCCESS, 0, 0 },
    1.97 +        { ECreateEndpointCase,  0,              EGL_SUCCESS, 1, 1 },
    1.98 +        { ECreateEndpointCase,  0,              EGL_SUCCESS, 2, 2 },
    1.99 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS, 0, 0 },
   1.100 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS, 1, 1 },
   1.101 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS, 2, 2 },
   1.102 +        { ETerminateCase,       0,              EGL_SUCCESS },
   1.103 +        { EFinishedCase }
   1.104 +        },
   1.105 +    },
   1.106 +    {
   1.107 +        TESTIDS("541D, 542D"),
   1.108 +        CASETITLE("Functional: Positive: eglCreateEndpointNOK & eglDestroyEndpointNOK with Valid Parameters: Create and destroy three endpoints, parallel, destroy reverse order"),
   1.109 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.110 +        {
   1.111 +        { EInitializeCase,      0,              EGL_SUCCESS },
   1.112 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
   1.113 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 1, EStandardSurface },
   1.114 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 2, EStandardSurface },
   1.115 +        { ECreateEndpointCase,  0,              EGL_SUCCESS, 0, 0 },
   1.116 +        { ECreateEndpointCase,  0,              EGL_SUCCESS, 1, 1 },
   1.117 +        { ECreateEndpointCase,  0,              EGL_SUCCESS, 2, 2 },
   1.118 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS, 2, 2 },
   1.119 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS, 1, 1 },
   1.120 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS, 0, 0 },
   1.121 +        { ETerminateCase,       0,              EGL_SUCCESS },
   1.122 +        { EFinishedCase }
   1.123 +        },
   1.124 +    },
   1.125 +    {
   1.126 +        TESTIDS("541E, 542E"),
   1.127 +        CASETITLE("Functional: Positive: eglCreateEndpointNOK & eglDestroyEndpointNOK with Valid Parameters: Create and destroy three endpoints, parallel, destroy out of order"),
   1.128 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.129 +        {
   1.130 +        { EInitializeCase,      0,              EGL_SUCCESS },
   1.131 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
   1.132 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 1, EStandardSurface },
   1.133 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 2, EStandardSurface },
   1.134 +        { ECreateEndpointCase,  0,              EGL_SUCCESS, 0, 0 },
   1.135 +        { ECreateEndpointCase,  0,              EGL_SUCCESS, 1, 1 },
   1.136 +        { ECreateEndpointCase,  0,              EGL_SUCCESS, 2, 2 },
   1.137 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS, 2, 2 },
   1.138 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS, 0, 0 },
   1.139 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS, 1, 1 },
   1.140 +        { ETerminateCase,       0,              EGL_SUCCESS },
   1.141 +        { EFinishedCase }
   1.142 +        },
   1.143 +    },
   1.144 +    {
   1.145 +        TESTIDS("541F"),
   1.146 +        CASETITLE("Functional: Positive: eglCreateEndpointNOK & eglTerminate with Valid Parameters: Create one endpoint then terminate EGL"),
   1.147 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.148 +        {
   1.149 +        { EInitializeCase,      0,              EGL_SUCCESS },
   1.150 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
   1.151 +        { ECreateEndpointCase,  0,              EGL_SUCCESS },
   1.152 +        { ETerminateCase,       0,              EGL_SUCCESS },
   1.153 +        { EFinishedCase }
   1.154 +        },
   1.155 +    },
   1.156 +    {
   1.157 +        TESTIDS("541G"),
   1.158 +        CASETITLE("Functional: Positive: eglCreateEndpointNOK & eglTerminate with Valid Parameters: Create three endpoints then terminate EGL"),
   1.159 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.160 +        {
   1.161 +        { EInitializeCase,      0,              EGL_SUCCESS },
   1.162 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
   1.163 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 1, EStandardSurface },
   1.164 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 2, EStandardSurface },
   1.165 +        { ECreateEndpointCase,  0,              EGL_SUCCESS, 0, 0 },
   1.166 +        { ECreateEndpointCase,  0,              EGL_SUCCESS, 1, 1 },
   1.167 +        { ECreateEndpointCase,  0,              EGL_SUCCESS, 2, 2 },
   1.168 +        { ETerminateCase,       0,              EGL_SUCCESS },
   1.169 +        { EFinishedCase }
   1.170 +        },
   1.171 +    },
   1.172 +};
   1.173 +
   1.174 +static const TTestCase KCreateBadParameterCases[] =
   1.175 +{
   1.176 +    {
   1.177 +        TESTIDS("549A"),
   1.178 +        CASETITLE("Functional: Negative: eglCreateEndpointNOK with Bad parameters: Create with bad display and various other bad parameters"),
   1.179 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.180 +        {
   1.181 +        { EInitializeCase,      0,              EGL_SUCCESS },
   1.182 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
   1.183 +        { ECreateEndpointCase,  EUseBadDisplay, EGL_BAD_DISPLAY },
   1.184 +        { ECreateEndpointCase,  EUseBadDisplay | EUseBadEndpointType, EGL_BAD_DISPLAY },
   1.185 +        { ECreateEndpointCase,  EUseBadDisplay | EUseBadSourceType, EGL_BAD_DISPLAY },
   1.186 +        { ECreateEndpointCase,  EUseBadDisplay | EUseBadSourceType | EUseBadEndpointType, EGL_BAD_DISPLAY },
   1.187 +        { ECreateEndpointCase,  EUseBadEndpointType, EGL_BAD_PARAMETER },
   1.188 +        { ECreateEndpointCase,  EUseBadSourceType, EGL_BAD_PARAMETER },
   1.189 +        { ETerminateCase,       0,              EGL_SUCCESS },
   1.190 +        { EFinishedCase }
   1.191 +        },
   1.192 +    },
   1.193 +    {
   1.194 +        TESTIDS("549B"),
   1.195 +        CASETITLE("Functional: Negative: eglCreateEndpointNOK with Bad parameters: Create with bad attributes"),
   1.196 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.197 +        {
   1.198 +        { EInitializeCase,      0,                EGL_SUCCESS },
   1.199 +        { ECreateSurfaceCase,   0,                EGL_SUCCESS, 0, EBadAttribSurface },
   1.200 +        { ECreateEndpointCase,  EUseBadDisplay,   EGL_BAD_DISPLAY },
   1.201 +        { ECreateEndpointCase,  EUseBadDisplay | EUseBadEndpointType, EGL_BAD_DISPLAY },
   1.202 +        { ECreateEndpointCase,  EUseBadDisplay | EUseBadSourceType, EGL_BAD_DISPLAY },
   1.203 +        { ECreateEndpointCase,  EUseBadDisplay | EUseBadSourceType | EUseBadEndpointType, EGL_BAD_DISPLAY },
   1.204 +        // Now, try with correct parameters aside from the attribute set - this should give us bad parameter.
   1.205 +        { ECreateEndpointCase,  EExpectError, EGL_BAD_PARAMETER },
   1.206 +        { ETerminateCase,       0,                EGL_SUCCESS },
   1.207 +        { EFinishedCase }
   1.208 +        },
   1.209 +    },
   1.210 +    {
   1.211 +        TESTIDS("549C"),
   1.212 +        CASETITLE("Functional: Negative: eglCreateEndpointNOK with Bad parameters: Create with bad surfaceid"),
   1.213 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.214 +        {
   1.215 +            { EInitializeCase,      0,                EGL_SUCCESS },
   1.216 +            { ECreateSurfaceCase,   0,                EGL_SUCCESS },
   1.217 +            // Check that bad display takes precedence over bad surface!
   1.218 +            { ECreateEndpointCase,  EUseBadDisplay | EUseBadSurfaceId, EGL_BAD_DISPLAY },
   1.219 +            { ECreateEndpointCase,  EUseBadSurfaceId, EGL_BAD_PARAMETER },
   1.220 +            // Now create an endpoint to see that nothing got messed up.
   1.221 +            { ECreateEndpointCase,  0,                EGL_SUCCESS },
   1.222 +            { EDestroyEndpointCase, 0,                EGL_SUCCESS },
   1.223 +            { ETerminateCase,       0,                EGL_SUCCESS },
   1.224 +            { EFinishedCase }
   1.225 +        }
   1.226 +    },
   1.227 +};
   1.228 +
   1.229 +// Note that some cases of "destroy" are tested as part of AcquireImage tests - they are
   1.230 +// borderline between the two functions, e.g. destroy when an image is acquired.
   1.231 +// Also, destroyendpoint is tested in the streaming tests, for the case where endstreaming
   1.232 +// is not performed before the destroyendpoint.
   1.233 +static const TTestCase KCreateNegativeCases[] =
   1.234 +{
   1.235 +    {
   1.236 +        TESTIDS("549D"),
   1.237 +        CASETITLE("Functional: Negative: eglCreateEndpointNOK with Bad parameters: check that creating an endpoint twice gives correct error"),
   1.238 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.239 +        {
   1.240 +        { EInitializeCase,      0,                EGL_SUCCESS },
   1.241 +        { ECreateSurfaceCase,   0,                EGL_SUCCESS, 0, EStandardSurface },
   1.242 +        { ECreateEndpointCase,  0,                EGL_SUCCESS },
   1.243 +        { ECreateEndpointCase,  EExpectError,     EGL_BAD_PARAMETER },
   1.244 +        { EDestroyEndpointCase, 0,                EGL_SUCCESS },
   1.245 +        { ETerminateCase,       0,                EGL_SUCCESS },
   1.246 +        { EFinishedCase }
   1.247 +        },
   1.248 +    },
   1.249 +};
   1.250 +
   1.251 +static const TTestCase KDestroyBadParameterCases[] =
   1.252 +{
   1.253 +    {
   1.254 +        TESTIDS("550A"),
   1.255 +        CASETITLE("Functional: Negative: eglDestroyEndpointNOK with Bad parameters: check various trivial bad parameters"),
   1.256 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.257 +        {
   1.258 +        { EInitializeCase,      0,              EGL_SUCCESS },
   1.259 +        { EDestroyEndpointCase, EUseBadDisplay, EGL_BAD_DISPLAY },
   1.260 +        { EDestroyEndpointCase, EUseBadDisplay, EGL_BAD_DISPLAY },
   1.261 +        // Now use bad endpoint WITH bad display - should give bad display.
   1.262 +        { EDestroyEndpointCase, EUseBadDisplay | EUseBadEndpoint, EGL_BAD_DISPLAY },
   1.263 +        // And bad endpoint on it's own, should give bad-endpoint.
   1.264 +        { EDestroyEndpointCase, EUseBadEndpoint, EGL_BAD_ENDPOINT_NOK },
   1.265 +        { ETerminateCase,       0,              EGL_SUCCESS },
   1.266 +        { EFinishedCase }
   1.267 +        },
   1.268 +    },
   1.269 +};
   1.270 +
   1.271 +static const TTestCase KDestroyNegativeCases[] =
   1.272 +{
   1.273 +    {
   1.274 +        TESTIDS("550B"),
   1.275 +        CASETITLE("Functional: Negative: eglDestroyEndpointNOK with Bad parameters: check that destroying the endpoint twice gives correct error"),
   1.276 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.277 +        {
   1.278 +        { EInitializeCase,      0,                EGL_SUCCESS },
   1.279 +        { ECreateSurfaceCase,   0,                EGL_SUCCESS, 0, EStandardSurface },
   1.280 +        { ECreateEndpointCase,  0,                EGL_SUCCESS },
   1.281 +        { EDestroyEndpointCase, 0,                EGL_SUCCESS },
   1.282 +        { EDestroyEndpointCase, EExpectError,     EGL_BAD_ENDPOINT_NOK },
   1.283 +        { ETerminateCase,       0,                EGL_SUCCESS },
   1.284 +        { EFinishedCase }
   1.285 +        },
   1.286 +    },
   1.287 +};
   1.288 +
   1.289 +
   1.290 +static const TTestCase KDestroyEndpointClosesAllReferences[] =
   1.291 +{
   1.292 +    {
   1.293 +        TESTIDS("564A"),
   1.294 +        CASETITLE("Functional: General: eglDestroyEndpoint closes all references: try to begin streaming after destroy endpoint"),
   1.295 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.296 +        {
   1.297 +        { EInitializeCase,      0,              EGL_SUCCESS },
   1.298 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
   1.299 +        { ECreateEndpointCase,  0,              EGL_SUCCESS },
   1.300 +        { EDrawContentCase,     0,              EGL_SUCCESS },
   1.301 +        { EContentUpdateCase,   0,              EGL_SUCCESS },
   1.302 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS },
   1.303 +        { EBeginStreamingCase,  EExpectError,   EGL_BAD_ENDPOINT_NOK },
   1.304 +        { EAcquireImageCase,    EExpectError,   EGL_BAD_ENDPOINT_NOK },
   1.305 +        { ETerminateCase,       0,              EGL_SUCCESS },
   1.306 +        { EFinishedCase }
   1.307 +        },
   1.308 +    },
   1.309 +    {
   1.310 +        TESTIDS("564B"),
   1.311 +        CASETITLE("Functional: General: eglDestroyEndpoint closes all references: try to create vg image from egl image after destroy endpoint"),
   1.312 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.313 +        {
   1.314 +        { EInitializeCase,      0,              EGL_SUCCESS },
   1.315 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
   1.316 +        { ECreateEndpointCase,  0,              EGL_SUCCESS },
   1.317 +        { EDrawContentCase,     0,              EGL_SUCCESS },
   1.318 +        { EContentUpdateCase,   0,              EGL_SUCCESS },
   1.319 +        { EBeginStreamingCase,  0,              EGL_SUCCESS },
   1.320 +        { EAcquireImageCase,    0,              EGL_SUCCESS },
   1.321 +        { ECompareImageCase,    0,              EGL_SUCCESS },
   1.322 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS },
   1.323 +        { ECreateVgImageCase,   EExpectError,   EFalse },
   1.324 +        { ETerminateCase,       0,              EGL_SUCCESS },
   1.325 +        { EFinishedCase }
   1.326 +        },
   1.327 +    },
   1.328 +};
   1.329 +
   1.330 +static const TTestCases KTestCases[] =
   1.331 +{
   1.332 +        TestCase(KCreatePositiveCases),
   1.333 +        TestCase(KCreateBadParameterCases),
   1.334 +        TestCase(KCreateNegativeCases),
   1.335 +        // Note: No positive tests for destroy - that is already done as part of
   1.336 +        // the positive create tests.
   1.337 +        TestCase(KDestroyBadParameterCases),
   1.338 +        TestCase(KDestroyNegativeCases),
   1.339 +        TestCase(KDestroyEndpointClosesAllReferences),
   1.340 +};
   1.341 +
   1.342 +const TInt KNumberTestCases = sizeof(KTestCases) / sizeof(KTestCases[0]);
   1.343 +
   1.344 +CEglTest_LocalTestStep_EndpointCreate::CEglTest_LocalTestStep_EndpointCreate():
   1.345 +    CEgltest_Local_Engine(KTestCases, KNumberTestCases)
   1.346 +    {
   1.347 +    }