os/graphics/egl/egltest/endpointtestsuite/automated/tsrc/egltest_endpointnotification.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_endpointnotification.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,294 @@
     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_endpointnotification.h"
    1.24 +
    1.25 +static const TTestCase KNotifcationPositiveCases[] =
    1.26 +{
    1.27 +    {
    1.28 +        TESTIDS("559,561"),
    1.29 +        CASETITLE("Functional: Positive: eglRequestNotification basic test."),
    1.30 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
    1.31 +        {
    1.32 +        { EInitializeCase,      0,              EGL_SUCCESS },
    1.33 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
    1.34 +        { ECreateEndpointCase,  0,              EGL_SUCCESS },
    1.35 +        { ERequestNotificationCase, 0,          EGL_SUCCESS },
    1.36 +        { ECancelNotificationCase, 0,           EGL_SUCCESS },
    1.37 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS },
    1.38 +        { ETerminateCase,       0,              EGL_SUCCESS },
    1.39 +        { EFinishedCase }
    1.40 +        },
    1.41 +    },
    1.42 +    {
    1.43 +        TESTIDS("604"),
    1.44 +        CASETITLE("Functional: Positive: eglRequestNotification with submitupdate."),
    1.45 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
    1.46 +        {
    1.47 +        { EInitializeCase,          0,              EGL_SUCCESS },
    1.48 +        { ECreateSurfaceCase,       0,              EGL_SUCCESS, 0, EStandardSurface },
    1.49 +        { ECreateEndpointCase,      0,              EGL_SUCCESS },
    1.50 +        { ERequestNotificationCase, 0,              EGL_SUCCESS },
    1.51 +        { EDrawContentCase,         0,              EGL_SUCCESS },
    1.52 +        { EContentUpdateCase,       0,              EGL_SUCCESS },
    1.53 +        { EWaitForNotificationCase, 0,              KErrNone,    0, 0, 100000 },
    1.54 +        { ECancelNotificationCase,  0,              EGL_SUCCESS },
    1.55 +        { EDestroyEndpointCase,     0,              EGL_SUCCESS },
    1.56 +        { ETerminateCase,           0,              EGL_SUCCESS },
    1.57 +        { EFinishedCase }
    1.58 +        },
    1.59 +    },
    1.60 +    {
    1.61 +        TESTIDS("605"),
    1.62 +        CASETITLE("Functional: Positive: eglRequestNotification with no submitupdate."),
    1.63 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
    1.64 +        {
    1.65 +        { EInitializeCase,          0,              EGL_SUCCESS },
    1.66 +        { ECreateSurfaceCase,       0,              EGL_SUCCESS,  0, EStandardSurface },
    1.67 +        { ECreateEndpointCase,      0,              EGL_SUCCESS },
    1.68 +        { ERequestNotificationCase, 0,              EGL_SUCCESS },
    1.69 +        { EWaitForNotificationCase, EExpectError,   KErrTimedOut, 0, 0, 100000 },
    1.70 +        { ECancelNotificationCase,  0,              EGL_SUCCESS },
    1.71 +        { EDestroyEndpointCase,     0,              EGL_SUCCESS },
    1.72 +        { ETerminateCase,           0,              EGL_SUCCESS },
    1.73 +        { EFinishedCase }
    1.74 +        },
    1.75 +    },
    1.76 +    {
    1.77 +        TESTIDS("606"),
    1.78 +        CASETITLE("Functional: Positive: eglRequestNotification with submitupdate first."),
    1.79 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
    1.80 +        {
    1.81 +        { EInitializeCase,          0,              EGL_SUCCESS },
    1.82 +        { ECreateSurfaceCase,       0,              EGL_SUCCESS, 0, EStandardSurface },
    1.83 +        { ECreateEndpointCase,      0,              EGL_SUCCESS },
    1.84 +        { EDrawContentCase,         0,              EGL_SUCCESS },
    1.85 +        { EContentUpdateCase,       0,              EGL_SUCCESS },
    1.86 +        { ERequestNotificationCase, 0,              EGL_SUCCESS },
    1.87 +        { EWaitForNotificationCase, 0,              KErrNone,    0, 0, 100000 },
    1.88 +        { ECancelNotificationCase,  0,              EGL_SUCCESS },
    1.89 +        { EDestroyEndpointCase,     0,              EGL_SUCCESS },
    1.90 +        { ETerminateCase,           0,              EGL_SUCCESS },
    1.91 +        { EFinishedCase }
    1.92 +        },
    1.93 +    },
    1.94 +    {
    1.95 +        TESTIDS("607A"),
    1.96 +        CASETITLE("Functional: Positive: eglRequestNotification with multiple endpoints."),
    1.97 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
    1.98 +        {
    1.99 +        { EInitializeCase,          0,              EGL_SUCCESS },
   1.100 +        { ECreateSurfaceCase,       0,              EGL_SUCCESS,  0, EStandardSurface },
   1.101 +        { ECreateSurfaceCase,       0,              EGL_SUCCESS,  1, EStandardSurface },
   1.102 +        { ECreateEndpointCase,      0,              EGL_SUCCESS,  0, 0 },
   1.103 +        { ECreateEndpointCase,      0,              EGL_SUCCESS,  1, 1},
   1.104 +        { EDrawContentCase,         0,              EGL_SUCCESS,  0, 0 },
   1.105 +        { EContentUpdateCase,       0,              EGL_SUCCESS,  0, 0 },
   1.106 +        { ERequestNotificationCase, 0,              EGL_SUCCESS,  0, 0 },
   1.107 +        { ERequestNotificationCase, 0,              EGL_SUCCESS,  1, 1 },
   1.108 +        { EWaitForNotificationCase, 0,              KErrNone,     0, 0, 100000 },
   1.109 +        { EWaitForNotificationCase, EExpectError,   KErrTimedOut, 1, 1, 100000 },
   1.110 +        { EDestroyEndpointCase,     0,              EGL_SUCCESS,  0, 0 },
   1.111 +        { EDestroyEndpointCase,     0,              EGL_SUCCESS,  1, 1 },
   1.112 +        { ETerminateCase,           0,              EGL_SUCCESS },
   1.113 +        { EFinishedCase }
   1.114 +        },
   1.115 +    },
   1.116 +    {
   1.117 +        TESTIDS("607B"),
   1.118 +        CASETITLE("Functional: Positive: Three endpoints, varying async notifications."),
   1.119 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.120 +        {
   1.121 +        { EInitializeCase,          0,              EGL_SUCCESS },
   1.122 +        { ECreateSurfaceCase,       0,              EGL_SUCCESS,  0, EStandardSurface },
   1.123 +        { ECreateSurfaceCase,       0,              EGL_SUCCESS,  1, EStandardSurface },
   1.124 +        { ECreateSurfaceCase,       0,              EGL_SUCCESS,  2, EStandardSurface },
   1.125 +        { ECreateEndpointCase,      0,              EGL_SUCCESS,  0, 0 },
   1.126 +        { ECreateEndpointCase,      0,              EGL_SUCCESS,  1, 1},
   1.127 +        { ECreateEndpointCase,      0,              EGL_SUCCESS,  2, 2},
   1.128 +        { ERequestNotificationCase, 0,              EGL_SUCCESS,  0, 0 },
   1.129 +        { ERequestNotificationCase, 0,              EGL_SUCCESS,  1, 1 },
   1.130 +        { ERequestNotificationCase, 0,              EGL_SUCCESS,  2, 2 },
   1.131 +        { EDrawContentCase,         0,              EGL_SUCCESS,  1, 1 },
   1.132 +        { EContentUpdateCase,       0,              EGL_SUCCESS,  1, 1 },
   1.133 +        { EWaitForNotificationCase, 0,              KErrNone,     1, 1, 100000 },
   1.134 +        { EWaitForNotificationCase, EExpectError,   KErrTimedOut, 0, 0, 100000 },
   1.135 +        { EWaitForNotificationCase, EExpectError,   KErrTimedOut, 2, 2, 100000 },
   1.136 +        { EDrawContentCase,         0,              EGL_SUCCESS,  2, 2 },
   1.137 +        { EContentUpdateCase,       0,              EGL_SUCCESS,  2, 2 },
   1.138 +        { EWaitForNotificationCase, 0,              KErrNone,     2, 2, 100000 },
   1.139 +        { EWaitForNotificationCase, EExpectError,   KErrTimedOut, 0, 0, 100000 },
   1.140 +        { EWaitForNotificationCase, EExpectError,   KErrTimedOut, 1, 1, 100000 },
   1.141 +        { ECancelNotificationCase,  0,              EGL_SUCCESS,  0, 0 },
   1.142 +        { EWaitForNotificationCase, EExpectError,   KErrCancel,   0, 0, 10000 },
   1.143 +        { EDestroyEndpointCase,     0,              EGL_SUCCESS,  0, 0 },
   1.144 +        { EDestroyEndpointCase,     0,              EGL_SUCCESS,  1, 1 },
   1.145 +        { EDestroyEndpointCase,     0,              EGL_SUCCESS,  2, 2 },
   1.146 +        { ETerminateCase,           0,              EGL_SUCCESS },
   1.147 +        { EFinishedCase }
   1.148 +        },
   1.149 +    },
   1.150 +    {
   1.151 +        TESTIDS("608"),
   1.152 +        CASETITLE("Functional: Positive: Multiple eglRequestNotification with no acquire."),
   1.153 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.154 +        {
   1.155 +        { EInitializeCase,          0,              EGL_SUCCESS },
   1.156 +        { ECreateSurfaceCase,       0,              EGL_SUCCESS, 0, EStandardSurface },
   1.157 +        { ECreateEndpointCase,      0,              EGL_SUCCESS },
   1.158 +        { EDrawContentCase,         0,              EGL_SUCCESS },
   1.159 +        { EContentUpdateCase,       0,              EGL_SUCCESS },
   1.160 +        { ERequestNotificationCase, 0,              EGL_SUCCESS },
   1.161 +        { EWaitForNotificationCase, 0,              KErrNone,    0, 0, 100000 },
   1.162 +        { ERequestNotificationCase, 0,              EGL_SUCCESS },
   1.163 +        { EWaitForNotificationCase, 0,              KErrNone,    0, 0, 100000 },
   1.164 +        { EDestroyEndpointCase,     0,              EGL_SUCCESS },
   1.165 +        { ETerminateCase,           0,              EGL_SUCCESS },
   1.166 +        { EFinishedCase }
   1.167 +        },
   1.168 +    },
   1.169 +    {
   1.170 +        TESTIDS("609"),
   1.171 +        CASETITLE("Functional: Positive: Notifications need submitupdate after acquire."),
   1.172 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.173 +        {
   1.174 +        { EInitializeCase,          0,              EGL_SUCCESS },
   1.175 +        { ECreateSurfaceCase,       0,              EGL_SUCCESS, 0, EStandardSurface },
   1.176 +        { ECreateEndpointCase,      0,              EGL_SUCCESS },
   1.177 +        { EDrawContentCase,         0,              EGL_SUCCESS },
   1.178 +        { EContentUpdateCase,       0,              EGL_SUCCESS },
   1.179 +        { ERequestNotificationCase, 0,              EGL_SUCCESS },
   1.180 +        { EWaitForNotificationCase, 0,              KErrNone,   0, 0, 100000 },
   1.181 +        { EBeginStreamingCase,      0,              EGL_SUCCESS },
   1.182 +        { EAcquireImageCase,        0,              EGL_SUCCESS },
   1.183 +        { ERequestNotificationCase, 0,              EGL_SUCCESS },
   1.184 +        { EWaitForNotificationCase, EExpectError,   KErrTimedOut,0, 0, 100000 },
   1.185 +        { EContentUpdateCase,       ENoSync,        EGL_SUCCESS },
   1.186 +        { EWaitForNotificationCase, 0,              KErrNone,    0, 0, 100000 },
   1.187 +        { EDestroyEndpointCase,     0,              EGL_SUCCESS },
   1.188 +        { ETerminateCase,           0,              EGL_SUCCESS },
   1.189 +        { EFinishedCase }
   1.190 +        },
   1.191 +    },
   1.192 +    {
   1.193 +        TESTIDS("610"),
   1.194 +        CASETITLE("Functional: Positive: Destroy Endpoint acts as eglCancelNotificationNOK."),
   1.195 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.196 +        {
   1.197 +        { EInitializeCase,          0,              EGL_SUCCESS },
   1.198 +        { ECreateSurfaceCase,       0,              EGL_SUCCESS, 0, EStandardSurface },
   1.199 +        { ECreateEndpointCase,      0,              EGL_SUCCESS },
   1.200 +        { ERequestNotificationCase, 0,              EGL_SUCCESS },
   1.201 +        { EDestroyEndpointCase,     0,              EGL_SUCCESS },
   1.202 +        { EWaitForNotificationCase, EExpectError,   KErrCancel, 0, 0, 100000 },
   1.203 +        { ETerminateCase,           0,              EGL_SUCCESS },
   1.204 +        { EFinishedCase }
   1.205 +        },
   1.206 +    },
   1.207 +    {
   1.208 +        TESTIDS("612"),
   1.209 +        CASETITLE("Functional: Positive: eglCancelNotificationNOK completes with KErrCancel."),
   1.210 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.211 +        {
   1.212 +        { EInitializeCase,          0,              EGL_SUCCESS },
   1.213 +        { ECreateSurfaceCase,       0,              EGL_SUCCESS, 0, EStandardSurface },
   1.214 +        { ECreateEndpointCase,      0,              EGL_SUCCESS },
   1.215 +        { ERequestNotificationCase, 0,              EGL_SUCCESS },
   1.216 +        { ECancelNotificationCase,  0,              EGL_SUCCESS },
   1.217 +        { EWaitForNotificationCase, EExpectError,   KErrCancel, 0, 0, 100000 },
   1.218 +        { EDestroyEndpointCase,     0,              EGL_SUCCESS },
   1.219 +        { ETerminateCase,           0,              EGL_SUCCESS },
   1.220 +        { EFinishedCase }
   1.221 +        },
   1.222 +    },
   1.223 +    {
   1.224 +        TESTIDS("613"),
   1.225 +        CASETITLE("Functional: Positive: eglCancelNotificationNOK works after notification completed."),
   1.226 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.227 +        {
   1.228 +        { EInitializeCase,          0,              EGL_SUCCESS },
   1.229 +        { ECreateSurfaceCase,       0,              EGL_SUCCESS, 0, EStandardSurface },
   1.230 +        { ECreateEndpointCase,      0,              EGL_SUCCESS },
   1.231 +        { ERequestNotificationCase, 0,              EGL_SUCCESS },
   1.232 +        { EContentUpdateCase,       0,              EGL_SUCCESS },
   1.233 +        { EWaitForNotificationCase, 0,              KErrNone,    0, 0, 100000 },
   1.234 +        { ECancelNotificationCase,  0,              EGL_SUCCESS },
   1.235 +        { EWaitForNotificationCase, EExpectError,   KErrTimedOut,0, 0, 100000 },
   1.236 +        { EDestroyEndpointCase,     0,              EGL_SUCCESS },
   1.237 +        { ETerminateCase,           0,              EGL_SUCCESS },
   1.238 +        { EFinishedCase }
   1.239 +        },
   1.240 +    },
   1.241 +};
   1.242 +
   1.243 +static const TTestCase KNotifcationNegativeCases[] =
   1.244 +{
   1.245 +    {
   1.246 +        TESTIDS("560"),
   1.247 +        CASETITLE("Functional: Negative: eglRequestNotification bad parameter test."),
   1.248 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.249 +        {
   1.250 +        { EInitializeCase,      0,              EGL_SUCCESS },
   1.251 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
   1.252 +        { ECreateEndpointCase,  0,              EGL_SUCCESS },
   1.253 +        // Bad display
   1.254 +        { ERequestNotificationCase, EUseBadDisplay, EGL_BAD_DISPLAY },
   1.255 +        { ERequestNotificationCase, EUseBadDisplay | EUseBadEndpoint, EGL_BAD_DISPLAY },
   1.256 +        { ERequestNotificationCase, EUseBadDisplay | EUseBadSync, EGL_BAD_DISPLAY },
   1.257 +        { ERequestNotificationCase, EUseBadDisplay | EUseBadEndpoint | EUseBadSync, EGL_BAD_DISPLAY },
   1.258 +        { ERequestNotificationCase, EUseBadEndpoint, EGL_BAD_ENDPOINT_NOK },
   1.259 +        { ERequestNotificationCase, EUseBadSync, EGL_BAD_PARAMETER },
   1.260 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS },
   1.261 +        { ETerminateCase,       0,              EGL_SUCCESS },
   1.262 +        { EFinishedCase }
   1.263 +        },
   1.264 +    },
   1.265 +    {
   1.266 +        TESTIDS("562"),
   1.267 +        CASETITLE("Functional: Negative: eglCancelNotification bad parameter test."),
   1.268 +        SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
   1.269 +        {
   1.270 +        { EInitializeCase,      0,              EGL_SUCCESS },
   1.271 +        { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
   1.272 +        { ECreateEndpointCase,  0,              EGL_SUCCESS },
   1.273 +        // Bad display
   1.274 +        { ECancelNotificationCase, EUseBadDisplay, EGL_BAD_DISPLAY },
   1.275 +        { ECancelNotificationCase, EUseBadDisplay | EUseBadEndpoint, EGL_BAD_DISPLAY },
   1.276 +        { ECancelNotificationCase, EUseBadEndpoint, EGL_BAD_ENDPOINT_NOK },
   1.277 +        { EDestroyEndpointCase, 0,              EGL_SUCCESS },
   1.278 +        { ETerminateCase,       0,              EGL_SUCCESS },
   1.279 +        { EFinishedCase }
   1.280 +        },
   1.281 +    },
   1.282 +};
   1.283 +
   1.284 +
   1.285 +
   1.286 +static const TTestCases KTestCases[] =
   1.287 +{
   1.288 +        TestCase(KNotifcationPositiveCases),
   1.289 +        TestCase(KNotifcationNegativeCases),
   1.290 +};
   1.291 +
   1.292 +const TInt KNumberTestCases = sizeof(KTestCases) / sizeof(KTestCases[0]);
   1.293 +
   1.294 +CEglTest_LocalTestStep_EndpointNotification::CEglTest_LocalTestStep_EndpointNotification():
   1.295 +    CEgltest_Local_Engine(KTestCases, KNumberTestCases)
   1.296 +    {
   1.297 +    }