egl/egltest/endpointtestsuite/automated/tsrc/egltest_endpointnotification.cpp
changeset 98 bf7481649c98
equal deleted inserted replaced
85:cdf2f6e5c390 98:bf7481649c98
       
     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_endpointnotification.h"
       
    21 
       
    22 static const TTestCase KNotifcationPositiveCases[] =
       
    23 {
       
    24     {
       
    25         TESTIDS("559,561"),
       
    26         CASETITLE("Functional: Positive: eglRequestNotification basic test."),
       
    27         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
       
    28         {
       
    29         { EInitializeCase,      0,              EGL_SUCCESS },
       
    30         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
       
    31         { ECreateEndpointCase,  0,              EGL_SUCCESS },
       
    32         { ERequestNotificationCase, 0,          EGL_SUCCESS },
       
    33         { ECancelNotificationCase, 0,           EGL_SUCCESS },
       
    34         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
       
    35         { ETerminateCase,       0,              EGL_SUCCESS },
       
    36         { EFinishedCase }
       
    37         },
       
    38     },
       
    39     {
       
    40         TESTIDS("604"),
       
    41         CASETITLE("Functional: Positive: eglRequestNotification with submitupdate."),
       
    42         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
       
    43         {
       
    44         { EInitializeCase,          0,              EGL_SUCCESS },
       
    45         { ECreateSurfaceCase,       0,              EGL_SUCCESS, 0, EStandardSurface },
       
    46         { ECreateEndpointCase,      0,              EGL_SUCCESS },
       
    47         { ERequestNotificationCase, 0,              EGL_SUCCESS },
       
    48         { EDrawContentCase,         0,              EGL_SUCCESS },
       
    49         { EContentUpdateCase,       0,              EGL_SUCCESS },
       
    50         { EWaitForNotificationCase, 0,              KErrNone,    0, 0, 100000 },
       
    51         { ECancelNotificationCase,  0,              EGL_SUCCESS },
       
    52         { EDestroyEndpointCase,     0,              EGL_SUCCESS },
       
    53         { ETerminateCase,           0,              EGL_SUCCESS },
       
    54         { EFinishedCase }
       
    55         },
       
    56     },
       
    57     {
       
    58         TESTIDS("605"),
       
    59         CASETITLE("Functional: Positive: eglRequestNotification with no submitupdate."),
       
    60         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
       
    61         {
       
    62         { EInitializeCase,          0,              EGL_SUCCESS },
       
    63         { ECreateSurfaceCase,       0,              EGL_SUCCESS,  0, EStandardSurface },
       
    64         { ECreateEndpointCase,      0,              EGL_SUCCESS },
       
    65         { ERequestNotificationCase, 0,              EGL_SUCCESS },
       
    66         { EWaitForNotificationCase, EExpectError,   KErrTimedOut, 0, 0, 100000 },
       
    67         { ECancelNotificationCase,  0,              EGL_SUCCESS },
       
    68         { EDestroyEndpointCase,     0,              EGL_SUCCESS },
       
    69         { ETerminateCase,           0,              EGL_SUCCESS },
       
    70         { EFinishedCase }
       
    71         },
       
    72     },
       
    73     {
       
    74         TESTIDS("606"),
       
    75         CASETITLE("Functional: Positive: eglRequestNotification with submitupdate first."),
       
    76         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
       
    77         {
       
    78         { EInitializeCase,          0,              EGL_SUCCESS },
       
    79         { ECreateSurfaceCase,       0,              EGL_SUCCESS, 0, EStandardSurface },
       
    80         { ECreateEndpointCase,      0,              EGL_SUCCESS },
       
    81         { EDrawContentCase,         0,              EGL_SUCCESS },
       
    82         { EContentUpdateCase,       0,              EGL_SUCCESS },
       
    83         { ERequestNotificationCase, 0,              EGL_SUCCESS },
       
    84         { EWaitForNotificationCase, 0,              KErrNone,    0, 0, 100000 },
       
    85         { ECancelNotificationCase,  0,              EGL_SUCCESS },
       
    86         { EDestroyEndpointCase,     0,              EGL_SUCCESS },
       
    87         { ETerminateCase,           0,              EGL_SUCCESS },
       
    88         { EFinishedCase }
       
    89         },
       
    90     },
       
    91     {
       
    92         TESTIDS("607A"),
       
    93         CASETITLE("Functional: Positive: eglRequestNotification with multiple endpoints."),
       
    94         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
       
    95         {
       
    96         { EInitializeCase,          0,              EGL_SUCCESS },
       
    97         { ECreateSurfaceCase,       0,              EGL_SUCCESS,  0, EStandardSurface },
       
    98         { ECreateSurfaceCase,       0,              EGL_SUCCESS,  1, EStandardSurface },
       
    99         { ECreateEndpointCase,      0,              EGL_SUCCESS,  0, 0 },
       
   100         { ECreateEndpointCase,      0,              EGL_SUCCESS,  1, 1},
       
   101         { EDrawContentCase,         0,              EGL_SUCCESS,  0, 0 },
       
   102         { EContentUpdateCase,       0,              EGL_SUCCESS,  0, 0 },
       
   103         { ERequestNotificationCase, 0,              EGL_SUCCESS,  0, 0 },
       
   104         { ERequestNotificationCase, 0,              EGL_SUCCESS,  1, 1 },
       
   105         { EWaitForNotificationCase, 0,              KErrNone,     0, 0, 100000 },
       
   106         { EWaitForNotificationCase, EExpectError,   KErrTimedOut, 1, 1, 100000 },
       
   107         { EDestroyEndpointCase,     0,              EGL_SUCCESS,  0, 0 },
       
   108         { EDestroyEndpointCase,     0,              EGL_SUCCESS,  1, 1 },
       
   109         { ETerminateCase,           0,              EGL_SUCCESS },
       
   110         { EFinishedCase }
       
   111         },
       
   112     },
       
   113     {
       
   114         TESTIDS("607B"),
       
   115         CASETITLE("Functional: Positive: Three endpoints, varying async notifications."),
       
   116         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
       
   117         {
       
   118         { EInitializeCase,          0,              EGL_SUCCESS },
       
   119         { ECreateSurfaceCase,       0,              EGL_SUCCESS,  0, EStandardSurface },
       
   120         { ECreateSurfaceCase,       0,              EGL_SUCCESS,  1, EStandardSurface },
       
   121         { ECreateSurfaceCase,       0,              EGL_SUCCESS,  2, EStandardSurface },
       
   122         { ECreateEndpointCase,      0,              EGL_SUCCESS,  0, 0 },
       
   123         { ECreateEndpointCase,      0,              EGL_SUCCESS,  1, 1},
       
   124         { ECreateEndpointCase,      0,              EGL_SUCCESS,  2, 2},
       
   125         { ERequestNotificationCase, 0,              EGL_SUCCESS,  0, 0 },
       
   126         { ERequestNotificationCase, 0,              EGL_SUCCESS,  1, 1 },
       
   127         { ERequestNotificationCase, 0,              EGL_SUCCESS,  2, 2 },
       
   128         { EDrawContentCase,         0,              EGL_SUCCESS,  1, 1 },
       
   129         { EContentUpdateCase,       0,              EGL_SUCCESS,  1, 1 },
       
   130         { EWaitForNotificationCase, 0,              KErrNone,     1, 1, 100000 },
       
   131         { EWaitForNotificationCase, EExpectError,   KErrTimedOut, 0, 0, 100000 },
       
   132         { EWaitForNotificationCase, EExpectError,   KErrTimedOut, 2, 2, 100000 },
       
   133         { EDrawContentCase,         0,              EGL_SUCCESS,  2, 2 },
       
   134         { EContentUpdateCase,       0,              EGL_SUCCESS,  2, 2 },
       
   135         { EWaitForNotificationCase, 0,              KErrNone,     2, 2, 100000 },
       
   136         { EWaitForNotificationCase, EExpectError,   KErrTimedOut, 0, 0, 100000 },
       
   137         { EWaitForNotificationCase, EExpectError,   KErrTimedOut, 1, 1, 100000 },
       
   138         { ECancelNotificationCase,  0,              EGL_SUCCESS,  0, 0 },
       
   139         { EWaitForNotificationCase, EExpectError,   KErrCancel,   0, 0, 10000 },
       
   140         { EDestroyEndpointCase,     0,              EGL_SUCCESS,  0, 0 },
       
   141         { EDestroyEndpointCase,     0,              EGL_SUCCESS,  1, 1 },
       
   142         { EDestroyEndpointCase,     0,              EGL_SUCCESS,  2, 2 },
       
   143         { ETerminateCase,           0,              EGL_SUCCESS },
       
   144         { EFinishedCase }
       
   145         },
       
   146     },
       
   147     {
       
   148         TESTIDS("608"),
       
   149         CASETITLE("Functional: Positive: Multiple eglRequestNotification with no acquire."),
       
   150         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
       
   151         {
       
   152         { EInitializeCase,          0,              EGL_SUCCESS },
       
   153         { ECreateSurfaceCase,       0,              EGL_SUCCESS, 0, EStandardSurface },
       
   154         { ECreateEndpointCase,      0,              EGL_SUCCESS },
       
   155         { EDrawContentCase,         0,              EGL_SUCCESS },
       
   156         { EContentUpdateCase,       0,              EGL_SUCCESS },
       
   157         { ERequestNotificationCase, 0,              EGL_SUCCESS },
       
   158         { EWaitForNotificationCase, 0,              KErrNone,    0, 0, 100000 },
       
   159         { ERequestNotificationCase, 0,              EGL_SUCCESS },
       
   160         { EWaitForNotificationCase, 0,              KErrNone,    0, 0, 100000 },
       
   161         { EDestroyEndpointCase,     0,              EGL_SUCCESS },
       
   162         { ETerminateCase,           0,              EGL_SUCCESS },
       
   163         { EFinishedCase }
       
   164         },
       
   165     },
       
   166     {
       
   167         TESTIDS("609"),
       
   168         CASETITLE("Functional: Positive: Notifications need submitupdate after acquire."),
       
   169         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
       
   170         {
       
   171         { EInitializeCase,          0,              EGL_SUCCESS },
       
   172         { ECreateSurfaceCase,       0,              EGL_SUCCESS, 0, EStandardSurface },
       
   173         { ECreateEndpointCase,      0,              EGL_SUCCESS },
       
   174         { EDrawContentCase,         0,              EGL_SUCCESS },
       
   175         { EContentUpdateCase,       0,              EGL_SUCCESS },
       
   176         { ERequestNotificationCase, 0,              EGL_SUCCESS },
       
   177         { EWaitForNotificationCase, 0,              KErrNone,   0, 0, 100000 },
       
   178         { EBeginStreamingCase,      0,              EGL_SUCCESS },
       
   179         { EAcquireImageCase,        0,              EGL_SUCCESS },
       
   180         { ERequestNotificationCase, 0,              EGL_SUCCESS },
       
   181         { EWaitForNotificationCase, EExpectError,   KErrTimedOut,0, 0, 100000 },
       
   182         { EContentUpdateCase,       ENoSync,        EGL_SUCCESS },
       
   183         { EWaitForNotificationCase, 0,              KErrNone,    0, 0, 100000 },
       
   184         { EDestroyEndpointCase,     0,              EGL_SUCCESS },
       
   185         { ETerminateCase,           0,              EGL_SUCCESS },
       
   186         { EFinishedCase }
       
   187         },
       
   188     },
       
   189     {
       
   190         TESTIDS("610"),
       
   191         CASETITLE("Functional: Positive: Destroy Endpoint acts as eglCancelNotificationNOK."),
       
   192         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
       
   193         {
       
   194         { EInitializeCase,          0,              EGL_SUCCESS },
       
   195         { ECreateSurfaceCase,       0,              EGL_SUCCESS, 0, EStandardSurface },
       
   196         { ECreateEndpointCase,      0,              EGL_SUCCESS },
       
   197         { ERequestNotificationCase, 0,              EGL_SUCCESS },
       
   198         { EDestroyEndpointCase,     0,              EGL_SUCCESS },
       
   199         { EWaitForNotificationCase, EExpectError,   KErrCancel, 0, 0, 100000 },
       
   200         { ETerminateCase,           0,              EGL_SUCCESS },
       
   201         { EFinishedCase }
       
   202         },
       
   203     },
       
   204     {
       
   205         TESTIDS("612"),
       
   206         CASETITLE("Functional: Positive: eglCancelNotificationNOK completes with KErrCancel."),
       
   207         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
       
   208         {
       
   209         { EInitializeCase,          0,              EGL_SUCCESS },
       
   210         { ECreateSurfaceCase,       0,              EGL_SUCCESS, 0, EStandardSurface },
       
   211         { ECreateEndpointCase,      0,              EGL_SUCCESS },
       
   212         { ERequestNotificationCase, 0,              EGL_SUCCESS },
       
   213         { ECancelNotificationCase,  0,              EGL_SUCCESS },
       
   214         { EWaitForNotificationCase, EExpectError,   KErrCancel, 0, 0, 100000 },
       
   215         { EDestroyEndpointCase,     0,              EGL_SUCCESS },
       
   216         { ETerminateCase,           0,              EGL_SUCCESS },
       
   217         { EFinishedCase }
       
   218         },
       
   219     },
       
   220     {
       
   221         TESTIDS("613"),
       
   222         CASETITLE("Functional: Positive: eglCancelNotificationNOK works after notification completed."),
       
   223         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
       
   224         {
       
   225         { EInitializeCase,          0,              EGL_SUCCESS },
       
   226         { ECreateSurfaceCase,       0,              EGL_SUCCESS, 0, EStandardSurface },
       
   227         { ECreateEndpointCase,      0,              EGL_SUCCESS },
       
   228         { ERequestNotificationCase, 0,              EGL_SUCCESS },
       
   229         { EContentUpdateCase,       0,              EGL_SUCCESS },
       
   230         { EWaitForNotificationCase, 0,              KErrNone,    0, 0, 100000 },
       
   231         { ECancelNotificationCase,  0,              EGL_SUCCESS },
       
   232         { EWaitForNotificationCase, EExpectError,   KErrTimedOut,0, 0, 100000 },
       
   233         { EDestroyEndpointCase,     0,              EGL_SUCCESS },
       
   234         { ETerminateCase,           0,              EGL_SUCCESS },
       
   235         { EFinishedCase }
       
   236         },
       
   237     },
       
   238 };
       
   239 
       
   240 static const TTestCase KNotifcationNegativeCases[] =
       
   241 {
       
   242     {
       
   243         TESTIDS("560"),
       
   244         CASETITLE("Functional: Negative: eglRequestNotification bad parameter test."),
       
   245         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
       
   246         {
       
   247         { EInitializeCase,      0,              EGL_SUCCESS },
       
   248         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
       
   249         { ECreateEndpointCase,  0,              EGL_SUCCESS },
       
   250         // Bad display
       
   251         { ERequestNotificationCase, EUseBadDisplay, EGL_BAD_DISPLAY },
       
   252         { ERequestNotificationCase, EUseBadDisplay | EUseBadEndpoint, EGL_BAD_DISPLAY },
       
   253         { ERequestNotificationCase, EUseBadDisplay | EUseBadSync, EGL_BAD_DISPLAY },
       
   254         { ERequestNotificationCase, EUseBadDisplay | EUseBadEndpoint | EUseBadSync, EGL_BAD_DISPLAY },
       
   255         { ERequestNotificationCase, EUseBadEndpoint, EGL_BAD_ENDPOINT_NOK },
       
   256         { ERequestNotificationCase, EUseBadSync, EGL_BAD_PARAMETER },
       
   257         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
       
   258         { ETerminateCase,       0,              EGL_SUCCESS },
       
   259         { EFinishedCase }
       
   260         },
       
   261     },
       
   262     {
       
   263         TESTIDS("562"),
       
   264         CASETITLE("Functional: Negative: eglCancelNotification bad parameter test."),
       
   265         SurfaceTypes3(ESurfTypeRaw, ESurfTypeEglWindow, ESurfTypeRawSingleBuffered),
       
   266         {
       
   267         { EInitializeCase,      0,              EGL_SUCCESS },
       
   268         { ECreateSurfaceCase,   0,              EGL_SUCCESS, 0, EStandardSurface },
       
   269         { ECreateEndpointCase,  0,              EGL_SUCCESS },
       
   270         // Bad display
       
   271         { ECancelNotificationCase, EUseBadDisplay, EGL_BAD_DISPLAY },
       
   272         { ECancelNotificationCase, EUseBadDisplay | EUseBadEndpoint, EGL_BAD_DISPLAY },
       
   273         { ECancelNotificationCase, EUseBadEndpoint, EGL_BAD_ENDPOINT_NOK },
       
   274         { EDestroyEndpointCase, 0,              EGL_SUCCESS },
       
   275         { ETerminateCase,       0,              EGL_SUCCESS },
       
   276         { EFinishedCase }
       
   277         },
       
   278     },
       
   279 };
       
   280 
       
   281 
       
   282 
       
   283 static const TTestCases KTestCases[] =
       
   284 {
       
   285         TestCase(KNotifcationPositiveCases),
       
   286         TestCase(KNotifcationNegativeCases),
       
   287 };
       
   288 
       
   289 const TInt KNumberTestCases = sizeof(KTestCases) / sizeof(KTestCases[0]);
       
   290 
       
   291 CEglTest_LocalTestStep_EndpointNotification::CEglTest_LocalTestStep_EndpointNotification():
       
   292     CEgltest_Local_Engine(KTestCases, KNumberTestCases)
       
   293     {
       
   294     }