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