egl/egltest/src/egltest_geterroranddisplay.cpp
changeset 0 5d03bc08d59c
child 26 15986eb6c500
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2007-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 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test
       
    19 */
       
    20 #include "egltest_geterroranddisplay.h"
       
    21 
       
    22 /**
       
    23 @SYMTestCaseID GRAPHICS-EGL-0507
       
    24 
       
    25 @SYMPREQ 2400
       
    26 
       
    27 @SYMTestPriority 1
       
    28 
       
    29 @SYMTestCaseDesc
       
    30 Test eglGetError behavior
       
    31 
       
    32 @SYMTestExpectedResults
       
    33 Error code is set according to EGL specification
       
    34 
       
    35 @SYMTestActions
       
    36 Call eglGetError
       
    37 Check error is EGL_SUCCESS
       
    38 
       
    39 Get default display
       
    40 Check error code is EGL_SUCCESS
       
    41 
       
    42 Query string for version
       
    43 Check return value is null and error code is EGL_NOT_INITIALIZED
       
    44 
       
    45 Call eglGetError
       
    46 Check error is EGL_SUCCESS
       
    47 
       
    48 Query string for vendor
       
    49 Check return value is null and error code is EGL_NOT_INITIALIZED
       
    50 
       
    51 Release thread
       
    52 Call eglGetError
       
    53 Check error is EGL_SUCCESS
       
    54 
       
    55 Release thread
       
    56 Check return value is true
       
    57 */
       
    58 TVerdict CEglTest_GetError::doTestStepL()
       
    59     {
       
    60     SetTestStepID(_L("GRAPHICS-EGL-0507"));
       
    61     INFO_PRINTF1(_L("CEglTest_GetError::doTestStepL"));
       
    62 
       
    63     TEST(eglGetError() == EGL_SUCCESS);
       
    64     
       
    65     // Create display object
       
    66     GetDisplayL();
       
    67     TEST(eglGetError() == EGL_SUCCESS);
       
    68     
       
    69     // Query string for version
       
    70     const char* strEglVersion = eglQueryString(iDisplay, EGL_VERSION);
       
    71     TEST_EGL_ERROR(strEglVersion == NULL, EGL_NOT_INITIALIZED);
       
    72 
       
    73     // Query string for vendor
       
    74     const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
    75     TEST_EGL_ERROR(strEglVendor == NULL, EGL_NOT_INITIALIZED);
       
    76 
       
    77     TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
       
    78     
       
    79     RecordTestResultL();
       
    80     CloseTMSGraphicsStep();
       
    81     return TestStepResult();
       
    82     }
       
    83 
       
    84 /**
       
    85 @SYMTestCaseID GRAPHICS-EGL-0508
       
    86 
       
    87 @SYMPREQ 2400
       
    88 
       
    89 @SYMTestPriority 1
       
    90 
       
    91 @SYMTestCaseDesc
       
    92 Test eglGetError behavior and to prove that error is specific to each thread
       
    93 
       
    94 @SYMTestExpectedResults
       
    95 Error code is set according to EGL specification
       
    96 
       
    97 @SYMTestActions
       
    98 Main Thread
       
    99 Call eglGetError
       
   100 Check error is EGL_SUCCESS
       
   101 
       
   102 Get default display
       
   103 Check error code is EGL_SUCCESS
       
   104 
       
   105 Query string for version
       
   106 Check return value is null but do not check error code
       
   107 
       
   108 Launch thread A
       
   109 Wait for thread A to exit
       
   110     Thread A
       
   111     Call eglGetError
       
   112     Check error is EGL_SUCCESS
       
   113 
       
   114     Get default display
       
   115     Check error code is EGL_SUCCESS
       
   116 
       
   117     Release thread
       
   118     Check return value is true
       
   119     Exit
       
   120 
       
   121 Main Thread
       
   122 Check error code is EGL_NOT_INITIALIZED
       
   123 
       
   124 Query string for version
       
   125 Check return value is null and error code is EGL_NOT_INITIALIZED
       
   126 
       
   127 Release thread
       
   128 Check return value is true
       
   129 Exit
       
   130 */
       
   131 TVerdict CEglTest_GetErrorMultiThread::doTestStepL()
       
   132     {
       
   133     SetTestStepID(_L("GRAPHICS-EGL-0508"));
       
   134     INFO_PRINTF1(_L("CEglTest_GetErrorMultiThread::doTestStepL"));
       
   135 
       
   136     TEST(eglGetError() == EGL_SUCCESS);
       
   137 
       
   138     GetDisplayL();
       
   139     TEST(eglGetError() == EGL_SUCCESS);
       
   140     
       
   141     INFO_PRINTF1(_L("Query string for version..."));
       
   142     const char* strEglVersion = eglQueryString(iDisplay, EGL_VERSION);
       
   143     TEST(strEglVersion == NULL);
       
   144     
       
   145     INFO_PRINTF1(_L("Launch thread A"));
       
   146     Test_MultiThreadL(1, ETrue);
       
   147     
       
   148     // Check that eglGetError is specific to each thread
       
   149     TEST(eglGetError() == EGL_NOT_INITIALIZED);
       
   150     
       
   151     INFO_PRINTF1(_L("Query string for vendor..."));
       
   152     const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
   153     TEST_EGL_ERROR(strEglVendor == NULL, EGL_NOT_INITIALIZED);
       
   154 
       
   155     TEST(eglReleaseThread() == EGL_TRUE);
       
   156     
       
   157     RecordTestResultL();
       
   158     CloseTMSGraphicsStep();
       
   159     return TestStepResult();
       
   160     }
       
   161 
       
   162 void CEglTest_GetErrorMultiThread::doThreadFunctionL(TInt aIdx)
       
   163     {
       
   164     INFO_PRINTF2(_L("CEglTest_GetErrorMultiThread::doThreadFunctionL, Thread %d"),aIdx);
       
   165     
       
   166     TEST(eglGetError() == EGL_SUCCESS);
       
   167     
       
   168     INFO_PRINTF2(_L("Create display object from thread: %d"), aIdx);
       
   169     EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);    
       
   170     TEST_EGL_ERROR(dpy == iDisplay, EGL_SUCCESS);
       
   171     
       
   172     TEST(eglReleaseThread() == EGL_TRUE);
       
   173     }
       
   174 
       
   175 /**
       
   176 @SYMTestCaseID GRAPHICS-EGL-0509
       
   177 
       
   178 @SYMPREQ 2400
       
   179 
       
   180 @SYMTestPriority 1
       
   181 
       
   182 @SYMTestPurpose
       
   183 Test eglGetDisplay, eglInitialize, eglTerminate and eglQueryString behaviors from a single thread
       
   184 
       
   185 @SYMTestExpectedResults
       
   186 Return value and error code shall conform to EGL specification
       
   187 
       
   188 @SYMTestCaseDesc
       
   189 Basic positive test
       
   190 
       
   191 @SYMTestActions
       
   192 Get default display
       
   193 Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
       
   194 
       
   195 Initialise display
       
   196 Check return value is true, error code is EGL_SUCCESS and version is updated
       
   197 
       
   198 Query string for vendor
       
   199 Check return value is not null and error code is EGL_SUCCESS
       
   200 
       
   201 Terminate display
       
   202 Check return value is true and error code is EGL_SUCCESS
       
   203 
       
   204 Release thread
       
   205 Check return value is true
       
   206 */
       
   207 TVerdict CEglTest_Display_Positive_Basic::doTestStepL()
       
   208     {
       
   209     SetTestStepID(_L("GRAPHICS-EGL-0509"));
       
   210     INFO_PRINTF1(_L("CEglTest_Display_Positive_Basic::doTestStepL"));
       
   211 
       
   212     // Create display object
       
   213     GetDisplayL();
       
   214     TEST(eglGetError() == EGL_SUCCESS);
       
   215     
       
   216     // Initialise display object
       
   217     EGLint major = -1, minor = -1;
       
   218     INFO_PRINTF1(_L("Calling eglInitialize..."));
       
   219     TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
       
   220     TEST(major != -1 && minor != -1);   // Version is updated
       
   221     
       
   222     // Query string for vendor
       
   223     INFO_PRINTF1(_L("Query string for vendor..."));
       
   224     const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
   225     TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
       
   226 
       
   227     // Terminate display
       
   228     TerminateDisplayL();
       
   229     TEST(eglGetError() == EGL_SUCCESS);
       
   230     
       
   231     // Release thread
       
   232     TEST(eglReleaseThread() == EGL_TRUE);
       
   233     
       
   234     RecordTestResultL();
       
   235     CloseTMSGraphicsStep();
       
   236     return TestStepResult();
       
   237     }
       
   238 
       
   239 /**
       
   240 @SYMTestCaseID GRAPHICS-EGL-0510
       
   241 @SYMPREQ 2400
       
   242 @SYMTestPriority 1
       
   243 @SYMTestPurpose
       
   244 Test eglGetDisplay, eglInitialize and eglTerminate behaviors from a single thread
       
   245 
       
   246 @SYMTestExpectedResults
       
   247 Return value and error code shall conform to EGL specification
       
   248 
       
   249 @SYMTestCaseDesc
       
   250 Invalid display test
       
   251 
       
   252 @SYMTestActions
       
   253 Get display other than default
       
   254 Check return value is EGL_NO_DISPLAY and error code is EGL_SUCCESS
       
   255 
       
   256 Initialise display
       
   257 Check return value is false, error code is EGL_BAD_DISPLAY and version is not updated
       
   258 
       
   259 Terminate display
       
   260 Check return value is false and error code is EGL_BAD_DISPLAY
       
   261 
       
   262 Release thread
       
   263 Check return value is true
       
   264 */
       
   265 TVerdict CEglTest_Display_Negative_InvalidDisplay::doTestStepL()
       
   266     {
       
   267     SetTestStepID(_L("GRAPHICS-EGL-0510"));
       
   268     INFO_PRINTF1(_L("CEglTest_Display_Negative_InvalidDisplay::doTestStepL"));
       
   269 
       
   270     // Get display other than default
       
   271     const NativeDisplayType nonDefaultDisplay = -1;
       
   272     iDisplay = eglGetDisplay(nonDefaultDisplay);
       
   273     TEST_EGL_ERROR(iDisplay == EGL_NO_DISPLAY, EGL_SUCCESS);
       
   274     
       
   275     // Initialise display object
       
   276     EGLint major = -1, minor = -1;
       
   277     INFO_PRINTF1(_L("Calling eglInitialize..."));
       
   278     TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor) == EGL_FALSE, EGL_BAD_DISPLAY);
       
   279     TEST(major == -1 && minor == -1);   // Version is Not updated
       
   280 
       
   281     // Terminate display
       
   282     TEST_EGL_ERROR(eglTerminate(iDisplay) == EGL_FALSE, EGL_BAD_DISPLAY);
       
   283     
       
   284     // Release thread
       
   285     TEST(eglReleaseThread() == EGL_TRUE);
       
   286     
       
   287     RecordTestResultL();
       
   288     CloseTMSGraphicsStep();
       
   289     return TestStepResult();
       
   290     }
       
   291 
       
   292 /**
       
   293 @SYMTestCaseID GRAPHICS-EGL-0511
       
   294 @SYMPREQ 2400
       
   295 @SYMTestPriority 1
       
   296 @SYMTestPurpose
       
   297 Test eglGetDisplay, eglInitialize, eglTerminate and eglQueryString behaviors from a single thread
       
   298 
       
   299 @SYMTestExpectedResults
       
   300 Return value and error code shall conform to EGL specification
       
   301 
       
   302 @SYMTestCaseDesc
       
   303 Un-initialised display usage test
       
   304 
       
   305 @SYMTestActions
       
   306 Get default display
       
   307 Check return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
       
   308 
       
   309 Query string for vendor
       
   310 Check return value is null and error code is EGL_NOT_INITIALIZED
       
   311 
       
   312 Terminate display
       
   313 Check return value is true and error code is EGL_SUCCESS
       
   314 
       
   315 Release thread
       
   316 Check return value is true
       
   317 */
       
   318 TVerdict CEglTest_Display_Negative_NotInitializedDisplay::doTestStepL()
       
   319     {
       
   320     SetTestStepID(_L("GRAPHICS-EGL-0511"));
       
   321     INFO_PRINTF1(_L("CEglTest_Display_Negative_NotInitializedDisplay::doTestStepL"));
       
   322 
       
   323     // Create display object
       
   324     GetDisplayL();
       
   325     TEST(eglGetError() == EGL_SUCCESS);
       
   326     
       
   327     // Query string for vendor
       
   328     INFO_PRINTF1(_L("Query string for vendor"));
       
   329     const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
   330     TEST_EGL_ERROR(strEglVendor == NULL, EGL_NOT_INITIALIZED);
       
   331 
       
   332     // Terminate display
       
   333     TerminateDisplayL();
       
   334     TEST(eglGetError() == EGL_SUCCESS);
       
   335     
       
   336     // Release thread
       
   337     TEST(eglReleaseThread() == EGL_TRUE);
       
   338     
       
   339     RecordTestResultL();
       
   340     CloseTMSGraphicsStep();
       
   341     return TestStepResult();
       
   342     }
       
   343 
       
   344 /**
       
   345 @SYMTestCaseID GRAPHICS-EGL-0512
       
   346 @SYMPREQ 2400
       
   347 @SYMTestPriority 1
       
   348 @SYMTestPurpose
       
   349 Test eglGetDisplay, eglInitialize, eglTerminate and eglQueryString behaviors from a single thread
       
   350 
       
   351 @SYMTestExpectedResults
       
   352 Return value and error code shall conform to EGL specification
       
   353 
       
   354 @SYMTestCaseDesc
       
   355 Reinitialise display test
       
   356 
       
   357 @SYMTestActions
       
   358 Get default display
       
   359 Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
       
   360 
       
   361 Initialise display
       
   362 Check return value is true, error code is EGL_SUCCESS and version is updated
       
   363 
       
   364 Terminate display
       
   365 Check return value is true and error code is EGL_SUCCESS
       
   366 
       
   367 Query string for version
       
   368 Check return value is null and error code is EGL_NOT_INITIALIZED
       
   369 
       
   370 Initialise display
       
   371 Check return value is true, error code is EGL_SUCCESS and version is updated
       
   372 
       
   373 Query string for version
       
   374 Check return value is not null and error code is EGL_SUCCESS
       
   375 
       
   376 Terminate display
       
   377 Check return value is true and error code is EGL_SUCCESS
       
   378 
       
   379 Release thread
       
   380 Check return value is true
       
   381 */
       
   382 TVerdict CEglTest_Display_Positive_ReinitializeDisplay::doTestStepL()
       
   383     {
       
   384     SetTestStepID(_L("GRAPHICS-EGL-0512"));
       
   385     INFO_PRINTF1(_L("CEglTest_Display_Positive_ReinitializeDisplay::doTestStepL"));
       
   386 
       
   387     // Create display object
       
   388     GetDisplayL();
       
   389     TEST(eglGetError() == EGL_SUCCESS);
       
   390     
       
   391     // Initialise display object
       
   392     EGLint major = -1, minor = -1;
       
   393     INFO_PRINTF1(_L("Calling eglInitialize..."));
       
   394     TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
       
   395     TEST(major != -1 && minor != -1);   // Version is updated
       
   396     
       
   397     // Terminate display
       
   398     INFO_PRINTF1(_L("Calling eglTerminate..."));
       
   399     TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
       
   400     
       
   401     // Query string for version
       
   402     INFO_PRINTF1(_L("Query string for version..."));
       
   403     const char* strEglVersion = eglQueryString(iDisplay, EGL_VERSION);
       
   404     TEST_EGL_ERROR(strEglVersion == NULL, EGL_NOT_INITIALIZED);
       
   405     
       
   406     // Re-Initialise display object
       
   407     major = -1;
       
   408     minor = -1;
       
   409     INFO_PRINTF1(_L("Calling eglInitialize..."));
       
   410     TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
       
   411     TEST(major != -1 && minor != -1);   // Version is updated
       
   412     
       
   413     // Query string for version
       
   414     INFO_PRINTF1(_L("Query string for version..."));
       
   415     strEglVersion = eglQueryString(iDisplay, EGL_VERSION);
       
   416     TEST_EGL_ERROR(strEglVersion != NULL, EGL_SUCCESS);
       
   417 
       
   418     // Terminate display
       
   419     TerminateDisplayL();
       
   420     TEST(eglGetError() == EGL_SUCCESS);
       
   421     
       
   422     // Release thread
       
   423     TEST(eglReleaseThread() == EGL_TRUE);
       
   424     
       
   425     RecordTestResultL();
       
   426     CloseTMSGraphicsStep();
       
   427     return TestStepResult();
       
   428     }
       
   429 
       
   430 /**
       
   431 @SYMTestCaseID GRAPHICS-EGL-0513
       
   432 @SYMPREQ 2400
       
   433 @SYMTestPriority 1
       
   434 @SYMTestPurpose
       
   435 Test eglGetDisplay, eglInitialize and eglTerminate behavior from a single thread
       
   436 
       
   437 @SYMTestExpectedResults
       
   438 Return value and error code shall conform to EGL specification
       
   439 
       
   440 @SYMTestCaseDesc
       
   441 Multiple initialisation test
       
   442 
       
   443 @SYMTestActions
       
   444 Get default display
       
   445 Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
       
   446 
       
   447 Initialise display
       
   448 Check return value is true, error code is EGL_SUCCESS and version is updated
       
   449 
       
   450 Initialise display
       
   451 Check return value is true, error code is EGL_SUCCESS and version is updated
       
   452 
       
   453 Terminate display
       
   454 Check return value is true and error code is EGL_SUCCESS
       
   455 
       
   456 Query string for version
       
   457 Check return value is null and error code is EGL_NOT_INITIALIZED
       
   458 
       
   459 Release thread
       
   460 Check return value is true
       
   461 */
       
   462 TVerdict CEglTest_Display_Positive_MultipleInitialization::doTestStepL()
       
   463     {
       
   464     SetTestStepID(_L("GRAPHICS-EGL-0513"));
       
   465     INFO_PRINTF1(_L("CEglTest_Display_Positive_MultipleInitialization::doTestStepL"));
       
   466 
       
   467     // Create display object
       
   468     GetDisplayL();
       
   469     TEST(eglGetError() == EGL_SUCCESS);
       
   470     
       
   471     // Initialise display object
       
   472     EGLint major = -1, minor = -1;
       
   473     INFO_PRINTF1(_L("Calling eglInitialize..."));
       
   474     TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
       
   475     TEST(major != -1 && minor != -1);   // Version is updated
       
   476     
       
   477     // Initialise display object
       
   478     major = -1; 
       
   479     minor = -1;
       
   480     INFO_PRINTF1(_L("Calling eglInitialize..."));
       
   481     TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
       
   482     TEST(major != -1 && minor != -1);   // Version is updated
       
   483     
       
   484     // Terminate display
       
   485     INFO_PRINTF1(_L("Calling eglTerminate..."));
       
   486     TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
       
   487     
       
   488     // Query string for version
       
   489     INFO_PRINTF1(_L("Query string for version..."));
       
   490     const char* strEglVersion = eglQueryString(iDisplay, EGL_VERSION);
       
   491     TEST_EGL_ERROR(strEglVersion == NULL, EGL_NOT_INITIALIZED);
       
   492     
       
   493     // Release thread
       
   494     TEST(eglReleaseThread() == EGL_TRUE);
       
   495     
       
   496     RecordTestResultL();
       
   497     CloseTMSGraphicsStep();
       
   498     return TestStepResult();
       
   499     }
       
   500 
       
   501 /**
       
   502 @SYMTestCaseID GRAPHICS-EGL-0514
       
   503 @SYMPREQ 2400
       
   504 @SYMTestPriority 1
       
   505 @SYMTestPurpose
       
   506 Test eglGetDisplay, eglInitialize and eglTerminate behavior from a single thread
       
   507 
       
   508 @SYMTestExpectedResults
       
   509 Return value and error code shall conform to EGL specification
       
   510 
       
   511 @SYMTestCaseDesc
       
   512 Multiple termination test
       
   513 
       
   514 @SYMTestActions
       
   515 Get default display
       
   516 Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
       
   517 
       
   518 Initialise display
       
   519 Check return value is true, error code is EGL_SUCCESS and version is updated
       
   520 
       
   521 Query string for extensions
       
   522 Check return value is not null and error code is EGL_SUCCESS
       
   523 
       
   524 Terminate display
       
   525 Check return value is true and error code is EGL_SUCCESS
       
   526 
       
   527 Terminate display
       
   528 Check return value is true and error code is EGL_SUCCESS
       
   529 
       
   530 Query string for extensions
       
   531 Check return value is null and error code is EGL_NOT_INITIALIZED
       
   532 
       
   533 Release thread
       
   534 Check return value is true
       
   535 
       
   536 Release thread
       
   537 Check return value is true
       
   538 */
       
   539 TVerdict CEglTest_Display_Positive_MultipleTermination::doTestStepL()
       
   540     {
       
   541     SetTestStepID(_L("GRAPHICS-EGL-0514"));
       
   542     INFO_PRINTF1(_L("CEglTest_Display_Positive_MultipleTermination::doTestStepL"));
       
   543 
       
   544     // Create display object
       
   545     GetDisplayL();
       
   546     TEST(eglGetError() == EGL_SUCCESS);
       
   547     
       
   548     // Initialise display object
       
   549     EGLint major = -1, minor = -1;
       
   550     INFO_PRINTF1(_L("Calling eglInitialize..."));
       
   551     TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
       
   552     TEST(major != -1 && minor != -1);   // Version is updated
       
   553     
       
   554     // Query string for extensions
       
   555     INFO_PRINTF1(_L("Query string for extensions..."));
       
   556     const char* strEglExtensions = eglQueryString(iDisplay, EGL_EXTENSIONS);
       
   557     TEST_EGL_ERROR(strEglExtensions != NULL, EGL_SUCCESS);
       
   558     
       
   559     // Terminate display
       
   560     INFO_PRINTF1(_L("Calling eglTerminate..."));
       
   561     TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
       
   562     
       
   563     // Terminate display
       
   564     INFO_PRINTF1(_L("Calling eglTerminate..."));
       
   565     TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
       
   566 
       
   567     // Query string for extensions
       
   568     INFO_PRINTF1(_L("Query string for extensions..."));
       
   569     strEglExtensions = eglQueryString(iDisplay, EGL_EXTENSIONS);
       
   570     TEST_EGL_ERROR(strEglExtensions == NULL, EGL_NOT_INITIALIZED);
       
   571     
       
   572     // Release thread
       
   573     TEST(eglReleaseThread() == EGL_TRUE);
       
   574     
       
   575     RecordTestResultL();
       
   576     CloseTMSGraphicsStep();
       
   577     return TestStepResult();
       
   578     }
       
   579 
       
   580 /**
       
   581 @SYMTestCaseID GRAPHICS-EGL-0515
       
   582 @SYMPREQ 2400
       
   583 @SYMTestPriority 1
       
   584 @SYMTestPurpose
       
   585 Test eglGetDisplay, eglInitialize, eglTerminate and eglQueryString behaviors from multiple threads within a process
       
   586 
       
   587 @SYMTestExpectedResults
       
   588 Return value and error code shall conform to EGL specification
       
   589 
       
   590 @SYMTestCaseDesc
       
   591 Basic multi threaded test
       
   592 
       
   593 @SYMTestActions
       
   594 Main Thread
       
   595 Get default display
       
   596 Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
       
   597 
       
   598 Initialise display
       
   599 Check return value is true, error code is EGL_SUCCESS and version is updated
       
   600 
       
   601 Query string for vendor
       
   602 Check return value is not null and error code is EGL_SUCCESS
       
   603 
       
   604 Launch thread A
       
   605 Wait for thread A to exit
       
   606     Thread A
       
   607     Get default display
       
   608     Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
       
   609     
       
   610     Initialise display
       
   611     Check return value is true, error code is EGL_SUCCESS and version is updated
       
   612     
       
   613     Query string for vendor
       
   614     Check return value is not null and error code is EGL_SUCCESS
       
   615     
       
   616     Terminate display
       
   617     Check return value is true and error code is EGL_SUCCESS
       
   618     
       
   619     Release thread
       
   620     Check return value is true
       
   621     Exit
       
   622 
       
   623 Main Thread
       
   624 Query string for vendor
       
   625 Check return value is null and error code is EGL_NOT_INITIALIZED
       
   626 
       
   627 Terminate display
       
   628 Check return value is true and error code is EGL_SUCCESS
       
   629 
       
   630 Release thread
       
   631 Check return value is true
       
   632 Exit
       
   633 */
       
   634 TVerdict CEglTest_Display_Positive_Multithread_Basic::doTestStepL()
       
   635     {
       
   636     SetTestStepID(_L("GRAPHICS-EGL-0515"));
       
   637     INFO_PRINTF1(_L("CEglTest_Display_Positive_Multithread_Basic::doTestStepL"));
       
   638 
       
   639     // Create display object
       
   640     GetDisplayL();
       
   641     TEST(eglGetError() == EGL_SUCCESS);
       
   642     
       
   643     // Initialise display object
       
   644     EGLint major = -1, minor = -1;
       
   645     INFO_PRINTF1(_L("Calling eglInitialize..."));
       
   646     TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
       
   647     TEST(major != -1 && minor != -1);
       
   648         
       
   649     // Query string for vendor
       
   650     INFO_PRINTF1(_L("Query string for vendor..."));
       
   651     const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
   652     TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
       
   653 
       
   654     INFO_PRINTF1(_L("Launch extra thread..."));
       
   655     Test_MultiThreadL(1, ETrue);
       
   656 
       
   657     // Query string for vendor
       
   658     INFO_PRINTF1(_L("Query string for vendor..."));
       
   659     strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
   660     TEST_EGL_ERROR(strEglVendor == NULL, EGL_NOT_INITIALIZED);
       
   661   
       
   662     // Terminate display
       
   663     TerminateDisplayL();
       
   664     TEST(eglGetError() == EGL_SUCCESS);
       
   665     
       
   666     // Release thread
       
   667     TEST(eglReleaseThread() == EGL_TRUE);
       
   668     
       
   669     RecordTestResultL();
       
   670     CloseTMSGraphicsStep();
       
   671     return TestStepResult();
       
   672     }
       
   673 
       
   674 void CEglTest_Display_Positive_Multithread_Basic::doThreadFunctionL(TInt aIdx)
       
   675     {
       
   676     INFO_PRINTF2(_L("CEglTest_Display_Positive_Multithread_Basic::doThreadFunctionL, Thread %d"),aIdx);
       
   677     
       
   678     INFO_PRINTF2(_L("Create display object from thread: %d"), aIdx);
       
   679     GetDisplayL();
       
   680     TEST(eglGetError() == EGL_SUCCESS);
       
   681     
       
   682     // Initialise display object
       
   683     EGLint major = -1, minor = -1;
       
   684     INFO_PRINTF1(_L("Calling eglInitialize..."));
       
   685     TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
       
   686     TEST(major != -1 && minor != -1);   // Version is updated
       
   687 
       
   688     // Query string for vendor
       
   689     INFO_PRINTF1(_L("Query string for vendor..."));
       
   690     const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
   691     TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
       
   692     
       
   693     // Terminate display
       
   694     INFO_PRINTF1(_L("Calling eglTerminate..."));
       
   695     TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
       
   696     
       
   697     TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
       
   698     }
       
   699 
       
   700 /**
       
   701 @SYMTestCaseID GRAPHICS-EGL-0516
       
   702 @SYMPREQ 2400
       
   703 @SYMTestPriority 1
       
   704 @SYMTestPurpose
       
   705 Test eglGetDisplay, eglInitialize and eglTerminate behavior from multiple threads within a process
       
   706 
       
   707 @SYMTestExpectedResults
       
   708 Return value and error code shall conform to EGL specification
       
   709 
       
   710 @SYMTestCaseDesc
       
   711 Initialise and terminate display from one thread only
       
   712 
       
   713 @SYMTestActions
       
   714 Main Thread
       
   715 Launch thread A and B
       
   716 Wait for both thread A and B to exit
       
   717 
       
   718     Thread A
       
   719     Get default display
       
   720     Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
       
   721     
       
   722     Initialise display
       
   723     Check return value is true, error code is EGL_SUCCESS and version is 1.4
       
   724     
       
   725     Rendezvous
       
   726     
       
   727     Thread A and B
       
   728     Query string for vendor
       
   729     Check return value is not null and error code is EGL_SUCCESS
       
   730     
       
   731     Rendezvous
       
   732     
       
   733     Thread A
       
   734     Terminate display
       
   735     Check return value is true and error code is EGL_SUCCESS
       
   736     
       
   737     Rendezvous
       
   738     
       
   739     Thread A and B
       
   740     Query string for vendor
       
   741     Check return value is null and error code is EGL_NOT_INITIALIZED
       
   742     
       
   743     Release thread
       
   744     Check return value is true
       
   745     Exit
       
   746 
       
   747 Main Thread
       
   748 Exit
       
   749 */
       
   750 TVerdict CEglTest_Display_Positive_Multithread_InitTerminateInOneTread::doTestStepL()
       
   751     {
       
   752     SetTestStepID(_L("GRAPHICS-EGL-0516"));
       
   753     INFO_PRINTF1(_L("CEglTest_Display_Positive_Multithread_InitTerminateInOneTread::doTestStepL"));
       
   754 
       
   755     INFO_PRINTF1(_L("Launch two threads"));
       
   756     Test_MultiThreadL(2, ETrue);
       
   757     
       
   758     RecordTestResultL();
       
   759     CloseTMSGraphicsStep();
       
   760     return TestStepResult();
       
   761     }
       
   762 
       
   763 void CEglTest_Display_Positive_Multithread_InitTerminateInOneTread::doThreadFunctionL(TInt aIdx)
       
   764     {
       
   765     INFO_PRINTF2(_L("CEglTest_Display_Positive_Multithread_InitTerminateInOneTread::doThreadFunctionL, Thread %d"),aIdx);
       
   766     
       
   767     if(aIdx == 0)
       
   768         {
       
   769         INFO_PRINTF2(_L("Create display object from thread: %d"), aIdx);
       
   770         GetDisplayL();
       
   771         TEST(eglGetError() == EGL_SUCCESS);
       
   772             
       
   773         // Initialise display object
       
   774         EGLint major = -1, minor = -1;
       
   775         INFO_PRINTF2(_L("Calling eglInitialize from thread %d"),aIdx);
       
   776         TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
       
   777         TEST(major != -1 && minor != -1);   // Version is updated
       
   778         }
       
   779     
       
   780     Rendezvous(aIdx);
       
   781     
       
   782     // Query string for vendor
       
   783     INFO_PRINTF2(_L("Query string for vendor from thread %d"), aIdx);
       
   784     const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
   785     TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
       
   786     
       
   787     Rendezvous(aIdx);
       
   788     
       
   789     if(aIdx == 0)
       
   790         {
       
   791         INFO_PRINTF2(_L("Calling eglTerminate... from thread: %d"), aIdx);
       
   792         TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
       
   793         }
       
   794     
       
   795     Rendezvous(aIdx);
       
   796     
       
   797     // Query string for vendor
       
   798     INFO_PRINTF2(_L("Query string for vendor from thread %d"), aIdx);
       
   799     strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
   800     TEST_EGL_ERROR(strEglVendor == NULL, EGL_NOT_INITIALIZED);
       
   801     
       
   802     TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
       
   803     }
       
   804 
       
   805 /*
       
   806 @SYMTestCaseID GRAPHICS-EGL-0517
       
   807 @SYMPREQ 2400
       
   808 @SYMTestPriority 1
       
   809 @SYMTestPurpose
       
   810 Test eglGetDisplay, eglInitialize, eglTerminate and eglQueryString behaviors from multiple threads within a process
       
   811 
       
   812 @SYMTestExpectedResults
       
   813 Return value and error code shall conform to EGL specification
       
   814 
       
   815 @SYMTestCaseDesc
       
   816 Initialise display from one thread and terminate from another thread
       
   817 
       
   818 @SYMTestActions
       
   819 Main Thread
       
   820 Launch thread A and B
       
   821 Wait for both thread A and B to exit
       
   822 
       
   823     Thread A
       
   824     Get default display
       
   825     Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
       
   826     
       
   827     Initialise display
       
   828     Check return value is true, error code is EGL_SUCCESS and version is 1.4
       
   829     
       
   830     Rendezvous
       
   831     
       
   832     Thread A and B
       
   833     Query string for vendor
       
   834     Check return value is not null and error code is EGL_SUCCESS
       
   835     
       
   836     Rendezvous
       
   837     
       
   838     Thread B
       
   839     Terminate display
       
   840     Check return value is true and error code is EGL_SUCCESS
       
   841     
       
   842     Rendezvous
       
   843     
       
   844     Thread A and B
       
   845     Query string for vendor
       
   846     Check return value is null and error code is EGL_NOT_INITIALIZED
       
   847     
       
   848     Release thread
       
   849     Check return value is true
       
   850     Exit
       
   851 
       
   852 Main Thread
       
   853 Exit
       
   854 */
       
   855 TVerdict CEglTest_Display_Positive_Multithread_InitTerminateFromDifferentThread::doTestStepL()
       
   856     {
       
   857     SetTestStepID(_L("GRAPHICS-EGL-0517"));
       
   858     INFO_PRINTF1(_L("CEglTest_Display_Positive_Multithread_InitTerminateFromDifferentThread::doTestStepL"));
       
   859 
       
   860     INFO_PRINTF1(_L("Launch two threads"));
       
   861     Test_MultiThreadL(2, ETrue);
       
   862     
       
   863     RecordTestResultL();
       
   864     CloseTMSGraphicsStep();
       
   865     return TestStepResult();
       
   866     }
       
   867 
       
   868 void CEglTest_Display_Positive_Multithread_InitTerminateFromDifferentThread::doThreadFunctionL(TInt aIdx)
       
   869     {
       
   870     INFO_PRINTF2(_L("CEglTest_Display_Positive_Multithread_InitTerminateFromDifferentThread::doThreadFunctionL, Thread %d"),aIdx);
       
   871     
       
   872     if(aIdx == 0)
       
   873         {
       
   874         INFO_PRINTF2(_L("Create display object from thread: %d"), aIdx);
       
   875         GetDisplayL();
       
   876         TEST(eglGetError() == EGL_SUCCESS);
       
   877             
       
   878         // Initialise display object
       
   879         EGLint major = -1, minor = -1;
       
   880         INFO_PRINTF2(_L("Calling eglInitialize from thread %d"),aIdx);
       
   881         TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
       
   882         TEST(major != -1 && minor != -1);
       
   883         }
       
   884     
       
   885     Rendezvous(aIdx);
       
   886     
       
   887     // Query string for vendor
       
   888     INFO_PRINTF2(_L("Query string for vendor from thread %d"), aIdx);
       
   889     const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
   890     TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
       
   891 
       
   892     Rendezvous(aIdx);
       
   893     
       
   894     if(aIdx == 1)
       
   895         {
       
   896         INFO_PRINTF2(_L("Calling eglTerminate... from thread: %d"), aIdx);
       
   897         TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
       
   898         }
       
   899     
       
   900     Rendezvous(aIdx);
       
   901     
       
   902     // Query string for vendor
       
   903     INFO_PRINTF2(_L("Query string for vendor from thread %d"), aIdx);
       
   904     strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
   905     TEST_EGL_ERROR(strEglVendor == NULL, EGL_NOT_INITIALIZED);
       
   906     
       
   907     TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
       
   908     }
       
   909 
       
   910 /**
       
   911 @SYMTestCaseID GRAPHICS-EGL-0518
       
   912 @SYMPREQ 2400
       
   913 @SYMTestPriority 1
       
   914 @SYMTestPurpose
       
   915 Test eglGetDisplay, eglInitialize, eglTerminate and eglQueryString behaviors from multiple threads within a process
       
   916 
       
   917 @SYMTestExpectedResults
       
   918 Return value and error code shall conform to EGL specification
       
   919 
       
   920 @SYMTestCaseDesc
       
   921 Test large number of threads
       
   922 
       
   923 @SYMTestActions
       
   924 Main thread
       
   925 Get default display
       
   926 Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
       
   927 
       
   928 Launch 100 threads
       
   929 Wait for all threads to exit
       
   930 
       
   931 From each spawned thread
       
   932 Get default display
       
   933 Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
       
   934 
       
   935 Initialise display
       
   936 Check return value is true, error code is EGL_SUCCESS and version is updated
       
   937 
       
   938 Query string for vendor
       
   939 Check return value is not null and error code is EGL_SUCCESS
       
   940             
       
   941 Release thread
       
   942 Check return value is true
       
   943 Exit
       
   944 
       
   945 Main thread
       
   946 Terminate display
       
   947 Check return value is true and error code is EGL_SUCCESS
       
   948 
       
   949 Query string for vendor
       
   950 Check return value is null and error code is EGL_NOT_INITIALIZED
       
   951 
       
   952 Release thread
       
   953 Check return value is true
       
   954 Exit
       
   955 */
       
   956 TVerdict CEglTest_Display_Positive_Multithread_Stress::doTestStepL()
       
   957     {
       
   958     SetTestStepID(_L("GRAPHICS-EGL-0518"));
       
   959     INFO_PRINTF1(_L("CEglTest_Display_Positive_Multithread_Stress::doTestStepL"));
       
   960 
       
   961     INFO_PRINTF1(_L("Create display object from main thread"));
       
   962     GetDisplayL();
       
   963     TEST(eglGetError() == EGL_SUCCESS);
       
   964     
       
   965     // launch 100 threads.
       
   966     Test_MultiThreadL(100, EFalse);
       
   967     
       
   968     INFO_PRINTF1(_L("Calling eglTerminate from main thread"));
       
   969     TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
       
   970     
       
   971     // Query string for vendor
       
   972     const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
   973     TEST_EGL_ERROR(strEglVendor == NULL, EGL_NOT_INITIALIZED);
       
   974     
       
   975     TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
       
   976     RecordTestResultL();
       
   977     CloseTMSGraphicsStep();
       
   978     return TestStepResult();
       
   979     }
       
   980 
       
   981 void CEglTest_Display_Positive_Multithread_Stress::doThreadFunctionL(TInt aIdx)
       
   982     {
       
   983     INFO_PRINTF2(_L("CEglTest_Display_Positive_Multithread_Stress::doThreadFunctionL, Thread %d"),aIdx);
       
   984 
       
   985     //Create display objec
       
   986     GetDisplayL();
       
   987     TEST(eglGetError() == EGL_SUCCESS);
       
   988         
       
   989     // Initialise display object
       
   990     EGLint major = -1, minor = -1;
       
   991     INFO_PRINTF1(_L("Calling eglInitialize..."));
       
   992     TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
       
   993     TEST(major != -1 && minor != -1);   // Version is updated
       
   994 
       
   995     // Query string for vendor
       
   996     const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
   997     TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
       
   998     
       
   999     TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
       
  1000     }
       
  1001 
       
  1002 /**
       
  1003 @SYMTestCaseID GRAPHICS-EGL-0519
       
  1004 @SYMPREQ 2400
       
  1005 @SYMTestPriority 1
       
  1006 @SYMTestPurpose
       
  1007 Test eglGetDisplay, eglInitialize, eglTerminate and eglQueryString behaviors from multiple processes
       
  1008 
       
  1009 @SYMTestExpectedResults
       
  1010 Return value and error code shall conform to EGL specification
       
  1011 
       
  1012 @SYMTestCaseDesc
       
  1013 Basic multi process test
       
  1014 
       
  1015 @SYMTestActions
       
  1016 Main Process
       
  1017 Launch process A and B
       
  1018 Wait until process A and B are terminated
       
  1019 
       
  1020     Process A
       
  1021     Get default display
       
  1022     Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
       
  1023     
       
  1024     Initialise display
       
  1025     Check return value is true, error code is EGL_SUCCESS and version is updated
       
  1026     
       
  1027     Query string for vendor
       
  1028     Check return value is not null and error code is EGL_SUCCESS
       
  1029     
       
  1030     Rendezvous
       
  1031     
       
  1032     Process B
       
  1033     Get default display
       
  1034     Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
       
  1035     
       
  1036     Initialise display
       
  1037     Check return value is true, error code is EGL_SUCCESS and version is updated
       
  1038     
       
  1039     Query string for vendor
       
  1040     Check return value is not null and error code is EGL_SUCCESS
       
  1041     
       
  1042     Terminate display
       
  1043     Check return value is true and error code is EGL_SUCCESS
       
  1044     
       
  1045     Release thread
       
  1046     Check return value is true
       
  1047     Exit
       
  1048     
       
  1049     Rendezvous
       
  1050     
       
  1051     Process A
       
  1052     Query string for vendor
       
  1053     Check return value is not null and error code is EGL_SUCCESS
       
  1054     
       
  1055     Terminate display
       
  1056     Check return value is true and error code is EGL_SUCCESS
       
  1057     
       
  1058     Release thread
       
  1059     Check return value is true
       
  1060     Exit
       
  1061 
       
  1062 Main Process
       
  1063 Exit
       
  1064 */
       
  1065 TVerdict CEglTest_Display_Positive_Multiprocess_Basic::doTestStepL()
       
  1066     {
       
  1067     SetTestStepID(_L("GRAPHICS-EGL-0519"));
       
  1068     INFO_PRINTF1(_L("CEglTest_Display_Positive_Multiprocess_Basic::doTestStepL"));
       
  1069 
       
  1070     INFO_PRINTF1(_L("Launch two processes"));
       
  1071     Test_MultiProcessL(KEglTestStepDllName, 2, KDisplay_Positive_Multiprocess_Basic);
       
  1072     
       
  1073     RecordTestResultL();
       
  1074     CloseTMSGraphicsStep();
       
  1075     return TestStepResult();
       
  1076     }
       
  1077 
       
  1078 void CEglTest_Display_Positive_Multiprocess_Basic::doProcessFunctionL(TInt aIdx)
       
  1079     {
       
  1080     INFO_PRINTF2(_L("CEglTest_Display_Positive_Multiprocess_Basic::doThreadFunctionL, Thread %d"),aIdx);
       
  1081     
       
  1082     if(aIdx == 0)
       
  1083         {
       
  1084         INFO_PRINTF2(_L("Create display object from Process: %d"), aIdx);
       
  1085         GetDisplayL();
       
  1086         TEST(eglGetError() == EGL_SUCCESS);
       
  1087         
       
  1088         // Initialise display object
       
  1089         EGLint major = -1, minor = -1;
       
  1090         INFO_PRINTF2(_L("Calling eglInitialize from Process %d"),aIdx);
       
  1091         TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
       
  1092         TEST(major != -1 && minor != -1);   // Version is updated
       
  1093         
       
  1094         // Query string for vendor
       
  1095         INFO_PRINTF2(_L("Query string for vendor from Process %d"),aIdx);
       
  1096         const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
  1097         TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
       
  1098         }
       
  1099     
       
  1100     Rendezvous(aIdx);
       
  1101     
       
  1102     if(aIdx == 1)
       
  1103         {
       
  1104         INFO_PRINTF2(_L("Create display object from Process: %d"), aIdx);
       
  1105         GetDisplayL();
       
  1106         TEST(eglGetError() == EGL_SUCCESS);
       
  1107         
       
  1108         // Initialise display object
       
  1109         EGLint major = -1, minor = -1;
       
  1110         INFO_PRINTF2(_L("Calling eglInitialize from Process %d"),aIdx);
       
  1111         TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
       
  1112         TEST(major != -1 && minor != -1);   // Version is updated
       
  1113         
       
  1114         // Query string for vendor
       
  1115         INFO_PRINTF2(_L("Query string for vendor from Process %d"),aIdx);
       
  1116         const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
  1117         TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
       
  1118     
       
  1119         // Terminate display object
       
  1120         INFO_PRINTF2(_L("Terminate display from Process %d"),aIdx);
       
  1121         TerminateDisplayL();
       
  1122         TEST(eglGetError() == EGL_SUCCESS);
       
  1123         
       
  1124         TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
       
  1125         }
       
  1126     
       
  1127     Rendezvous(aIdx);
       
  1128     
       
  1129     if(aIdx == 0)
       
  1130         {
       
  1131         // Query string for vendor
       
  1132         INFO_PRINTF2(_L("Query string for vendor from Process %d"),aIdx);
       
  1133         const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
  1134         TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
       
  1135     
       
  1136         // Terminate display object
       
  1137         INFO_PRINTF2(_L("Terminate display from Process %d"),aIdx);
       
  1138         TerminateDisplayL();
       
  1139         TEST(eglGetError() == EGL_SUCCESS);
       
  1140         
       
  1141         TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
       
  1142         }    
       
  1143     }
       
  1144 
       
  1145 /**
       
  1146 @SYMTestCaseID GRAPHICS-EGL-0520
       
  1147 @SYMPREQ 2400
       
  1148 @SYMTestPriority 1
       
  1149 @SYMTestPurpose
       
  1150 Test the behaviour of eglGetDisplay in a Client heap OOM situation.
       
  1151 
       
  1152 @SYMTestExpectedResults
       
  1153 No memory or handle leaks.
       
  1154 
       
  1155 @SYMTestCaseDesc
       
  1156 Client heap OOM test
       
  1157 
       
  1158 @SYMTestActions
       
  1159 Within a for loop that iterates through increasing memory failure at failAt:
       
  1160     *mark client heap with __UHEAP_SETFAIL(RHeap::EDeterministic,failAt)
       
  1161     *mark client heap with __UHEAP_MARK
       
  1162     *call eglGetDisplay()
       
  1163     *call eglGetError()
       
  1164     *reset client heap with __UHEAP_RESET
       
  1165     *If either egl function call fails and raises EGL_BAD_ALLOC, increase the failAt and restart the loop.
       
  1166 If the procedure was successful release all the resources and check the client heap for memory leaks.
       
  1167 No memory or handle leaks.
       
  1168 */
       
  1169 TVerdict CEglTest_Display_OOM_ClientHeap::doTestStepL()
       
  1170     {
       
  1171     SetTestStepID(_L("GRAPHICS-EGL-520"));
       
  1172     INFO_PRINTF1(_L("CEglTest_OOM_ClientHeap::doTestStepL"));
       
  1173     
       
  1174     EGLint errorCode = EGL_BAD_ALLOC;
       
  1175     for(TInt failAt=1; errorCode == EGL_BAD_ALLOC; ++failAt)
       
  1176         {
       
  1177         INFO_PRINTF2(_L("Set Client heap to fail at %u allocations"), failAt);
       
  1178         
       
  1179         __UHEAP_SETFAIL(RHeap::EDeterministic, failAt);
       
  1180         __UHEAP_MARK;
       
  1181         EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
       
  1182         errorCode = eglGetError();
       
  1183         __UHEAP_RESET;
       
  1184         
       
  1185         if(display == EGL_NO_DISPLAY)
       
  1186             {
       
  1187             // If it's not EGL_BAD_ALLOC, loop will exit naturally.
       
  1188             TEST(errorCode == EGL_BAD_ALLOC);
       
  1189             __UHEAP_MARKEND;
       
  1190             }
       
  1191         else
       
  1192             {
       
  1193             // All memory failure points have been tested. So can exit the test.
       
  1194             TEST(errorCode == EGL_SUCCESS);
       
  1195             eglReleaseThread();
       
  1196             __UHEAP_MARKEND;
       
  1197             break;            
       
  1198             }        
       
  1199         }
       
  1200     
       
  1201     RecordTestResultL();
       
  1202     CloseTMSGraphicsStep();
       
  1203     return TestStepResult();
       
  1204     }
       
  1205 
       
  1206 /**
       
  1207 @SYMTestCaseID GRAPHICS-EGL-0521
       
  1208 @SYMPREQ 2400
       
  1209 @SYMTestPriority 1
       
  1210 @SYMTestPurpose
       
  1211 Test the behaviour of eglInitialize in a Client heap OOM situation.
       
  1212 
       
  1213 @SYMTestExpectedResults
       
  1214 No memory or handle leaks.
       
  1215 
       
  1216 @SYMTestCaseDesc
       
  1217 Client heap OOM test
       
  1218 
       
  1219 @SYMTestActions
       
  1220 Get the display without setting memory failure.
       
  1221 
       
  1222 Within a for loop that iterates through increasing memory failure at failAt:
       
  1223     *mark client heap with __UHEAP_SETFAIL(RHeap::EDeterministic,failAt)
       
  1224     *mark client heap with __UHEAP_MARK
       
  1225     *call eglInitialize()
       
  1226     *call eglGetError()
       
  1227     *reset client heap with __UHEAP_RESET
       
  1228     *If either egl function call fails and raises EGL_BAD_ALLOC, increase the failAt and restart the loop.
       
  1229 If the procedure was successful release all the resources and check the client heap for memory leaks.
       
  1230 No memory or handle leaks.
       
  1231 */
       
  1232 TVerdict CEglTest_Display_OOM_ClientHeap_Initialize::doTestStepL()
       
  1233     {
       
  1234     SetTestStepID(_L("GRAPHICS-EGL-521"));
       
  1235     INFO_PRINTF1(_L("CEglTest_Display_OOM_ClientHeap_Initialize::doTestStepL"));
       
  1236     
       
  1237     EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
       
  1238     TEST(eglGetError() == EGL_SUCCESS);
       
  1239     
       
  1240     TEST(display != EGL_NO_DISPLAY);
       
  1241     if(display != EGL_NO_DISPLAY)
       
  1242         {
       
  1243         EGLint errorCode = EGL_BAD_ALLOC;
       
  1244         for(TInt failAt=1; errorCode == EGL_BAD_ALLOC; ++failAt)
       
  1245             {       
       
  1246             INFO_PRINTF2(_L("Set Client heap to fail at %u allocations"), failAt);
       
  1247             __UHEAP_SETFAIL(RHeap::EDeterministic, failAt);
       
  1248             __UHEAP_MARK;
       
  1249             EGLBoolean res = eglInitialize(display, NULL, NULL);
       
  1250             errorCode = eglGetError();
       
  1251             __UHEAP_RESET;
       
  1252                     
       
  1253             if(res == EGL_TRUE)
       
  1254                 {
       
  1255                 // All memory failure points have been tested. So can exit the test.
       
  1256                 TEST(errorCode == EGL_SUCCESS);
       
  1257                 TEST_EGL_ERROR(eglTerminate(display), EGL_SUCCESS);
       
  1258                 __UHEAP_MARKEND;
       
  1259                  break;            
       
  1260                 }
       
  1261             else
       
  1262                 {
       
  1263                 // If it's not EGL_BAD_ALLOC, loop will exit naturally.
       
  1264                 TEST(errorCode == EGL_BAD_ALLOC);
       
  1265                 __UHEAP_MARKEND;
       
  1266                 }                                
       
  1267             }
       
  1268         }
       
  1269     
       
  1270     eglReleaseThread();
       
  1271   
       
  1272     RecordTestResultL();
       
  1273     CloseTMSGraphicsStep();
       
  1274     return TestStepResult();
       
  1275     }
       
  1276