1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/egl/egltest/src/egltest_geterroranddisplay.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1276 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +/**
1.20 + @file
1.21 + @test
1.22 +*/
1.23 +#include "egltest_geterroranddisplay.h"
1.24 +
1.25 +/**
1.26 +@SYMTestCaseID GRAPHICS-EGL-0507
1.27 +
1.28 +@SYMPREQ 2400
1.29 +
1.30 +@SYMTestPriority 1
1.31 +
1.32 +@SYMTestCaseDesc
1.33 +Test eglGetError behavior
1.34 +
1.35 +@SYMTestExpectedResults
1.36 +Error code is set according to EGL specification
1.37 +
1.38 +@SYMTestActions
1.39 +Call eglGetError
1.40 +Check error is EGL_SUCCESS
1.41 +
1.42 +Get default display
1.43 +Check error code is EGL_SUCCESS
1.44 +
1.45 +Query string for version
1.46 +Check return value is null and error code is EGL_NOT_INITIALIZED
1.47 +
1.48 +Call eglGetError
1.49 +Check error is EGL_SUCCESS
1.50 +
1.51 +Query string for vendor
1.52 +Check return value is null and error code is EGL_NOT_INITIALIZED
1.53 +
1.54 +Release thread
1.55 +Call eglGetError
1.56 +Check error is EGL_SUCCESS
1.57 +
1.58 +Release thread
1.59 +Check return value is true
1.60 +*/
1.61 +TVerdict CEglTest_GetError::doTestStepL()
1.62 + {
1.63 + SetTestStepID(_L("GRAPHICS-EGL-0507"));
1.64 + INFO_PRINTF1(_L("CEglTest_GetError::doTestStepL"));
1.65 +
1.66 + TEST(eglGetError() == EGL_SUCCESS);
1.67 +
1.68 + // Create display object
1.69 + GetDisplayL();
1.70 + TEST(eglGetError() == EGL_SUCCESS);
1.71 +
1.72 + // Query string for version
1.73 + const char* strEglVersion = eglQueryString(iDisplay, EGL_VERSION);
1.74 + TEST_EGL_ERROR(strEglVersion == NULL, EGL_NOT_INITIALIZED);
1.75 +
1.76 + // Query string for vendor
1.77 + const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
1.78 + TEST_EGL_ERROR(strEglVendor == NULL, EGL_NOT_INITIALIZED);
1.79 +
1.80 + TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
1.81 +
1.82 + RecordTestResultL();
1.83 + CloseTMSGraphicsStep();
1.84 + return TestStepResult();
1.85 + }
1.86 +
1.87 +/**
1.88 +@SYMTestCaseID GRAPHICS-EGL-0508
1.89 +
1.90 +@SYMPREQ 2400
1.91 +
1.92 +@SYMTestPriority 1
1.93 +
1.94 +@SYMTestCaseDesc
1.95 +Test eglGetError behavior and to prove that error is specific to each thread
1.96 +
1.97 +@SYMTestExpectedResults
1.98 +Error code is set according to EGL specification
1.99 +
1.100 +@SYMTestActions
1.101 +Main Thread
1.102 +Call eglGetError
1.103 +Check error is EGL_SUCCESS
1.104 +
1.105 +Get default display
1.106 +Check error code is EGL_SUCCESS
1.107 +
1.108 +Query string for version
1.109 +Check return value is null but do not check error code
1.110 +
1.111 +Launch thread A
1.112 +Wait for thread A to exit
1.113 + Thread A
1.114 + Call eglGetError
1.115 + Check error is EGL_SUCCESS
1.116 +
1.117 + Get default display
1.118 + Check error code is EGL_SUCCESS
1.119 +
1.120 + Release thread
1.121 + Check return value is true
1.122 + Exit
1.123 +
1.124 +Main Thread
1.125 +Check error code is EGL_NOT_INITIALIZED
1.126 +
1.127 +Query string for version
1.128 +Check return value is null and error code is EGL_NOT_INITIALIZED
1.129 +
1.130 +Release thread
1.131 +Check return value is true
1.132 +Exit
1.133 +*/
1.134 +TVerdict CEglTest_GetErrorMultiThread::doTestStepL()
1.135 + {
1.136 + SetTestStepID(_L("GRAPHICS-EGL-0508"));
1.137 + INFO_PRINTF1(_L("CEglTest_GetErrorMultiThread::doTestStepL"));
1.138 +
1.139 + TEST(eglGetError() == EGL_SUCCESS);
1.140 +
1.141 + GetDisplayL();
1.142 + TEST(eglGetError() == EGL_SUCCESS);
1.143 +
1.144 + INFO_PRINTF1(_L("Query string for version..."));
1.145 + const char* strEglVersion = eglQueryString(iDisplay, EGL_VERSION);
1.146 + TEST(strEglVersion == NULL);
1.147 +
1.148 + INFO_PRINTF1(_L("Launch thread A"));
1.149 + Test_MultiThreadL(1, ETrue);
1.150 +
1.151 + // Check that eglGetError is specific to each thread
1.152 + TEST(eglGetError() == EGL_NOT_INITIALIZED);
1.153 +
1.154 + INFO_PRINTF1(_L("Query string for vendor..."));
1.155 + const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
1.156 + TEST_EGL_ERROR(strEglVendor == NULL, EGL_NOT_INITIALIZED);
1.157 +
1.158 + TEST(eglReleaseThread() == EGL_TRUE);
1.159 +
1.160 + RecordTestResultL();
1.161 + CloseTMSGraphicsStep();
1.162 + return TestStepResult();
1.163 + }
1.164 +
1.165 +void CEglTest_GetErrorMultiThread::doThreadFunctionL(TInt aIdx)
1.166 + {
1.167 + INFO_PRINTF2(_L("CEglTest_GetErrorMultiThread::doThreadFunctionL, Thread %d"),aIdx);
1.168 +
1.169 + TEST(eglGetError() == EGL_SUCCESS);
1.170 +
1.171 + INFO_PRINTF2(_L("Create display object from thread: %d"), aIdx);
1.172 + EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
1.173 + TEST_EGL_ERROR(dpy == iDisplay, EGL_SUCCESS);
1.174 +
1.175 + TEST(eglReleaseThread() == EGL_TRUE);
1.176 + }
1.177 +
1.178 +/**
1.179 +@SYMTestCaseID GRAPHICS-EGL-0509
1.180 +
1.181 +@SYMPREQ 2400
1.182 +
1.183 +@SYMTestPriority 1
1.184 +
1.185 +@SYMTestPurpose
1.186 +Test eglGetDisplay, eglInitialize, eglTerminate and eglQueryString behaviors from a single thread
1.187 +
1.188 +@SYMTestExpectedResults
1.189 +Return value and error code shall conform to EGL specification
1.190 +
1.191 +@SYMTestCaseDesc
1.192 +Basic positive test
1.193 +
1.194 +@SYMTestActions
1.195 +Get default display
1.196 +Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
1.197 +
1.198 +Initialise display
1.199 +Check return value is true, error code is EGL_SUCCESS and version is updated
1.200 +
1.201 +Query string for vendor
1.202 +Check return value is not null and error code is EGL_SUCCESS
1.203 +
1.204 +Terminate display
1.205 +Check return value is true and error code is EGL_SUCCESS
1.206 +
1.207 +Release thread
1.208 +Check return value is true
1.209 +*/
1.210 +TVerdict CEglTest_Display_Positive_Basic::doTestStepL()
1.211 + {
1.212 + SetTestStepID(_L("GRAPHICS-EGL-0509"));
1.213 + INFO_PRINTF1(_L("CEglTest_Display_Positive_Basic::doTestStepL"));
1.214 +
1.215 + // Create display object
1.216 + GetDisplayL();
1.217 + TEST(eglGetError() == EGL_SUCCESS);
1.218 +
1.219 + // Initialise display object
1.220 + EGLint major = -1, minor = -1;
1.221 + INFO_PRINTF1(_L("Calling eglInitialize..."));
1.222 + TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
1.223 + TEST(major != -1 && minor != -1); // Version is updated
1.224 +
1.225 + // Query string for vendor
1.226 + INFO_PRINTF1(_L("Query string for vendor..."));
1.227 + const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
1.228 + TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
1.229 +
1.230 + // Terminate display
1.231 + TerminateDisplayL();
1.232 + TEST(eglGetError() == EGL_SUCCESS);
1.233 +
1.234 + // Release thread
1.235 + TEST(eglReleaseThread() == EGL_TRUE);
1.236 +
1.237 + RecordTestResultL();
1.238 + CloseTMSGraphicsStep();
1.239 + return TestStepResult();
1.240 + }
1.241 +
1.242 +/**
1.243 +@SYMTestCaseID GRAPHICS-EGL-0510
1.244 +@SYMPREQ 2400
1.245 +@SYMTestPriority 1
1.246 +@SYMTestPurpose
1.247 +Test eglGetDisplay, eglInitialize and eglTerminate behaviors from a single thread
1.248 +
1.249 +@SYMTestExpectedResults
1.250 +Return value and error code shall conform to EGL specification
1.251 +
1.252 +@SYMTestCaseDesc
1.253 +Invalid display test
1.254 +
1.255 +@SYMTestActions
1.256 +Get display other than default
1.257 +Check return value is EGL_NO_DISPLAY and error code is EGL_SUCCESS
1.258 +
1.259 +Initialise display
1.260 +Check return value is false, error code is EGL_BAD_DISPLAY and version is not updated
1.261 +
1.262 +Terminate display
1.263 +Check return value is false and error code is EGL_BAD_DISPLAY
1.264 +
1.265 +Release thread
1.266 +Check return value is true
1.267 +*/
1.268 +TVerdict CEglTest_Display_Negative_InvalidDisplay::doTestStepL()
1.269 + {
1.270 + SetTestStepID(_L("GRAPHICS-EGL-0510"));
1.271 + INFO_PRINTF1(_L("CEglTest_Display_Negative_InvalidDisplay::doTestStepL"));
1.272 +
1.273 + // Get display other than default
1.274 + const NativeDisplayType nonDefaultDisplay = -1;
1.275 + iDisplay = eglGetDisplay(nonDefaultDisplay);
1.276 + TEST_EGL_ERROR(iDisplay == EGL_NO_DISPLAY, EGL_SUCCESS);
1.277 +
1.278 + // Initialise display object
1.279 + EGLint major = -1, minor = -1;
1.280 + INFO_PRINTF1(_L("Calling eglInitialize..."));
1.281 + TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor) == EGL_FALSE, EGL_BAD_DISPLAY);
1.282 + TEST(major == -1 && minor == -1); // Version is Not updated
1.283 +
1.284 + // Terminate display
1.285 + TEST_EGL_ERROR(eglTerminate(iDisplay) == EGL_FALSE, EGL_BAD_DISPLAY);
1.286 +
1.287 + // Release thread
1.288 + TEST(eglReleaseThread() == EGL_TRUE);
1.289 +
1.290 + RecordTestResultL();
1.291 + CloseTMSGraphicsStep();
1.292 + return TestStepResult();
1.293 + }
1.294 +
1.295 +/**
1.296 +@SYMTestCaseID GRAPHICS-EGL-0511
1.297 +@SYMPREQ 2400
1.298 +@SYMTestPriority 1
1.299 +@SYMTestPurpose
1.300 +Test eglGetDisplay, eglInitialize, eglTerminate and eglQueryString behaviors from a single thread
1.301 +
1.302 +@SYMTestExpectedResults
1.303 +Return value and error code shall conform to EGL specification
1.304 +
1.305 +@SYMTestCaseDesc
1.306 +Un-initialised display usage test
1.307 +
1.308 +@SYMTestActions
1.309 +Get default display
1.310 +Check return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
1.311 +
1.312 +Query string for vendor
1.313 +Check return value is null and error code is EGL_NOT_INITIALIZED
1.314 +
1.315 +Terminate display
1.316 +Check return value is true and error code is EGL_SUCCESS
1.317 +
1.318 +Release thread
1.319 +Check return value is true
1.320 +*/
1.321 +TVerdict CEglTest_Display_Negative_NotInitializedDisplay::doTestStepL()
1.322 + {
1.323 + SetTestStepID(_L("GRAPHICS-EGL-0511"));
1.324 + INFO_PRINTF1(_L("CEglTest_Display_Negative_NotInitializedDisplay::doTestStepL"));
1.325 +
1.326 + // Create display object
1.327 + GetDisplayL();
1.328 + TEST(eglGetError() == EGL_SUCCESS);
1.329 +
1.330 + // Query string for vendor
1.331 + INFO_PRINTF1(_L("Query string for vendor"));
1.332 + const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
1.333 + TEST_EGL_ERROR(strEglVendor == NULL, EGL_NOT_INITIALIZED);
1.334 +
1.335 + // Terminate display
1.336 + TerminateDisplayL();
1.337 + TEST(eglGetError() == EGL_SUCCESS);
1.338 +
1.339 + // Release thread
1.340 + TEST(eglReleaseThread() == EGL_TRUE);
1.341 +
1.342 + RecordTestResultL();
1.343 + CloseTMSGraphicsStep();
1.344 + return TestStepResult();
1.345 + }
1.346 +
1.347 +/**
1.348 +@SYMTestCaseID GRAPHICS-EGL-0512
1.349 +@SYMPREQ 2400
1.350 +@SYMTestPriority 1
1.351 +@SYMTestPurpose
1.352 +Test eglGetDisplay, eglInitialize, eglTerminate and eglQueryString behaviors from a single thread
1.353 +
1.354 +@SYMTestExpectedResults
1.355 +Return value and error code shall conform to EGL specification
1.356 +
1.357 +@SYMTestCaseDesc
1.358 +Reinitialise display test
1.359 +
1.360 +@SYMTestActions
1.361 +Get default display
1.362 +Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
1.363 +
1.364 +Initialise display
1.365 +Check return value is true, error code is EGL_SUCCESS and version is updated
1.366 +
1.367 +Terminate display
1.368 +Check return value is true and error code is EGL_SUCCESS
1.369 +
1.370 +Query string for version
1.371 +Check return value is null and error code is EGL_NOT_INITIALIZED
1.372 +
1.373 +Initialise display
1.374 +Check return value is true, error code is EGL_SUCCESS and version is updated
1.375 +
1.376 +Query string for version
1.377 +Check return value is not null and error code is EGL_SUCCESS
1.378 +
1.379 +Terminate display
1.380 +Check return value is true and error code is EGL_SUCCESS
1.381 +
1.382 +Release thread
1.383 +Check return value is true
1.384 +*/
1.385 +TVerdict CEglTest_Display_Positive_ReinitializeDisplay::doTestStepL()
1.386 + {
1.387 + SetTestStepID(_L("GRAPHICS-EGL-0512"));
1.388 + INFO_PRINTF1(_L("CEglTest_Display_Positive_ReinitializeDisplay::doTestStepL"));
1.389 +
1.390 + // Create display object
1.391 + GetDisplayL();
1.392 + TEST(eglGetError() == EGL_SUCCESS);
1.393 +
1.394 + // Initialise display object
1.395 + EGLint major = -1, minor = -1;
1.396 + INFO_PRINTF1(_L("Calling eglInitialize..."));
1.397 + TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
1.398 + TEST(major != -1 && minor != -1); // Version is updated
1.399 +
1.400 + // Terminate display
1.401 + INFO_PRINTF1(_L("Calling eglTerminate..."));
1.402 + TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
1.403 +
1.404 + // Query string for version
1.405 + INFO_PRINTF1(_L("Query string for version..."));
1.406 + const char* strEglVersion = eglQueryString(iDisplay, EGL_VERSION);
1.407 + TEST_EGL_ERROR(strEglVersion == NULL, EGL_NOT_INITIALIZED);
1.408 +
1.409 + // Re-Initialise display object
1.410 + major = -1;
1.411 + minor = -1;
1.412 + INFO_PRINTF1(_L("Calling eglInitialize..."));
1.413 + TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
1.414 + TEST(major != -1 && minor != -1); // Version is updated
1.415 +
1.416 + // Query string for version
1.417 + INFO_PRINTF1(_L("Query string for version..."));
1.418 + strEglVersion = eglQueryString(iDisplay, EGL_VERSION);
1.419 + TEST_EGL_ERROR(strEglVersion != NULL, EGL_SUCCESS);
1.420 +
1.421 + // Terminate display
1.422 + TerminateDisplayL();
1.423 + TEST(eglGetError() == EGL_SUCCESS);
1.424 +
1.425 + // Release thread
1.426 + TEST(eglReleaseThread() == EGL_TRUE);
1.427 +
1.428 + RecordTestResultL();
1.429 + CloseTMSGraphicsStep();
1.430 + return TestStepResult();
1.431 + }
1.432 +
1.433 +/**
1.434 +@SYMTestCaseID GRAPHICS-EGL-0513
1.435 +@SYMPREQ 2400
1.436 +@SYMTestPriority 1
1.437 +@SYMTestPurpose
1.438 +Test eglGetDisplay, eglInitialize and eglTerminate behavior from a single thread
1.439 +
1.440 +@SYMTestExpectedResults
1.441 +Return value and error code shall conform to EGL specification
1.442 +
1.443 +@SYMTestCaseDesc
1.444 +Multiple initialisation test
1.445 +
1.446 +@SYMTestActions
1.447 +Get default display
1.448 +Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
1.449 +
1.450 +Initialise display
1.451 +Check return value is true, error code is EGL_SUCCESS and version is updated
1.452 +
1.453 +Initialise display
1.454 +Check return value is true, error code is EGL_SUCCESS and version is updated
1.455 +
1.456 +Terminate display
1.457 +Check return value is true and error code is EGL_SUCCESS
1.458 +
1.459 +Query string for version
1.460 +Check return value is null and error code is EGL_NOT_INITIALIZED
1.461 +
1.462 +Release thread
1.463 +Check return value is true
1.464 +*/
1.465 +TVerdict CEglTest_Display_Positive_MultipleInitialization::doTestStepL()
1.466 + {
1.467 + SetTestStepID(_L("GRAPHICS-EGL-0513"));
1.468 + INFO_PRINTF1(_L("CEglTest_Display_Positive_MultipleInitialization::doTestStepL"));
1.469 +
1.470 + // Create display object
1.471 + GetDisplayL();
1.472 + TEST(eglGetError() == EGL_SUCCESS);
1.473 +
1.474 + // Initialise display object
1.475 + EGLint major = -1, minor = -1;
1.476 + INFO_PRINTF1(_L("Calling eglInitialize..."));
1.477 + TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
1.478 + TEST(major != -1 && minor != -1); // Version is updated
1.479 +
1.480 + // Initialise display object
1.481 + major = -1;
1.482 + minor = -1;
1.483 + INFO_PRINTF1(_L("Calling eglInitialize..."));
1.484 + TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
1.485 + TEST(major != -1 && minor != -1); // Version is updated
1.486 +
1.487 + // Terminate display
1.488 + INFO_PRINTF1(_L("Calling eglTerminate..."));
1.489 + TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
1.490 +
1.491 + // Query string for version
1.492 + INFO_PRINTF1(_L("Query string for version..."));
1.493 + const char* strEglVersion = eglQueryString(iDisplay, EGL_VERSION);
1.494 + TEST_EGL_ERROR(strEglVersion == NULL, EGL_NOT_INITIALIZED);
1.495 +
1.496 + // Release thread
1.497 + TEST(eglReleaseThread() == EGL_TRUE);
1.498 +
1.499 + RecordTestResultL();
1.500 + CloseTMSGraphicsStep();
1.501 + return TestStepResult();
1.502 + }
1.503 +
1.504 +/**
1.505 +@SYMTestCaseID GRAPHICS-EGL-0514
1.506 +@SYMPREQ 2400
1.507 +@SYMTestPriority 1
1.508 +@SYMTestPurpose
1.509 +Test eglGetDisplay, eglInitialize and eglTerminate behavior from a single thread
1.510 +
1.511 +@SYMTestExpectedResults
1.512 +Return value and error code shall conform to EGL specification
1.513 +
1.514 +@SYMTestCaseDesc
1.515 +Multiple termination test
1.516 +
1.517 +@SYMTestActions
1.518 +Get default display
1.519 +Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
1.520 +
1.521 +Initialise display
1.522 +Check return value is true, error code is EGL_SUCCESS and version is updated
1.523 +
1.524 +Query string for extensions
1.525 +Check return value is not null and error code is EGL_SUCCESS
1.526 +
1.527 +Terminate display
1.528 +Check return value is true and error code is EGL_SUCCESS
1.529 +
1.530 +Terminate display
1.531 +Check return value is true and error code is EGL_SUCCESS
1.532 +
1.533 +Query string for extensions
1.534 +Check return value is null and error code is EGL_NOT_INITIALIZED
1.535 +
1.536 +Release thread
1.537 +Check return value is true
1.538 +
1.539 +Release thread
1.540 +Check return value is true
1.541 +*/
1.542 +TVerdict CEglTest_Display_Positive_MultipleTermination::doTestStepL()
1.543 + {
1.544 + SetTestStepID(_L("GRAPHICS-EGL-0514"));
1.545 + INFO_PRINTF1(_L("CEglTest_Display_Positive_MultipleTermination::doTestStepL"));
1.546 +
1.547 + // Create display object
1.548 + GetDisplayL();
1.549 + TEST(eglGetError() == EGL_SUCCESS);
1.550 +
1.551 + // Initialise display object
1.552 + EGLint major = -1, minor = -1;
1.553 + INFO_PRINTF1(_L("Calling eglInitialize..."));
1.554 + TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
1.555 + TEST(major != -1 && minor != -1); // Version is updated
1.556 +
1.557 + // Query string for extensions
1.558 + INFO_PRINTF1(_L("Query string for extensions..."));
1.559 + const char* strEglExtensions = eglQueryString(iDisplay, EGL_EXTENSIONS);
1.560 + TEST_EGL_ERROR(strEglExtensions != NULL, EGL_SUCCESS);
1.561 +
1.562 + // Terminate display
1.563 + INFO_PRINTF1(_L("Calling eglTerminate..."));
1.564 + TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
1.565 +
1.566 + // Terminate display
1.567 + INFO_PRINTF1(_L("Calling eglTerminate..."));
1.568 + TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
1.569 +
1.570 + // Query string for extensions
1.571 + INFO_PRINTF1(_L("Query string for extensions..."));
1.572 + strEglExtensions = eglQueryString(iDisplay, EGL_EXTENSIONS);
1.573 + TEST_EGL_ERROR(strEglExtensions == NULL, EGL_NOT_INITIALIZED);
1.574 +
1.575 + // Release thread
1.576 + TEST(eglReleaseThread() == EGL_TRUE);
1.577 +
1.578 + RecordTestResultL();
1.579 + CloseTMSGraphicsStep();
1.580 + return TestStepResult();
1.581 + }
1.582 +
1.583 +/**
1.584 +@SYMTestCaseID GRAPHICS-EGL-0515
1.585 +@SYMPREQ 2400
1.586 +@SYMTestPriority 1
1.587 +@SYMTestPurpose
1.588 +Test eglGetDisplay, eglInitialize, eglTerminate and eglQueryString behaviors from multiple threads within a process
1.589 +
1.590 +@SYMTestExpectedResults
1.591 +Return value and error code shall conform to EGL specification
1.592 +
1.593 +@SYMTestCaseDesc
1.594 +Basic multi threaded test
1.595 +
1.596 +@SYMTestActions
1.597 +Main Thread
1.598 +Get default display
1.599 +Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
1.600 +
1.601 +Initialise display
1.602 +Check return value is true, error code is EGL_SUCCESS and version is updated
1.603 +
1.604 +Query string for vendor
1.605 +Check return value is not null and error code is EGL_SUCCESS
1.606 +
1.607 +Launch thread A
1.608 +Wait for thread A to exit
1.609 + Thread A
1.610 + Get default display
1.611 + Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
1.612 +
1.613 + Initialise display
1.614 + Check return value is true, error code is EGL_SUCCESS and version is updated
1.615 +
1.616 + Query string for vendor
1.617 + Check return value is not null and error code is EGL_SUCCESS
1.618 +
1.619 + Terminate display
1.620 + Check return value is true and error code is EGL_SUCCESS
1.621 +
1.622 + Release thread
1.623 + Check return value is true
1.624 + Exit
1.625 +
1.626 +Main Thread
1.627 +Query string for vendor
1.628 +Check return value is null and error code is EGL_NOT_INITIALIZED
1.629 +
1.630 +Terminate display
1.631 +Check return value is true and error code is EGL_SUCCESS
1.632 +
1.633 +Release thread
1.634 +Check return value is true
1.635 +Exit
1.636 +*/
1.637 +TVerdict CEglTest_Display_Positive_Multithread_Basic::doTestStepL()
1.638 + {
1.639 + SetTestStepID(_L("GRAPHICS-EGL-0515"));
1.640 + INFO_PRINTF1(_L("CEglTest_Display_Positive_Multithread_Basic::doTestStepL"));
1.641 +
1.642 + // Create display object
1.643 + GetDisplayL();
1.644 + TEST(eglGetError() == EGL_SUCCESS);
1.645 +
1.646 + // Initialise display object
1.647 + EGLint major = -1, minor = -1;
1.648 + INFO_PRINTF1(_L("Calling eglInitialize..."));
1.649 + TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
1.650 + TEST(major != -1 && minor != -1);
1.651 +
1.652 + // Query string for vendor
1.653 + INFO_PRINTF1(_L("Query string for vendor..."));
1.654 + const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
1.655 + TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
1.656 +
1.657 + INFO_PRINTF1(_L("Launch extra thread..."));
1.658 + Test_MultiThreadL(1, ETrue);
1.659 +
1.660 + // Query string for vendor
1.661 + INFO_PRINTF1(_L("Query string for vendor..."));
1.662 + strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
1.663 + TEST_EGL_ERROR(strEglVendor == NULL, EGL_NOT_INITIALIZED);
1.664 +
1.665 + // Terminate display
1.666 + TerminateDisplayL();
1.667 + TEST(eglGetError() == EGL_SUCCESS);
1.668 +
1.669 + // Release thread
1.670 + TEST(eglReleaseThread() == EGL_TRUE);
1.671 +
1.672 + RecordTestResultL();
1.673 + CloseTMSGraphicsStep();
1.674 + return TestStepResult();
1.675 + }
1.676 +
1.677 +void CEglTest_Display_Positive_Multithread_Basic::doThreadFunctionL(TInt aIdx)
1.678 + {
1.679 + INFO_PRINTF2(_L("CEglTest_Display_Positive_Multithread_Basic::doThreadFunctionL, Thread %d"),aIdx);
1.680 +
1.681 + INFO_PRINTF2(_L("Create display object from thread: %d"), aIdx);
1.682 + GetDisplayL();
1.683 + TEST(eglGetError() == EGL_SUCCESS);
1.684 +
1.685 + // Initialise display object
1.686 + EGLint major = -1, minor = -1;
1.687 + INFO_PRINTF1(_L("Calling eglInitialize..."));
1.688 + TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
1.689 + TEST(major != -1 && minor != -1); // Version is updated
1.690 +
1.691 + // Query string for vendor
1.692 + INFO_PRINTF1(_L("Query string for vendor..."));
1.693 + const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
1.694 + TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
1.695 +
1.696 + // Terminate display
1.697 + INFO_PRINTF1(_L("Calling eglTerminate..."));
1.698 + TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
1.699 +
1.700 + TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
1.701 + }
1.702 +
1.703 +/**
1.704 +@SYMTestCaseID GRAPHICS-EGL-0516
1.705 +@SYMPREQ 2400
1.706 +@SYMTestPriority 1
1.707 +@SYMTestPurpose
1.708 +Test eglGetDisplay, eglInitialize and eglTerminate behavior from multiple threads within a process
1.709 +
1.710 +@SYMTestExpectedResults
1.711 +Return value and error code shall conform to EGL specification
1.712 +
1.713 +@SYMTestCaseDesc
1.714 +Initialise and terminate display from one thread only
1.715 +
1.716 +@SYMTestActions
1.717 +Main Thread
1.718 +Launch thread A and B
1.719 +Wait for both thread A and B to exit
1.720 +
1.721 + Thread A
1.722 + Get default display
1.723 + Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
1.724 +
1.725 + Initialise display
1.726 + Check return value is true, error code is EGL_SUCCESS and version is 1.4
1.727 +
1.728 + Rendezvous
1.729 +
1.730 + Thread A and B
1.731 + Query string for vendor
1.732 + Check return value is not null and error code is EGL_SUCCESS
1.733 +
1.734 + Rendezvous
1.735 +
1.736 + Thread A
1.737 + Terminate display
1.738 + Check return value is true and error code is EGL_SUCCESS
1.739 +
1.740 + Rendezvous
1.741 +
1.742 + Thread A and B
1.743 + Query string for vendor
1.744 + Check return value is null and error code is EGL_NOT_INITIALIZED
1.745 +
1.746 + Release thread
1.747 + Check return value is true
1.748 + Exit
1.749 +
1.750 +Main Thread
1.751 +Exit
1.752 +*/
1.753 +TVerdict CEglTest_Display_Positive_Multithread_InitTerminateInOneTread::doTestStepL()
1.754 + {
1.755 + SetTestStepID(_L("GRAPHICS-EGL-0516"));
1.756 + INFO_PRINTF1(_L("CEglTest_Display_Positive_Multithread_InitTerminateInOneTread::doTestStepL"));
1.757 +
1.758 + INFO_PRINTF1(_L("Launch two threads"));
1.759 + Test_MultiThreadL(2, ETrue);
1.760 +
1.761 + RecordTestResultL();
1.762 + CloseTMSGraphicsStep();
1.763 + return TestStepResult();
1.764 + }
1.765 +
1.766 +void CEglTest_Display_Positive_Multithread_InitTerminateInOneTread::doThreadFunctionL(TInt aIdx)
1.767 + {
1.768 + INFO_PRINTF2(_L("CEglTest_Display_Positive_Multithread_InitTerminateInOneTread::doThreadFunctionL, Thread %d"),aIdx);
1.769 +
1.770 + if(aIdx == 0)
1.771 + {
1.772 + INFO_PRINTF2(_L("Create display object from thread: %d"), aIdx);
1.773 + GetDisplayL();
1.774 + TEST(eglGetError() == EGL_SUCCESS);
1.775 +
1.776 + // Initialise display object
1.777 + EGLint major = -1, minor = -1;
1.778 + INFO_PRINTF2(_L("Calling eglInitialize from thread %d"),aIdx);
1.779 + TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
1.780 + TEST(major != -1 && minor != -1); // Version is updated
1.781 + }
1.782 +
1.783 + Rendezvous(aIdx);
1.784 +
1.785 + // Query string for vendor
1.786 + INFO_PRINTF2(_L("Query string for vendor from thread %d"), aIdx);
1.787 + const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
1.788 + TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
1.789 +
1.790 + Rendezvous(aIdx);
1.791 +
1.792 + if(aIdx == 0)
1.793 + {
1.794 + INFO_PRINTF2(_L("Calling eglTerminate... from thread: %d"), aIdx);
1.795 + TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
1.796 + }
1.797 +
1.798 + Rendezvous(aIdx);
1.799 +
1.800 + // Query string for vendor
1.801 + INFO_PRINTF2(_L("Query string for vendor from thread %d"), aIdx);
1.802 + strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
1.803 + TEST_EGL_ERROR(strEglVendor == NULL, EGL_NOT_INITIALIZED);
1.804 +
1.805 + TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
1.806 + }
1.807 +
1.808 +/*
1.809 +@SYMTestCaseID GRAPHICS-EGL-0517
1.810 +@SYMPREQ 2400
1.811 +@SYMTestPriority 1
1.812 +@SYMTestPurpose
1.813 +Test eglGetDisplay, eglInitialize, eglTerminate and eglQueryString behaviors from multiple threads within a process
1.814 +
1.815 +@SYMTestExpectedResults
1.816 +Return value and error code shall conform to EGL specification
1.817 +
1.818 +@SYMTestCaseDesc
1.819 +Initialise display from one thread and terminate from another thread
1.820 +
1.821 +@SYMTestActions
1.822 +Main Thread
1.823 +Launch thread A and B
1.824 +Wait for both thread A and B to exit
1.825 +
1.826 + Thread A
1.827 + Get default display
1.828 + Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
1.829 +
1.830 + Initialise display
1.831 + Check return value is true, error code is EGL_SUCCESS and version is 1.4
1.832 +
1.833 + Rendezvous
1.834 +
1.835 + Thread A and B
1.836 + Query string for vendor
1.837 + Check return value is not null and error code is EGL_SUCCESS
1.838 +
1.839 + Rendezvous
1.840 +
1.841 + Thread B
1.842 + Terminate display
1.843 + Check return value is true and error code is EGL_SUCCESS
1.844 +
1.845 + Rendezvous
1.846 +
1.847 + Thread A and B
1.848 + Query string for vendor
1.849 + Check return value is null and error code is EGL_NOT_INITIALIZED
1.850 +
1.851 + Release thread
1.852 + Check return value is true
1.853 + Exit
1.854 +
1.855 +Main Thread
1.856 +Exit
1.857 +*/
1.858 +TVerdict CEglTest_Display_Positive_Multithread_InitTerminateFromDifferentThread::doTestStepL()
1.859 + {
1.860 + SetTestStepID(_L("GRAPHICS-EGL-0517"));
1.861 + INFO_PRINTF1(_L("CEglTest_Display_Positive_Multithread_InitTerminateFromDifferentThread::doTestStepL"));
1.862 +
1.863 + INFO_PRINTF1(_L("Launch two threads"));
1.864 + Test_MultiThreadL(2, ETrue);
1.865 +
1.866 + RecordTestResultL();
1.867 + CloseTMSGraphicsStep();
1.868 + return TestStepResult();
1.869 + }
1.870 +
1.871 +void CEglTest_Display_Positive_Multithread_InitTerminateFromDifferentThread::doThreadFunctionL(TInt aIdx)
1.872 + {
1.873 + INFO_PRINTF2(_L("CEglTest_Display_Positive_Multithread_InitTerminateFromDifferentThread::doThreadFunctionL, Thread %d"),aIdx);
1.874 +
1.875 + if(aIdx == 0)
1.876 + {
1.877 + INFO_PRINTF2(_L("Create display object from thread: %d"), aIdx);
1.878 + GetDisplayL();
1.879 + TEST(eglGetError() == EGL_SUCCESS);
1.880 +
1.881 + // Initialise display object
1.882 + EGLint major = -1, minor = -1;
1.883 + INFO_PRINTF2(_L("Calling eglInitialize from thread %d"),aIdx);
1.884 + TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
1.885 + TEST(major != -1 && minor != -1);
1.886 + }
1.887 +
1.888 + Rendezvous(aIdx);
1.889 +
1.890 + // Query string for vendor
1.891 + INFO_PRINTF2(_L("Query string for vendor from thread %d"), aIdx);
1.892 + const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
1.893 + TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
1.894 +
1.895 + Rendezvous(aIdx);
1.896 +
1.897 + if(aIdx == 1)
1.898 + {
1.899 + INFO_PRINTF2(_L("Calling eglTerminate... from thread: %d"), aIdx);
1.900 + TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
1.901 + }
1.902 +
1.903 + Rendezvous(aIdx);
1.904 +
1.905 + // Query string for vendor
1.906 + INFO_PRINTF2(_L("Query string for vendor from thread %d"), aIdx);
1.907 + strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
1.908 + TEST_EGL_ERROR(strEglVendor == NULL, EGL_NOT_INITIALIZED);
1.909 +
1.910 + TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
1.911 + }
1.912 +
1.913 +/**
1.914 +@SYMTestCaseID GRAPHICS-EGL-0518
1.915 +@SYMPREQ 2400
1.916 +@SYMTestPriority 1
1.917 +@SYMTestPurpose
1.918 +Test eglGetDisplay, eglInitialize, eglTerminate and eglQueryString behaviors from multiple threads within a process
1.919 +
1.920 +@SYMTestExpectedResults
1.921 +Return value and error code shall conform to EGL specification
1.922 +
1.923 +@SYMTestCaseDesc
1.924 +Test large number of threads
1.925 +
1.926 +@SYMTestActions
1.927 +Main thread
1.928 +Get default display
1.929 +Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
1.930 +
1.931 +Launch 100 threads
1.932 +Wait for all threads to exit
1.933 +
1.934 +From each spawned thread
1.935 +Get default display
1.936 +Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
1.937 +
1.938 +Initialise display
1.939 +Check return value is true, error code is EGL_SUCCESS and version is updated
1.940 +
1.941 +Query string for vendor
1.942 +Check return value is not null and error code is EGL_SUCCESS
1.943 +
1.944 +Release thread
1.945 +Check return value is true
1.946 +Exit
1.947 +
1.948 +Main thread
1.949 +Terminate display
1.950 +Check return value is true and error code is EGL_SUCCESS
1.951 +
1.952 +Query string for vendor
1.953 +Check return value is null and error code is EGL_NOT_INITIALIZED
1.954 +
1.955 +Release thread
1.956 +Check return value is true
1.957 +Exit
1.958 +*/
1.959 +TVerdict CEglTest_Display_Positive_Multithread_Stress::doTestStepL()
1.960 + {
1.961 + SetTestStepID(_L("GRAPHICS-EGL-0518"));
1.962 + INFO_PRINTF1(_L("CEglTest_Display_Positive_Multithread_Stress::doTestStepL"));
1.963 +
1.964 + INFO_PRINTF1(_L("Create display object from main thread"));
1.965 + GetDisplayL();
1.966 + TEST(eglGetError() == EGL_SUCCESS);
1.967 +
1.968 + // launch 100 threads.
1.969 + Test_MultiThreadL(100, ETrue);
1.970 +
1.971 + INFO_PRINTF1(_L("Calling eglTerminate from main thread"));
1.972 + TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
1.973 +
1.974 + // Query string for vendor
1.975 + const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
1.976 + TEST_EGL_ERROR(strEglVendor == NULL, EGL_NOT_INITIALIZED);
1.977 +
1.978 + TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
1.979 + RecordTestResultL();
1.980 + CloseTMSGraphicsStep();
1.981 + return TestStepResult();
1.982 + }
1.983 +
1.984 +void CEglTest_Display_Positive_Multithread_Stress::doThreadFunctionL(TInt aIdx)
1.985 + {
1.986 + INFO_PRINTF2(_L("CEglTest_Display_Positive_Multithread_Stress::doThreadFunctionL, Thread %d"),aIdx);
1.987 +
1.988 + //Create display objec
1.989 + GetDisplayL();
1.990 + TEST(eglGetError() == EGL_SUCCESS);
1.991 +
1.992 + // Initialise display object
1.993 + EGLint major = -1, minor = -1;
1.994 + INFO_PRINTF1(_L("Calling eglInitialize..."));
1.995 + TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
1.996 + TEST(major != -1 && minor != -1); // Version is updated
1.997 +
1.998 + // Query string for vendor
1.999 + const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
1.1000 + TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
1.1001 +
1.1002 + TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
1.1003 + }
1.1004 +
1.1005 +/**
1.1006 +@SYMTestCaseID GRAPHICS-EGL-0519
1.1007 +@SYMPREQ 2400
1.1008 +@SYMTestPriority 1
1.1009 +@SYMTestPurpose
1.1010 +Test eglGetDisplay, eglInitialize, eglTerminate and eglQueryString behaviors from multiple processes
1.1011 +
1.1012 +@SYMTestExpectedResults
1.1013 +Return value and error code shall conform to EGL specification
1.1014 +
1.1015 +@SYMTestCaseDesc
1.1016 +Basic multi process test
1.1017 +
1.1018 +@SYMTestActions
1.1019 +Main Process
1.1020 +Launch process A and B
1.1021 +Wait until process A and B are terminated
1.1022 +
1.1023 + Process A
1.1024 + Get default display
1.1025 + Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
1.1026 +
1.1027 + Initialise display
1.1028 + Check return value is true, error code is EGL_SUCCESS and version is updated
1.1029 +
1.1030 + Query string for vendor
1.1031 + Check return value is not null and error code is EGL_SUCCESS
1.1032 +
1.1033 + Rendezvous
1.1034 +
1.1035 + Process B
1.1036 + Get default display
1.1037 + Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
1.1038 +
1.1039 + Initialise display
1.1040 + Check return value is true, error code is EGL_SUCCESS and version is updated
1.1041 +
1.1042 + Query string for vendor
1.1043 + Check return value is not null and error code is EGL_SUCCESS
1.1044 +
1.1045 + Terminate display
1.1046 + Check return value is true and error code is EGL_SUCCESS
1.1047 +
1.1048 + Release thread
1.1049 + Check return value is true
1.1050 + Exit
1.1051 +
1.1052 + Rendezvous
1.1053 +
1.1054 + Process A
1.1055 + Query string for vendor
1.1056 + Check return value is not null and error code is EGL_SUCCESS
1.1057 +
1.1058 + Terminate display
1.1059 + Check return value is true and error code is EGL_SUCCESS
1.1060 +
1.1061 + Release thread
1.1062 + Check return value is true
1.1063 + Exit
1.1064 +
1.1065 +Main Process
1.1066 +Exit
1.1067 +*/
1.1068 +TVerdict CEglTest_Display_Positive_Multiprocess_Basic::doTestStepL()
1.1069 + {
1.1070 + SetTestStepID(_L("GRAPHICS-EGL-0519"));
1.1071 + INFO_PRINTF1(_L("CEglTest_Display_Positive_Multiprocess_Basic::doTestStepL"));
1.1072 +
1.1073 + INFO_PRINTF1(_L("Launch two processes"));
1.1074 + Test_MultiProcessL(KEglTestStepDllName, 2, KDisplay_Positive_Multiprocess_Basic);
1.1075 +
1.1076 + RecordTestResultL();
1.1077 + CloseTMSGraphicsStep();
1.1078 + return TestStepResult();
1.1079 + }
1.1080 +
1.1081 +void CEglTest_Display_Positive_Multiprocess_Basic::doProcessFunctionL(TInt aIdx)
1.1082 + {
1.1083 + INFO_PRINTF2(_L("CEglTest_Display_Positive_Multiprocess_Basic::doThreadFunctionL, Thread %d"),aIdx);
1.1084 +
1.1085 + if(aIdx == 0)
1.1086 + {
1.1087 + INFO_PRINTF2(_L("Create display object from Process: %d"), aIdx);
1.1088 + GetDisplayL();
1.1089 + TEST(eglGetError() == EGL_SUCCESS);
1.1090 +
1.1091 + // Initialise display object
1.1092 + EGLint major = -1, minor = -1;
1.1093 + INFO_PRINTF2(_L("Calling eglInitialize from Process %d"),aIdx);
1.1094 + TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
1.1095 + TEST(major != -1 && minor != -1); // Version is updated
1.1096 +
1.1097 + // Query string for vendor
1.1098 + INFO_PRINTF2(_L("Query string for vendor from Process %d"),aIdx);
1.1099 + const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
1.1100 + TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
1.1101 + }
1.1102 +
1.1103 + Rendezvous(aIdx);
1.1104 +
1.1105 + if(aIdx == 1)
1.1106 + {
1.1107 + INFO_PRINTF2(_L("Create display object from Process: %d"), aIdx);
1.1108 + GetDisplayL();
1.1109 + TEST(eglGetError() == EGL_SUCCESS);
1.1110 +
1.1111 + // Initialise display object
1.1112 + EGLint major = -1, minor = -1;
1.1113 + INFO_PRINTF2(_L("Calling eglInitialize from Process %d"),aIdx);
1.1114 + TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
1.1115 + TEST(major != -1 && minor != -1); // Version is updated
1.1116 +
1.1117 + // Query string for vendor
1.1118 + INFO_PRINTF2(_L("Query string for vendor from Process %d"),aIdx);
1.1119 + const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
1.1120 + TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
1.1121 +
1.1122 + // Terminate display object
1.1123 + INFO_PRINTF2(_L("Terminate display from Process %d"),aIdx);
1.1124 + TerminateDisplayL();
1.1125 + TEST(eglGetError() == EGL_SUCCESS);
1.1126 +
1.1127 + TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
1.1128 + }
1.1129 +
1.1130 + Rendezvous(aIdx);
1.1131 +
1.1132 + if(aIdx == 0)
1.1133 + {
1.1134 + // Query string for vendor
1.1135 + INFO_PRINTF2(_L("Query string for vendor from Process %d"),aIdx);
1.1136 + const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
1.1137 + TEST_EGL_ERROR(strEglVendor != NULL, EGL_SUCCESS);
1.1138 +
1.1139 + // Terminate display object
1.1140 + INFO_PRINTF2(_L("Terminate display from Process %d"),aIdx);
1.1141 + TerminateDisplayL();
1.1142 + TEST(eglGetError() == EGL_SUCCESS);
1.1143 +
1.1144 + TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
1.1145 + }
1.1146 + }
1.1147 +
1.1148 +/**
1.1149 +@SYMTestCaseID GRAPHICS-EGL-0520
1.1150 +@SYMPREQ 2400
1.1151 +@SYMTestPriority 1
1.1152 +@SYMTestPurpose
1.1153 +Test the behaviour of eglGetDisplay in a Client heap OOM situation.
1.1154 +
1.1155 +@SYMTestExpectedResults
1.1156 +No memory or handle leaks.
1.1157 +
1.1158 +@SYMTestCaseDesc
1.1159 +Client heap OOM test
1.1160 +
1.1161 +@SYMTestActions
1.1162 +Within a for loop that iterates through increasing memory failure at failAt:
1.1163 + *mark client heap with __UHEAP_SETFAIL(RHeap::EDeterministic,failAt)
1.1164 + *mark client heap with __UHEAP_MARK
1.1165 + *call eglGetDisplay()
1.1166 + *call eglGetError()
1.1167 + *reset client heap with __UHEAP_RESET
1.1168 + *If either egl function call fails and raises EGL_BAD_ALLOC, increase the failAt and restart the loop.
1.1169 +If the procedure was successful release all the resources and check the client heap for memory leaks.
1.1170 +No memory or handle leaks.
1.1171 +*/
1.1172 +TVerdict CEglTest_Display_OOM_ClientHeap::doTestStepL()
1.1173 + {
1.1174 + SetTestStepID(_L("GRAPHICS-EGL-520"));
1.1175 + INFO_PRINTF1(_L("CEglTest_OOM_ClientHeap::doTestStepL"));
1.1176 +
1.1177 + EGLint errorCode = EGL_BAD_ALLOC;
1.1178 + for(TInt failAt=1; errorCode == EGL_BAD_ALLOC; ++failAt)
1.1179 + {
1.1180 + INFO_PRINTF2(_L("Set Client heap to fail at %u allocations"), failAt);
1.1181 +
1.1182 + __UHEAP_SETFAIL(RHeap::EDeterministic, failAt);
1.1183 + __UHEAP_MARK;
1.1184 + EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
1.1185 + errorCode = eglGetError();
1.1186 + __UHEAP_RESET;
1.1187 +
1.1188 + if(display == EGL_NO_DISPLAY)
1.1189 + {
1.1190 + // If it's not EGL_BAD_ALLOC, loop will exit naturally.
1.1191 + TEST(errorCode == EGL_BAD_ALLOC);
1.1192 + __UHEAP_MARKEND;
1.1193 + }
1.1194 + else
1.1195 + {
1.1196 + // All memory failure points have been tested. So can exit the test.
1.1197 + TEST(errorCode == EGL_SUCCESS);
1.1198 + eglReleaseThread();
1.1199 + __UHEAP_MARKEND;
1.1200 + break;
1.1201 + }
1.1202 + }
1.1203 +
1.1204 + RecordTestResultL();
1.1205 + CloseTMSGraphicsStep();
1.1206 + return TestStepResult();
1.1207 + }
1.1208 +
1.1209 +/**
1.1210 +@SYMTestCaseID GRAPHICS-EGL-0521
1.1211 +@SYMPREQ 2400
1.1212 +@SYMTestPriority 1
1.1213 +@SYMTestPurpose
1.1214 +Test the behaviour of eglInitialize in a Client heap OOM situation.
1.1215 +
1.1216 +@SYMTestExpectedResults
1.1217 +No memory or handle leaks.
1.1218 +
1.1219 +@SYMTestCaseDesc
1.1220 +Client heap OOM test
1.1221 +
1.1222 +@SYMTestActions
1.1223 +Get the display without setting memory failure.
1.1224 +
1.1225 +Within a for loop that iterates through increasing memory failure at failAt:
1.1226 + *mark client heap with __UHEAP_SETFAIL(RHeap::EDeterministic,failAt)
1.1227 + *mark client heap with __UHEAP_MARK
1.1228 + *call eglInitialize()
1.1229 + *call eglGetError()
1.1230 + *reset client heap with __UHEAP_RESET
1.1231 + *If either egl function call fails and raises EGL_BAD_ALLOC, increase the failAt and restart the loop.
1.1232 +If the procedure was successful release all the resources and check the client heap for memory leaks.
1.1233 +No memory or handle leaks.
1.1234 +*/
1.1235 +TVerdict CEglTest_Display_OOM_ClientHeap_Initialize::doTestStepL()
1.1236 + {
1.1237 + SetTestStepID(_L("GRAPHICS-EGL-521"));
1.1238 + INFO_PRINTF1(_L("CEglTest_Display_OOM_ClientHeap_Initialize::doTestStepL"));
1.1239 +
1.1240 + EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
1.1241 + TEST(eglGetError() == EGL_SUCCESS);
1.1242 +
1.1243 + TEST(display != EGL_NO_DISPLAY);
1.1244 + if(display != EGL_NO_DISPLAY)
1.1245 + {
1.1246 + EGLint errorCode = EGL_BAD_ALLOC;
1.1247 + for(TInt failAt=1; errorCode == EGL_BAD_ALLOC; ++failAt)
1.1248 + {
1.1249 + INFO_PRINTF2(_L("Set Client heap to fail at %u allocations"), failAt);
1.1250 + __UHEAP_SETFAIL(RHeap::EDeterministic, failAt);
1.1251 + __UHEAP_MARK;
1.1252 + EGLBoolean res = eglInitialize(display, NULL, NULL);
1.1253 + errorCode = eglGetError();
1.1254 + __UHEAP_RESET;
1.1255 +
1.1256 + if(res == EGL_TRUE)
1.1257 + {
1.1258 + // All memory failure points have been tested. So can exit the test.
1.1259 + TEST(errorCode == EGL_SUCCESS);
1.1260 + TEST_EGL_ERROR(eglTerminate(display), EGL_SUCCESS);
1.1261 + __UHEAP_MARKEND;
1.1262 + break;
1.1263 + }
1.1264 + else
1.1265 + {
1.1266 + // If it's not EGL_BAD_ALLOC, loop will exit naturally.
1.1267 + TEST(errorCode == EGL_BAD_ALLOC);
1.1268 + __UHEAP_MARKEND;
1.1269 + }
1.1270 + }
1.1271 + }
1.1272 +
1.1273 + eglReleaseThread();
1.1274 +
1.1275 + RecordTestResultL();
1.1276 + CloseTMSGraphicsStep();
1.1277 + return TestStepResult();
1.1278 + }
1.1279 +