egl/eglrefimpl/test/src/egltest_reference.cpp
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test
       
    19  */
       
    20 
       
    21 #include "egltest_reference.h"
       
    22 
       
    23 /**
       
    24 @SYMTestCaseID GRAPHICS-EGL-REF-0001
       
    25 
       
    26 @SYMPREQ 2400
       
    27 
       
    28 @SYMTestPriority 1
       
    29 
       
    30 @SYMTestCaseDesc
       
    31 Test eglQueryString returns the expected string for Reference EGL
       
    32 
       
    33 @SYMTestActions
       
    34 Get default display
       
    35 	Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
       
    36 Initialise display
       
    37 	Check return value is true, error code is EGL_SUCCESS and version is updated
       
    38 Query string for version
       
    39 	Check return value is “1.4 Reference EGL” and error code is EGL_SUCCESS
       
    40 Query string for vendor
       
    41 	Check return value is “Nokia” and error code is EGL_SUCCESS
       
    42 Query string for client APIs
       
    43 	Check return value is “” and error code is EGL_SUCCESS
       
    44 Query string for extensions
       
    45 	Check return value is “EGL_KHR_reusable_sync EGL_NOK__private__signal_sync” and error code is EGL_SUCCESS
       
    46 Terminate display
       
    47 	Check return value is true and error code is EGL_SUCCESS
       
    48 Release thread
       
    49 	Check return value is true
       
    50 
       
    51 @SYMTestExpectedResults
       
    52 Non-null pointer is returned and all strings contain the expected value
       
    53 */
       
    54 TVerdict CEglTest_QueryString::doTestStepL()
       
    55     {
       
    56     SetTestStepID(_L("GRAPHICS-EGL-REF-0001"));
       
    57     INFO_PRINTF1(_L("CEglTest_QueryString::doTestStepL"));
       
    58 
       
    59     INFO_PRINTF1(_L("Create display object"));
       
    60     GetDisplayL();
       
    61     TEST(eglGetError() == EGL_SUCCESS);
       
    62    
       
    63     // Initialize display object
       
    64     EGLint major = -1, minor = -1;
       
    65     INFO_PRINTF1(_L("Calling eglInitialize"));
       
    66     TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
       
    67     TEST(major == 1 && minor == 4);   // Version is updated
       
    68     
       
    69     // Query string for version
       
    70     const char* strEglVersion = eglQueryString(iDisplay, EGL_VERSION);    
       
    71     TPtrC8 ptrEglVersion(reinterpret_cast<const TUint8*>(strEglVersion));
       
    72     TEST_EGL_ERROR(ptrEglVersion.Compare(_L8("1.4 Reference EGL")) == 0, EGL_SUCCESS);
       
    73     
       
    74     // Query string for vendor
       
    75     const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
       
    76     TPtrC8 ptrEglVendor(reinterpret_cast<const TUint8*>(strEglVendor));
       
    77     TEST_EGL_ERROR(ptrEglVendor.Compare(_L8("Nokia")) == 0, EGL_SUCCESS);
       
    78     
       
    79     // Query string for client APIs
       
    80     const char* strEglClinentAPI = eglQueryString(iDisplay, EGL_CLIENT_APIS);
       
    81     TPtrC8 ptrEglClinentAPI(reinterpret_cast<const TUint8*>(strEglClinentAPI));
       
    82     TEST_EGL_ERROR(ptrEglClinentAPI.Compare(_L8("")) == 0, EGL_SUCCESS);
       
    83     
       
    84     // Query string for extensions
       
    85     const char* strEglExtensions = eglQueryString(iDisplay, EGL_EXTENSIONS);
       
    86     TPtrC8 ptrEglExtensions(reinterpret_cast<const TUint8*>(strEglExtensions));
       
    87     TEST_EGL_ERROR(ptrEglExtensions.Compare(_L8("EGL_KHR_reusable_sync EGL_NOK__private__signal_sync")) == 0, EGL_SUCCESS);
       
    88  
       
    89     // Terminate display object
       
    90     INFO_PRINTF1(_L("Terminate display"));
       
    91     TerminateDisplayL();
       
    92     TEST(eglGetError() == EGL_SUCCESS);
       
    93     
       
    94     TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
       
    95     RecordTestResultL();
       
    96     CloseTMSGraphicsStep();
       
    97     return TestStepResult();
       
    98     }
       
    99