sl@0: // Copyright (c) 2010 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: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: */ sl@0: sl@0: #include "egltest_surfacescaling.h" sl@0: sl@0: #include // for ASSERT macros sl@0: #include sl@0: #include "egltestcommoninisettings.h" sl@0: sl@0: //We are restricted by the screen comparison utility that requires images to be EColor16MU sl@0: const TDisplayMode KTestSourceDisplayMode = EColor16MU; sl@0: sl@0: CEglTest_SurfaceScalingBase::~CEglTest_SurfaceScalingBase() sl@0: { sl@0: CleanAll(); sl@0: delete iImageComparison; sl@0: delete iScreenDevice; sl@0: CloseWindow(); sl@0: CloseWsSession(); sl@0: } sl@0: sl@0: TVerdict CEglTest_SurfaceScalingBase::doTestStepPreambleL() sl@0: { sl@0: TVerdict verdict = CEglTestStep::doTestStepPreambleL(); sl@0: sl@0: INFO_PRINTF1(_L("doTestStepPreambleL() - Initialise surface scaling test settings...")); sl@0: if(!CheckForExtensionL(KEGL_NOK_surface_scaling)) sl@0: { sl@0: ERR_PRINTF1(_L("KEGL_NOK_surface_scaling not supported!")); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: //retrieve the pointers to the EGL surface scaling extension functions sl@0: iPfnEglQuerySurfaceScalingCapabilityNOK = reinterpret_cast (eglGetProcAddress("eglQuerySurfaceScalingCapabilityNOK")); sl@0: iPfnEglSetSurfaceScalingNOK = reinterpret_cast (eglGetProcAddress("eglSetSurfaceScalingNOK")); sl@0: if(!iPfnEglQuerySurfaceScalingCapabilityNOK) sl@0: { sl@0: ERR_PRINTF1(_L(" Cannot retrieve address of the \"eglQuerySurfaceScalingCapabilityNOK\" function")); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: if(!iPfnEglSetSurfaceScalingNOK) sl@0: { sl@0: ERR_PRINTF1(_L(" Cannot retrieve address of the \"eglSetSurfaceScalingNOK\" function")); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: //retrieve surface scaling ini settings sl@0: CIniData* iniData = CIniData::NewL(KConfigFileName); sl@0: CleanupStack::PushL(iniData); sl@0: sl@0: _LIT(KSectionSurfaceScaling, "SurfaceScaling"); sl@0: _LIT(KKeyAllScalable, "AllScalable"); sl@0: sl@0: TPtrC scalable; sl@0: if(!iniData->FindVar(KSectionSurfaceScaling,KKeyAllScalable,scalable)) sl@0: { sl@0: ERR_PRINTF3(_L(" Cannot retrieve section:%S key:%S"), &KSectionSurfaceScaling, &KKeyAllScalable); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: iAllScalable = (scalable.FindF( _L("true"))==KErrNotFound)? EFalse : ETrue; sl@0: INFO_PRINTF1(_L(" ************************************************************************")); sl@0: INFO_PRINTF1(_L(" **** The test will be run in following configuration: ")); sl@0: INFO_PRINTF2(_L(" **** All window surfaces scalable: %S"), &scalable); sl@0: INFO_PRINTF1(_L(" ************************************************************************")); sl@0: CleanupStack::PopAndDestroy(iniData); sl@0: sl@0: //Initiate a window server session and create a window group sl@0: OpenWsSessionL(KDefaultWindowGroupId); sl@0: sl@0: //Create a Screen Device sl@0: const TInt screen0 = 0; sl@0: iScreenDevice = new(ELeave) CWsScreenDevice(iWsSession); sl@0: User::LeaveIfError(iScreenDevice->Construct(screen0)); sl@0: sl@0: // get full screen size sl@0: TPixelsAndRotation sizeAndRotation; sl@0: iScreenDevice->GetDefaultScreenSizeAndRotation(sizeAndRotation); sl@0: iScreenSize = sizeAndRotation.iPixelSize; sl@0: sl@0: //Create the image comparison tool from the screen device as required by most tests sl@0: iImageComparison = CTGraphicsScreenComparison::NewL(*iScreenDevice); sl@0: sl@0: return verdict; sl@0: } sl@0: sl@0: TVerdict CEglTest_SurfaceScalingBase::doTestStepPostambleL() sl@0: { sl@0: INFO_PRINTF1(_L("doTestStepPostambleL() - Cleaning up")); sl@0: sl@0: // cleanup egltest framework stuff sl@0: CleanAll(); sl@0: sl@0: // cleanup member variables sl@0: delete iImageComparison; sl@0: iImageComparison = NULL; sl@0: delete iScreenDevice; sl@0: iScreenDevice = NULL; sl@0: sl@0: // close window and wserver session sl@0: CloseWindow(); sl@0: CloseWsSession(); sl@0: sl@0: return CEglTestStep::doTestStepPostambleL(); sl@0: } sl@0: sl@0: void CEglTest_SurfaceScalingBase::CreateAndActivateWindowL(const TSize& aWindowSize) sl@0: { sl@0: ConstructWindowL(iWindow, aWindowSize); sl@0: } sl@0: sl@0: void CEglTest_SurfaceScalingBase::CloseWindow() sl@0: { sl@0: iWindow.Close(); sl@0: } sl@0: sl@0: //check if border color matches with expected values sl@0: void CEglTest_SurfaceScalingBase::CheckBorderColorL(EGLint aExpectedRedChannelColor, EGLint aExpectedBlueChannelColor, EGLint aExpectedGreenChannelColor) sl@0: { sl@0: EGLint value = 0xffff; //set color channel to some arbitrary number sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, &value)); sl@0: ASSERT_EQUALS(value, aExpectedRedChannelColor); sl@0: sl@0: value = 0xffff; //set color channel to some arbitrary number sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, &value)); sl@0: ASSERT_EQUALS(value, aExpectedGreenChannelColor); sl@0: sl@0: value = 0xffff; //set color channel to some arbitrary number sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, &value)); sl@0: ASSERT_EQUALS(value, aExpectedBlueChannelColor); sl@0: } sl@0: sl@0: //check if scaling attributes match with expected values sl@0: void CEglTest_SurfaceScalingBase::CheckScalingAttributesL(EGLint aExpectedSurfaceWidth, EGLint aExpectedSurfaceHeight, EGLint aExpectedExtentWidth, EGLint aExpectedExtentHeight, EGLint aExpectedOffsetX, EGLint aExpectedOffsetY) sl@0: { sl@0: EGLint value = 0xffff; //set initial value to some arbitrary number sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_WIDTH, &value)); sl@0: ASSERT_EQUALS(value, aExpectedSurfaceWidth); sl@0: sl@0: value = 0xffff; //set initial value to some arbitrary number sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_HEIGHT, &value)); sl@0: ASSERT_EQUALS(value, aExpectedSurfaceHeight); sl@0: sl@0: value = 0xffff; //set initial value to some arbitrary number sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, &value)); sl@0: ASSERT_EQUALS(value, aExpectedExtentWidth); sl@0: sl@0: value = 0xffff; //set initial value to some arbitrary number sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, &value)); sl@0: ASSERT_EQUALS(value, aExpectedExtentHeight); sl@0: sl@0: value = 0xffff; //set initial value to some arbitrary number sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, &value)); sl@0: ASSERT_EQUALS(value, aExpectedOffsetX); sl@0: sl@0: value = 0xffff; //set initial value to some arbitrary number sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, &value)); sl@0: ASSERT_EQUALS(value, aExpectedOffsetY); sl@0: } sl@0: sl@0: /* sl@0: Simple create bitmap function to initialise a rectangular bitmap in four simple colours plus borders sl@0: --------------------------- sl@0: ¦ borderTop ¦ sl@0: ¦ ----------------- ¦ sl@0: ¦ b. ¦ ¦ ¦ b. ¦ sl@0: ¦ ¦ 1 ¦ 2 ¦ ¦ sl@0: ¦ L ¦ ¦ ¦ R ¦ sl@0: ¦ e ¦--------¦--------¦ i ¦ sl@0: ¦ f ¦ ¦ ¦ g ¦ sl@0: ¦ t ¦ 3 ¦ 4 ¦ h ¦ sl@0: ¦ ¦ ¦ ¦ t ¦ sl@0: ¦ ----------------- ¦ sl@0: ¦ borderBottom ¦ sl@0: --------------------------- sl@0: */ sl@0: CFbsBitmap* CEglTest_SurfaceScalingBase::CreateBitmapLC(const TSize& aSize, TInt aBorderTop, TInt aBorderBottom, TInt aBorderLeft, TInt aBorderRight, const TRgb& aBorderColor) sl@0: { sl@0: // create the bitmap to the requested size (DisplayMode set to default value) sl@0: CFbsBitmap* bitmap = new(ELeave) CFbsBitmap(); sl@0: CleanupStack::PushL(bitmap); sl@0: User::LeaveIfError(bitmap->Create(aSize,KTestSourceDisplayMode)); sl@0: TEST(bitmap->SizeInPixels().iHeight == aSize.iHeight); sl@0: TEST(bitmap->SizeInPixels().iWidth == aSize.iWidth); sl@0: sl@0: //Create a device and context for the purpose of generating the bitmap which will be the sl@0: //master reference used in the test sl@0: CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmap); sl@0: CleanupStack::PushL(bitmapDevice); sl@0: CFbsBitGc* bitmapGc = CFbsBitGc::NewL(); sl@0: CleanupStack::PushL(bitmapGc); sl@0: bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN); sl@0: bitmapGc->Activate(bitmapDevice); sl@0: sl@0: // First off, set the whole bitmap to the border colour sl@0: bitmapGc->SetBrushColor(aBorderColor); sl@0: bitmapGc->SetPenColor(aBorderColor); sl@0: bitmapGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: bitmapGc->DrawRect(aSize); sl@0: sl@0: // Set each individual quadrant to a different arbitrary colour sl@0: const TInt height = aSize.iHeight; sl@0: const TInt width = aSize.iWidth; sl@0: const TInt quadrantHeight = (height - aBorderTop - aBorderBottom) / 2; sl@0: const TInt quadrantWidth = (width - aBorderLeft - aBorderRight) / 2; sl@0: sl@0: // quadrant 1 - Colour KRgbMagenta sl@0: TRect rect = TRect(TPoint(aBorderLeft, aBorderTop), TSize(quadrantWidth, quadrantHeight)); sl@0: bitmapGc->SetBrushColor(KRgbMagenta); sl@0: bitmapGc->SetPenColor(KRgbMagenta); sl@0: bitmapGc->DrawRect(rect); sl@0: sl@0: // quadrant 2 - Colour KRgbCyan sl@0: rect = TRect(TPoint(aBorderLeft+quadrantWidth, aBorderTop), TSize(quadrantWidth, quadrantHeight)); sl@0: bitmapGc->SetBrushColor(KRgbCyan); sl@0: bitmapGc->SetPenColor(KRgbCyan); sl@0: bitmapGc->DrawRect(rect); sl@0: sl@0: // quadrant 3 - Colour KRgbYellow sl@0: rect = TRect(TPoint(aBorderLeft, aBorderTop+quadrantHeight), TSize(quadrantWidth, quadrantHeight)); sl@0: bitmapGc->SetBrushColor(KRgbYellow); sl@0: bitmapGc->SetPenColor(KRgbYellow); sl@0: bitmapGc->DrawRect(rect); sl@0: sl@0: // quadrant 4 - Colour KRgbDarkGreen sl@0: rect = TRect(TPoint(aBorderLeft+quadrantWidth, aBorderTop+quadrantHeight), TSize(quadrantWidth, quadrantHeight)); sl@0: bitmapGc->SetBrushColor(KRgbDarkGreen); sl@0: bitmapGc->SetPenColor(KRgbDarkGreen); sl@0: bitmapGc->DrawRect(rect); sl@0: sl@0: //clean-up sl@0: CleanupStack::PopAndDestroy(2, bitmapDevice); sl@0: return bitmap; sl@0: } sl@0: sl@0: void CEglTest_SurfaceScalingBase::WritePixelsToSurfaceL(const CFbsBitmap& aBitmap) sl@0: { sl@0: // Mind the fact that CFbsBitmap and VGImages use different coordinates origin sl@0: const TSize bitmapSize = aBitmap.SizeInPixels(); sl@0: TUint8* address = reinterpret_cast(aBitmap.DataAddress()); sl@0: const TInt stride = aBitmap.DataStride(); sl@0: address += (bitmapSize.iHeight - 1) * stride; sl@0: sl@0: // copy pixel data to the drawing surface sl@0: vgWritePixels(address, -stride, KDefaultSurfaceFormat,0,0, bitmapSize.iWidth, bitmapSize.iHeight); sl@0: ASSERT_TRUE(vgGetError()==VG_NO_ERROR); sl@0: sl@0: // force all outstanding requests on the current context to complete sl@0: vgFinish(); sl@0: iWsSession.Finish(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0651 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Choose a suitable extent to test that specified border colours are correct. sl@0: sl@0: @SYMTestActions sl@0: For a number of different situations, do the following: sl@0: 1. Create a window of known size sl@0: 2. Create a fixed size surface, filled in with a predefined bitmap sl@0: 3. Draw the surface onto the window for a set extent and border colour sl@0: 4. Compare window content and border against a reference bitmap containing expected values. sl@0: sl@0: @SYMTestExpectedResults sl@0: The window content matches the independently created reference bitmap in each situation sl@0: */ sl@0: TVerdict CEglTest_SurfaceScaling_Positive::doTestStepL() sl@0: { sl@0: SetTestStepID(_L("GRAPHICS-EGL-0651")); sl@0: SetTestStepName(_L("GRAPHICS-EGL-0651")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScaling_Positive::doTestStepL started....")); sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects sl@0: iEglSess->InitializeL(); sl@0: sl@0: // NOTE: Borders depend on what you set as extent, offset, window and surface sl@0: // Care should be taken when choosing size values, better to use even numbers sl@0: // (CreateBitmap splits rectangle in four, so we don't want a pixel mismatch there) sl@0: for (TInt index=1; index<=17; index++) sl@0: { sl@0: // Set some default values which are used in most cases sl@0: iWindowWidth = iWindowHeight = 200; sl@0: iBorderColor = TRgb(0,0,0); sl@0: iBorderTop = iBorderBottom = iBorderLeft = iBorderRight = 0; sl@0: sl@0: switch(index) sl@0: { sl@0: case 1: sl@0: // surface scaled to same window size with no border sl@0: iSurfaceWidth = 100; iSurfaceHeight = 50; sl@0: iExtentWidth = 200; iExtentHeight = 200; sl@0: iOffsetX = 0; iOffsetY = 0; sl@0: break; sl@0: case 2: sl@0: // surface scaled to half the window size with border top sl@0: iSurfaceWidth = 100; iSurfaceHeight = 50; sl@0: iExtentWidth = 200; iExtentHeight = 100; sl@0: iOffsetX = 0; iOffsetY = 100; sl@0: iBorderColor = TRgb(0,0,0); // arbitrary border colour sl@0: iBorderTop = 100; sl@0: break; sl@0: case 3: sl@0: // surface scaled to half the window size with border bottom sl@0: iSurfaceWidth = 100; iSurfaceHeight = 50; sl@0: iExtentWidth = 200; iExtentHeight = 100; sl@0: iOffsetX = 0; iOffsetY = 0; sl@0: iBorderColor = TRgb(128,0,255); // arbitrary border colour sl@0: iBorderBottom = 100; sl@0: break; sl@0: case 4: sl@0: // surface scaled to half the window size with border top and bottom sl@0: iSurfaceWidth = 100; iSurfaceHeight = 50; sl@0: iExtentWidth = 200; iExtentHeight = 100; sl@0: iOffsetX = 0; iOffsetY = 50; sl@0: iBorderColor = TRgb(128,0,0); // arbitrary border colour sl@0: iBorderTop = 50; iBorderBottom = 50; sl@0: break; sl@0: case 5: sl@0: // surface scaled to half the window size with border left sl@0: iSurfaceWidth = 100; iSurfaceHeight = 50; sl@0: iExtentWidth = 100; iExtentHeight = 200; sl@0: iOffsetX = 100; iOffsetY = 0; sl@0: iBorderColor = TRgb(96,96,96); // arbitrary border colour sl@0: iBorderLeft = 100; sl@0: break; sl@0: case 6: sl@0: // surface scaled to half the window size with border right sl@0: iSurfaceWidth = 100; iSurfaceHeight = 50; sl@0: iExtentWidth = 100; iExtentHeight = 200; sl@0: iOffsetX = 0; iOffsetY = 0; sl@0: iBorderColor = TRgb(192,192,192); // arbitrary border colour sl@0: iBorderRight = 100; sl@0: break; sl@0: case 7: sl@0: // surface scaled to half the window size with border left and right sl@0: iSurfaceWidth = 100; iSurfaceHeight = 50; sl@0: iExtentWidth = 100; iExtentHeight = 200; sl@0: iOffsetX = 50; iOffsetY = 0; sl@0: iBorderColor = TRgb(0,0,0); // arbitrary border colour sl@0: iBorderLeft = 50; iBorderRight = 50; sl@0: break; sl@0: case 8: sl@0: // surface scaled in different proportions in width and height, with borders sl@0: iSurfaceWidth = 100; iSurfaceHeight = 50; sl@0: iExtentWidth = 190; iExtentHeight = 10; sl@0: iOffsetX = 5; iOffsetY = 95; sl@0: iBorderColor = TRgb(240,240,240); // arbitrary border colour sl@0: iBorderTop = 95; iBorderBottom = 95; iBorderLeft = 5; iBorderRight = 5; sl@0: break; sl@0: case 9: sl@0: // surface scaled to double the window height size, surface cropped with no borders sl@0: iSurfaceWidth = 100; iSurfaceHeight = 50; sl@0: iExtentWidth = 400; iExtentHeight = 200; sl@0: iOffsetX = 0; iOffsetY = 0; sl@0: break; sl@0: case 10: sl@0: // surface scaled to double the window width and height size, surface cropped with no borders sl@0: iSurfaceWidth = 100; iSurfaceHeight = 50; sl@0: iExtentWidth = 400; iExtentHeight = 400; sl@0: iOffsetX = 0; iOffsetY = 0; sl@0: break; sl@0: case 11: sl@0: // surface scaled to double the window width and height size, surface cropped with borders top and left sl@0: iSurfaceWidth = 100; iSurfaceHeight = 50; sl@0: iExtentWidth = 400; iExtentHeight = 400; sl@0: iOffsetX = 100; iOffsetY = 100; sl@0: iBorderColor = TRgb(255,128,255); // arbitrary border colour sl@0: iBorderTop = 100; iBorderLeft = 100; sl@0: break; sl@0: case 12: sl@0: // QnHD to full screen size sl@0: iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight; sl@0: iSurfaceWidth = 320; iSurfaceHeight = 180; sl@0: iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight; sl@0: iOffsetX = 0; iOffsetY = 0; sl@0: break; sl@0: case 13: sl@0: // QVGA to full screen size sl@0: iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight; sl@0: iSurfaceWidth = 320; iSurfaceHeight = 240; sl@0: iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight; sl@0: iOffsetX = 0; iOffsetY = 0; sl@0: break; sl@0: case 14: sl@0: // HVGA to full screen size sl@0: iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight; sl@0: iSurfaceWidth = 480; iSurfaceHeight = 320; sl@0: iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight; sl@0: iOffsetX = 0; iOffsetY = 0; sl@0: break; sl@0: case 15: sl@0: // 480x270 to full screen size sl@0: iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight; sl@0: iSurfaceWidth = 480; iSurfaceHeight = 270; sl@0: iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight; sl@0: iOffsetX = 0; iOffsetY = 0; sl@0: break; sl@0: case 16: sl@0: // VGA to full screen size sl@0: iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight; sl@0: iSurfaceWidth = 640; iSurfaceHeight = 480; sl@0: iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight; sl@0: iOffsetX = 0; iOffsetY = 0; sl@0: break; sl@0: case 17: sl@0: // WVGA to full screen size sl@0: iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight; sl@0: iSurfaceWidth = 768; iSurfaceHeight = 480; sl@0: iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight; sl@0: iOffsetX = 0; iOffsetY = 0; sl@0: break; sl@0: default: sl@0: ERR_PRINTF2(_L("Inconsistency in test code, case does not exist: %d."), index); sl@0: User::Leave(KErrNotSupported); sl@0: break; sl@0: } sl@0: sl@0: // perform the testing sl@0: doTestPartialStepL(); sl@0: } sl@0: sl@0: // clean-up sl@0: CleanAll(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_Positive::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: TVerdict CEglTest_SurfaceScaling_Positive::doTestPartialStepL() sl@0: { sl@0: INFO_PRINTF5(_L("doTestPartialStepL started with (%d,%d) fixed surface scaled to (%d,%d) extent...."), iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight); sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(iWindowWidth, iWindowHeight)); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported sl@0: sl@0: EGLint attrib_list[] = { sl@0: EGL_FIXED_WIDTH_NOK, iSurfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, iSurfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, iOffsetX, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, iOffsetY, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iExtentWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iExtentHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, iBorderColor.Red(), sl@0: EGL_BORDER_COLOR_GREEN_NOK, iBorderColor.Green(), sl@0: EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue(), sl@0: EGL_NONE}; sl@0: sl@0: // Create the window surface and the egl context and make them current sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list); sl@0: sl@0: // Create the test bitmap that will be used in the scaled surface sl@0: // NOTE: This bitmap generally does not have borders, sl@0: CFbsBitmap* testBitmap = CreateBitmapLC(TSize(iSurfaceWidth, iSurfaceHeight),0,0,0,0,TRgb(0,0,0)); sl@0: sl@0: // Copy test bitmap to drawing surface sl@0: WritePixelsToSurfaceL(*testBitmap); sl@0: sl@0: //call eglSwapBuffers sl@0: ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface())); sl@0: //Wait for the draw operation to complete sl@0: eglWaitClient(); sl@0: sl@0: // Create the reference bitmap that should be expected after the scaling sl@0: // NOTE: This bitmap may have borders sl@0: // Size could exceed that of the window, so check both extent and window sl@0: const TInt refWidth = iExtentWidth>iWindowWidth ? iExtentWidth : iWindowWidth; sl@0: const TInt refHeight = iExtentHeight>iWindowHeight ? iExtentHeight : iWindowHeight; sl@0: CFbsBitmap* refBitmap = CreateBitmapLC(TSize(refWidth, refHeight), iBorderTop, iBorderBottom, iBorderLeft, iBorderRight, iBorderColor); sl@0: sl@0: // compare window contents with expected bitmap sl@0: TInt comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), TPoint(0,0), *refBitmap, TestStepName()); sl@0: TEST(comparison==KErrNone); sl@0: INFO_PRINTF3(_L("CompareScreenImageL returns %d (expected is %d)"), comparison, KErrNone); sl@0: sl@0: /// Cleanup sl@0: CleanupStack::PopAndDestroy(2, testBitmap); // refBitmap, testBitmap sl@0: iEglSess->CleanupSurfaceAndContextL(); sl@0: CloseWindow(); sl@0: sl@0: INFO_PRINTF1(_L("....doTestPartialStepL completed!")); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0661 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Resize native window to verify target extent remains fixed. sl@0: sl@0: @SYMTestActions sl@0: 1. Create a window of known size sl@0: 2. Create a fixed size surface, filled in with a predefined bitmap sl@0: 3. Draw the surface onto the window for a set extent and border colour sl@0: 4. Repeat step 3 but increasing native window size by (1,1) pixels. sl@0: 5. Compare window content and border against a reference bitmap containing expected values. sl@0: sl@0: @SYMTestExpectedResults sl@0: The window content matches the independently created reference bitmap in each situation sl@0: */ sl@0: TVerdict CEglTest_SurfaceScaling_WindowResize::doTestStepL() sl@0: { sl@0: SetTestStepID(_L("GRAPHICS-EGL-0661")); sl@0: SetTestStepName(_L("GRAPHICS-EGL-0661")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScaling_WindowResize::doTestStepL started....")); sl@0: sl@0: // set the initial value of a square window sl@0: const TInt KWindowSize = 100; sl@0: sl@0: // surface with size and extent that matches the window size and no offset sl@0: iWindowWidth = iWindowHeight = KWindowSize; sl@0: iSurfaceWidth = iSurfaceHeight = KWindowSize; sl@0: iExtentWidth = iExtentHeight = KWindowSize; sl@0: iOffsetX = 0; iOffsetY = 0; sl@0: iBorderColor = TRgb(0x99,0xcc,0xff); // set some arbitrary colour sl@0: iBorderTop = 0; iBorderBottom = 0; iBorderLeft = 0; iBorderRight = 0; sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(iWindowWidth, iWindowHeight)); sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects sl@0: iEglSess->InitializeL(); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported sl@0: sl@0: EGLint attrib_list[] = { sl@0: EGL_FIXED_WIDTH_NOK, iSurfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, iSurfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, iOffsetX, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, iOffsetY, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iExtentWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iExtentHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, iBorderColor.Red(), sl@0: EGL_BORDER_COLOR_GREEN_NOK, iBorderColor.Green(), sl@0: EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue(), sl@0: EGL_NONE}; sl@0: sl@0: // Create the window surface and the egl context and make them current sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list); sl@0: sl@0: // Create the test bitmap that will be used in the scaled surface sl@0: // NOTE: This bitmap generally does not have borders, sl@0: CFbsBitmap* testBitmap = CreateBitmapLC(TSize(iSurfaceWidth, iSurfaceHeight),0,0,0,0,TRgb(0,0,0)); sl@0: sl@0: // Copy test bitmap to drawing surface sl@0: WritePixelsToSurfaceL(*testBitmap); sl@0: sl@0: // Start doing iterations by increasing native window size. sl@0: INFO_PRINTF1(_L("Start increasing native window size by (1,1)...")); sl@0: iWindowWidth=1; sl@0: iWindowHeight=1; sl@0: while(iWindowWidth<=(KWindowSize*2) && iWindowHeight<=(KWindowSize*2)) sl@0: { sl@0: // Note that borders will appear while window size is bigger than extent sl@0: // - iSurfaceWidth/iSurfaceHeight - unmodified sl@0: // - iExtentWidth/iExtentHeight - unmodified sl@0: // - iOffsetX/iOffsetY - unmodified sl@0: // Set up expected values for the border sl@0: iBorderTop = 0; iBorderLeft = 0; sl@0: iBorderBottom = iExtentHeightCleanupSurfaceAndContextL(); sl@0: CleanAll(); sl@0: CloseWindow(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_WindowResize::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: TVerdict CEglTest_SurfaceScaling_WindowResize::doTestPartialStepL() sl@0: { sl@0: INFO_PRINTF3(_L("doTestPartialStepL started for native window size of (%d, %d)...."), iWindowWidth, iWindowHeight); sl@0: sl@0: // resize may be effective only after swapbuffers sl@0: ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface())); sl@0: ASSERT_EGL_TRUE(eglWaitClient()); sl@0: sl@0: //check all expected values sl@0: CheckScalingAttributesL(iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight, iOffsetX, iOffsetY); sl@0: CheckBorderColorL(iBorderColor.Red(), iBorderColor.Blue(), iBorderColor.Green()); sl@0: sl@0: // Create the reference bitmap that should be expected after the window resize sl@0: // NOTE: This bitmap may have borders sl@0: // Size could exceed that of the window, so check both extent and window sl@0: const TInt refWidth = iExtentWidth>iWindowWidth ? iExtentWidth : iWindowWidth; sl@0: const TInt refHeight = iExtentHeight>iWindowHeight ? iExtentHeight : iWindowHeight; sl@0: CFbsBitmap* refBitmap = CreateBitmapLC(TSize(refWidth, refHeight), iBorderTop, iBorderBottom, iBorderLeft, iBorderRight, iBorderColor); sl@0: sl@0: // compare window contents with expected bitmap sl@0: TInt comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), TPoint(0,0), *refBitmap, TestStepName()); sl@0: TEST(comparison==KErrNone); sl@0: INFO_PRINTF3(_L("CompareScreenImageL returns %d (expected is %d)"), comparison, KErrNone); sl@0: sl@0: /// Cleanup sl@0: CleanupStack::PopAndDestroy(refBitmap); sl@0: sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0668 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Create a fixed size surface and vary the extent position for a range of values. sl@0: sl@0: @SYMTestActions sl@0: 1. Create a window of known size sl@0: 2. Create a fixed size surface, filled in with a predefined bitmap sl@0: 3. Draw the surface onto the window for a set extent and border colour sl@0: 4. Repeat step 3 but increasing target extent offset by (1,1) pixels. sl@0: 5. Compare window content and border against a reference bitmap containing expected values. sl@0: sl@0: @SYMTestExpectedResults sl@0: The window content matches the independently created reference bitmap in each situation sl@0: */ sl@0: TVerdict CEglTest_SurfaceScaling_ExtentPositionChange::doTestStepL() sl@0: { sl@0: SetTestStepID(_L("GRAPHICS-EGL-0668")); sl@0: SetTestStepName(_L("GRAPHICS-EGL-0668")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScaling_ExtentPositionChange::doTestStepL started....")); sl@0: sl@0: // surface with size and extent that matches the window size and no offset sl@0: iWindowWidth = iWindowHeight = 100; sl@0: iSurfaceWidth = iExtentWidth = iWindowWidth; sl@0: iSurfaceHeight = iExtentHeight = iWindowHeight; sl@0: iOffsetX = 0; iOffsetY = 0; sl@0: iBorderColor = TRgb(0x11,0x22,0x33); // set some arbitrary colour sl@0: iBorderTop = 0; iBorderBottom = 0; iBorderLeft = 0; iBorderRight = 0; sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(iWindowWidth, iWindowHeight)); sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects sl@0: iEglSess->InitializeL(); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported sl@0: sl@0: EGLint attrib_list[] = { sl@0: EGL_FIXED_WIDTH_NOK, iSurfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, iSurfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, iOffsetX, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, iOffsetY, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iExtentWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iExtentHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, iBorderColor.Red(), sl@0: EGL_BORDER_COLOR_GREEN_NOK, iBorderColor.Green(), sl@0: EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue(), sl@0: EGL_NONE}; sl@0: sl@0: // Create the window surface and the egl context and make them current sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list); sl@0: sl@0: // Create the test bitmap that will be used in the scaled surface sl@0: // NOTE: This bitmap generally does not have borders, sl@0: CFbsBitmap* testBitmap = CreateBitmapLC(TSize(iSurfaceWidth, iSurfaceHeight),0,0,0,0,TRgb(0,0,0)); sl@0: sl@0: // Copy test bitmap to drawing surface sl@0: WritePixelsToSurfaceL(*testBitmap); sl@0: sl@0: // This test is a bit different. Since the extent remains the same, and we only change sl@0: // the offset, we create an oversized reference bitmap and compare the screen with a sl@0: // region contained within the reference bitmap sl@0: // Size is three times the extent so that it has extent size borders all around sl@0: const TInt refWidth = 3*iExtentWidth; sl@0: const TInt refHeight = 3*iExtentHeight; sl@0: iBorderTop=iBorderBottom=iBorderLeft=iBorderRight=iExtentWidth; sl@0: CFbsBitmap* refBitmap = CreateBitmapLC(TSize(refWidth, refHeight), iBorderTop, iBorderBottom, iBorderLeft, iBorderRight, iBorderColor); sl@0: sl@0: // Start doing iterations by increasing target extent offset sl@0: INFO_PRINTF1(_L("Start increasing target extent offset size by (1,1)...")); sl@0: for (iOffsetX=-iExtentWidth,iOffsetY=-iExtentHeight; iOffsetX<=iExtentWidth&&iOffsetY<=iExtentHeight; ++iOffsetX,++iOffsetY) sl@0: { sl@0: // Note that borders will appear other than when offset is (0,0) sl@0: // - iSurfaceWidth/iSurfaceHeight - unmodified sl@0: // - iExtentWidth/iExtentHeight - unmodified sl@0: sl@0: // set new offset values sl@0: ASSERT_EGL_TRUE(iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), iOffsetX, iOffsetY, iExtentWidth, iExtentHeight)); sl@0: sl@0: // re-populate buffers with the unmodified fixed size surface content sl@0: WritePixelsToSurfaceL(*testBitmap); sl@0: sl@0: // perform the testing sl@0: doTestPartialStepL(*refBitmap); sl@0: } sl@0: sl@0: /// Cleanup sl@0: CleanupStack::PopAndDestroy(2, testBitmap); //testBitmap, refBitmap sl@0: iEglSess->CleanupSurfaceAndContextL(); sl@0: CleanAll(); sl@0: CloseWindow(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_ExtentPositionChange::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: TVerdict CEglTest_SurfaceScaling_ExtentPositionChange::doTestPartialStepL(const CFbsBitmap& aRefBitmap) sl@0: { sl@0: INFO_PRINTF3(_L("doTestPartialStepL started for offset of (%d, %d)...."), iOffsetX, iOffsetY); sl@0: sl@0: // offset change may be effective only after swapbuffers sl@0: ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface())); sl@0: ASSERT_EGL_TRUE(eglWaitClient()); sl@0: // Finish() to ensure all native window operations related to the surface complete before image comparision. sl@0: iWsSession.Finish(); sl@0: sl@0: //check all expected values sl@0: CheckScalingAttributesL(iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight, iOffsetX, iOffsetY); sl@0: CheckBorderColorL(iBorderColor.Red(), iBorderColor.Blue(), iBorderColor.Green()); sl@0: sl@0: // Prepare the offset of the reference bitmap to know what sub-region should be compared sl@0: const TInt refWidth = 3*iExtentWidth; sl@0: const TInt refHeight = 3*iExtentHeight; sl@0: TPoint bitmapOffset(refWidth-iExtentWidth-iRefBitmapOffset, refHeight-iExtentHeight-iRefBitmapOffset); sl@0: iRefBitmapOffset++; // increase offset for next iteration sl@0: sl@0: // Comparision takes into account specific region within the reference bitmap sl@0: TInt comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), bitmapOffset, aRefBitmap, TestStepName()); sl@0: TEST(comparison==KErrNone); sl@0: INFO_PRINTF3(_L("CompareScreenImageL returns %d (expected is %d)"), comparison, KErrNone); sl@0: sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0669 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Create a fixed size surface and vary the extent size for a range of values sl@0: sl@0: @SYMTestActions sl@0: 1. Create a window of known size sl@0: 2. Create a fixed size surface, filled in with a predefined bitmap sl@0: 3. Draw the surface onto the window for a set extent and border colour sl@0: 4. Repeat step 3 but increasing target extent size by (2,2) pixels. sl@0: 5. Compare window content and border against a reference bitmap containing expected values. sl@0: sl@0: @SYMTestExpectedResults sl@0: The window content matches the independently created reference bitmap in each situation sl@0: */ sl@0: TVerdict CEglTest_SurfaceScaling_ExtentSizeChange::doTestStepL() sl@0: { sl@0: SetTestStepID(_L("GRAPHICS-EGL-0669")); sl@0: SetTestStepName(_L("GRAPHICS-EGL-0669")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScaling_ExtentSizeChange::doTestStepL started....")); sl@0: sl@0: // set the initial value of a square window sl@0: const TInt KWindowSize = 100; sl@0: sl@0: // surface with size and extent that matches the window size and no offset sl@0: iWindowWidth = iWindowHeight = KWindowSize; sl@0: iSurfaceWidth = iSurfaceHeight = KWindowSize; sl@0: iExtentWidth = iExtentHeight = KWindowSize; sl@0: iOffsetX = 0; iOffsetY = 0; sl@0: iBorderColor = TRgb(0x80,0x40,0xF0); // set some arbitrary colour sl@0: iBorderTop = 0; iBorderBottom = 0; iBorderLeft = 0; iBorderRight = 0; sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(iWindowWidth, iWindowHeight)); sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects sl@0: iEglSess->InitializeL(); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported sl@0: sl@0: EGLint attrib_list[] = { sl@0: EGL_FIXED_WIDTH_NOK, iSurfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, iSurfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, iOffsetX, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, iOffsetY, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iExtentWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iExtentHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, iBorderColor.Red(), sl@0: EGL_BORDER_COLOR_GREEN_NOK, iBorderColor.Green(), sl@0: EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue(), sl@0: EGL_NONE}; sl@0: sl@0: // Create the window surface and the egl context and make them current sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list); sl@0: sl@0: // Create the test bitmap that will be used in the scaled surface sl@0: // NOTE: This bitmap generally does not have borders, sl@0: CFbsBitmap* testBitmap = CreateBitmapLC(TSize(iSurfaceWidth, iSurfaceHeight),0,0,0,0,TRgb(0,0,0)); sl@0: sl@0: // Copy test bitmap to drawing surface sl@0: WritePixelsToSurfaceL(*testBitmap); sl@0: sl@0: // Start doing iterations by increasing target extent size sl@0: // We do increments of (2,2) because the reference bitmap is simetrically split into 4 areas, so size sl@0: // of this reference bitmap should be an even number of pixels sl@0: INFO_PRINTF1(_L("Start increasing target extent size by (2,2)...")); sl@0: iExtentWidth=2; sl@0: iExtentHeight=2; sl@0: while(iExtentWidth <= (KWindowSize*2) && iExtentHeight <= (KWindowSize*2)) sl@0: { sl@0: // Note that borders will appear while extent is smaller than window sl@0: // - iSurfaceWidth/iSurfaceHeight - unmodified sl@0: // - iOffsetX/iOffsetY - unmodified sl@0: // Set up expected values for the border sl@0: iBorderTop = 0; iBorderLeft = 0; sl@0: iBorderBottom = iExtentHeightSurface(), iOffsetX, iOffsetY, iExtentWidth, iExtentHeight)); sl@0: sl@0: // re-populate buffers with the unmodified fixed size surface content sl@0: WritePixelsToSurfaceL(*testBitmap); sl@0: sl@0: // perform the testing sl@0: doTestPartialStepL(); sl@0: iExtentWidth+=2; sl@0: iExtentHeight+=2; sl@0: } sl@0: sl@0: /// Cleanup sl@0: CleanupStack::PopAndDestroy(testBitmap); sl@0: iEglSess->CleanupSurfaceAndContextL(); sl@0: CleanAll(); sl@0: CloseWindow(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_ExtentSizeChange::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: TVerdict CEglTest_SurfaceScaling_ExtentSizeChange::doTestPartialStepL() sl@0: { sl@0: INFO_PRINTF3(_L("doTestPartialStepL started for extent size of (%d, %d)...."), iExtentWidth, iExtentHeight); sl@0: sl@0: // extent change may be effective only after swapbuffers sl@0: ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface())); sl@0: ASSERT_EGL_TRUE(eglWaitClient()); sl@0: // Finish() to ensure all native window operations related to the surface complete before image comparision. sl@0: iWsSession.Finish(); sl@0: sl@0: //check all expected values sl@0: CheckScalingAttributesL(iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight, iOffsetX, iOffsetY); sl@0: CheckBorderColorL(iBorderColor.Red(), iBorderColor.Blue(), iBorderColor.Green()); sl@0: sl@0: // Create the reference bitmap that should be expected after the window resize sl@0: // NOTE: This bitmap may have borders sl@0: // Size could exceed that of the window, so check both extent and window sl@0: const TInt refWidth = iExtentWidth>iWindowWidth ? iExtentWidth : iWindowWidth; sl@0: const TInt refHeight = iExtentHeight>iWindowHeight ? iExtentHeight : iWindowHeight; sl@0: CFbsBitmap* refBitmap = CreateBitmapLC(TSize(refWidth, refHeight), iBorderTop, iBorderBottom, iBorderLeft, iBorderRight, iBorderColor); sl@0: sl@0: // compare window contents with expected bitmap sl@0: TInt comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), TPoint(0,0), *refBitmap, TestStepName()); sl@0: TEST(comparison==KErrNone); sl@0: INFO_PRINTF3(_L("CompareScreenImageL returns %d (expected is %d)"), comparison, KErrNone); sl@0: sl@0: /// Cleanup sl@0: CleanupStack::PopAndDestroy(refBitmap); sl@0: sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0670 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Check that updating surface scaling attributes is visible only after calling eglSwapBuffers sl@0: sl@0: @SYMTestActions sl@0: 1. Create a window of known size sl@0: 2. Create a fixed size surface, filled in with a predefined bitmap sl@0: 3. Draw the surface onto the window for a set extent and border colour sl@0: 4. Repeat step 3 but increasing target extent size and changing border colours sl@0: 5. Compare window content and border against a reference bitmap containing expected values sl@0: 5a. Before calling eglSwapBuffers sl@0: 5b. After callnig eglSwapBuffers sl@0: sl@0: @SYMTestExpectedResults sl@0: 5a. The window content matches the independently created reference with old values sl@0: 5b. The window content matches the independently created reference with new values sl@0: */ sl@0: TVerdict CEglTest_SurfaceScaling_SwapBuffers::doTestStepL() sl@0: { sl@0: SetTestStepID(_L("GRAPHICS-EGL-0670")); sl@0: SetTestStepName(_L("GRAPHICS-EGL-0670")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScaling_SwapBuffers::doTestStepL started....")); sl@0: sl@0: // set the initial value of a square window sl@0: const TInt KWindowSize = 200; sl@0: sl@0: // surface with size that matches the window size and no offset and extent a quarter sl@0: // of that originally positioned in the middle (so borders should be seen) sl@0: iWindowWidth = iWindowHeight = KWindowSize; sl@0: iSurfaceWidth = iSurfaceHeight = KWindowSize; sl@0: iExtentWidth = iExtentHeight = KWindowSize/4; sl@0: iOffsetX = (iWindowWidth-iExtentWidth)/2; iOffsetY = (iWindowHeight-iExtentHeight)/2; // to center the surface at the middle of the window sl@0: iBorderColor = TRgb(0xFF,0xFF,0x00); // set some arbitrary colour with blue channel to 0x00 sl@0: iBorderTop = iBorderBottom = iExtentHeightInitializeL(); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported sl@0: sl@0: EGLint attrib_list[] = { sl@0: EGL_FIXED_WIDTH_NOK, iSurfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, iSurfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, iOffsetX, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, iOffsetY, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iExtentWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iExtentHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, iBorderColor.Red(), sl@0: EGL_BORDER_COLOR_GREEN_NOK, iBorderColor.Green(), sl@0: EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue(), sl@0: EGL_NONE}; sl@0: sl@0: // Create the window surface and the egl context and make them current sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list); sl@0: sl@0: // Create the test bitmap that will be used in the scaled surface sl@0: // NOTE: This bitmap generally does not have borders, sl@0: CFbsBitmap* testBitmap = CreateBitmapLC(TSize(iSurfaceWidth, iSurfaceHeight),0,0,0,0,TRgb(0,0,0)); sl@0: sl@0: // Copy test bitmap to drawing surface sl@0: WritePixelsToSurfaceL(*testBitmap); sl@0: sl@0: // we need to update the window content for the first frame comparison inside the loop further down sl@0: ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface())); sl@0: ASSERT_EGL_TRUE(eglWaitClient()); sl@0: sl@0: // Start doing iterations changing border colours and increasing target extent size sl@0: // We do increments of (2,2) because the reference bitmap is simetrically split into 4 areas, so size sl@0: // of this reference bitmap should be an even number of pixels sl@0: INFO_PRINTF1(_L("Start changing border colours and increasing target extent size by (2,2)...")); sl@0: for (;;) sl@0: { sl@0: // re-populate buffers with the unmodified fixed size surface content sl@0: WritePixelsToSurfaceL(*testBitmap); sl@0: sl@0: // perform the testing sl@0: doTestPartialStepL(); sl@0: sl@0: // break the loop when necessary sl@0: if (iBorderColor.Blue()>=255) sl@0: break; sl@0: } sl@0: sl@0: /// Cleanup sl@0: CleanupStack::PopAndDestroy(testBitmap); sl@0: iEglSess->CleanupSurfaceAndContextL(); sl@0: CleanAll(); sl@0: CloseWindow(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_SwapBuffers::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: TVerdict CEglTest_SurfaceScaling_SwapBuffers::doTestPartialStepL() sl@0: { sl@0: INFO_PRINTF4(_L("doTestPartialStepL started for border colour (%d,%d,%d)...."), iBorderColor.Red(), iBorderColor.Green(), iBorderColor.Blue()); sl@0: sl@0: // Note that borders will appear while extent is smaller than window sl@0: // - iSurfaceWidth/iSurfaceHeight - unmodified sl@0: // - iExtentWidth/iExtentHeight - modified sl@0: // - iOffsetX/iOffsetY - modified sl@0: sl@0: // Set up new value for border blue channel, storing old ones sl@0: TRgb oldBorderColor(iBorderColor); sl@0: TInt newColorBlue = oldBorderColor.Blue() + 5; sl@0: TESTL(newColorBlue>=0 && newColorBlue<=255); sl@0: iBorderColor.SetBlue(newColorBlue); sl@0: sl@0: // Set up new values for extent/offset, storing old ones sl@0: TInt oldExtentWidth = iExtentWidth; sl@0: TInt oldExtentHeight = iExtentHeight; sl@0: iExtentWidth+=2; sl@0: iExtentHeight+=2; sl@0: iOffsetX = (iWindowWidth-iExtentWidth)/2; sl@0: iOffsetY = (iWindowHeight-iExtentHeight)/2; sl@0: sl@0: // Set up expected values for the border, storing old ones sl@0: TInt oldBorderTop = iBorderTop; sl@0: TInt oldBorderBottom = iBorderBottom; sl@0: TInt oldBorderLeft = iBorderLeft; sl@0: TInt oldBorderRight = iBorderRight; sl@0: iBorderTop = iBorderBottom = iExtentHeightSurface(), iOffsetX, iOffsetY, iExtentWidth, iExtentHeight)); sl@0: // set new border colour values sl@0: ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue())); sl@0: sl@0: // Check that values have been updated as expected sl@0: CheckScalingAttributesL(iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight, iOffsetX, iOffsetY); sl@0: CheckBorderColorL(iBorderColor.Red(), iBorderColor.Blue(), iBorderColor.Green()); sl@0: sl@0: // Check that the screen has NOT BEEN UPDATED just yet sl@0: sl@0: // Create the reference bitmap that should be expected before the extent/border changes sl@0: TInt refWidth = oldExtentWidth>iWindowWidth ? oldExtentWidth : iWindowWidth; sl@0: TInt refHeight = oldExtentHeight>iWindowHeight ? oldExtentHeight : iWindowHeight; sl@0: CFbsBitmap* oldRefBitmap = CreateBitmapLC(TSize(refWidth, refHeight), oldBorderTop, oldBorderBottom, oldBorderLeft, oldBorderRight, oldBorderColor); sl@0: sl@0: // compare screen with old reference bitmap sl@0: TInt comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), TPoint(0,0), *oldRefBitmap, TestStepName()); sl@0: TEST(comparison==KErrNone); sl@0: INFO_PRINTF3(_L("CompareScreenImageL before eglSwapBuffers returns %d (expected is %d)"), comparison, KErrNone); sl@0: sl@0: // extent/offset changes MUST be effective only after swapbuffers sl@0: ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface())); sl@0: ASSERT_EGL_TRUE(eglWaitClient()); sl@0: // Finish() to ensure all native window operations related to the surface complete before image comparision. sl@0: iWsSession.Finish(); sl@0: sl@0: //check values still are as expected sl@0: CheckScalingAttributesL(iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight, iOffsetX, iOffsetY); sl@0: CheckBorderColorL(iBorderColor.Red(), iBorderColor.Blue(), iBorderColor.Green()); sl@0: sl@0: // Create the reference bitmap that should be expected after the extent/border changes sl@0: refWidth = iExtentWidth>iWindowWidth ? iExtentWidth : iWindowWidth; sl@0: refHeight = iExtentHeight>iWindowHeight ? iExtentHeight : iWindowHeight; sl@0: CFbsBitmap* newRefBitmap = CreateBitmapLC(TSize(refWidth, refHeight), iBorderTop, iBorderBottom, iBorderLeft, iBorderRight, iBorderColor); sl@0: sl@0: // compare screen with new reference bitmap sl@0: comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), TPoint(0,0), *newRefBitmap, TestStepName()); sl@0: TEST(comparison==KErrNone); sl@0: INFO_PRINTF3(_L("CompareScreenImageL after eglSwapBuffers returns %d (expected is %d)"), comparison, KErrNone); sl@0: sl@0: /// Cleanup sl@0: CleanupStack::PopAndDestroy(2, oldRefBitmap); // oldRefBitmap, newRefBitmap sl@0: sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0652 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Check that all configs that support surface scaling also support window surfaces. sl@0: sl@0: @SYMTestActions sl@0: 1. Query number of configs sl@0: 2. Iterate through all configs and check if surface scaling is supported sl@0: 3. If surface scaling is supported, chech that it supports window surfaces and sl@0: attempt to create a fixed size window surface sl@0: 4. If surface scaling is not supported, check eglGetConfigAttrib return value and sl@0: attempt to create a fixed size window surface sl@0: sl@0: @SYMTestExpectedResults sl@0: 3. All configs that support surface scaling support window surfaces and window surface creation succeeds. sl@0: 4. If surface scaling is not supported, eglGetConfigAttrib sets value to EGL_FALSE and window surface creation fails. sl@0: */ sl@0: TVerdict CEglTest_SurfaceScaling_WindowSurface_Check::doTestStepL() sl@0: { sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScaling_WindowSurface_Check::doTestStepL")); sl@0: SetTestStepName(_L("GRAPHICS-EGL-0652")); sl@0: SetTestStepID(_L("GRAPHICS-EGL-0652")); sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(100, 100)); sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects sl@0: iEglSess->InitializeL(); sl@0: sl@0: EGLConfig matchingConfigs[KMaxEglConfigs]; sl@0: EGLint numConfigs = 0; sl@0: sl@0: EGLint attrib_list[] = { sl@0: EGL_FIXED_WIDTH_NOK, 50, sl@0: EGL_FIXED_HEIGHT_NOK, 50, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, 100, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, 100, sl@0: EGL_NONE}; sl@0: sl@0: // Query total number of configs sl@0: ASSERT_EGL_TRUE(eglGetConfigs(iDisplay, NULL, KMaxTInt, &numConfigs)); sl@0: TESTL(numConfigs >= 1 && numConfigs <= KMaxEglConfigs); sl@0: INFO_PRINTF2(_L("Found %d configs in total"), numConfigs); sl@0: sl@0: // Get all configs sl@0: ASSERT_EGL_TRUE(eglGetConfigs(iDisplay, matchingConfigs, KMaxEglConfigs, &numConfigs)); sl@0: sl@0: // Check that if surface scaling is supported in the config, then window surfaces are supported too sl@0: for(TInt i=0; iInitializeL(); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported sl@0: sl@0: // Make the fixed size surface half width and height of the window sl@0: TInt surfaceWidth = iWindow.Size().iWidth / 2; sl@0: TInt surfaceHeight = iWindow.Size().iHeight / 2; sl@0: sl@0: TInt invalidCombinationAttrNum = 6; sl@0: EGLint invalid_combination_attrib_list[][11] = { sl@0: { sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_NONE} sl@0: }; sl@0: sl@0: TInt illegalValAttrNum = 14; sl@0: EGLint illegal_value_attrib_list[][19] = { sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, -1, sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, 0xfc, sl@0: EGL_BORDER_COLOR_GREEN_NOK, 0xfd, sl@0: EGL_BORDER_COLOR_BLUE_NOK, 0xfe, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, 0, sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, 0xfc, sl@0: EGL_BORDER_COLOR_GREEN_NOK, 0xfd, sl@0: EGL_BORDER_COLOR_BLUE_NOK, 0xfe, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, -1, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, 0xfc, sl@0: EGL_BORDER_COLOR_GREEN_NOK, 0xfd, sl@0: EGL_BORDER_COLOR_BLUE_NOK, 0xfe, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, 0xfc, sl@0: EGL_BORDER_COLOR_GREEN_NOK, 0xfd, sl@0: EGL_BORDER_COLOR_BLUE_NOK, 0xfe, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, -1, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, 0xfc, sl@0: EGL_BORDER_COLOR_GREEN_NOK, 0xfd, sl@0: EGL_BORDER_COLOR_BLUE_NOK, 0xfe, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, 0, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, 0xfc, sl@0: EGL_BORDER_COLOR_GREEN_NOK, 0xfd, sl@0: EGL_BORDER_COLOR_BLUE_NOK, 0xfe, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, -1, sl@0: EGL_BORDER_COLOR_RED_NOK, 0xfc, sl@0: EGL_BORDER_COLOR_GREEN_NOK, 0xfd, sl@0: EGL_BORDER_COLOR_BLUE_NOK, 0xfe, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, 0, sl@0: EGL_BORDER_COLOR_RED_NOK, 0xfc, sl@0: EGL_BORDER_COLOR_GREEN_NOK, 0xfd, sl@0: EGL_BORDER_COLOR_BLUE_NOK, 0xfe, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, -1, sl@0: EGL_BORDER_COLOR_GREEN_NOK, 0, sl@0: EGL_BORDER_COLOR_BLUE_NOK, 0, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, 0, sl@0: EGL_BORDER_COLOR_GREEN_NOK, -1, sl@0: EGL_BORDER_COLOR_BLUE_NOK, 0, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, 0, sl@0: EGL_BORDER_COLOR_GREEN_NOK, 0, sl@0: EGL_BORDER_COLOR_BLUE_NOK, -1, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, 256, sl@0: EGL_BORDER_COLOR_GREEN_NOK, 0, sl@0: EGL_BORDER_COLOR_BLUE_NOK, 0, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, 0, sl@0: EGL_BORDER_COLOR_GREEN_NOK, 256, sl@0: EGL_BORDER_COLOR_BLUE_NOK, 0, sl@0: EGL_NONE}, sl@0: { sl@0: EGL_FIXED_WIDTH_NOK, surfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, surfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, 0, sl@0: EGL_BORDER_COLOR_GREEN_NOK, 0, sl@0: EGL_BORDER_COLOR_BLUE_NOK, 256, sl@0: EGL_NONE} sl@0: }; sl@0: sl@0: INFO_PRINTF1(_L("Calling eglCreateWindowSurface with invalid combination of Surface Scaling attributes... - only five out of six compulsary attributes specified")); sl@0: for(TInt i = 0;i < invalidCombinationAttrNum;i++) sl@0: { sl@0: EGLSurface surface = eglCreateWindowSurface(iDisplay, matchingConfigs[0], &iWindow, invalid_combination_attrib_list[i]); sl@0: TEST_EGL_ERROR(surface == EGL_NO_SURFACE, EGL_BAD_ATTRIBUTE); sl@0: } sl@0: sl@0: INFO_PRINTF1(_L("Calling eglCreateWindowSurface with illegal values for each attribute...")); sl@0: for(TInt i = 0;i < illegalValAttrNum;i++) sl@0: { sl@0: EGLSurface surface = eglCreateWindowSurface(iDisplay, matchingConfigs[0], &iWindow, illegal_value_attrib_list[i]); sl@0: TEST_EGL_ERROR(surface == EGL_NO_SURFACE, EGL_BAD_ATTRIBUTE); sl@0: } sl@0: sl@0: // clean-up sl@0: CloseWindow(); sl@0: CleanAll(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_Negative_CreateWindowSurface::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0654 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Negative test. This test is to check the return value and error code when creating sl@0: a fixed size non window surface. sl@0: sl@0: @SYMTestActions sl@0: 1. Attempt to create a pixmap with scaling attributes specified sl@0: 2. Attempt to create a pbuffer surface with scaling attributes specified sl@0: 3. Attempt to create a window surface with scaling attributes specified but sl@0: config doesn't support surface scaling sl@0: sl@0: @SYMTestExpectedResults sl@0: 1. EGL_NO_SURFACE is returned with error set to EGL_BAD_ATTRIBUTE sl@0: 2. EGL_NO_SURFACE is returned with error set to EGL_BAD_ATTRIBUTE sl@0: 3. EGL_NO_SURFACE is returned with error set to EGL_BAD_MATCH sl@0: */ sl@0: TVerdict CEglTest_SurfaceScaling_Negative_FixedSize_NonWindowSurface::doTestStepL() sl@0: { sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScaling_Negative_FixedSize_NonWindowSurface::doTestStepL")); sl@0: SetTestStepName(_L("GRAPHICS-EGL-0654")); sl@0: SetTestStepID(_L("GRAPHICS-EGL-0654")); sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(100, 100)); sl@0: sl@0: // Create bitmap sl@0: User::LeaveIfError(RFbsSession::Connect()); sl@0: CFbsBitmap* bitmap = new(ELeave) CFbsBitmap(); sl@0: CleanupStack::PushL(bitmap); sl@0: User::LeaveIfError(bitmap->Create(TSize(20, 20), EColor16MU)); sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); sl@0: iEglSess->InitializeL(); sl@0: sl@0: EGLConfig config; sl@0: EGLSurface surface = EGL_NO_SURFACE; sl@0: EGLint numConfigs = 0; sl@0: sl@0: // Use OpenVG to draw sl@0: ASSERT_EGL_TRUE(eglBindAPI(EGL_OPENVG_API)); sl@0: sl@0: const EGLint KFixedSize_surface_attrib_list[] = { sl@0: EGL_FIXED_WIDTH_NOK, 100, sl@0: EGL_FIXED_HEIGHT_NOK, 100, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, 150, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, 150, sl@0: EGL_NONE}; sl@0: sl@0: // If all window surfaces in EGL are scalable, first case must be skipped. Others still valid sl@0: TInt index = iAllScalable ? 1 : 0; sl@0: for(; index < 3; index++) sl@0: { sl@0: switch(index) sl@0: { sl@0: case 0: sl@0: INFO_PRINTF1(_L("Calling eglCreateWindowSurface with surface scaling attribute specified in a config that does not support scaling...")); sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribs_NoScaling], &config, 1, &numConfigs)); sl@0: TEST(numConfigs==1); sl@0: surface = eglCreateWindowSurface(iDisplay, config, &iWindow, KFixedSize_surface_attrib_list); sl@0: TEST_EGL_ERROR(surface == EGL_NO_SURFACE, EGL_BAD_MATCH); sl@0: break; sl@0: case 1: sl@0: INFO_PRINTF1(_L("Calling eglCreatePixmapSurface with surface scaling attribute specified...")); sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPixmapAttribsColor16MU], &config, 1, &numConfigs)); sl@0: TEST(numConfigs==1); sl@0: surface = eglCreatePixmapSurface(iDisplay, config, (NativePixmapType)bitmap, KFixedSize_surface_attrib_list); sl@0: TEST_EGL_ERROR(surface == EGL_NO_SURFACE, EGL_BAD_ATTRIBUTE); sl@0: break; sl@0: case 2: sl@0: INFO_PRINTF1(_L("Calling eglCreatePbufferSurface with surface scaling attribute specified...")); sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPBufferAttribsColor64K], &config, 1, &numConfigs)); sl@0: TEST(numConfigs==1); sl@0: surface = eglCreatePbufferSurface(iDisplay, config, KFixedSize_surface_attrib_list); sl@0: TEST_EGL_ERROR(surface == EGL_NO_SURFACE, EGL_BAD_ATTRIBUTE); sl@0: break; sl@0: } sl@0: } sl@0: sl@0: // cleanup sl@0: CleanupStack::PopAndDestroy(bitmap); sl@0: CloseWindow(); sl@0: CleanAll(); sl@0: RFbsSession::Disconnect(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_Negative_FixedSize_NonWindowSurface::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0655 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Exercising border color set by default. sl@0: sl@0: @SYMTestActions sl@0: 1. Create a fixed size EGL Window Surface without border color specified. sl@0: 2. Create a fixed size EGL Window Surface with border color specified for one channel. sl@0: 3. Create a fixed size EGL Window Surface with border color specified for two channels. sl@0: sl@0: @SYMTestExpectedResults sl@0: Retrieved border color matches to the value it has been set at surface creation, sl@0: if during the surface creation border color has not been specified it is set to black (0x0). sl@0: */ sl@0: TVerdict CEglTest_SurfaceScalingDefaultBorderColor::doTestStepL() sl@0: { sl@0: SetTestStepName(_L("GRAPHICS-EGL-0655")); sl@0: SetTestStepID(_L("GRAPHICS-EGL-0655")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScalingDefaultBorderColor::doTestStepL")); sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(100,100)); sl@0: const TInt KWindowWidth = iWindow.Size().iWidth; sl@0: const TInt KWindowHeight = iWindow.Size().iHeight; sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects sl@0: iEglSess->InitializeL(); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL (numConfigs == 1); // Abort the test if the EGL config is not supported sl@0: sl@0: // Make the fixed size surface half width and height of the window sl@0: const TInt KSurfaceWidth = KWindowWidth/2; sl@0: const TInt KSurfaceHeight = KWindowHeight/2; sl@0: sl@0: EGLint attrib_list1[] = { sl@0: EGL_FIXED_WIDTH_NOK, KSurfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, KSurfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, KWindowWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, KWindowHeight, sl@0: EGL_NONE}; sl@0: sl@0: EGLint attrib_list2[] = { sl@0: EGL_FIXED_WIDTH_NOK, KSurfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, KSurfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, KWindowWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, KWindowHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, 0xf0, sl@0: EGL_NONE}; sl@0: sl@0: EGLint attrib_list3[] = { sl@0: EGL_FIXED_WIDTH_NOK, KSurfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, KSurfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, KWindowWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, KWindowHeight, sl@0: EGL_BORDER_COLOR_BLUE_NOK, 0xf8, sl@0: EGL_BORDER_COLOR_GREEN_NOK, 0xfc, sl@0: EGL_NONE}; sl@0: sl@0: for(TInt index = 0; index < 3; index++) sl@0: { sl@0: EGLint* attrib_list = NULL; sl@0: EGLint expectedRedChannelColor = 0; sl@0: EGLint expectedGreenChannelColor = 0; sl@0: EGLint expectedBlueChannelColor = 0; sl@0: sl@0: switch(index) sl@0: { sl@0: case 0: sl@0: attrib_list = attrib_list1; sl@0: break; sl@0: case 1: sl@0: expectedRedChannelColor = 0xf0; sl@0: attrib_list = attrib_list2; sl@0: break; sl@0: case 2: sl@0: expectedBlueChannelColor = 0xf8; sl@0: expectedGreenChannelColor = 0xfc; sl@0: attrib_list = attrib_list3; sl@0: break; sl@0: } sl@0: // Create the window surface and the egl context and make them current sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list); sl@0: sl@0: // Check expected border colours sl@0: CheckBorderColorL(expectedRedChannelColor, expectedBlueChannelColor, expectedGreenChannelColor); sl@0: sl@0: // Cleanup sl@0: iEglSess->CleanupSurfaceAndContextL(); sl@0: } sl@0: sl@0: CleanAll(); sl@0: CloseWindow(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScalingDefaultBorderColor::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0656 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Modifying an existing fixed size surface border color. sl@0: sl@0: @SYMTestActions sl@0: 1. Create a fixed size EGL Window Surface with border color specified. sl@0: 2. Modify border color with the new values. sl@0: sl@0: @SYMTestExpectedResults sl@0: New color will take place only after setting new values. sl@0: */ sl@0: sl@0: TVerdict CEglTest_SurfaceScalingModifyingBorderColor::doTestStepL() sl@0: { sl@0: SetTestStepName(_L("GRAPHICS-EGL-0656")); sl@0: SetTestStepID(_L("GRAPHICS-EGL-0656")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScalingModifyingBorderColor::doTestStepL")); sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(100,100)); sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects sl@0: iEglSess->InitializeL(); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL (numConfigs == 1); // Abort the test if the EGL config is not supported sl@0: sl@0: // Make the fixed size surface half width and height of the window sl@0: const TInt KWindowWidth = iWindow.Size().iWidth; sl@0: const TInt KWindowHeight = iWindow.Size().iHeight; sl@0: const TInt KSurfaceWidth = KWindowWidth/2; sl@0: const TInt KSurfaceHeight = KWindowHeight/2; sl@0: const TInt KExtentWidth = KSurfaceWidth; sl@0: const TInt KExtentHeight = KSurfaceHeight; sl@0: const EGLint KRedChannelColor = 0x20; sl@0: const EGLint KGreenChannelColor = 0x40; sl@0: const EGLint KBlueChannelColor = 0x60; sl@0: sl@0: EGLint attrib_list[] = { sl@0: EGL_FIXED_WIDTH_NOK, KSurfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, KSurfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, KRedChannelColor, sl@0: EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor, sl@0: EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor, sl@0: EGL_NONE}; sl@0: sl@0: // Create the window surface and the egl context and make them current sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list); sl@0: sl@0: CheckBorderColorL(KRedChannelColor, KBlueChannelColor, KGreenChannelColor); sl@0: sl@0: //modify existing attributes sl@0: const EGLint KOffsetColor = 100; sl@0: ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, KRedChannelColor + KOffsetColor)); sl@0: ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor + KOffsetColor)); sl@0: ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor + KOffsetColor)); sl@0: sl@0: //check that border color has been modified now sl@0: CheckBorderColorL(KRedChannelColor+KOffsetColor, KBlueChannelColor+KOffsetColor, KGreenChannelColor+KOffsetColor); sl@0: sl@0: // Cleanup sl@0: iEglSess->CleanupSurfaceAndContextL(); sl@0: CleanAll(); sl@0: CloseWindow(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScalingModifyingBorderColor::doTestStepL completed!")); sl@0: sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0657 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Negative testing. Modifying an existing non-fixed size surface border color. sl@0: sl@0: @SYMTestActions sl@0: 1. Create a non-fixed size EGL Window Surface. sl@0: 2. Try to set border color after surface creation. sl@0: 3. Repeat steps 1-2 for pixmap and pbuffer surface sl@0: sl@0: @SYMTestExpectedResults sl@0: Setting border color has no effect. sl@0: */ sl@0: TVerdict CEglTest_SurfaceScalingModifyingBorderColorNonFixed::doTestStepL() sl@0: { sl@0: SetTestStepName(_L("GRAPHICS-EGL-0657")); sl@0: SetTestStepID(_L("GRAPHICS-EGL-0657")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScalingModifyingBorderColorNonFixed::doTestStepL")); sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(100,100)); sl@0: sl@0: const TInt KWindowWidth = iWindow.Size().iWidth; sl@0: const TInt KWindowHeight = iWindow.Size().iHeight; sl@0: const TInt KSurfaceWidth = KWindowWidth; sl@0: const TInt KSurfaceHeight = KWindowHeight; sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects sl@0: iEglSess->InitializeL(); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: sl@0: // If all window surfaces in EGL are scalable, first case must be skipped. Others still valid sl@0: TInt index = iAllScalable ? 1 : 0; sl@0: for(; index < 3; index++) sl@0: { sl@0: switch(index) sl@0: { sl@0: case 0: sl@0: // Create the non-fixed size window surface and the egl context and make them current sl@0: INFO_PRINTF1(_L("Create the non-fixed size window surface and the egl context and make them current...")); sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribs_NoScaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow); sl@0: break; sl@0: case 1: sl@0: // Create the pbuffer surface and the egl context and make them current sl@0: INFO_PRINTF1(_L("Create the pbuffer surface and the egl context and make them current...")); sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPBufferAttribsColor16MU], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); sl@0: iEglSess->CreatePbufferSurfaceAndMakeCurrentL(matchingConfigs[0], TSize(KSurfaceWidth, KSurfaceHeight)); sl@0: break; sl@0: case 2: sl@0: // Create the pixmap surface and the egl context and make them current sl@0: INFO_PRINTF1(_L("Create the pixmap surface and the egl context and make them current...")); sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPixmapAttribsColor16MU], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); sl@0: iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(TSize(KSurfaceWidth, KSurfaceHeight), EColor16MU); sl@0: break; sl@0: } sl@0: sl@0: // Set border color values to a non fixed size window (nothing should happen) sl@0: const EGLint KRedChannelColor = 0x20; sl@0: const EGLint KGreenChannelColor = 0x40; sl@0: const EGLint KBlueChannelColor = 0x60; sl@0: ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, KRedChannelColor)); sl@0: ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor)); sl@0: ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor)); sl@0: sl@0: // Check all attributes (this is a non-fixed size window) sl@0: // Note that we cannot use CheckBorderColorL because values are not updated sl@0: EGLint redChannelColor = -1; sl@0: EGLint greenChannelColor = -2; sl@0: EGLint blueChannelColor = -3; sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, &redChannelColor)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, &blueChannelColor)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, &greenChannelColor)); sl@0: TEST(redChannelColor == -1); sl@0: TEST(greenChannelColor == -2); sl@0: TEST(blueChannelColor == -3); sl@0: sl@0: // Set invalid border color values to a non fixed size window (nothing should happen) sl@0: INFO_PRINTF1(_L("Attempt to set invalid border color values to a non fixed size window...")); sl@0: ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, KRedChannelColor+256)); sl@0: ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor+256)); sl@0: ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor+256)); sl@0: sl@0: // Check all attributes (this is a non-fixed size window) sl@0: // Note that we cannot use CheckBorderColorL because values are not updated sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, &redChannelColor)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, &blueChannelColor)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, &greenChannelColor)); sl@0: TEST(redChannelColor == -1); sl@0: TEST(greenChannelColor == -2); sl@0: TEST(blueChannelColor == -3); sl@0: sl@0: // destroy surface and context sl@0: iEglSess->CleanupSurfaceAndContextL(); sl@0: } sl@0: sl@0: // Cleanup sl@0: CleanAll(); sl@0: CloseWindow(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScalingModifyingBorderColorNonFixed::doTestStepL completed!")); sl@0: sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0658 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Negative testing. Attempt to modify an existing fixed size surface border color with invalid values. sl@0: sl@0: @SYMTestActions sl@0: 1. Create a fixed size EGL Window Surface with border color specified. sl@0: 2. Try to modify border color with the negative values. sl@0: 3. Try to modify border color with the positive values greater than 255. sl@0: sl@0: @SYMTestExpectedResults sl@0: Attempt to modify the border color with the new values will fail with error code EGL_BAD_ATTRIBUTE. sl@0: */ sl@0: TVerdict CEglTest_SurfaceScalingModifyingInvalidBorderColor::doTestStepL() sl@0: { sl@0: SetTestStepName(_L("GRAPHICS-EGL-0658")); sl@0: SetTestStepID(_L("GRAPHICS-EGL-0658")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScalingModifyingInvalidBorderColor::doTestStepL")); sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(100,100)); sl@0: const TInt KWindowWidth = iWindow.Size().iWidth; sl@0: const TInt KWindowHeight = iWindow.Size().iHeight; sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects sl@0: iEglSess->InitializeL(); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL (numConfigs == 1); // Abort the test if the EGL config is not supported sl@0: sl@0: // Make the fixed size surface half width and height of the window sl@0: const TInt KSurfaceWidth = KWindowWidth/2; sl@0: const TInt KSurfaceHeight = KWindowHeight/2; sl@0: const EGLint KRedChannelColor = 0x20; sl@0: const EGLint KGreenChannelColor = 0x40; sl@0: const EGLint KBlueChannelColor = 0x60; sl@0: sl@0: EGLint attrib_list[] = { sl@0: EGL_FIXED_WIDTH_NOK, KSurfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, KSurfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, 0, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, KWindowWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, KWindowHeight, sl@0: EGL_BORDER_COLOR_RED_NOK, KRedChannelColor, sl@0: EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor, sl@0: EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor, sl@0: EGL_NONE}; sl@0: sl@0: sl@0: // Create the window surface and the egl context and make them current sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list); sl@0: sl@0: // check initial values match sl@0: CheckBorderColorL(KRedChannelColor, KBlueChannelColor, KGreenChannelColor); sl@0: sl@0: //modify existing attributes with negative value sl@0: INFO_PRINTF1(_L("Attempt to set negative border color values...")); sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, -KRedChannelColor) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_PARAMETER); sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, -KBlueChannelColor) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_PARAMETER); sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, -KGreenChannelColor) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_PARAMETER); sl@0: sl@0: //check that border color has not been modified sl@0: CheckBorderColorL(KRedChannelColor, KBlueChannelColor, KGreenChannelColor); sl@0: sl@0: //modify existing attributes with very big positive value sl@0: INFO_PRINTF1(_L("Attempt to set border color values that are too big...")); sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, KRedChannelColor + 256) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_PARAMETER); sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor + 256) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_PARAMETER); sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor + 256) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_PARAMETER); sl@0: sl@0: //check that border color has not been modified sl@0: CheckBorderColorL(KRedChannelColor, KBlueChannelColor, KGreenChannelColor); sl@0: sl@0: /// Cleanup sl@0: iEglSess->CleanupSurfaceAndContextL(); sl@0: CleanAll(); sl@0: CloseWindow(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScalingModifyingInvalidBorderColor::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0659 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Negative testing. Attempt to modify an extent with eglSurfaceAttrib() after surface has been created. sl@0: sl@0: @SYMTestActions sl@0: 1. Create a fixed size EGL Window Surface. sl@0: 2. Try to modify a surface extent parameters with arbitrary values via eglSurfaceAttrib(). sl@0: sl@0: @SYMTestExpectedResults sl@0: Attempt to modify the extent will fail with error code EGL_BAD_ATTRIBUTE. sl@0: */ sl@0: TVerdict CEglTest_SurfaceScalingModifyingExtent::doTestStepL() sl@0: { sl@0: SetTestStepName(_L("GRAPHICS-EGL-0659")); sl@0: SetTestStepID(_L("GRAPHICS-EGL-0659")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScalingModifyingExtent::doTestStepL")); sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(100,100)); sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects sl@0: iEglSess->InitializeL(); sl@0: sl@0: INFO_PRINTF1(_L("Attempt to modify surface extent for fixed size surfaces...")); sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL (numConfigs == 1); // Abort the test if the EGL config is not supported sl@0: sl@0: const TInt KWindowWidth = iWindow.Size().iWidth; sl@0: const TInt KWindowHeight = iWindow.Size().iHeight; sl@0: const TInt KSurfaceWidth = KWindowWidth/2; sl@0: const TInt KSurfaceHeight = KWindowHeight/2; sl@0: const TInt KExtentWidth = KWindowWidth; sl@0: const TInt KExtentHeight = KWindowHeight; sl@0: const TInt KOffsetX = 10; sl@0: const TInt KOffsetY = 20; sl@0: sl@0: EGLint attrib_list[] = { sl@0: EGL_FIXED_WIDTH_NOK, KSurfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, KSurfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight, sl@0: EGL_NONE}; sl@0: sl@0: // Create the window surface and the egl context and make them current sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list); sl@0: sl@0: // Invalid update - modify existing attributes with any value sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_FIXED_WIDTH_NOK, KSurfaceWidth/2) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE); sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_FIXED_HEIGHT_NOK, KSurfaceHeight/2) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE); sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth/2) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE); sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight/2) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE); sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX/2) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE); sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY/2) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE); sl@0: sl@0: // check that attributes have not been modified sl@0: CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, KOffsetX, KOffsetY); sl@0: sl@0: /// Cleanup sl@0: iEglSess->CleanupSurfaceAndContextL(); sl@0: CleanAll(); sl@0: CloseWindow(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScalingModifyingExtent::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0671 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Negative testing. Attempt to modify an extent with eglSurfaceAttrib() after surface has been created. sl@0: sl@0: @SYMTestActions sl@0: 1. Create a non fixed size EGL Window Surface. sl@0: 2. Try to modify a surface extent parameters with arbitrary values via eglSurfaceAttrib(). sl@0: 3. Repeat steps 2-3 for pixmap and pbuffer surface sl@0: sl@0: @SYMTestExpectedResults sl@0: Attempt to modify the extent will fail with error code EGL_BAD_ATTRIBUTE. sl@0: */ sl@0: TVerdict CEglTest_SurfaceScalingModifyingExtentNonFixed::doTestStepL() sl@0: { sl@0: SetTestStepName(_L("GRAPHICS-EGL-0671")); sl@0: SetTestStepID(_L("GRAPHICS-EGL-0671")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScalingModifyingExtentNonFixed::doTestStepL")); sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(100,100)); sl@0: sl@0: const TInt KWindowWidth = iWindow.Size().iWidth; sl@0: const TInt KWindowHeight = iWindow.Size().iHeight; sl@0: const TInt KSurfaceWidth = KWindowWidth; sl@0: const TInt KSurfaceHeight = KWindowHeight; sl@0: const TInt KExtentWidth = KWindowWidth; sl@0: const TInt KExtentHeight = KWindowHeight; sl@0: const TInt KOffsetX = 11; sl@0: const TInt KOffsetY = 22; sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects sl@0: iEglSess->InitializeL(); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: sl@0: // If all window surfaces in EGL are scalable, first case must be skipped. Others still valid sl@0: TInt index = iAllScalable ? 1 : 0; sl@0: for(; index < 3; index++) sl@0: { sl@0: switch(index) sl@0: { sl@0: case 0: sl@0: // Create the non-fixed size window surface and the egl context and make them current sl@0: INFO_PRINTF1(_L("Create the non-fixed size window surface and the egl context and make them current...")); sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribs_NoScaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow); sl@0: break; sl@0: case 1: sl@0: // Create the pbuffer surface and the egl context and make them current sl@0: INFO_PRINTF1(_L("Create the pbuffer surface and the egl context and make them current...")); sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPBufferAttribsColor16MU], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); sl@0: iEglSess->CreatePbufferSurfaceAndMakeCurrentL(matchingConfigs[0], TSize(KSurfaceWidth, KSurfaceHeight)); sl@0: break; sl@0: case 2: sl@0: // Create the pixmap surface and the egl context and make them current sl@0: INFO_PRINTF1(_L("Create the pixmap surface and the egl context and make them current...")); sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPixmapAttribsColor16MU], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); sl@0: iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(TSize(KSurfaceWidth, KSurfaceHeight), EColor16MU); sl@0: break; sl@0: } sl@0: sl@0: // Invalid update - modify existing attributes with any value sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_FIXED_WIDTH_NOK, KSurfaceWidth/2) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE); sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_FIXED_HEIGHT_NOK, KSurfaceHeight/2) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE); sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth/2) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE); sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight/2) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE); sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX/2) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE); sl@0: TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY/2) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE); sl@0: sl@0: // destroy surface and context sl@0: iEglSess->CleanupSurfaceAndContextL(); sl@0: } sl@0: sl@0: /// Cleanup sl@0: CleanAll(); sl@0: CloseWindow(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScalingModifyingExtentNonFixed::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0660 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Query surface attrubutes related to scaling. sl@0: sl@0: @SYMTestActions sl@0: 1. Create a non-fixed size EGL Window Surface. sl@0: 2. Query surface attributes. sl@0: sl@0: @SYMTestExpectedResults sl@0: 2. Query surface attributes succeeds and all atributes matches to the expected values. sl@0: */ sl@0: TVerdict CEglTest_SurfaceScalingQuerySurface::doTestStepL() sl@0: { sl@0: SetTestStepName(_L("GRAPHICS-EGL-0660")); sl@0: SetTestStepID(_L("GRAPHICS-EGL-0660")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScalingQuerySurface::doTestStepL")); sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(100,100)); sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects sl@0: iEglSess->InitializeL(); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL (numConfigs == 1); // Abort the test if the EGL config is not supported sl@0: sl@0: const TInt KWindowWidth = iWindow.Size().iWidth; sl@0: const TInt KWindowHeight = iWindow.Size().iHeight; sl@0: const TInt KSurfaceWidth = KWindowWidth/2; sl@0: const TInt KSurfaceHeight = KWindowHeight/2; sl@0: const TInt KExtentWidth = KWindowWidth; sl@0: const TInt KExtentHeight = KWindowHeight; sl@0: const EGLint KXOffset = 10; sl@0: const EGLint KYOffset = 20; sl@0: const EGLint KBorderColorRed = 0xa0; sl@0: const EGLint KBorderColorBlue = 0xf0; sl@0: const EGLint KBorderColorGreen = 0xfc; sl@0: sl@0: EGLint attrib_list[] = { sl@0: EGL_FIXED_WIDTH_NOK, KSurfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, KSurfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, KXOffset, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, KYOffset, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight, sl@0: EGL_BORDER_COLOR_BLUE_NOK, KBorderColorBlue, sl@0: EGL_BORDER_COLOR_GREEN_NOK, KBorderColorGreen, sl@0: EGL_BORDER_COLOR_RED_NOK, KBorderColorRed, sl@0: EGL_NONE}; sl@0: sl@0: // Create the window surface and the egl context and make them current sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list); sl@0: sl@0: INFO_PRINTF1(_L("Query surface attributes and border colour back and check expected values...")); sl@0: CheckBorderColorL(KBorderColorRed, KBorderColorBlue, KBorderColorGreen); sl@0: CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, KXOffset, KYOffset); sl@0: sl@0: INFO_PRINTF1(_L("Check EGL_FIXED_WIDTH_NOK and EGL_FIXED_HEIGHT_NOK cannot be queried...")); sl@0: EGLint surfaceFixedWidth = -1; sl@0: EGLint surfaceFixedHeight = -2; sl@0: TEST(EGL_FALSE == eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_FIXED_WIDTH_NOK, &surfaceFixedWidth)); sl@0: ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE); sl@0: TEST(EGL_FALSE == eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_FIXED_HEIGHT_NOK, &surfaceFixedHeight)); sl@0: ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE); sl@0: TEST(surfaceFixedWidth == -1); sl@0: TEST(surfaceFixedHeight == -2); sl@0: sl@0: // clean-up sl@0: iEglSess->CleanupSurfaceAndContextL(); sl@0: CloseWindow(); sl@0: CleanAll(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScalingQuerySurface::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0662 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Negative testing. Query surface attributes which are not supported by this API. sl@0: sl@0: @SYMTestActions sl@0: 1. Create a non-fixed size EGL window surface. sl@0: 2. Query surface attributes. sl@0: 3. Repeat step 2 for EGL window surface, pixmap and pbuffer surface sl@0: sl@0: @SYMTestExpectedResults sl@0: Query surface attributes will fail with error code EGL_BAD_ATTRIBUTE. sl@0: */ sl@0: TVerdict CEglTest_SurfaceScalingQuerySurfaceNonFixed::doTestStepL() sl@0: { sl@0: SetTestStepName(_L("GRAPHICS-EGL-0662")); sl@0: SetTestStepID(_L("GRAPHICS-EGL-0662")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScalingQuerySurfaceNonFixed::doTestStepL")); sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(100,100)); sl@0: sl@0: const TInt KWindowWidth = iWindow.Size().iWidth; sl@0: const TInt KWindowHeight = iWindow.Size().iHeight; sl@0: const TInt KSurfaceWidth = KWindowWidth; sl@0: const TInt KSurfaceHeight = KWindowHeight; sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects sl@0: iEglSess->InitializeL(); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: sl@0: // If all window surfaces in EGL are scalable, first case must be skipped. Others still valid sl@0: TInt index = iAllScalable ? 1 : 0; sl@0: for(; index < 3; index++) sl@0: { sl@0: switch(index) sl@0: { sl@0: case 0: sl@0: // Create the non-fixed size window surface and the egl context and make them current sl@0: INFO_PRINTF1(_L("Create the non-fixed size window surface and the egl context and make them current...")); sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribs_NoScaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow); sl@0: break; sl@0: case 1: sl@0: // Create the pbuffer surface and the egl context and make them current sl@0: INFO_PRINTF1(_L("Create the pbuffer surface and the egl context and make them current...")); sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPBufferAttribsColor16MU], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); sl@0: iEglSess->CreatePbufferSurfaceAndMakeCurrentL(matchingConfigs[0], TSize(KSurfaceWidth, KSurfaceHeight)); sl@0: break; sl@0: case 2: sl@0: // Create the pixmap surface and the egl context and make them current sl@0: INFO_PRINTF1(_L("Create the pixmap surface and the egl context and make them current...")); sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPixmapAttribsColor16MU], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); sl@0: iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(TSize(KSurfaceWidth, KSurfaceHeight), EColor16MU); sl@0: break; sl@0: } sl@0: sl@0: INFO_PRINTF1(_L("Check EGL_FIXED_WIDTH_NOK and EGL_FIXED_HEIGHT_NOK cannot be queried...")); sl@0: EGLint surfaceFixedWidth = -1; sl@0: EGLint surfaceFixedHeight = -2; sl@0: TEST(EGL_FALSE == eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_FIXED_WIDTH_NOK, &surfaceFixedWidth)); sl@0: ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE); sl@0: TEST(EGL_FALSE == eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_FIXED_HEIGHT_NOK, &surfaceFixedHeight)); sl@0: ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE); sl@0: TEST(surfaceFixedWidth == -1); sl@0: TEST(surfaceFixedHeight == -2); sl@0: sl@0: INFO_PRINTF1(_L("Check surface size is as we would expect...")); sl@0: EGLint surfaceWidth = 0; sl@0: EGLint surfaceHeight = 0; sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_WIDTH, &surfaceWidth)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_HEIGHT, &surfaceHeight)); sl@0: TEST(surfaceWidth == KWindowWidth); // non-fixed size surface sl@0: TEST(surfaceHeight == KWindowHeight); // non-fixed size surface sl@0: sl@0: INFO_PRINTF1(_L("Check scaling attributes cannot be queried...")); sl@0: EGLint extentOffsetX = -1; sl@0: EGLint extentOffsetY = -2; sl@0: EGLint extentWidth = -3; sl@0: EGLint extentHeight = -4; sl@0: EGLint borderColorBlue = -5; sl@0: EGLint borderColorRed = -6; sl@0: EGLint borderColorGreen = -7; sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, &extentOffsetX)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, &extentOffsetY)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, &extentWidth)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, &extentHeight)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, &borderColorBlue)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, &borderColorGreen)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, &borderColorRed)); sl@0: TEST(extentOffsetX == -1); sl@0: TEST(extentOffsetY == -2); sl@0: TEST(extentWidth == -3); sl@0: TEST(extentHeight == -4); sl@0: TEST(borderColorBlue == -5); sl@0: TEST(borderColorRed == -6); sl@0: TEST(borderColorGreen == -7); sl@0: sl@0: // destroy surface and context sl@0: iEglSess->CleanupSurfaceAndContextL(); sl@0: } sl@0: sl@0: // clean-up sl@0: CloseWindow(); sl@0: CleanAll(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScalingQuerySurfaceNonFixed::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0663 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Negative testing. Query surface scaling capability with invalid parameters. sl@0: sl@0: @SYMTestActions sl@0: 1. Query surface scaling capability for the different configs. sl@0: 2. Query surface scaling capability with invalid display. sl@0: 3. Query surface scaling capability with negative surface width. sl@0: 4. Query surface scaling capability with negative surface height. sl@0: 5. Query surface scaling capability with negative target width. sl@0: 6. Query surface scaling capability with negative target height. sl@0: 7. Query surface scaling capability with zero surface width. sl@0: 8. Query surface scaling capability with zero surface height. sl@0: 9. Query surface scaling capability with zero target width. sl@0: 10. Query surface scaling capability with zero target height. sl@0: sl@0: @SYMTestExpectedResults sl@0: 1. Query surface capability will fail with error code EGL_BAD_MATCH if config doesn't support scaling and succeed otherwise. sl@0: 2. Query surface capability will fail with error code EGL_BAD_DISPLAY. sl@0: 3. Query surface capability will fail with error code EGL_BAD_PARAMETER. sl@0: 4. Query surface capability will fail with error code EGL_BAD_PARAMETER. sl@0: 5. Query surface capability will fail with error code EGL_BAD_PARAMETER. sl@0: 6. Query surface capability will fail with error code EGL_BAD_PARAMETER. sl@0: 7. Query surface capability will fail with error code EGL_BAD_PARAMETER. sl@0: 8. Query surface capability will fail with error code EGL_BAD_PARAMETER. sl@0: 9. Query surface capability will fail with error code EGL_BAD_PARAMETER. sl@0: 10. Query surface capability will fail with error code EGL_BAD_PARAMETER. sl@0: */ sl@0: TVerdict CEglTest_SurfaceScalingCapability::doTestStepL() sl@0: { sl@0: SetTestStepName(_L("GRAPHICS-EGL-0663")); sl@0: SetTestStepID(_L("GRAPHICS-EGL-0663")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScalingCapability::doTestStepL")); sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); sl@0: iEglSess->InitializeL(); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[KMaxEglConfigs]; sl@0: EGLint numConfigs = 0; sl@0: sl@0: CreateAndActivateWindowL(TSize(100,100)); sl@0: sl@0: const TInt KWindowWidth = iWindow.Size().iWidth; sl@0: const TInt KWindowHeight = iWindow.Size().iHeight; sl@0: const TInt KSurfaceWidth = KWindowWidth/2; sl@0: const TInt KSurfaceHeight = KWindowHeight/2; sl@0: const EGLDisplay KInvalidDisplay = iDisplay - 100; sl@0: EGLint capability = -1; //arbitrary number beyond the existing range sl@0: EGLConfig config = -1; sl@0: sl@0: INFO_PRINTF1(_L("Calling eglGetConfigs to get configs...")); sl@0: ASSERT_EGL_TRUE(eglGetConfigs(iDisplay, matchingConfigs, KMaxEglConfigs, &numConfigs)); sl@0: for(TInt index = 0; index < numConfigs; index++) sl@0: { sl@0: EGLint value = EGL_FALSE; sl@0: ASSERT_EGL_TRUE(eglGetConfigAttrib(iDisplay, matchingConfigs[index], EGL_SURFACE_SCALING_NOK, &value)); sl@0: if(value == EGL_FALSE) sl@0: { sl@0: TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, matchingConfigs[index], KSurfaceWidth, KSurfaceHeight, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE); sl@0: TEST(capability == -1); //make sure that value has not been modified sl@0: ASSERT_EGL_ERROR(EGL_BAD_MATCH); sl@0: } sl@0: else sl@0: { sl@0: if(config == -1) sl@0: {//memorize the first config that supports scaling sl@0: config = matchingConfigs[index]; sl@0: } sl@0: ASSERT_EGL_TRUE(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, matchingConfigs[index], KSurfaceWidth, KSurfaceHeight, KWindowWidth, KWindowHeight, &capability)); sl@0: TEST((capability == EGL_SUPPORTED_NOK) || (capability == EGL_SLOW_NOK)); sl@0: capability = -1; sl@0: } sl@0: } sl@0: capability = -1; sl@0: TEST(config != -1); // make sure that at least one config supports scaling sl@0: sl@0: //invalid display sl@0: TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(KInvalidDisplay, config, KSurfaceWidth, KSurfaceHeight, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE); sl@0: TEST(capability == -1); //make sure that value has not been modified sl@0: ASSERT_EGL_ERROR(EGL_BAD_DISPLAY); sl@0: sl@0: //negative width sl@0: TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, -KSurfaceWidth, KSurfaceHeight, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE); sl@0: TEST(capability == -1); //make sure that value has not been modified sl@0: ASSERT_EGL_ERROR(EGL_BAD_PARAMETER); sl@0: TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, KSurfaceHeight, -KWindowWidth, KWindowHeight, &capability) == EGL_FALSE); sl@0: TEST(capability == -1); //make sure that value has not been modified sl@0: ASSERT_EGL_ERROR(EGL_BAD_PARAMETER); sl@0: //negative height sl@0: TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, -KSurfaceHeight, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE); sl@0: TEST(capability == -1); //make sure that value has not been modified sl@0: ASSERT_EGL_ERROR(EGL_BAD_PARAMETER); sl@0: TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, KSurfaceHeight, KWindowWidth, -KWindowHeight, &capability) == EGL_FALSE); sl@0: TEST(capability == -1); //make sure that value has not been modified sl@0: ASSERT_EGL_ERROR(EGL_BAD_PARAMETER); sl@0: sl@0: //zero width sl@0: TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, -0, KSurfaceHeight, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE); sl@0: TEST(capability == -1); //make sure that value has not been modified sl@0: ASSERT_EGL_ERROR(EGL_BAD_PARAMETER); sl@0: TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, KSurfaceHeight, -0, KWindowHeight, &capability) == EGL_FALSE); sl@0: TEST(capability == -1); //make sure that value has not been modified sl@0: ASSERT_EGL_ERROR(EGL_BAD_PARAMETER); sl@0: //zero height sl@0: TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, -0, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE); sl@0: TEST(capability == -1); //make sure that value has not been modified sl@0: ASSERT_EGL_ERROR(EGL_BAD_PARAMETER); sl@0: TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, KSurfaceHeight, KWindowWidth, -0, &capability) == EGL_FALSE); sl@0: TEST(capability == -1); //make sure that value has not been modified sl@0: ASSERT_EGL_ERROR(EGL_BAD_PARAMETER); sl@0: sl@0: // Cleanup sl@0: CloseWindow(); sl@0: CleanAll(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScalingCapability::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0664 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Call eglSetSurfaceScalingNOK with fixed size surface and a target extent that can be set. sl@0: sl@0: @SYMTestActions sl@0: Retrieve all available EGL configs and for those that support surface scaling sl@0: 1. Create a window surface with surface scaling attributes and make it current sl@0: 2. Query these attributes and check they correspond with what is expected sl@0: 3. Query if surface supports scaling to a different extent sl@0: 4. Set the new extent and new offset to the surface sl@0: 5. Query these attributes sl@0: sl@0: @SYMTestExpectedResults sl@0: 5. Surface scaling attributes have been updated sl@0: */ sl@0: TVerdict CEglTest_SurfaceScalingSet::doTestStepL() sl@0: { sl@0: SetTestStepName(_L("GRAPHICS-EGL-0664")); sl@0: SetTestStepID(_L("GRAPHICS-EGL-0664")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScalingSet::doTestStepL")); sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(100, 100)); sl@0: sl@0: const TInt KWindowWidth = iWindow.Size().iWidth; sl@0: const TInt KWindowHeight = iWindow.Size().iHeight; sl@0: const TInt KSurfaceWidth = KWindowWidth/2; sl@0: const TInt KSurfaceHeight = KWindowHeight/2; sl@0: const TInt KExtentWidth = KWindowWidth; sl@0: const TInt KExtentHeight = KWindowHeight; sl@0: const EGLint KOffsetX = 3; sl@0: const EGLint KOffsetY = 7; sl@0: sl@0: EGLint attrib_list[] = { sl@0: EGL_FIXED_WIDTH_NOK, KSurfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, KSurfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight, sl@0: EGL_NONE}; sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); sl@0: iEglSess->InitializeL(); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[KMaxEglConfigs]; sl@0: EGLint numConfigs = 0; sl@0: sl@0: // Query total number of configs sl@0: ASSERT_EGL_TRUE(eglGetConfigs(iDisplay, NULL, KMaxTInt, &numConfigs)); sl@0: TESTL(numConfigs >= 1 && numConfigs <= KMaxEglConfigs); sl@0: INFO_PRINTF2(_L("Found %d configs"), numConfigs); sl@0: sl@0: // Get the configs sl@0: ASSERT_EGL_TRUE(eglGetConfigs(iDisplay, matchingConfigs, KMaxEglConfigs, &numConfigs)); sl@0: sl@0: // Check if surface scaling is supported in the config, if so, create surface sl@0: for(TInt i=0; iCreateWindowSurfaceAndMakeCurrentL(matchingConfigs[i], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list); sl@0: } sl@0: else if (renderableType&EGL_OPENGL_ES_BIT) sl@0: { sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[i], iWindow, EFalse, EGL_OPENGL_ES_API, 1, attrib_list); sl@0: } sl@0: else sl@0: { sl@0: WARN_PRINTF2(_L("Config %d does not support either OPENVG or OPENGL_ES. Skip!"), i); sl@0: continue; sl@0: } sl@0: sl@0: // Check values are as expected sl@0: CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, KOffsetX, KOffsetY); sl@0: sl@0: // modify target extent atttributes sl@0: // 1 - first check that this new extent is supported, should do as we're reducing it sl@0: EGLint capability = -1; //arbitrary number beyond the existing range sl@0: EGLint newExtentWidth = KExtentWidth / 2; sl@0: EGLint newExtentHeight = KExtentHeight / 2; sl@0: EGLint newOffsetX = KOffsetX * 2; sl@0: EGLint newOffsetY = KOffsetY * 2; sl@0: ASSERT_EGL_TRUE(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, matchingConfigs[i], KSurfaceWidth, KSurfaceHeight, newExtentWidth, newExtentHeight, &capability)); sl@0: TEST((capability == EGL_SUPPORTED_NOK) || (capability == EGL_SLOW_NOK)); sl@0: // 2 - set new extent sl@0: ASSERT_EGL_TRUE(iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), newOffsetX, newOffsetY, newExtentWidth, newExtentHeight)); sl@0: sl@0: // Check attributes have changed sl@0: CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, newExtentWidth, newExtentHeight, newOffsetX, newOffsetY); sl@0: sl@0: // Cleanup sl@0: iEglSess->CleanupSurfaceAndContextL(); sl@0: } sl@0: } sl@0: sl@0: // Cleanup sl@0: CloseWindow(); sl@0: CleanAll(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScalingSet::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0665 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Negative testing. Call eglSetSurfaceScalingNOK with invalid parameters sl@0: sl@0: @SYMTestActions sl@0: 1. Set surface scaling with invalid display. sl@0: 2. Set surface scaling with negative target width. sl@0: 3. Set surface scaling with negative target height. sl@0: 3. Set surface scaling with zero target width. sl@0: 3. Set surface scaling with zero target height. sl@0: @SYMTestExpectedResults sl@0: 1. Set surface scaling will fail with error code EGL_BAD_DISPLAY. sl@0: 2. Set surface scaling will fail with error code EGL_BAD_PARAMETER. sl@0: 3. Set surface scaling will fail with error code EGL_BAD_PARAMETER. sl@0: 4. Set surface scaling will fail with error code EGL_BAD_PARAMETER. sl@0: 5. Set surface scaling will fail with error code EGL_BAD_PARAMETER. sl@0: */ sl@0: TVerdict CEglTest_SurfaceScalingSetInvalidAttributes::doTestStepL() sl@0: { sl@0: SetTestStepName(_L("GRAPHICS-EGL-0665")); sl@0: SetTestStepID(_L("GRAPHICS-EGL-0665")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScalingSetInvalidAttributes::doTestStepL")); sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(100, 100)); sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects sl@0: iEglSess->InitializeL(); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported sl@0: sl@0: const TInt KWindowWidth = iWindow.Size().iWidth; sl@0: const TInt KWindowHeight = iWindow.Size().iHeight; sl@0: const TInt KSurfaceWidth = KWindowWidth/2; sl@0: const TInt KSurfaceHeight = KWindowHeight/2; sl@0: const TInt KExtentWidth = KWindowWidth; sl@0: const TInt KExtentHeight = KWindowHeight; sl@0: const EGLint KOffsetX = 11; sl@0: const EGLint KOffsetY = 13; sl@0: EGLint attrib_list[] = { sl@0: EGL_FIXED_WIDTH_NOK, KSurfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, KSurfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight, sl@0: EGL_NONE}; sl@0: sl@0: // Create the window surface and the egl context and make them current sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list); sl@0: sl@0: // Check all attributes sl@0: CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, KOffsetX, KOffsetY); sl@0: sl@0: for(TInt index = 0; index < 5; index++) sl@0: { sl@0: // new attribute values sl@0: EGLDisplay newDisplay = iDisplay; sl@0: EGLint newExtentWidth = KExtentWidth; sl@0: EGLint newExtentHeight = KExtentHeight; sl@0: EGLint newOffsetX = KOffsetX; sl@0: EGLint newOffsetY = KOffsetY; sl@0: // expected error value sl@0: EGLint error = EGL_BAD_PARAMETER; sl@0: sl@0: switch(index) sl@0: { sl@0: case 0: sl@0: // Invalid display - valid extent sl@0: newDisplay = newDisplay - 100; sl@0: error = EGL_BAD_DISPLAY; sl@0: break; sl@0: case 1: sl@0: // Valid display - Negative extent width sl@0: newExtentWidth = -newExtentHeight; sl@0: break; sl@0: case 2: sl@0: // Valid display - Negative extent height sl@0: newExtentHeight = -newExtentHeight; sl@0: break; sl@0: case 3: sl@0: // Valid display - zero extent width sl@0: newExtentWidth = 0; sl@0: break; sl@0: case 4: sl@0: // Valid display - zero extent height sl@0: newExtentHeight = 0; sl@0: break; sl@0: } sl@0: sl@0: TEST(EGL_FALSE == iPfnEglSetSurfaceScalingNOK(newDisplay, iEglSess->Surface(), newOffsetX, newOffsetY, newExtentWidth, newExtentHeight)); sl@0: ASSERT_EGL_ERROR(error); sl@0: sl@0: // attributes haven't changed sl@0: CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, KWindowWidth, KWindowHeight, KOffsetX, KOffsetY); sl@0: } sl@0: sl@0: // Cleanup sl@0: CleanAll(); sl@0: CloseWindow(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScalingSetInvalidAttributes::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0666 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Negative testing. Query scaling attributes in non-fixed size surfaces sl@0: sl@0: @SYMTestActions sl@0: 1. Create a window surface from a non-fixed size surface sl@0: 2. Set surface scaling with valid target extent. sl@0: 3. Query scaling attributes sl@0: 4. Repeat step 2-3 for EGL window surface, pixmap and pbuffer surface sl@0: sl@0: @SYMTestExpectedResults sl@0: 2. Set surface scaling will fail with error code EGL_BAD_MATCH. sl@0: 3. Query scaling attributes does not fail, but values not updated sl@0: */ sl@0: TVerdict CEglTest_SurfaceScalingSetNonFixed::doTestStepL() sl@0: { sl@0: SetTestStepName(_L("GRAPHICS-EGL-0666")); sl@0: SetTestStepID(_L("GRAPHICS-EGL-0666")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScalingSetNonFixed::doTestStepL")); sl@0: sl@0: // Establish the connection to the window server and create sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(100, 100)); sl@0: sl@0: const TInt KWindowWidth = iWindow.Size().iWidth; sl@0: const TInt KWindowHeight = iWindow.Size().iHeight; sl@0: const TInt KSurfaceWidth = KWindowWidth; sl@0: const TInt KSurfaceHeight = KWindowHeight; sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects sl@0: iEglSess->InitializeL(); sl@0: sl@0: // Choose EGL config - Make sure it DOES NOT support surface scaling sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: sl@0: // If all window surfaces in EGL are scalable, first case must be skipped. Others still valid sl@0: TInt index = iAllScalable ? 1 : 0; sl@0: for(; index < 3; index++) sl@0: { sl@0: switch(index) sl@0: { sl@0: case 0: sl@0: // Create the non-fixed size window surface and the egl context and make them current sl@0: INFO_PRINTF1(_L("Create the non-fixed size window surface and the egl context and make them current...")); sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribs_NoScaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow); sl@0: break; sl@0: case 1: sl@0: // Create the pbuffer surface and the egl context and make them current sl@0: INFO_PRINTF1(_L("Create the pbuffer surface and the egl context and make them current...")); sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPBufferAttribsColor16MU], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); sl@0: iEglSess->CreatePbufferSurfaceAndMakeCurrentL(matchingConfigs[0], TSize(KSurfaceWidth, KSurfaceHeight)); sl@0: break; sl@0: case 2: sl@0: // Create the pixmap surface and the egl context and make them current sl@0: INFO_PRINTF1(_L("Create the pixmap surface and the egl context and make them current...")); sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPixmapAttribsColor16MU], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); sl@0: iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(TSize(KSurfaceWidth, KSurfaceHeight), EColor16MU); sl@0: break; sl@0: } sl@0: sl@0: // Check all attributes (this is a non-fixed size surface) - sl@0: // Note that we cannot use CheckScalingAttributesL because values are not updated sl@0: EGLint surfaceWidth = 0; sl@0: EGLint surfaceHeight = 0; sl@0: EGLint extentWidth = -1; sl@0: EGLint extentHeight = -2; sl@0: EGLint offsetX = -3; sl@0: EGLint offsetY = -4; sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_WIDTH, &surfaceWidth)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_HEIGHT, &surfaceHeight)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, &extentWidth)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, &extentHeight)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, &offsetX)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, &offsetY)); sl@0: TEST((surfaceWidth == KWindowWidth) && (surfaceHeight == KWindowHeight)); sl@0: // following values should not be modified (non fixed size window) sl@0: TEST((extentWidth == -1) && (extentHeight == -2)); sl@0: TEST((offsetX == -3) && (offsetY == -4)); sl@0: sl@0: // new attribute values sl@0: EGLint newExtentWidth = extentWidth / 2; sl@0: EGLint newExtentHeight = extentHeight / 2; sl@0: EGLint newOffsetX = offsetX * 2; sl@0: EGLint newOffsetY = offsetY * 2; sl@0: sl@0: // Valid parameters - But non fixed size surface sl@0: TEST(iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), newOffsetX, newOffsetY, newExtentWidth, newExtentHeight) == EGL_FALSE); sl@0: ASSERT_EGL_ERROR(EGL_BAD_MATCH); sl@0: sl@0: // attributes haven't changed sl@0: // Note that we cannot use CheckScalingAttributesL because values are not updated sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_WIDTH, &surfaceWidth)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_HEIGHT, &surfaceHeight)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, &extentWidth)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, &extentHeight)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, &offsetX)); sl@0: ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, &offsetY)); sl@0: TEST((surfaceWidth == KWindowWidth) && (surfaceHeight == KWindowHeight)); sl@0: TEST((extentWidth == -1) && (extentHeight == -2)); sl@0: TEST((offsetX == -3) && (offsetY == -4)); sl@0: sl@0: // destroy surface and context sl@0: iEglSess->CleanupSurfaceAndContextL(); sl@0: } sl@0: sl@0: // Cleanup sl@0: CleanAll(); sl@0: CloseWindow(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScalingSetNonFixed::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-EGL-0667 sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMPREQ 2676 sl@0: sl@0: @SYMREQ 417-56592 sl@0: sl@0: @SYMTestCaseDesc sl@0: Negative testing. Calling extensions without initialising EGL sl@0: sl@0: @SYMTestActions sl@0: Without initialising EGL sl@0: 1. Call query surface scaling capability sl@0: 2. Call set surface scaling sl@0: sl@0: @SYMTestExpectedResults sl@0: 1. Query scaling capability will fail with error code EGL_NOT_INITIALIZED. sl@0: 2. Set surface scaling will fail with error code EGL_NOT_INITIALIZED. sl@0: */ sl@0: TVerdict CEglTest_SurfaceScalingNotInitialized::doTestStepL() sl@0: { sl@0: SetTestStepName(_L("GRAPHICS-EGL-0667")); sl@0: SetTestStepID(_L("GRAPHICS-EGL-0667")); sl@0: INFO_PRINTF1(_L("CEglTest_SurfaceScalingNotInitialized::doTestStepL")); sl@0: sl@0: // a WindowGroup and a Window object sl@0: CreateAndActivateWindowL(TSize(100, 100)); sl@0: sl@0: // Create display object sl@0: GetDisplayL(); sl@0: CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects sl@0: iEglSess->InitializeL(); sl@0: sl@0: // Choose EGL config sl@0: EGLConfig matchingConfigs[1]; sl@0: EGLint numConfigs = 0; sl@0: ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs)); sl@0: TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported sl@0: sl@0: const TInt KWindowWidth = iWindow.Size().iWidth; sl@0: const TInt KWindowHeight = iWindow.Size().iHeight; sl@0: const TInt KSurfaceWidth = KWindowWidth/2; sl@0: const TInt KSurfaceHeight = KWindowHeight/2; sl@0: const TInt KExtentWidth = KWindowWidth; sl@0: const TInt KExtentHeight = KWindowHeight; sl@0: const EGLint KOffsetX = 11; sl@0: const EGLint KOffsetY = 13; sl@0: EGLint attrib_list[] = { sl@0: EGL_FIXED_WIDTH_NOK, KSurfaceWidth, sl@0: EGL_FIXED_HEIGHT_NOK, KSurfaceHeight, sl@0: EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX, sl@0: EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY, sl@0: EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth, sl@0: EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight, sl@0: EGL_NONE}; sl@0: sl@0: // Create the window surface and the egl context and make them current sl@0: iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list); sl@0: sl@0: // First set new offset attributes (fairly simple, so should be supported) sl@0: INFO_PRINTF1(_L("Set new offset attributes - should succeed...")); sl@0: EGLint capability = -1; //arbitrary number beyond the existing range sl@0: ASSERT_EGL_TRUE(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, matchingConfigs[0], KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, &capability)); sl@0: TEST((capability == EGL_SUPPORTED_NOK) || (capability == EGL_SLOW_NOK)); sl@0: ASSERT_EGL_TRUE(iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), KOffsetX+1, KOffsetY+1, KExtentWidth, KExtentHeight)); sl@0: sl@0: // Terminate display and try again sl@0: INFO_PRINTF1(_L("Terminate display and try again, should fail now...")); sl@0: eglTerminate(iDisplay); sl@0: sl@0: capability = -1; //arbitrary number beyond the existing range sl@0: TEST(EGL_FALSE == iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, matchingConfigs[0], KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, &capability)); sl@0: TEST(capability == -1); //make sure that value has not been modified sl@0: ASSERT_EGL_ERROR(EGL_NOT_INITIALIZED); sl@0: sl@0: TEST(EGL_FALSE == iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), KOffsetX, KOffsetY, KExtentWidth, KExtentHeight)); sl@0: ASSERT_EGL_ERROR(EGL_NOT_INITIALIZED); sl@0: sl@0: // Cleanup sl@0: CleanAll(); sl@0: CloseWindow(); sl@0: sl@0: INFO_PRINTF1(_L("....CEglTest_SurfaceScalingNotInitialized::doTestStepL completed!")); sl@0: RecordTestResultL(); sl@0: CloseTMSGraphicsStep(); sl@0: return TestStepResult(); sl@0: } sl@0: