sl@0: // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent - Internal Symbian test code sl@0: */ sl@0: sl@0: #include "egltest_endpointattrib.h" sl@0: sl@0: const TInt KBadAttribValue = EGL_BAD_ATTRIBUTE; // Use error code as a "invalid attribute value". sl@0: sl@0: // For testing flexibility of the concept. Not actually used in the testcode at this point in time. sl@0: static const TTestCase KAttribBadParameterCases[] = sl@0: { sl@0: { sl@0: TESTIDS("551A"), sl@0: CASETITLE("Functional: Negative: eglGetEndpointAttribNOK with Bad Parameters: bad display is error code when getting attributes"), sl@0: SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow), sl@0: { sl@0: { EInitializeCase, 0, EGL_SUCCESS }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 0, EStandardSurface }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS }, sl@0: { EGetAttribCase, EUseBadDisplay, EGL_BAD_DISPLAY, 0, 0, EGL_ENDPOINT_READY_NOK, 0}, sl@0: // Use bad endpoint with bad display - should give bad display. sl@0: { EGetAttribCase, EUseBadEndpoint | EUseBadDisplay, sl@0: EGL_BAD_DISPLAY, 0, 0, EGL_ENDPOINT_READY_NOK, 0}, sl@0: { EGetAttribCase, EUseBadEndpoint, sl@0: EGL_BAD_ENDPOINT_NOK, 0, 0, EGL_ENDPOINT_READY_NOK, 0}, sl@0: { EGetAttribCase, EUseBadDisplay, EGL_BAD_DISPLAY, 0, 0, EGL_DELAY_NOK, 0 }, sl@0: // Use bad endpoint with bad display - should give bad display. sl@0: { EGetAttribCase, EUseBadEndpoint | EUseBadDisplay, sl@0: EGL_BAD_DISPLAY, 0, 0, EGL_DELAY_NOK, 0}, sl@0: { EGetAttribCase, EUseBadEndpoint,EGL_BAD_ENDPOINT_NOK, 0, 0, EGL_DELAY_NOK, 0}, sl@0: { EGetAttribCase, EUseBadDisplay, EGL_BAD_DISPLAY, 0, 0, KBadAttribValue, 0}, sl@0: { EGetAttribCase, EExpectError, EGL_BAD_PARAMETER, 0, 0, KBadAttribValue, 0}, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS }, sl@0: { ETerminateCase, 0, EGL_SUCCESS }, sl@0: { EFinishedCase } sl@0: }, sl@0: }, sl@0: { sl@0: TESTIDS("551B"), sl@0: CASETITLE("Functional: Negative: eglGetEndpointAttribNOK with Bad Parameters: bad parameter is error code when requesting invalid attribute"), sl@0: SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow), sl@0: { sl@0: { EInitializeCase, 0, EGL_SUCCESS }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 0, EStandardSurface }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS }, sl@0: // First check that bad display is issued even when the attribute is bad. sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS }, sl@0: { ETerminateCase, 0, EGL_SUCCESS }, sl@0: { EFinishedCase } sl@0: }, sl@0: }, sl@0: // SetEndpointAttrib tests. sl@0: { sl@0: TESTIDS("552A"), sl@0: CASETITLE("Functional: Negative: eglSetEndpointAttribNOK with Bad Parameters: bad display is error code when setting endpoint ready"), sl@0: SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow), sl@0: { sl@0: { EInitializeCase, 0, EGL_SUCCESS }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 0, EStandardSurface }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS }, sl@0: { ESetAttribCase, EUseBadDisplay, EGL_BAD_DISPLAY, 0, 0, EGL_ENDPOINT_READY_NOK, 0}, sl@0: { ESetAttribCase, EUseBadDisplay, EGL_BAD_DISPLAY, 0, 0, EGL_ENDPOINT_READY_NOK, 0}, sl@0: // Use bad endpoint with bad display - should give bad display. sl@0: { ESetAttribCase, EUseBadEndpoint | EUseBadDisplay, sl@0: EGL_BAD_DISPLAY, 0, 0, EGL_ENDPOINT_READY_NOK, 0}, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS }, sl@0: { ETerminateCase, 0, EGL_SUCCESS }, sl@0: { EFinishedCase } sl@0: }, sl@0: }, sl@0: { sl@0: TESTIDS("552B"), sl@0: CASETITLE("Functional: Negative: eglSetEndpointAttribNOK with Bad Parameters: bad display is error code when setting endpoint delay"), sl@0: SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow), sl@0: { sl@0: { EInitializeCase, 0, EGL_SUCCESS }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 0, EStandardSurface }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS }, sl@0: { ESetAttribCase, EUseBadDisplay, EGL_BAD_DISPLAY, 0, 0, EGL_DELAY_NOK, 0 }, sl@0: // Use bad endpoint with bad display - should give bad display. sl@0: { ESetAttribCase, EUseBadEndpoint | EUseBadDisplay, sl@0: EGL_BAD_DISPLAY, 0, 0, EGL_DELAY_NOK, 0}, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS }, sl@0: { ETerminateCase, 0, EGL_SUCCESS }, sl@0: { EFinishedCase } sl@0: }, sl@0: }, sl@0: { sl@0: TESTIDS("552C"), sl@0: CASETITLE("Functional: Negative: eglSetEndpointAttribNOK with Bad Parameters: bad endpoint is error code when setting endpoint delay"), sl@0: SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow), sl@0: { sl@0: { EInitializeCase, 0, EGL_SUCCESS }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 0, EStandardSurface }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS }, sl@0: { ESetAttribCase, EUseBadEndpoint,EGL_BAD_ENDPOINT_NOK, 0, 0, EGL_DELAY_NOK, 0}, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS }, sl@0: { ETerminateCase, 0, EGL_SUCCESS }, sl@0: { EFinishedCase } sl@0: }, sl@0: }, sl@0: { sl@0: TESTIDS("552D"), sl@0: CASETITLE("Functional: Negative: eglSetEndpointAttribNOK with Bad Parameters: bad parameter is error code when setting invalid attribute"), sl@0: SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow), sl@0: { sl@0: { EInitializeCase, 0, EGL_SUCCESS }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 0, EStandardSurface }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS }, sl@0: // First check that bad display is issued even when the attribute is bad. sl@0: { ESetAttribCase, EUseBadDisplay, EGL_BAD_DISPLAY, 0, 0, KBadAttribValue, 0}, sl@0: { ESetAttribCase, EExpectError, EGL_BAD_PARAMETER, 0, 0, KBadAttribValue, 0}, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS }, sl@0: { ETerminateCase, 0, EGL_SUCCESS }, sl@0: { EFinishedCase } sl@0: }, sl@0: }, sl@0: { sl@0: TESTIDS("552E"), sl@0: CASETITLE("Functional: Negative: eglSetEndpointAttribNOK with Bad Parameters: bad parameter is error code when setting EGL_ENDPOINT_READY_NOK"), sl@0: SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow), sl@0: { sl@0: { EInitializeCase, 0, EGL_SUCCESS }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 0, EStandardSurface }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS }, sl@0: { ESetAttribCase, EExpectError, EGL_BAD_PARAMETER, 0, 0, EGL_ENDPOINT_READY_NOK, 0}, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS }, sl@0: { ETerminateCase, 0, EGL_SUCCESS }, sl@0: { EFinishedCase } sl@0: }, sl@0: }, sl@0: }; sl@0: sl@0: static const TTestCase KAttribPositiveCases[] = sl@0: { sl@0: { sl@0: TESTIDS("543A"), sl@0: CASETITLE("Functional: Positive: eglGetEndpointAttribNOK with Valid Parameters: check that EGL_ENDPOINT_READY_NOK returns EGL_FALSE when not ready"), sl@0: SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow), sl@0: { sl@0: { EInitializeCase, 0, EGL_SUCCESS }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 0, EStandardSurface }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_ENDPOINT_READY_NOK, EGL_FALSE }, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS }, sl@0: { ETerminateCase, 0, EGL_SUCCESS }, sl@0: { EFinishedCase } sl@0: }, sl@0: }, sl@0: { sl@0: TESTIDS("543B"), sl@0: CASETITLE("Functional: Positive: eglGetEndpointAttribNOK with Valid Parameters: check that EGL_ENDPOINT_READY_NOK returns EGL_TRUE when ready"), sl@0: SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow), sl@0: { sl@0: { EInitializeCase, 0, EGL_SUCCESS }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 0, EStandardSurface }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS }, sl@0: { EDrawContentCase, 0, EGL_SUCCESS }, sl@0: { EContentUpdateCase, 0, EGL_SUCCESS }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_ENDPOINT_READY_NOK, EGL_TRUE }, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS }, sl@0: { ETerminateCase, 0, EGL_SUCCESS }, sl@0: { EFinishedCase } sl@0: }, sl@0: }, sl@0: { sl@0: TESTIDS("543C"), sl@0: CASETITLE("Functional: Positive: eglGetEndpointAttribNOK with Valid Parameters: Two endpoints, check EGL_ENDPOINT_READY_NOK returns EGL_TRUE for one but not other endpoint"), sl@0: SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow), sl@0: { sl@0: { EInitializeCase, 0, EGL_SUCCESS }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 0, EStandardSurface }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 1, EUnalignedPixelSizeSurface }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS, 1 }, sl@0: { EDrawContentCase, 0, EGL_SUCCESS }, sl@0: { EContentUpdateCase, 0, EGL_SUCCESS }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_ENDPOINT_READY_NOK, EGL_TRUE }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 1, 0, EGL_ENDPOINT_READY_NOK, EGL_FALSE }, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS }, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS, 1 }, sl@0: { ETerminateCase, 0, EGL_SUCCESS }, sl@0: { EFinishedCase } sl@0: }, sl@0: }, sl@0: { sl@0: TESTIDS("543D"), sl@0: CASETITLE("Functional: Positive: eglGetEndpointAttribNOK with Valid Parameters: check that EGL_DELAY_NOK returns 0 for a new endpoint"), sl@0: SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow), sl@0: { sl@0: { EInitializeCase, 0, EGL_SUCCESS }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 0, EStandardSurface }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS }, sl@0: { EDrawContentCase, 0, EGL_SUCCESS }, sl@0: { EContentUpdateCase, 0, EGL_SUCCESS }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 0 }, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS }, sl@0: { ETerminateCase, 0, EGL_SUCCESS }, sl@0: { EFinishedCase } sl@0: }, sl@0: }, sl@0: // SetEndpointAttribute tests. sl@0: { sl@0: TESTIDS("544A"), sl@0: CASETITLE("Functional: Positive: eglSetEndpointAttribNOK with Valid Parameters: set EGL_DELAY_NOK"), sl@0: SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow), sl@0: { sl@0: { EInitializeCase, 0, EGL_SUCCESS }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 0, EStandardSurface }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS }, sl@0: { EDrawContentCase, 0, EGL_SUCCESS }, sl@0: { EContentUpdateCase, 0, EGL_SUCCESS }, sl@0: { ESetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 }, sl@0: // Check that we can set a relatively large value, 250 ms, and that it remains. sl@0: { ESetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 250000 }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 250000 }, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS }, sl@0: { ETerminateCase, 0, EGL_SUCCESS }, sl@0: { EFinishedCase } sl@0: }, sl@0: }, sl@0: { sl@0: TESTIDS("544B"), sl@0: CASETITLE("Functional: Positive: eglSetEndpointAttribNOK with Valid Parameters: set EGL_DELAY_NOK, then set again to a different value"), sl@0: SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow), sl@0: { sl@0: { EInitializeCase, 0, EGL_SUCCESS }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 0, EStandardSurface }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS }, sl@0: { ESetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 }, sl@0: { ESetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 208 }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 208 }, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS }, sl@0: { ETerminateCase, 0, EGL_SUCCESS }, sl@0: { EFinishedCase } sl@0: }, sl@0: }, sl@0: { sl@0: TESTIDS("544C"), sl@0: CASETITLE("Functional: Positive: eglSetEndpointAttribNOK with Valid Parameters: set EGL_DELAY_NOK, then with draw/update between set and get, then set again"), sl@0: SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow), sl@0: { sl@0: { EInitializeCase, 0, EGL_SUCCESS }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 0, EStandardSurface }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS }, sl@0: { ESetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 }, sl@0: { EDrawContentCase, 0, EGL_SUCCESS }, sl@0: { EContentUpdateCase, 0, EGL_SUCCESS }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 }, sl@0: { ESetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 208 }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 208 }, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS }, sl@0: { ETerminateCase, 0, EGL_SUCCESS }, sl@0: { EFinishedCase } sl@0: }, sl@0: }, sl@0: { sl@0: TESTIDS("544D"), sl@0: CASETITLE("Functional: Positive: eglSetEndpointAttribNOK with Valid Parameters: set EGL_DELAY_NOK on two endpoints, with different values"), sl@0: SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow), sl@0: { sl@0: { EInitializeCase, 0, EGL_SUCCESS }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 0, EStandardSurface }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 1, EUnalignedPixelSizeSurface }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS, 0, 0 }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS, 1, 1 }, sl@0: { ESetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 }, sl@0: { ESetAttribCase, 0, EGL_SUCCESS, 1, 0, EGL_DELAY_NOK, 208 }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 1, 0, EGL_DELAY_NOK, 208 }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 }, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS, 1, 1 }, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS, 0, 0 }, sl@0: { ETerminateCase, 0, EGL_SUCCESS }, sl@0: { EFinishedCase } sl@0: }, sl@0: }, sl@0: { sl@0: TESTIDS("544E"), sl@0: CASETITLE("Functional: Positive: eglSetEndpointAttribNOK with Valid Parameters: set EGL_DELAY_NOK on two endpoints, with different values, and swapping buffers between"), sl@0: SurfaceTypes2(ESurfTypeRaw, ESurfTypeEglWindow), sl@0: { sl@0: { EInitializeCase, 0, EGL_SUCCESS }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 0, EStandardSurface }, sl@0: { ECreateSurfaceCase, 0, EGL_SUCCESS, 1, EUnalignedPixelSizeSurface }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS, 0, 0 }, sl@0: { ECreateEndpointCase, 0, EGL_SUCCESS, 1, 1 }, sl@0: { ESetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 }, sl@0: { ESetAttribCase, 0, EGL_SUCCESS, 1, 0, EGL_DELAY_NOK, 208 }, sl@0: { EDrawContentCase, 0, EGL_SUCCESS }, sl@0: { EContentUpdateCase, 0, EGL_SUCCESS }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 1, 0, EGL_DELAY_NOK, 208 }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_DELAY_NOK, 100 }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 1, 0, EGL_ENDPOINT_READY_NOK, EGL_FALSE }, sl@0: { EGetAttribCase, 0, EGL_SUCCESS, 0, 0, EGL_ENDPOINT_READY_NOK, EGL_TRUE }, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS, 1, 1 }, sl@0: { EDestroyEndpointCase, 0, EGL_SUCCESS, 0, 0 }, sl@0: { ETerminateCase, 0, EGL_SUCCESS }, sl@0: { EFinishedCase } sl@0: }, sl@0: }, sl@0: }; sl@0: sl@0: static const TTestCases KTestCases[] = sl@0: { sl@0: TestCase(KAttribPositiveCases), sl@0: TestCase(KAttribBadParameterCases), sl@0: }; sl@0: sl@0: const TInt KNumberTestCases = sizeof(KTestCases) / sizeof(KTestCases[0]); sl@0: sl@0: CEglTest_LocalTestStep_EndpointAttrib::CEglTest_LocalTestStep_EndpointAttrib(): sl@0: CEgltest_Local_Engine(KTestCases, KNumberTestCases) sl@0: { sl@0: }