os/graphics/egl/eglrefimpl/test/src/egltest_reference.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/egl/eglrefimpl/test/src/egltest_reference.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,99 @@
     1.4 +// Copyright (c) 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 +
    1.24 +#include "egltest_reference.h"
    1.25 +
    1.26 +/**
    1.27 +@SYMTestCaseID GRAPHICS-EGL-REF-0001
    1.28 +
    1.29 +@SYMPREQ 2400
    1.30 +
    1.31 +@SYMTestPriority 1
    1.32 +
    1.33 +@SYMTestCaseDesc
    1.34 +Test eglQueryString returns the expected string for Reference EGL
    1.35 +
    1.36 +@SYMTestActions
    1.37 +Get default display
    1.38 +	Check the return value is not EGL_NO_DISPLAY and error code is EGL_SUCCESS
    1.39 +Initialise display
    1.40 +	Check return value is true, error code is EGL_SUCCESS and version is updated
    1.41 +Query string for version
    1.42 +	Check return value is “1.4 Reference EGL” and error code is EGL_SUCCESS
    1.43 +Query string for vendor
    1.44 +	Check return value is “Nokia” and error code is EGL_SUCCESS
    1.45 +Query string for client APIs
    1.46 +	Check return value is “” and error code is EGL_SUCCESS
    1.47 +Query string for extensions
    1.48 +	Check return value is “EGL_KHR_reusable_sync EGL_NOK__private__signal_sync” and error code is EGL_SUCCESS
    1.49 +Terminate display
    1.50 +	Check return value is true and error code is EGL_SUCCESS
    1.51 +Release thread
    1.52 +	Check return value is true
    1.53 +
    1.54 +@SYMTestExpectedResults
    1.55 +Non-null pointer is returned and all strings contain the expected value
    1.56 +*/
    1.57 +TVerdict CEglTest_QueryString::doTestStepL()
    1.58 +    {
    1.59 +    SetTestStepID(_L("GRAPHICS-EGL-REF-0001"));
    1.60 +    INFO_PRINTF1(_L("CEglTest_QueryString::doTestStepL"));
    1.61 +
    1.62 +    INFO_PRINTF1(_L("Create display object"));
    1.63 +    GetDisplayL();
    1.64 +    TEST(eglGetError() == EGL_SUCCESS);
    1.65 +   
    1.66 +    // Initialize display object
    1.67 +    EGLint major = -1, minor = -1;
    1.68 +    INFO_PRINTF1(_L("Calling eglInitialize"));
    1.69 +    TEST_EGL_ERROR(eglInitialize(iDisplay, &major, &minor), EGL_SUCCESS);
    1.70 +    TEST(major == 1 && minor == 4);   // Version is updated
    1.71 +    
    1.72 +    // Query string for version
    1.73 +    const char* strEglVersion = eglQueryString(iDisplay, EGL_VERSION);    
    1.74 +    TPtrC8 ptrEglVersion(reinterpret_cast<const TUint8*>(strEglVersion));
    1.75 +    TEST_EGL_ERROR(ptrEglVersion.Compare(_L8("1.4 Reference EGL")) == 0, EGL_SUCCESS);
    1.76 +    
    1.77 +    // Query string for vendor
    1.78 +    const char* strEglVendor = eglQueryString(iDisplay, EGL_VENDOR);
    1.79 +    TPtrC8 ptrEglVendor(reinterpret_cast<const TUint8*>(strEglVendor));
    1.80 +    TEST_EGL_ERROR(ptrEglVendor.Compare(_L8("Nokia")) == 0, EGL_SUCCESS);
    1.81 +    
    1.82 +    // Query string for client APIs
    1.83 +    const char* strEglClinentAPI = eglQueryString(iDisplay, EGL_CLIENT_APIS);
    1.84 +    TPtrC8 ptrEglClinentAPI(reinterpret_cast<const TUint8*>(strEglClinentAPI));
    1.85 +    TEST_EGL_ERROR(ptrEglClinentAPI.Compare(_L8("")) == 0, EGL_SUCCESS);
    1.86 +    
    1.87 +    // Query string for extensions
    1.88 +    const char* strEglExtensions = eglQueryString(iDisplay, EGL_EXTENSIONS);
    1.89 +    TPtrC8 ptrEglExtensions(reinterpret_cast<const TUint8*>(strEglExtensions));
    1.90 +    TEST_EGL_ERROR(ptrEglExtensions.Compare(_L8("EGL_KHR_reusable_sync EGL_NOK__private__signal_sync")) == 0, EGL_SUCCESS);
    1.91 + 
    1.92 +    // Terminate display object
    1.93 +    INFO_PRINTF1(_L("Terminate display"));
    1.94 +    TerminateDisplayL();
    1.95 +    TEST(eglGetError() == EGL_SUCCESS);
    1.96 +    
    1.97 +    TEST_EGL_ERROR(eglReleaseThread() == EGL_TRUE, EGL_SUCCESS);
    1.98 +    RecordTestResultL();
    1.99 +    CloseTMSGraphicsStep();
   1.100 +    return TestStepResult();
   1.101 +    }
   1.102 +