1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/egl/egltest/src/egltest_surfacescaling.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,3103 @@
1.4 +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +/**
1.20 + @file
1.21 + @test
1.22 +*/
1.23 +
1.24 +#include "egltest_surfacescaling.h"
1.25 +
1.26 +#include <test/tefunit.h> // for ASSERT macros
1.27 +#include <test/egltestcommonutils.h>
1.28 +#include "egltestcommoninisettings.h"
1.29 +
1.30 +//We are restricted by the screen comparison utility that requires images to be EColor16MU
1.31 +const TDisplayMode KTestSourceDisplayMode = EColor16MU;
1.32 +
1.33 +CEglTest_SurfaceScalingBase::~CEglTest_SurfaceScalingBase()
1.34 + {
1.35 + CleanAll();
1.36 + delete iImageComparison;
1.37 + delete iScreenDevice;
1.38 + CloseWindow();
1.39 + CloseWsSession();
1.40 + }
1.41 +
1.42 +TVerdict CEglTest_SurfaceScalingBase::doTestStepPreambleL()
1.43 + {
1.44 + TVerdict verdict = CEglTestStep::doTestStepPreambleL();
1.45 +
1.46 + INFO_PRINTF1(_L("doTestStepPreambleL() - Initialise surface scaling test settings..."));
1.47 + if(!CheckForExtensionL(KEGL_NOK_surface_scaling))
1.48 + {
1.49 + ERR_PRINTF1(_L("KEGL_NOK_surface_scaling not supported!"));
1.50 + User::Leave(KErrNotSupported);
1.51 + }
1.52 + //retrieve the pointers to the EGL surface scaling extension functions
1.53 + iPfnEglQuerySurfaceScalingCapabilityNOK = reinterpret_cast <TFPtrEglQuerySurfaceScalingCapabilityNok> (eglGetProcAddress("eglQuerySurfaceScalingCapabilityNOK"));
1.54 + iPfnEglSetSurfaceScalingNOK = reinterpret_cast <TFPtrEglSetSurfaceScalingNok> (eglGetProcAddress("eglSetSurfaceScalingNOK"));
1.55 + if(!iPfnEglQuerySurfaceScalingCapabilityNOK)
1.56 + {
1.57 + ERR_PRINTF1(_L(" Cannot retrieve address of the \"eglQuerySurfaceScalingCapabilityNOK\" function"));
1.58 + User::Leave(KErrNotSupported);
1.59 + }
1.60 + if(!iPfnEglSetSurfaceScalingNOK)
1.61 + {
1.62 + ERR_PRINTF1(_L(" Cannot retrieve address of the \"eglSetSurfaceScalingNOK\" function"));
1.63 + User::Leave(KErrNotSupported);
1.64 + }
1.65 +
1.66 + //retrieve surface scaling ini settings
1.67 + CIniData* iniData = CIniData::NewL(KConfigFileName);
1.68 + CleanupStack::PushL(iniData);
1.69 +
1.70 + _LIT(KSectionSurfaceScaling, "SurfaceScaling");
1.71 + _LIT(KKeyAllScalable, "AllScalable");
1.72 +
1.73 + TPtrC scalable;
1.74 + if(!iniData->FindVar(KSectionSurfaceScaling,KKeyAllScalable,scalable))
1.75 + {
1.76 + ERR_PRINTF3(_L(" Cannot retrieve section:%S key:%S"), &KSectionSurfaceScaling, &KKeyAllScalable);
1.77 + User::Leave(KErrNotSupported);
1.78 + }
1.79 + iAllScalable = (scalable.FindF( _L("true"))==KErrNotFound)? EFalse : ETrue;
1.80 + INFO_PRINTF1(_L(" ************************************************************************"));
1.81 + INFO_PRINTF1(_L(" **** The test will be run in following configuration: "));
1.82 + INFO_PRINTF2(_L(" **** All window surfaces scalable: %S"), &scalable);
1.83 + INFO_PRINTF1(_L(" ************************************************************************"));
1.84 + CleanupStack::PopAndDestroy(iniData);
1.85 +
1.86 + //Initiate a window server session and create a window group
1.87 + OpenWsSessionL(KDefaultWindowGroupId);
1.88 +
1.89 + //Create a Screen Device
1.90 + const TInt screen0 = 0;
1.91 + iScreenDevice = new(ELeave) CWsScreenDevice(iWsSession);
1.92 + User::LeaveIfError(iScreenDevice->Construct(screen0));
1.93 +
1.94 + // get full screen size
1.95 + TPixelsAndRotation sizeAndRotation;
1.96 + iScreenDevice->GetDefaultScreenSizeAndRotation(sizeAndRotation);
1.97 + iScreenSize = sizeAndRotation.iPixelSize;
1.98 +
1.99 + //Create the image comparison tool from the screen device as required by most tests
1.100 + iImageComparison = CTGraphicsScreenComparison::NewL(*iScreenDevice);
1.101 +
1.102 + return verdict;
1.103 + }
1.104 +
1.105 +TVerdict CEglTest_SurfaceScalingBase::doTestStepPostambleL()
1.106 + {
1.107 + INFO_PRINTF1(_L("doTestStepPostambleL() - Cleaning up"));
1.108 +
1.109 + // cleanup egltest framework stuff
1.110 + CleanAll();
1.111 +
1.112 + // cleanup member variables
1.113 + delete iImageComparison;
1.114 + iImageComparison = NULL;
1.115 + delete iScreenDevice;
1.116 + iScreenDevice = NULL;
1.117 +
1.118 + // close window and wserver session
1.119 + CloseWindow();
1.120 + CloseWsSession();
1.121 +
1.122 + return CEglTestStep::doTestStepPostambleL();
1.123 + }
1.124 +
1.125 +void CEglTest_SurfaceScalingBase::CreateAndActivateWindowL(const TSize& aWindowSize)
1.126 + {
1.127 + ConstructWindowL(iWindow, aWindowSize);
1.128 + }
1.129 +
1.130 +void CEglTest_SurfaceScalingBase::CloseWindow()
1.131 + {
1.132 + iWindow.Close();
1.133 + }
1.134 +
1.135 +//check if border color matches with expected values
1.136 +void CEglTest_SurfaceScalingBase::CheckBorderColorL(EGLint aExpectedRedChannelColor, EGLint aExpectedBlueChannelColor, EGLint aExpectedGreenChannelColor)
1.137 + {
1.138 + EGLint value = 0xffff; //set color channel to some arbitrary number
1.139 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, &value));
1.140 + ASSERT_EQUALS(value, aExpectedRedChannelColor);
1.141 +
1.142 + value = 0xffff; //set color channel to some arbitrary number
1.143 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, &value));
1.144 + ASSERT_EQUALS(value, aExpectedGreenChannelColor);
1.145 +
1.146 + value = 0xffff; //set color channel to some arbitrary number
1.147 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, &value));
1.148 + ASSERT_EQUALS(value, aExpectedBlueChannelColor);
1.149 + }
1.150 +
1.151 +//check if scaling attributes match with expected values
1.152 +void CEglTest_SurfaceScalingBase::CheckScalingAttributesL(EGLint aExpectedSurfaceWidth, EGLint aExpectedSurfaceHeight, EGLint aExpectedExtentWidth, EGLint aExpectedExtentHeight, EGLint aExpectedOffsetX, EGLint aExpectedOffsetY)
1.153 + {
1.154 + EGLint value = 0xffff; //set initial value to some arbitrary number
1.155 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_WIDTH, &value));
1.156 + ASSERT_EQUALS(value, aExpectedSurfaceWidth);
1.157 +
1.158 + value = 0xffff; //set initial value to some arbitrary number
1.159 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_HEIGHT, &value));
1.160 + ASSERT_EQUALS(value, aExpectedSurfaceHeight);
1.161 +
1.162 + value = 0xffff; //set initial value to some arbitrary number
1.163 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, &value));
1.164 + ASSERT_EQUALS(value, aExpectedExtentWidth);
1.165 +
1.166 + value = 0xffff; //set initial value to some arbitrary number
1.167 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, &value));
1.168 + ASSERT_EQUALS(value, aExpectedExtentHeight);
1.169 +
1.170 + value = 0xffff; //set initial value to some arbitrary number
1.171 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, &value));
1.172 + ASSERT_EQUALS(value, aExpectedOffsetX);
1.173 +
1.174 + value = 0xffff; //set initial value to some arbitrary number
1.175 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, &value));
1.176 + ASSERT_EQUALS(value, aExpectedOffsetY);
1.177 + }
1.178 +
1.179 +/*
1.180 + Simple create bitmap function to initialise a rectangular bitmap in four simple colours plus borders
1.181 + ---------------------------
1.182 + ¦ borderTop ¦
1.183 + ¦ ----------------- ¦
1.184 + ¦ b. ¦ ¦ ¦ b. ¦
1.185 + ¦ ¦ 1 ¦ 2 ¦ ¦
1.186 + ¦ L ¦ ¦ ¦ R ¦
1.187 + ¦ e ¦--------¦--------¦ i ¦
1.188 + ¦ f ¦ ¦ ¦ g ¦
1.189 + ¦ t ¦ 3 ¦ 4 ¦ h ¦
1.190 + ¦ ¦ ¦ ¦ t ¦
1.191 + ¦ ----------------- ¦
1.192 + ¦ borderBottom ¦
1.193 + ---------------------------
1.194 +*/
1.195 +CFbsBitmap* CEglTest_SurfaceScalingBase::CreateBitmapLC(const TSize& aSize, TInt aBorderTop, TInt aBorderBottom, TInt aBorderLeft, TInt aBorderRight, const TRgb& aBorderColor)
1.196 + {
1.197 + // create the bitmap to the requested size (DisplayMode set to default value)
1.198 + CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
1.199 + CleanupStack::PushL(bitmap);
1.200 + User::LeaveIfError(bitmap->Create(aSize,KTestSourceDisplayMode));
1.201 + TEST(bitmap->SizeInPixels().iHeight == aSize.iHeight);
1.202 + TEST(bitmap->SizeInPixels().iWidth == aSize.iWidth);
1.203 +
1.204 + //Create a device and context for the purpose of generating the bitmap which will be the
1.205 + //master reference used in the test
1.206 + CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmap);
1.207 + CleanupStack::PushL(bitmapDevice);
1.208 + CFbsBitGc* bitmapGc = CFbsBitGc::NewL();
1.209 + CleanupStack::PushL(bitmapGc);
1.210 + bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
1.211 + bitmapGc->Activate(bitmapDevice);
1.212 +
1.213 + // First off, set the whole bitmap to the border colour
1.214 + bitmapGc->SetBrushColor(aBorderColor);
1.215 + bitmapGc->SetPenColor(aBorderColor);
1.216 + bitmapGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.217 + bitmapGc->DrawRect(aSize);
1.218 +
1.219 + // Set each individual quadrant to a different arbitrary colour
1.220 + const TInt height = aSize.iHeight;
1.221 + const TInt width = aSize.iWidth;
1.222 + const TInt quadrantHeight = (height - aBorderTop - aBorderBottom) / 2;
1.223 + const TInt quadrantWidth = (width - aBorderLeft - aBorderRight) / 2;
1.224 +
1.225 + // quadrant 1 - Colour KRgbMagenta
1.226 + TRect rect = TRect(TPoint(aBorderLeft, aBorderTop), TSize(quadrantWidth, quadrantHeight));
1.227 + bitmapGc->SetBrushColor(KRgbMagenta);
1.228 + bitmapGc->SetPenColor(KRgbMagenta);
1.229 + bitmapGc->DrawRect(rect);
1.230 +
1.231 + // quadrant 2 - Colour KRgbCyan
1.232 + rect = TRect(TPoint(aBorderLeft+quadrantWidth, aBorderTop), TSize(quadrantWidth, quadrantHeight));
1.233 + bitmapGc->SetBrushColor(KRgbCyan);
1.234 + bitmapGc->SetPenColor(KRgbCyan);
1.235 + bitmapGc->DrawRect(rect);
1.236 +
1.237 + // quadrant 3 - Colour KRgbYellow
1.238 + rect = TRect(TPoint(aBorderLeft, aBorderTop+quadrantHeight), TSize(quadrantWidth, quadrantHeight));
1.239 + bitmapGc->SetBrushColor(KRgbYellow);
1.240 + bitmapGc->SetPenColor(KRgbYellow);
1.241 + bitmapGc->DrawRect(rect);
1.242 +
1.243 + // quadrant 4 - Colour KRgbDarkGreen
1.244 + rect = TRect(TPoint(aBorderLeft+quadrantWidth, aBorderTop+quadrantHeight), TSize(quadrantWidth, quadrantHeight));
1.245 + bitmapGc->SetBrushColor(KRgbDarkGreen);
1.246 + bitmapGc->SetPenColor(KRgbDarkGreen);
1.247 + bitmapGc->DrawRect(rect);
1.248 +
1.249 + //clean-up
1.250 + CleanupStack::PopAndDestroy(2, bitmapDevice);
1.251 + return bitmap;
1.252 + }
1.253 +
1.254 +void CEglTest_SurfaceScalingBase::WritePixelsToSurfaceL(const CFbsBitmap& aBitmap)
1.255 + {
1.256 + // Mind the fact that CFbsBitmap and VGImages use different coordinates origin
1.257 + const TSize bitmapSize = aBitmap.SizeInPixels();
1.258 + TUint8* address = reinterpret_cast<TUint8*>(aBitmap.DataAddress());
1.259 + const TInt stride = aBitmap.DataStride();
1.260 + address += (bitmapSize.iHeight - 1) * stride;
1.261 +
1.262 + // copy pixel data to the drawing surface
1.263 + vgWritePixels(address, -stride, KDefaultSurfaceFormat,0,0, bitmapSize.iWidth, bitmapSize.iHeight);
1.264 + ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
1.265 +
1.266 + // force all outstanding requests on the current context to complete
1.267 + vgFinish();
1.268 + iWsSession.Finish();
1.269 + }
1.270 +
1.271 +/**
1.272 +@SYMTestCaseID GRAPHICS-EGL-0651
1.273 +
1.274 +@SYMTestPriority 1
1.275 +
1.276 +@SYMPREQ 2676
1.277 +
1.278 +@SYMREQ 417-56592
1.279 +
1.280 +@SYMTestCaseDesc
1.281 +Choose a suitable extent to test that specified border colours are correct.
1.282 +
1.283 +@SYMTestActions
1.284 +For a number of different situations, do the following:
1.285 +1. Create a window of known size
1.286 +2. Create a fixed size surface, filled in with a predefined bitmap
1.287 +3. Draw the surface onto the window for a set extent and border colour
1.288 +4. Compare window content and border against a reference bitmap containing expected values.
1.289 +
1.290 +@SYMTestExpectedResults
1.291 +The window content matches the independently created reference bitmap in each situation
1.292 +*/
1.293 +TVerdict CEglTest_SurfaceScaling_Positive::doTestStepL()
1.294 + {
1.295 + SetTestStepID(_L("GRAPHICS-EGL-0651"));
1.296 + SetTestStepName(_L("GRAPHICS-EGL-0651"));
1.297 + INFO_PRINTF1(_L("CEglTest_SurfaceScaling_Positive::doTestStepL started...."));
1.298 +
1.299 + // Create display object
1.300 + GetDisplayL();
1.301 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.302 + iEglSess->InitializeL();
1.303 +
1.304 + // NOTE: Borders depend on what you set as extent, offset, window and surface
1.305 + // Care should be taken when choosing size values, better to use even numbers
1.306 + // (CreateBitmap splits rectangle in four, so we don't want a pixel mismatch there)
1.307 + for (TInt index=1; index<=17; index++)
1.308 + {
1.309 + // Set some default values which are used in most cases
1.310 + iWindowWidth = iWindowHeight = 200;
1.311 + iBorderColor = TRgb(0,0,0);
1.312 + iBorderTop = iBorderBottom = iBorderLeft = iBorderRight = 0;
1.313 +
1.314 + switch(index)
1.315 + {
1.316 + case 1:
1.317 + // surface scaled to same window size with no border
1.318 + iSurfaceWidth = 100; iSurfaceHeight = 50;
1.319 + iExtentWidth = 200; iExtentHeight = 200;
1.320 + iOffsetX = 0; iOffsetY = 0;
1.321 + break;
1.322 + case 2:
1.323 + // surface scaled to half the window size with border top
1.324 + iSurfaceWidth = 100; iSurfaceHeight = 50;
1.325 + iExtentWidth = 200; iExtentHeight = 100;
1.326 + iOffsetX = 0; iOffsetY = 100;
1.327 + iBorderColor = TRgb(0,0,0); // arbitrary border colour
1.328 + iBorderTop = 100;
1.329 + break;
1.330 + case 3:
1.331 + // surface scaled to half the window size with border bottom
1.332 + iSurfaceWidth = 100; iSurfaceHeight = 50;
1.333 + iExtentWidth = 200; iExtentHeight = 100;
1.334 + iOffsetX = 0; iOffsetY = 0;
1.335 + iBorderColor = TRgb(128,0,255); // arbitrary border colour
1.336 + iBorderBottom = 100;
1.337 + break;
1.338 + case 4:
1.339 + // surface scaled to half the window size with border top and bottom
1.340 + iSurfaceWidth = 100; iSurfaceHeight = 50;
1.341 + iExtentWidth = 200; iExtentHeight = 100;
1.342 + iOffsetX = 0; iOffsetY = 50;
1.343 + iBorderColor = TRgb(128,0,0); // arbitrary border colour
1.344 + iBorderTop = 50; iBorderBottom = 50;
1.345 + break;
1.346 + case 5:
1.347 + // surface scaled to half the window size with border left
1.348 + iSurfaceWidth = 100; iSurfaceHeight = 50;
1.349 + iExtentWidth = 100; iExtentHeight = 200;
1.350 + iOffsetX = 100; iOffsetY = 0;
1.351 + iBorderColor = TRgb(96,96,96); // arbitrary border colour
1.352 + iBorderLeft = 100;
1.353 + break;
1.354 + case 6:
1.355 + // surface scaled to half the window size with border right
1.356 + iSurfaceWidth = 100; iSurfaceHeight = 50;
1.357 + iExtentWidth = 100; iExtentHeight = 200;
1.358 + iOffsetX = 0; iOffsetY = 0;
1.359 + iBorderColor = TRgb(192,192,192); // arbitrary border colour
1.360 + iBorderRight = 100;
1.361 + break;
1.362 + case 7:
1.363 + // surface scaled to half the window size with border left and right
1.364 + iSurfaceWidth = 100; iSurfaceHeight = 50;
1.365 + iExtentWidth = 100; iExtentHeight = 200;
1.366 + iOffsetX = 50; iOffsetY = 0;
1.367 + iBorderColor = TRgb(0,0,0); // arbitrary border colour
1.368 + iBorderLeft = 50; iBorderRight = 50;
1.369 + break;
1.370 + case 8:
1.371 + // surface scaled in different proportions in width and height, with borders
1.372 + iSurfaceWidth = 100; iSurfaceHeight = 50;
1.373 + iExtentWidth = 190; iExtentHeight = 10;
1.374 + iOffsetX = 5; iOffsetY = 95;
1.375 + iBorderColor = TRgb(240,240,240); // arbitrary border colour
1.376 + iBorderTop = 95; iBorderBottom = 95; iBorderLeft = 5; iBorderRight = 5;
1.377 + break;
1.378 + case 9:
1.379 + // surface scaled to double the window height size, surface cropped with no borders
1.380 + iSurfaceWidth = 100; iSurfaceHeight = 50;
1.381 + iExtentWidth = 400; iExtentHeight = 200;
1.382 + iOffsetX = 0; iOffsetY = 0;
1.383 + break;
1.384 + case 10:
1.385 + // surface scaled to double the window width and height size, surface cropped with no borders
1.386 + iSurfaceWidth = 100; iSurfaceHeight = 50;
1.387 + iExtentWidth = 400; iExtentHeight = 400;
1.388 + iOffsetX = 0; iOffsetY = 0;
1.389 + break;
1.390 + case 11:
1.391 + // surface scaled to double the window width and height size, surface cropped with borders top and left
1.392 + iSurfaceWidth = 100; iSurfaceHeight = 50;
1.393 + iExtentWidth = 400; iExtentHeight = 400;
1.394 + iOffsetX = 100; iOffsetY = 100;
1.395 + iBorderColor = TRgb(255,128,255); // arbitrary border colour
1.396 + iBorderTop = 100; iBorderLeft = 100;
1.397 + break;
1.398 + case 12:
1.399 + // QnHD to full screen size
1.400 + iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight;
1.401 + iSurfaceWidth = 320; iSurfaceHeight = 180;
1.402 + iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight;
1.403 + iOffsetX = 0; iOffsetY = 0;
1.404 + break;
1.405 + case 13:
1.406 + // QVGA to full screen size
1.407 + iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight;
1.408 + iSurfaceWidth = 320; iSurfaceHeight = 240;
1.409 + iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight;
1.410 + iOffsetX = 0; iOffsetY = 0;
1.411 + break;
1.412 + case 14:
1.413 + // HVGA to full screen size
1.414 + iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight;
1.415 + iSurfaceWidth = 480; iSurfaceHeight = 320;
1.416 + iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight;
1.417 + iOffsetX = 0; iOffsetY = 0;
1.418 + break;
1.419 + case 15:
1.420 + // 480x270 to full screen size
1.421 + iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight;
1.422 + iSurfaceWidth = 480; iSurfaceHeight = 270;
1.423 + iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight;
1.424 + iOffsetX = 0; iOffsetY = 0;
1.425 + break;
1.426 + case 16:
1.427 + // VGA to full screen size
1.428 + iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight;
1.429 + iSurfaceWidth = 640; iSurfaceHeight = 480;
1.430 + iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight;
1.431 + iOffsetX = 0; iOffsetY = 0;
1.432 + break;
1.433 + case 17:
1.434 + // WVGA to full screen size
1.435 + iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight;
1.436 + iSurfaceWidth = 768; iSurfaceHeight = 480;
1.437 + iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight;
1.438 + iOffsetX = 0; iOffsetY = 0;
1.439 + break;
1.440 + default:
1.441 + ERR_PRINTF2(_L("Inconsistency in test code, case does not exist: %d."), index);
1.442 + User::Leave(KErrNotSupported);
1.443 + break;
1.444 + }
1.445 +
1.446 + // perform the testing
1.447 + doTestPartialStepL();
1.448 + }
1.449 +
1.450 + // clean-up
1.451 + CleanAll();
1.452 +
1.453 + INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_Positive::doTestStepL completed!"));
1.454 + RecordTestResultL();
1.455 + CloseTMSGraphicsStep();
1.456 + return TestStepResult();
1.457 + }
1.458 +
1.459 +TVerdict CEglTest_SurfaceScaling_Positive::doTestPartialStepL()
1.460 + {
1.461 + INFO_PRINTF5(_L("doTestPartialStepL started with (%d,%d) fixed surface scaled to (%d,%d) extent...."), iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight);
1.462 +
1.463 + // Establish the connection to the window server and create
1.464 + // a WindowGroup and a Window object
1.465 + CreateAndActivateWindowL(TSize(iWindowWidth, iWindowHeight));
1.466 +
1.467 + // Choose EGL config
1.468 + EGLConfig matchingConfigs[1];
1.469 + EGLint numConfigs = 0;
1.470 +
1.471 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
1.472 + TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported
1.473 +
1.474 + EGLint attrib_list[] = {
1.475 + EGL_FIXED_WIDTH_NOK, iSurfaceWidth,
1.476 + EGL_FIXED_HEIGHT_NOK, iSurfaceHeight,
1.477 + EGL_TARGET_EXTENT_OFFSET_X_NOK, iOffsetX,
1.478 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, iOffsetY,
1.479 + EGL_TARGET_EXTENT_WIDTH_NOK, iExtentWidth,
1.480 + EGL_TARGET_EXTENT_HEIGHT_NOK, iExtentHeight,
1.481 + EGL_BORDER_COLOR_RED_NOK, iBorderColor.Red(),
1.482 + EGL_BORDER_COLOR_GREEN_NOK, iBorderColor.Green(),
1.483 + EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue(),
1.484 + EGL_NONE};
1.485 +
1.486 + // Create the window surface and the egl context and make them current
1.487 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);
1.488 +
1.489 + // Create the test bitmap that will be used in the scaled surface
1.490 + // NOTE: This bitmap generally does not have borders,
1.491 + CFbsBitmap* testBitmap = CreateBitmapLC(TSize(iSurfaceWidth, iSurfaceHeight),0,0,0,0,TRgb(0,0,0));
1.492 +
1.493 + // Copy test bitmap to drawing surface
1.494 + WritePixelsToSurfaceL(*testBitmap);
1.495 +
1.496 + //call eglSwapBuffers
1.497 + ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface()));
1.498 + //Wait for the draw operation to complete
1.499 + eglWaitClient();
1.500 +
1.501 + // Create the reference bitmap that should be expected after the scaling
1.502 + // NOTE: This bitmap may have borders
1.503 + // Size could exceed that of the window, so check both extent and window
1.504 + const TInt refWidth = iExtentWidth>iWindowWidth ? iExtentWidth : iWindowWidth;
1.505 + const TInt refHeight = iExtentHeight>iWindowHeight ? iExtentHeight : iWindowHeight;
1.506 + CFbsBitmap* refBitmap = CreateBitmapLC(TSize(refWidth, refHeight), iBorderTop, iBorderBottom, iBorderLeft, iBorderRight, iBorderColor);
1.507 +
1.508 + // compare window contents with expected bitmap
1.509 + TInt comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), TPoint(0,0), *refBitmap, TestStepName());
1.510 + TEST(comparison==KErrNone);
1.511 + INFO_PRINTF3(_L("CompareScreenImageL returns %d (expected is %d)"), comparison, KErrNone);
1.512 +
1.513 + /// Cleanup
1.514 + CleanupStack::PopAndDestroy(2, testBitmap); // refBitmap, testBitmap
1.515 + iEglSess->CleanupSurfaceAndContextL();
1.516 + CloseWindow();
1.517 +
1.518 + INFO_PRINTF1(_L("....doTestPartialStepL completed!"));
1.519 + return TestStepResult();
1.520 + }
1.521 +
1.522 +/**
1.523 +@SYMTestCaseID GRAPHICS-EGL-0661
1.524 +
1.525 +@SYMTestPriority 1
1.526 +
1.527 +@SYMPREQ 2676
1.528 +
1.529 +@SYMREQ 417-56592
1.530 +
1.531 +@SYMTestCaseDesc
1.532 +Resize native window to verify target extent remains fixed.
1.533 +
1.534 +@SYMTestActions
1.535 +1. Create a window of known size
1.536 +2. Create a fixed size surface, filled in with a predefined bitmap
1.537 +3. Draw the surface onto the window for a set extent and border colour
1.538 +4. Repeat step 3 but increasing native window size by (1,1) pixels.
1.539 +5. Compare window content and border against a reference bitmap containing expected values.
1.540 +
1.541 +@SYMTestExpectedResults
1.542 +The window content matches the independently created reference bitmap in each situation
1.543 +*/
1.544 +TVerdict CEglTest_SurfaceScaling_WindowResize::doTestStepL()
1.545 + {
1.546 + SetTestStepID(_L("GRAPHICS-EGL-0661"));
1.547 + SetTestStepName(_L("GRAPHICS-EGL-0661"));
1.548 + INFO_PRINTF1(_L("CEglTest_SurfaceScaling_WindowResize::doTestStepL started...."));
1.549 +
1.550 + // set the initial value of a square window
1.551 + const TInt KWindowSize = 100;
1.552 +
1.553 + // surface with size and extent that matches the window size and no offset
1.554 + iWindowWidth = iWindowHeight = KWindowSize;
1.555 + iSurfaceWidth = iSurfaceHeight = KWindowSize;
1.556 + iExtentWidth = iExtentHeight = KWindowSize;
1.557 + iOffsetX = 0; iOffsetY = 0;
1.558 + iBorderColor = TRgb(0x99,0xcc,0xff); // set some arbitrary colour
1.559 + iBorderTop = 0; iBorderBottom = 0; iBorderLeft = 0; iBorderRight = 0;
1.560 +
1.561 + // Establish the connection to the window server and create
1.562 + // a WindowGroup and a Window object
1.563 + CreateAndActivateWindowL(TSize(iWindowWidth, iWindowHeight));
1.564 +
1.565 + // Create display object
1.566 + GetDisplayL();
1.567 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.568 + iEglSess->InitializeL();
1.569 +
1.570 + // Choose EGL config
1.571 + EGLConfig matchingConfigs[1];
1.572 + EGLint numConfigs = 0;
1.573 +
1.574 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
1.575 + TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported
1.576 +
1.577 + EGLint attrib_list[] = {
1.578 + EGL_FIXED_WIDTH_NOK, iSurfaceWidth,
1.579 + EGL_FIXED_HEIGHT_NOK, iSurfaceHeight,
1.580 + EGL_TARGET_EXTENT_OFFSET_X_NOK, iOffsetX,
1.581 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, iOffsetY,
1.582 + EGL_TARGET_EXTENT_WIDTH_NOK, iExtentWidth,
1.583 + EGL_TARGET_EXTENT_HEIGHT_NOK, iExtentHeight,
1.584 + EGL_BORDER_COLOR_RED_NOK, iBorderColor.Red(),
1.585 + EGL_BORDER_COLOR_GREEN_NOK, iBorderColor.Green(),
1.586 + EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue(),
1.587 + EGL_NONE};
1.588 +
1.589 + // Create the window surface and the egl context and make them current
1.590 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);
1.591 +
1.592 + // Create the test bitmap that will be used in the scaled surface
1.593 + // NOTE: This bitmap generally does not have borders,
1.594 + CFbsBitmap* testBitmap = CreateBitmapLC(TSize(iSurfaceWidth, iSurfaceHeight),0,0,0,0,TRgb(0,0,0));
1.595 +
1.596 + // Copy test bitmap to drawing surface
1.597 + WritePixelsToSurfaceL(*testBitmap);
1.598 +
1.599 + // Start doing iterations by increasing native window size.
1.600 + INFO_PRINTF1(_L("Start increasing native window size by (1,1)..."));
1.601 + iWindowWidth=1;
1.602 + iWindowHeight=1;
1.603 + while(iWindowWidth<=(KWindowSize*2) && iWindowHeight<=(KWindowSize*2))
1.604 + {
1.605 + // Note that borders will appear while window size is bigger than extent
1.606 + // - iSurfaceWidth/iSurfaceHeight - unmodified
1.607 + // - iExtentWidth/iExtentHeight - unmodified
1.608 + // - iOffsetX/iOffsetY - unmodified
1.609 + // Set up expected values for the border
1.610 + iBorderTop = 0; iBorderLeft = 0;
1.611 + iBorderBottom = iExtentHeight<iWindowHeight ? iWindowHeight-iExtentHeight : 0;
1.612 + iBorderRight = iExtentWidth<iWindowWidth ? iWindowWidth-iExtentWidth : 0;
1.613 +
1.614 + // resize window to new given size
1.615 + iWindow.Invalidate();
1.616 + iWindow.BeginRedraw();
1.617 + iWindow.SetSize(TSize(iWindowWidth, iWindowHeight));
1.618 + iWindow.EndRedraw();
1.619 +
1.620 + // re-populate buffers with the unmodified fixed size surface content
1.621 + WritePixelsToSurfaceL(*testBitmap);
1.622 +
1.623 + // perform the testing
1.624 + doTestPartialStepL();
1.625 + ++iWindowWidth;
1.626 + ++iWindowHeight;
1.627 + }
1.628 +
1.629 + /// Cleanup
1.630 + CleanupStack::PopAndDestroy(testBitmap);
1.631 + iEglSess->CleanupSurfaceAndContextL();
1.632 + CleanAll();
1.633 + CloseWindow();
1.634 +
1.635 + INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_WindowResize::doTestStepL completed!"));
1.636 + RecordTestResultL();
1.637 + CloseTMSGraphicsStep();
1.638 + return TestStepResult();
1.639 + }
1.640 +
1.641 +TVerdict CEglTest_SurfaceScaling_WindowResize::doTestPartialStepL()
1.642 + {
1.643 + INFO_PRINTF3(_L("doTestPartialStepL started for native window size of (%d, %d)...."), iWindowWidth, iWindowHeight);
1.644 +
1.645 + // resize may be effective only after swapbuffers
1.646 + ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface()));
1.647 + ASSERT_EGL_TRUE(eglWaitClient());
1.648 +
1.649 + //check all expected values
1.650 + CheckScalingAttributesL(iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight, iOffsetX, iOffsetY);
1.651 + CheckBorderColorL(iBorderColor.Red(), iBorderColor.Blue(), iBorderColor.Green());
1.652 +
1.653 + // Create the reference bitmap that should be expected after the window resize
1.654 + // NOTE: This bitmap may have borders
1.655 + // Size could exceed that of the window, so check both extent and window
1.656 + const TInt refWidth = iExtentWidth>iWindowWidth ? iExtentWidth : iWindowWidth;
1.657 + const TInt refHeight = iExtentHeight>iWindowHeight ? iExtentHeight : iWindowHeight;
1.658 + CFbsBitmap* refBitmap = CreateBitmapLC(TSize(refWidth, refHeight), iBorderTop, iBorderBottom, iBorderLeft, iBorderRight, iBorderColor);
1.659 +
1.660 + // compare window contents with expected bitmap
1.661 + TInt comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), TPoint(0,0), *refBitmap, TestStepName());
1.662 + TEST(comparison==KErrNone);
1.663 + INFO_PRINTF3(_L("CompareScreenImageL returns %d (expected is %d)"), comparison, KErrNone);
1.664 +
1.665 + /// Cleanup
1.666 + CleanupStack::PopAndDestroy(refBitmap);
1.667 +
1.668 + return TestStepResult();
1.669 + }
1.670 +
1.671 +/**
1.672 +@SYMTestCaseID GRAPHICS-EGL-0668
1.673 +
1.674 +@SYMTestPriority 1
1.675 +
1.676 +@SYMPREQ 2676
1.677 +
1.678 +@SYMREQ 417-56592
1.679 +
1.680 +@SYMTestCaseDesc
1.681 +Create a fixed size surface and vary the extent position for a range of values.
1.682 +
1.683 +@SYMTestActions
1.684 +1. Create a window of known size
1.685 +2. Create a fixed size surface, filled in with a predefined bitmap
1.686 +3. Draw the surface onto the window for a set extent and border colour
1.687 +4. Repeat step 3 but increasing target extent offset by (1,1) pixels.
1.688 +5. Compare window content and border against a reference bitmap containing expected values.
1.689 +
1.690 +@SYMTestExpectedResults
1.691 +The window content matches the independently created reference bitmap in each situation
1.692 +*/
1.693 +TVerdict CEglTest_SurfaceScaling_ExtentPositionChange::doTestStepL()
1.694 + {
1.695 + SetTestStepID(_L("GRAPHICS-EGL-0668"));
1.696 + SetTestStepName(_L("GRAPHICS-EGL-0668"));
1.697 + INFO_PRINTF1(_L("CEglTest_SurfaceScaling_ExtentPositionChange::doTestStepL started...."));
1.698 +
1.699 + // surface with size and extent that matches the window size and no offset
1.700 + iWindowWidth = iWindowHeight = 100;
1.701 + iSurfaceWidth = iExtentWidth = iWindowWidth;
1.702 + iSurfaceHeight = iExtentHeight = iWindowHeight;
1.703 + iOffsetX = 0; iOffsetY = 0;
1.704 + iBorderColor = TRgb(0x11,0x22,0x33); // set some arbitrary colour
1.705 + iBorderTop = 0; iBorderBottom = 0; iBorderLeft = 0; iBorderRight = 0;
1.706 +
1.707 + // Establish the connection to the window server and create
1.708 + // a WindowGroup and a Window object
1.709 + CreateAndActivateWindowL(TSize(iWindowWidth, iWindowHeight));
1.710 +
1.711 + // Create display object
1.712 + GetDisplayL();
1.713 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.714 + iEglSess->InitializeL();
1.715 +
1.716 + // Choose EGL config
1.717 + EGLConfig matchingConfigs[1];
1.718 + EGLint numConfigs = 0;
1.719 +
1.720 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
1.721 + TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported
1.722 +
1.723 + EGLint attrib_list[] = {
1.724 + EGL_FIXED_WIDTH_NOK, iSurfaceWidth,
1.725 + EGL_FIXED_HEIGHT_NOK, iSurfaceHeight,
1.726 + EGL_TARGET_EXTENT_OFFSET_X_NOK, iOffsetX,
1.727 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, iOffsetY,
1.728 + EGL_TARGET_EXTENT_WIDTH_NOK, iExtentWidth,
1.729 + EGL_TARGET_EXTENT_HEIGHT_NOK, iExtentHeight,
1.730 + EGL_BORDER_COLOR_RED_NOK, iBorderColor.Red(),
1.731 + EGL_BORDER_COLOR_GREEN_NOK, iBorderColor.Green(),
1.732 + EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue(),
1.733 + EGL_NONE};
1.734 +
1.735 + // Create the window surface and the egl context and make them current
1.736 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);
1.737 +
1.738 + // Create the test bitmap that will be used in the scaled surface
1.739 + // NOTE: This bitmap generally does not have borders,
1.740 + CFbsBitmap* testBitmap = CreateBitmapLC(TSize(iSurfaceWidth, iSurfaceHeight),0,0,0,0,TRgb(0,0,0));
1.741 +
1.742 + // Copy test bitmap to drawing surface
1.743 + WritePixelsToSurfaceL(*testBitmap);
1.744 +
1.745 + // This test is a bit different. Since the extent remains the same, and we only change
1.746 + // the offset, we create an oversized reference bitmap and compare the screen with a
1.747 + // region contained within the reference bitmap
1.748 + // Size is three times the extent so that it has extent size borders all around
1.749 + const TInt refWidth = 3*iExtentWidth;
1.750 + const TInt refHeight = 3*iExtentHeight;
1.751 + iBorderTop=iBorderBottom=iBorderLeft=iBorderRight=iExtentWidth;
1.752 + CFbsBitmap* refBitmap = CreateBitmapLC(TSize(refWidth, refHeight), iBorderTop, iBorderBottom, iBorderLeft, iBorderRight, iBorderColor);
1.753 +
1.754 + // Start doing iterations by increasing target extent offset
1.755 + INFO_PRINTF1(_L("Start increasing target extent offset size by (1,1)..."));
1.756 + for (iOffsetX=-iExtentWidth,iOffsetY=-iExtentHeight; iOffsetX<=iExtentWidth&&iOffsetY<=iExtentHeight; ++iOffsetX,++iOffsetY)
1.757 + {
1.758 + // Note that borders will appear other than when offset is (0,0)
1.759 + // - iSurfaceWidth/iSurfaceHeight - unmodified
1.760 + // - iExtentWidth/iExtentHeight - unmodified
1.761 +
1.762 + // set new offset values
1.763 + ASSERT_EGL_TRUE(iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), iOffsetX, iOffsetY, iExtentWidth, iExtentHeight));
1.764 +
1.765 + // re-populate buffers with the unmodified fixed size surface content
1.766 + WritePixelsToSurfaceL(*testBitmap);
1.767 +
1.768 + // perform the testing
1.769 + doTestPartialStepL(*refBitmap);
1.770 + }
1.771 +
1.772 + /// Cleanup
1.773 + CleanupStack::PopAndDestroy(2, testBitmap); //testBitmap, refBitmap
1.774 + iEglSess->CleanupSurfaceAndContextL();
1.775 + CleanAll();
1.776 + CloseWindow();
1.777 +
1.778 + INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_ExtentPositionChange::doTestStepL completed!"));
1.779 + RecordTestResultL();
1.780 + CloseTMSGraphicsStep();
1.781 + return TestStepResult();
1.782 + }
1.783 +
1.784 +TVerdict CEglTest_SurfaceScaling_ExtentPositionChange::doTestPartialStepL(const CFbsBitmap& aRefBitmap)
1.785 + {
1.786 + INFO_PRINTF3(_L("doTestPartialStepL started for offset of (%d, %d)...."), iOffsetX, iOffsetY);
1.787 +
1.788 + // offset change may be effective only after swapbuffers
1.789 + ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface()));
1.790 + ASSERT_EGL_TRUE(eglWaitClient());
1.791 + // Finish() to ensure all native window operations related to the surface complete before image comparision.
1.792 + iWsSession.Finish();
1.793 +
1.794 + //check all expected values
1.795 + CheckScalingAttributesL(iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight, iOffsetX, iOffsetY);
1.796 + CheckBorderColorL(iBorderColor.Red(), iBorderColor.Blue(), iBorderColor.Green());
1.797 +
1.798 + // Prepare the offset of the reference bitmap to know what sub-region should be compared
1.799 + const TInt refWidth = 3*iExtentWidth;
1.800 + const TInt refHeight = 3*iExtentHeight;
1.801 + TPoint bitmapOffset(refWidth-iExtentWidth-iRefBitmapOffset, refHeight-iExtentHeight-iRefBitmapOffset);
1.802 + iRefBitmapOffset++; // increase offset for next iteration
1.803 +
1.804 + // Comparision takes into account specific region within the reference bitmap
1.805 + TInt comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), bitmapOffset, aRefBitmap, TestStepName());
1.806 + TEST(comparison==KErrNone);
1.807 + INFO_PRINTF3(_L("CompareScreenImageL returns %d (expected is %d)"), comparison, KErrNone);
1.808 +
1.809 + return TestStepResult();
1.810 + }
1.811 +
1.812 +/**
1.813 +@SYMTestCaseID GRAPHICS-EGL-0669
1.814 +
1.815 +@SYMTestPriority 1
1.816 +
1.817 +@SYMPREQ 2676
1.818 +
1.819 +@SYMREQ 417-56592
1.820 +
1.821 +@SYMTestCaseDesc
1.822 +Create a fixed size surface and vary the extent size for a range of values
1.823 +
1.824 +@SYMTestActions
1.825 +1. Create a window of known size
1.826 +2. Create a fixed size surface, filled in with a predefined bitmap
1.827 +3. Draw the surface onto the window for a set extent and border colour
1.828 +4. Repeat step 3 but increasing target extent size by (2,2) pixels.
1.829 +5. Compare window content and border against a reference bitmap containing expected values.
1.830 +
1.831 +@SYMTestExpectedResults
1.832 +The window content matches the independently created reference bitmap in each situation
1.833 +*/
1.834 +TVerdict CEglTest_SurfaceScaling_ExtentSizeChange::doTestStepL()
1.835 + {
1.836 + SetTestStepID(_L("GRAPHICS-EGL-0669"));
1.837 + SetTestStepName(_L("GRAPHICS-EGL-0669"));
1.838 + INFO_PRINTF1(_L("CEglTest_SurfaceScaling_ExtentSizeChange::doTestStepL started...."));
1.839 +
1.840 + // set the initial value of a square window
1.841 + const TInt KWindowSize = 100;
1.842 +
1.843 + // surface with size and extent that matches the window size and no offset
1.844 + iWindowWidth = iWindowHeight = KWindowSize;
1.845 + iSurfaceWidth = iSurfaceHeight = KWindowSize;
1.846 + iExtentWidth = iExtentHeight = KWindowSize;
1.847 + iOffsetX = 0; iOffsetY = 0;
1.848 + iBorderColor = TRgb(0x80,0x40,0xF0); // set some arbitrary colour
1.849 + iBorderTop = 0; iBorderBottom = 0; iBorderLeft = 0; iBorderRight = 0;
1.850 +
1.851 + // Establish the connection to the window server and create
1.852 + // a WindowGroup and a Window object
1.853 + CreateAndActivateWindowL(TSize(iWindowWidth, iWindowHeight));
1.854 +
1.855 + // Create display object
1.856 + GetDisplayL();
1.857 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.858 + iEglSess->InitializeL();
1.859 +
1.860 + // Choose EGL config
1.861 + EGLConfig matchingConfigs[1];
1.862 + EGLint numConfigs = 0;
1.863 +
1.864 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
1.865 + TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported
1.866 +
1.867 + EGLint attrib_list[] = {
1.868 + EGL_FIXED_WIDTH_NOK, iSurfaceWidth,
1.869 + EGL_FIXED_HEIGHT_NOK, iSurfaceHeight,
1.870 + EGL_TARGET_EXTENT_OFFSET_X_NOK, iOffsetX,
1.871 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, iOffsetY,
1.872 + EGL_TARGET_EXTENT_WIDTH_NOK, iExtentWidth,
1.873 + EGL_TARGET_EXTENT_HEIGHT_NOK, iExtentHeight,
1.874 + EGL_BORDER_COLOR_RED_NOK, iBorderColor.Red(),
1.875 + EGL_BORDER_COLOR_GREEN_NOK, iBorderColor.Green(),
1.876 + EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue(),
1.877 + EGL_NONE};
1.878 +
1.879 + // Create the window surface and the egl context and make them current
1.880 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);
1.881 +
1.882 + // Create the test bitmap that will be used in the scaled surface
1.883 + // NOTE: This bitmap generally does not have borders,
1.884 + CFbsBitmap* testBitmap = CreateBitmapLC(TSize(iSurfaceWidth, iSurfaceHeight),0,0,0,0,TRgb(0,0,0));
1.885 +
1.886 + // Copy test bitmap to drawing surface
1.887 + WritePixelsToSurfaceL(*testBitmap);
1.888 +
1.889 + // Start doing iterations by increasing target extent size
1.890 + // We do increments of (2,2) because the reference bitmap is simetrically split into 4 areas, so size
1.891 + // of this reference bitmap should be an even number of pixels
1.892 + INFO_PRINTF1(_L("Start increasing target extent size by (2,2)..."));
1.893 + iExtentWidth=2;
1.894 + iExtentHeight=2;
1.895 + while(iExtentWidth <= (KWindowSize*2) && iExtentHeight <= (KWindowSize*2))
1.896 + {
1.897 + // Note that borders will appear while extent is smaller than window
1.898 + // - iSurfaceWidth/iSurfaceHeight - unmodified
1.899 + // - iOffsetX/iOffsetY - unmodified
1.900 + // Set up expected values for the border
1.901 + iBorderTop = 0; iBorderLeft = 0;
1.902 + iBorderBottom = iExtentHeight<iWindowHeight ? iWindowHeight-iExtentHeight : 0;
1.903 + iBorderRight = iExtentWidth<iWindowWidth ? iWindowWidth-iExtentWidth : 0;
1.904 +
1.905 + // set new target extent values
1.906 + ASSERT_EGL_TRUE(iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), iOffsetX, iOffsetY, iExtentWidth, iExtentHeight));
1.907 +
1.908 + // re-populate buffers with the unmodified fixed size surface content
1.909 + WritePixelsToSurfaceL(*testBitmap);
1.910 +
1.911 + // perform the testing
1.912 + doTestPartialStepL();
1.913 + iExtentWidth+=2;
1.914 + iExtentHeight+=2;
1.915 + }
1.916 +
1.917 + /// Cleanup
1.918 + CleanupStack::PopAndDestroy(testBitmap);
1.919 + iEglSess->CleanupSurfaceAndContextL();
1.920 + CleanAll();
1.921 + CloseWindow();
1.922 +
1.923 + INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_ExtentSizeChange::doTestStepL completed!"));
1.924 + RecordTestResultL();
1.925 + CloseTMSGraphicsStep();
1.926 + return TestStepResult();
1.927 + }
1.928 +
1.929 +TVerdict CEglTest_SurfaceScaling_ExtentSizeChange::doTestPartialStepL()
1.930 + {
1.931 + INFO_PRINTF3(_L("doTestPartialStepL started for extent size of (%d, %d)...."), iExtentWidth, iExtentHeight);
1.932 +
1.933 + // extent change may be effective only after swapbuffers
1.934 + ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface()));
1.935 + ASSERT_EGL_TRUE(eglWaitClient());
1.936 + // Finish() to ensure all native window operations related to the surface complete before image comparision.
1.937 + iWsSession.Finish();
1.938 +
1.939 + //check all expected values
1.940 + CheckScalingAttributesL(iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight, iOffsetX, iOffsetY);
1.941 + CheckBorderColorL(iBorderColor.Red(), iBorderColor.Blue(), iBorderColor.Green());
1.942 +
1.943 + // Create the reference bitmap that should be expected after the window resize
1.944 + // NOTE: This bitmap may have borders
1.945 + // Size could exceed that of the window, so check both extent and window
1.946 + const TInt refWidth = iExtentWidth>iWindowWidth ? iExtentWidth : iWindowWidth;
1.947 + const TInt refHeight = iExtentHeight>iWindowHeight ? iExtentHeight : iWindowHeight;
1.948 + CFbsBitmap* refBitmap = CreateBitmapLC(TSize(refWidth, refHeight), iBorderTop, iBorderBottom, iBorderLeft, iBorderRight, iBorderColor);
1.949 +
1.950 + // compare window contents with expected bitmap
1.951 + TInt comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), TPoint(0,0), *refBitmap, TestStepName());
1.952 + TEST(comparison==KErrNone);
1.953 + INFO_PRINTF3(_L("CompareScreenImageL returns %d (expected is %d)"), comparison, KErrNone);
1.954 +
1.955 + /// Cleanup
1.956 + CleanupStack::PopAndDestroy(refBitmap);
1.957 +
1.958 + return TestStepResult();
1.959 + }
1.960 +
1.961 +/**
1.962 +@SYMTestCaseID GRAPHICS-EGL-0670
1.963 +
1.964 +@SYMTestPriority 1
1.965 +
1.966 +@SYMPREQ 2676
1.967 +
1.968 +@SYMREQ 417-56592
1.969 +
1.970 +@SYMTestCaseDesc
1.971 +Check that updating surface scaling attributes is visible only after calling eglSwapBuffers
1.972 +
1.973 +@SYMTestActions
1.974 +1. Create a window of known size
1.975 +2. Create a fixed size surface, filled in with a predefined bitmap
1.976 +3. Draw the surface onto the window for a set extent and border colour
1.977 +4. Repeat step 3 but increasing target extent size and changing border colours
1.978 +5. Compare window content and border against a reference bitmap containing expected values
1.979 + 5a. Before calling eglSwapBuffers
1.980 + 5b. After callnig eglSwapBuffers
1.981 +
1.982 +@SYMTestExpectedResults
1.983 +5a. The window content matches the independently created reference with old values
1.984 +5b. The window content matches the independently created reference with new values
1.985 +*/
1.986 +TVerdict CEglTest_SurfaceScaling_SwapBuffers::doTestStepL()
1.987 + {
1.988 + SetTestStepID(_L("GRAPHICS-EGL-0670"));
1.989 + SetTestStepName(_L("GRAPHICS-EGL-0670"));
1.990 + INFO_PRINTF1(_L("CEglTest_SurfaceScaling_SwapBuffers::doTestStepL started...."));
1.991 +
1.992 + // set the initial value of a square window
1.993 + const TInt KWindowSize = 200;
1.994 +
1.995 + // surface with size that matches the window size and no offset and extent a quarter
1.996 + // of that originally positioned in the middle (so borders should be seen)
1.997 + iWindowWidth = iWindowHeight = KWindowSize;
1.998 + iSurfaceWidth = iSurfaceHeight = KWindowSize;
1.999 + iExtentWidth = iExtentHeight = KWindowSize/4;
1.1000 + iOffsetX = (iWindowWidth-iExtentWidth)/2; iOffsetY = (iWindowHeight-iExtentHeight)/2; // to center the surface at the middle of the window
1.1001 + iBorderColor = TRgb(0xFF,0xFF,0x00); // set some arbitrary colour with blue channel to 0x00
1.1002 + iBorderTop = iBorderBottom = iExtentHeight<iWindowHeight ? (iWindowHeight-iExtentHeight)/2 : 0;
1.1003 + iBorderLeft = iBorderRight = iExtentWidth<iWindowWidth ? (iWindowWidth-iExtentWidth)/2 : 0;
1.1004 +
1.1005 + // Establish the connection to the window server and create
1.1006 + // a WindowGroup and a Window object
1.1007 + CreateAndActivateWindowL(TSize(iWindowWidth, iWindowHeight));
1.1008 +
1.1009 + // Create display object
1.1010 + GetDisplayL();
1.1011 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.1012 + iEglSess->InitializeL();
1.1013 +
1.1014 + // Choose EGL config
1.1015 + EGLConfig matchingConfigs[1];
1.1016 + EGLint numConfigs = 0;
1.1017 +
1.1018 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
1.1019 + TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported
1.1020 +
1.1021 + EGLint attrib_list[] = {
1.1022 + EGL_FIXED_WIDTH_NOK, iSurfaceWidth,
1.1023 + EGL_FIXED_HEIGHT_NOK, iSurfaceHeight,
1.1024 + EGL_TARGET_EXTENT_OFFSET_X_NOK, iOffsetX,
1.1025 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, iOffsetY,
1.1026 + EGL_TARGET_EXTENT_WIDTH_NOK, iExtentWidth,
1.1027 + EGL_TARGET_EXTENT_HEIGHT_NOK, iExtentHeight,
1.1028 + EGL_BORDER_COLOR_RED_NOK, iBorderColor.Red(),
1.1029 + EGL_BORDER_COLOR_GREEN_NOK, iBorderColor.Green(),
1.1030 + EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue(),
1.1031 + EGL_NONE};
1.1032 +
1.1033 + // Create the window surface and the egl context and make them current
1.1034 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);
1.1035 +
1.1036 + // Create the test bitmap that will be used in the scaled surface
1.1037 + // NOTE: This bitmap generally does not have borders,
1.1038 + CFbsBitmap* testBitmap = CreateBitmapLC(TSize(iSurfaceWidth, iSurfaceHeight),0,0,0,0,TRgb(0,0,0));
1.1039 +
1.1040 + // Copy test bitmap to drawing surface
1.1041 + WritePixelsToSurfaceL(*testBitmap);
1.1042 +
1.1043 + // we need to update the window content for the first frame comparison inside the loop further down
1.1044 + ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface()));
1.1045 + ASSERT_EGL_TRUE(eglWaitClient());
1.1046 +
1.1047 + // Start doing iterations changing border colours and increasing target extent size
1.1048 + // We do increments of (2,2) because the reference bitmap is simetrically split into 4 areas, so size
1.1049 + // of this reference bitmap should be an even number of pixels
1.1050 + INFO_PRINTF1(_L("Start changing border colours and increasing target extent size by (2,2)..."));
1.1051 + for (;;)
1.1052 + {
1.1053 + // re-populate buffers with the unmodified fixed size surface content
1.1054 + WritePixelsToSurfaceL(*testBitmap);
1.1055 +
1.1056 + // perform the testing
1.1057 + doTestPartialStepL();
1.1058 +
1.1059 + // break the loop when necessary
1.1060 + if (iBorderColor.Blue()>=255)
1.1061 + break;
1.1062 + }
1.1063 +
1.1064 + /// Cleanup
1.1065 + CleanupStack::PopAndDestroy(testBitmap);
1.1066 + iEglSess->CleanupSurfaceAndContextL();
1.1067 + CleanAll();
1.1068 + CloseWindow();
1.1069 +
1.1070 + INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_SwapBuffers::doTestStepL completed!"));
1.1071 + RecordTestResultL();
1.1072 + CloseTMSGraphicsStep();
1.1073 + return TestStepResult();
1.1074 + }
1.1075 +
1.1076 +TVerdict CEglTest_SurfaceScaling_SwapBuffers::doTestPartialStepL()
1.1077 + {
1.1078 + INFO_PRINTF4(_L("doTestPartialStepL started for border colour (%d,%d,%d)...."), iBorderColor.Red(), iBorderColor.Green(), iBorderColor.Blue());
1.1079 +
1.1080 + // Note that borders will appear while extent is smaller than window
1.1081 + // - iSurfaceWidth/iSurfaceHeight - unmodified
1.1082 + // - iExtentWidth/iExtentHeight - modified
1.1083 + // - iOffsetX/iOffsetY - modified
1.1084 +
1.1085 + // Set up new value for border blue channel, storing old ones
1.1086 + TRgb oldBorderColor(iBorderColor);
1.1087 + TInt newColorBlue = oldBorderColor.Blue() + 5;
1.1088 + TESTL(newColorBlue>=0 && newColorBlue<=255);
1.1089 + iBorderColor.SetBlue(newColorBlue);
1.1090 +
1.1091 + // Set up new values for extent/offset, storing old ones
1.1092 + TInt oldExtentWidth = iExtentWidth;
1.1093 + TInt oldExtentHeight = iExtentHeight;
1.1094 + iExtentWidth+=2;
1.1095 + iExtentHeight+=2;
1.1096 + iOffsetX = (iWindowWidth-iExtentWidth)/2;
1.1097 + iOffsetY = (iWindowHeight-iExtentHeight)/2;
1.1098 +
1.1099 + // Set up expected values for the border, storing old ones
1.1100 + TInt oldBorderTop = iBorderTop;
1.1101 + TInt oldBorderBottom = iBorderBottom;
1.1102 + TInt oldBorderLeft = iBorderLeft;
1.1103 + TInt oldBorderRight = iBorderRight;
1.1104 + iBorderTop = iBorderBottom = iExtentHeight<iWindowHeight ? (iWindowHeight-iExtentHeight)/2 : 0;
1.1105 + iBorderLeft = iBorderRight = iExtentWidth<iWindowWidth ? (iWindowWidth-iExtentWidth)/2 : 0;
1.1106 +
1.1107 + // set new extent/offset values
1.1108 + ASSERT_EGL_TRUE(iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), iOffsetX, iOffsetY, iExtentWidth, iExtentHeight));
1.1109 + // set new border colour values
1.1110 + ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue()));
1.1111 +
1.1112 + // Check that values have been updated as expected
1.1113 + CheckScalingAttributesL(iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight, iOffsetX, iOffsetY);
1.1114 + CheckBorderColorL(iBorderColor.Red(), iBorderColor.Blue(), iBorderColor.Green());
1.1115 +
1.1116 + // Check that the screen has NOT BEEN UPDATED just yet
1.1117 +
1.1118 + // Create the reference bitmap that should be expected before the extent/border changes
1.1119 + TInt refWidth = oldExtentWidth>iWindowWidth ? oldExtentWidth : iWindowWidth;
1.1120 + TInt refHeight = oldExtentHeight>iWindowHeight ? oldExtentHeight : iWindowHeight;
1.1121 + CFbsBitmap* oldRefBitmap = CreateBitmapLC(TSize(refWidth, refHeight), oldBorderTop, oldBorderBottom, oldBorderLeft, oldBorderRight, oldBorderColor);
1.1122 +
1.1123 + // compare screen with old reference bitmap
1.1124 + TInt comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), TPoint(0,0), *oldRefBitmap, TestStepName());
1.1125 + TEST(comparison==KErrNone);
1.1126 + INFO_PRINTF3(_L("CompareScreenImageL before eglSwapBuffers returns %d (expected is %d)"), comparison, KErrNone);
1.1127 +
1.1128 + // extent/offset changes MUST be effective only after swapbuffers
1.1129 + ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface()));
1.1130 + ASSERT_EGL_TRUE(eglWaitClient());
1.1131 + // Finish() to ensure all native window operations related to the surface complete before image comparision.
1.1132 + iWsSession.Finish();
1.1133 +
1.1134 + //check values still are as expected
1.1135 + CheckScalingAttributesL(iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight, iOffsetX, iOffsetY);
1.1136 + CheckBorderColorL(iBorderColor.Red(), iBorderColor.Blue(), iBorderColor.Green());
1.1137 +
1.1138 + // Create the reference bitmap that should be expected after the extent/border changes
1.1139 + refWidth = iExtentWidth>iWindowWidth ? iExtentWidth : iWindowWidth;
1.1140 + refHeight = iExtentHeight>iWindowHeight ? iExtentHeight : iWindowHeight;
1.1141 + CFbsBitmap* newRefBitmap = CreateBitmapLC(TSize(refWidth, refHeight), iBorderTop, iBorderBottom, iBorderLeft, iBorderRight, iBorderColor);
1.1142 +
1.1143 + // compare screen with new reference bitmap
1.1144 + comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), TPoint(0,0), *newRefBitmap, TestStepName());
1.1145 + TEST(comparison==KErrNone);
1.1146 + INFO_PRINTF3(_L("CompareScreenImageL after eglSwapBuffers returns %d (expected is %d)"), comparison, KErrNone);
1.1147 +
1.1148 + /// Cleanup
1.1149 + CleanupStack::PopAndDestroy(2, oldRefBitmap); // oldRefBitmap, newRefBitmap
1.1150 +
1.1151 + return TestStepResult();
1.1152 + }
1.1153 +
1.1154 +/**
1.1155 +@SYMTestCaseID GRAPHICS-EGL-0652
1.1156 +
1.1157 +@SYMTestPriority 1
1.1158 +
1.1159 +@SYMPREQ 2676
1.1160 +
1.1161 +@SYMREQ 417-56592
1.1162 +
1.1163 +@SYMTestCaseDesc
1.1164 +Check that all configs that support surface scaling also support window surfaces.
1.1165 +
1.1166 +@SYMTestActions
1.1167 +1. Query number of configs
1.1168 +2. Iterate through all configs and check if surface scaling is supported
1.1169 +3. If surface scaling is supported, chech that it supports window surfaces and
1.1170 + attempt to create a fixed size window surface
1.1171 +4. If surface scaling is not supported, check eglGetConfigAttrib return value and
1.1172 + attempt to create a fixed size window surface
1.1173 +
1.1174 +@SYMTestExpectedResults
1.1175 +3. All configs that support surface scaling support window surfaces and window surface creation succeeds.
1.1176 +4. If surface scaling is not supported, eglGetConfigAttrib sets value to EGL_FALSE and window surface creation fails.
1.1177 +*/
1.1178 +TVerdict CEglTest_SurfaceScaling_WindowSurface_Check::doTestStepL()
1.1179 + {
1.1180 + INFO_PRINTF1(_L("CEglTest_SurfaceScaling_WindowSurface_Check::doTestStepL"));
1.1181 + SetTestStepName(_L("GRAPHICS-EGL-0652"));
1.1182 + SetTestStepID(_L("GRAPHICS-EGL-0652"));
1.1183 +
1.1184 + // Establish the connection to the window server and create
1.1185 + // a WindowGroup and a Window object
1.1186 + CreateAndActivateWindowL(TSize(100, 100));
1.1187 +
1.1188 + // Create display object
1.1189 + GetDisplayL();
1.1190 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.1191 + iEglSess->InitializeL();
1.1192 +
1.1193 + EGLConfig matchingConfigs[KMaxEglConfigs];
1.1194 + EGLint numConfigs = 0;
1.1195 +
1.1196 + EGLint attrib_list[] = {
1.1197 + EGL_FIXED_WIDTH_NOK, 50,
1.1198 + EGL_FIXED_HEIGHT_NOK, 50,
1.1199 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1200 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1201 + EGL_TARGET_EXTENT_WIDTH_NOK, 100,
1.1202 + EGL_TARGET_EXTENT_HEIGHT_NOK, 100,
1.1203 + EGL_NONE};
1.1204 +
1.1205 + // Query total number of configs
1.1206 + ASSERT_EGL_TRUE(eglGetConfigs(iDisplay, NULL, KMaxTInt, &numConfigs));
1.1207 + TESTL(numConfigs >= 1 && numConfigs <= KMaxEglConfigs);
1.1208 + INFO_PRINTF2(_L("Found %d configs in total"), numConfigs);
1.1209 +
1.1210 + // Get all configs
1.1211 + ASSERT_EGL_TRUE(eglGetConfigs(iDisplay, matchingConfigs, KMaxEglConfigs, &numConfigs));
1.1212 +
1.1213 + // Check that if surface scaling is supported in the config, then window surfaces are supported too
1.1214 + for(TInt i=0; i<numConfigs; i++)
1.1215 + {
1.1216 + // query scaling support
1.1217 + EGLint scalingSupport = -32; // arbitraty value which is neither EGL_TRUE nor EGL_FALSE
1.1218 + ASSERT_EGL_TRUE(eglGetConfigAttrib(iDisplay, matchingConfigs[i], EGL_SURFACE_SCALING_NOK, &scalingSupport));
1.1219 +
1.1220 + // query window surface support
1.1221 + EGLint surfaceType=-1;
1.1222 + ASSERT_EGL_TRUE(eglGetConfigAttrib(iDisplay, matchingConfigs[i], EGL_SURFACE_TYPE, &surfaceType));
1.1223 +
1.1224 + // check that if surface scaling is supported, it also supports window surfaces
1.1225 + if (scalingSupport==EGL_TRUE)
1.1226 + {
1.1227 + INFO_PRINTF2(_L("Config %d supports surface scaling. Checking window surface support..."), i);
1.1228 + TEST((surfaceType&EGL_WINDOW_BIT) == EGL_WINDOW_BIT);
1.1229 + }
1.1230 + else
1.1231 + {
1.1232 + // check value was updated accordingly
1.1233 + INFO_PRINTF2(_L("Config %d does NOT support surface scaling."), i);
1.1234 + TEST(scalingSupport==EGL_FALSE);
1.1235 + }
1.1236 +
1.1237 + // check if config supports window surface, fixed window surface creation follows scaling support
1.1238 + if ((surfaceType&EGL_WINDOW_BIT) == EGL_WINDOW_BIT)
1.1239 + {
1.1240 + EGLSurface windowSurface = eglCreateWindowSurface(iDisplay, matchingConfigs[i], &iWindow, attrib_list);
1.1241 + if (scalingSupport==EGL_TRUE)
1.1242 + {
1.1243 + INFO_PRINTF1(_L("Checking window surface creation succeeds..."));
1.1244 + TEST_EGL_ERROR(windowSurface =! EGL_NO_SURFACE, EGL_SUCCESS);
1.1245 + }
1.1246 + else
1.1247 + {
1.1248 + INFO_PRINTF1(_L("Checking window surface creation fails..."));
1.1249 + TEST_EGL_ERROR(windowSurface == EGL_NO_SURFACE, EGL_BAD_MATCH);
1.1250 + }
1.1251 + }
1.1252 + }
1.1253 +
1.1254 + // clean-up
1.1255 + CleanAll();
1.1256 + CloseWindow();
1.1257 +
1.1258 + INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_WindowSurface_Check::doTestStepL completed!"));
1.1259 + RecordTestResultL();
1.1260 + CloseTMSGraphicsStep();
1.1261 + return TestStepResult();
1.1262 + }
1.1263 +
1.1264 +/**
1.1265 +@SYMTestCaseID GRAPHICS-EGL-0653
1.1266 +
1.1267 +@SYMTestPriority 1
1.1268 +
1.1269 +@SYMPREQ 2676
1.1270 +
1.1271 +@SYMREQ 417-56592
1.1272 +
1.1273 +@SYMTestCaseDesc
1.1274 +Negative test. This test is to check the return value and error code of eglCreateWindowSurface
1.1275 +when creating a fixed size window surface with invalid combination of Surface Scaling attributes
1.1276 +and illegal values for each attribute.
1.1277 +
1.1278 +@SYMTestActions
1.1279 +1. Create a fixed size Window Surface with invalid combination of Surface Scaling attributes.
1.1280 + - Only specify 5 out of 6 of the following attributes, when specified, should be valid.
1.1281 + EGL_EXTENT_WIDTH_NOK, EGL_EXTENT_HEIGHT_NOK, EGL_TARGET_EXTENT_WIDTH_NOK,
1.1282 + EGL_TARGET_EXTENT_HEIGHT_NOK, EGL_TARGET_EXTENT_OFFSET_X_NOK, EGL_TARGET_EXTENT_OFFSET_Y_NOK
1.1283 +2. Create a fixed size Window Surface with illegal values for each attribute.
1.1284 + [attribute] [illegal value]
1.1285 + EGL_FIXED_WIDTH_NOK less than or equal to zero
1.1286 + EGL_FIXED_HEIGHT_NOK less than or equal to zero
1.1287 + EGL_TARGET_EXTENT_WIDTH_NOK less than or equal to zero
1.1288 + EGL_TARGET_EXTENT_HEIGHT_NOK less than or equal to zero
1.1289 +
1.1290 +@SYMTestExpectedResults
1.1291 +1. EGL_NO_SURFACE is returned with error set to EGL_BAD_ATTRIBUTE
1.1292 +2. EGL_NO_SURFACE is returned with error set to EGL_BAD_ATTRIBUTE
1.1293 +*/
1.1294 +TVerdict CEglTest_SurfaceScaling_Negative_CreateWindowSurface::doTestStepL()
1.1295 + {
1.1296 + INFO_PRINTF1(_L("CEglTest_SurfaceScaling_Negative_CreateWindowSurface::doTestStepL"));
1.1297 + SetTestStepName(_L("GRAPHICS-EGL-0653"));
1.1298 + SetTestStepID(_L("GRAPHICS-EGL-0653"));
1.1299 +
1.1300 + // Establish the connection to the window server and create
1.1301 + // a WindowGroup and a Window object
1.1302 + CreateAndActivateWindowL(TSize(100, 100));
1.1303 +
1.1304 + // Create display object
1.1305 + GetDisplayL();
1.1306 + CreateEglSessionL();
1.1307 + iEglSess->InitializeL();
1.1308 +
1.1309 + // Choose EGL config
1.1310 + EGLConfig matchingConfigs[1];
1.1311 + EGLint numConfigs = 0;
1.1312 +
1.1313 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
1.1314 + TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported
1.1315 +
1.1316 + // Make the fixed size surface half width and height of the window
1.1317 + TInt surfaceWidth = iWindow.Size().iWidth / 2;
1.1318 + TInt surfaceHeight = iWindow.Size().iHeight / 2;
1.1319 +
1.1320 + TInt invalidCombinationAttrNum = 6;
1.1321 + EGLint invalid_combination_attrib_list[][11] = {
1.1322 + {
1.1323 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1324 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1325 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1326 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1327 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1328 + EGL_NONE},
1.1329 + {
1.1330 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1331 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1332 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1333 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1334 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1335 + EGL_NONE},
1.1336 + {
1.1337 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1338 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1339 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1340 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1341 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1342 + EGL_NONE},
1.1343 + {
1.1344 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1345 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1346 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1347 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1348 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1349 + EGL_NONE},
1.1350 + {
1.1351 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1352 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1353 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1354 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1355 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1356 + EGL_NONE},
1.1357 + {
1.1358 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1359 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1360 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1361 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1362 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1363 + EGL_NONE}
1.1364 + };
1.1365 +
1.1366 + TInt illegalValAttrNum = 14;
1.1367 + EGLint illegal_value_attrib_list[][19] = {
1.1368 + {
1.1369 + EGL_FIXED_WIDTH_NOK, -1,
1.1370 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1371 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1372 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1373 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1374 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1375 + EGL_BORDER_COLOR_RED_NOK, 0xfc,
1.1376 + EGL_BORDER_COLOR_GREEN_NOK, 0xfd,
1.1377 + EGL_BORDER_COLOR_BLUE_NOK, 0xfe,
1.1378 + EGL_NONE},
1.1379 + {
1.1380 + EGL_FIXED_WIDTH_NOK, 0,
1.1381 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1382 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1383 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1384 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1385 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1386 + EGL_BORDER_COLOR_RED_NOK, 0xfc,
1.1387 + EGL_BORDER_COLOR_GREEN_NOK, 0xfd,
1.1388 + EGL_BORDER_COLOR_BLUE_NOK, 0xfe,
1.1389 + EGL_NONE},
1.1390 + {
1.1391 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1392 + EGL_FIXED_HEIGHT_NOK, -1,
1.1393 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1394 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1395 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1396 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1397 + EGL_BORDER_COLOR_RED_NOK, 0xfc,
1.1398 + EGL_BORDER_COLOR_GREEN_NOK, 0xfd,
1.1399 + EGL_BORDER_COLOR_BLUE_NOK, 0xfe,
1.1400 + EGL_NONE},
1.1401 + {
1.1402 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1403 + EGL_FIXED_HEIGHT_NOK, 0,
1.1404 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1405 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1406 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1407 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1408 + EGL_BORDER_COLOR_RED_NOK, 0xfc,
1.1409 + EGL_BORDER_COLOR_GREEN_NOK, 0xfd,
1.1410 + EGL_BORDER_COLOR_BLUE_NOK, 0xfe,
1.1411 + EGL_NONE},
1.1412 + {
1.1413 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1414 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1415 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1416 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1417 + EGL_TARGET_EXTENT_WIDTH_NOK, -1,
1.1418 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1419 + EGL_BORDER_COLOR_RED_NOK, 0xfc,
1.1420 + EGL_BORDER_COLOR_GREEN_NOK, 0xfd,
1.1421 + EGL_BORDER_COLOR_BLUE_NOK, 0xfe,
1.1422 + EGL_NONE},
1.1423 + {
1.1424 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1425 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1426 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1427 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1428 + EGL_TARGET_EXTENT_WIDTH_NOK, 0,
1.1429 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1430 + EGL_BORDER_COLOR_RED_NOK, 0xfc,
1.1431 + EGL_BORDER_COLOR_GREEN_NOK, 0xfd,
1.1432 + EGL_BORDER_COLOR_BLUE_NOK, 0xfe,
1.1433 + EGL_NONE},
1.1434 + {
1.1435 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1436 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1437 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1438 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1439 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1440 + EGL_TARGET_EXTENT_HEIGHT_NOK, -1,
1.1441 + EGL_BORDER_COLOR_RED_NOK, 0xfc,
1.1442 + EGL_BORDER_COLOR_GREEN_NOK, 0xfd,
1.1443 + EGL_BORDER_COLOR_BLUE_NOK, 0xfe,
1.1444 + EGL_NONE},
1.1445 + {
1.1446 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1447 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1448 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1449 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1450 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1451 + EGL_TARGET_EXTENT_HEIGHT_NOK, 0,
1.1452 + EGL_BORDER_COLOR_RED_NOK, 0xfc,
1.1453 + EGL_BORDER_COLOR_GREEN_NOK, 0xfd,
1.1454 + EGL_BORDER_COLOR_BLUE_NOK, 0xfe,
1.1455 + EGL_NONE},
1.1456 + {
1.1457 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1458 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1459 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1460 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1461 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1462 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1463 + EGL_BORDER_COLOR_RED_NOK, -1,
1.1464 + EGL_BORDER_COLOR_GREEN_NOK, 0,
1.1465 + EGL_BORDER_COLOR_BLUE_NOK, 0,
1.1466 + EGL_NONE},
1.1467 + {
1.1468 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1469 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1470 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1471 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1472 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1473 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1474 + EGL_BORDER_COLOR_RED_NOK, 0,
1.1475 + EGL_BORDER_COLOR_GREEN_NOK, -1,
1.1476 + EGL_BORDER_COLOR_BLUE_NOK, 0,
1.1477 + EGL_NONE},
1.1478 + {
1.1479 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1480 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1481 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1482 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1483 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1484 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1485 + EGL_BORDER_COLOR_RED_NOK, 0,
1.1486 + EGL_BORDER_COLOR_GREEN_NOK, 0,
1.1487 + EGL_BORDER_COLOR_BLUE_NOK, -1,
1.1488 + EGL_NONE},
1.1489 + {
1.1490 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1491 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1492 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1493 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1494 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1495 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1496 + EGL_BORDER_COLOR_RED_NOK, 256,
1.1497 + EGL_BORDER_COLOR_GREEN_NOK, 0,
1.1498 + EGL_BORDER_COLOR_BLUE_NOK, 0,
1.1499 + EGL_NONE},
1.1500 + {
1.1501 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1502 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1503 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1504 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1505 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1506 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1507 + EGL_BORDER_COLOR_RED_NOK, 0,
1.1508 + EGL_BORDER_COLOR_GREEN_NOK, 256,
1.1509 + EGL_BORDER_COLOR_BLUE_NOK, 0,
1.1510 + EGL_NONE},
1.1511 + {
1.1512 + EGL_FIXED_WIDTH_NOK, surfaceWidth,
1.1513 + EGL_FIXED_HEIGHT_NOK, surfaceHeight,
1.1514 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1515 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1516 + EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
1.1517 + EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
1.1518 + EGL_BORDER_COLOR_RED_NOK, 0,
1.1519 + EGL_BORDER_COLOR_GREEN_NOK, 0,
1.1520 + EGL_BORDER_COLOR_BLUE_NOK, 256,
1.1521 + EGL_NONE}
1.1522 + };
1.1523 +
1.1524 + INFO_PRINTF1(_L("Calling eglCreateWindowSurface with invalid combination of Surface Scaling attributes... - only five out of six compulsary attributes specified"));
1.1525 + for(TInt i = 0;i < invalidCombinationAttrNum;i++)
1.1526 + {
1.1527 + EGLSurface surface = eglCreateWindowSurface(iDisplay, matchingConfigs[0], &iWindow, invalid_combination_attrib_list[i]);
1.1528 + TEST_EGL_ERROR(surface == EGL_NO_SURFACE, EGL_BAD_ATTRIBUTE);
1.1529 + }
1.1530 +
1.1531 + INFO_PRINTF1(_L("Calling eglCreateWindowSurface with illegal values for each attribute..."));
1.1532 + for(TInt i = 0;i < illegalValAttrNum;i++)
1.1533 + {
1.1534 + EGLSurface surface = eglCreateWindowSurface(iDisplay, matchingConfigs[0], &iWindow, illegal_value_attrib_list[i]);
1.1535 + TEST_EGL_ERROR(surface == EGL_NO_SURFACE, EGL_BAD_ATTRIBUTE);
1.1536 + }
1.1537 +
1.1538 + // clean-up
1.1539 + CloseWindow();
1.1540 + CleanAll();
1.1541 +
1.1542 + INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_Negative_CreateWindowSurface::doTestStepL completed!"));
1.1543 + RecordTestResultL();
1.1544 + CloseTMSGraphicsStep();
1.1545 + return TestStepResult();
1.1546 + }
1.1547 +
1.1548 +/**
1.1549 +@SYMTestCaseID GRAPHICS-EGL-0654
1.1550 +
1.1551 +@SYMTestPriority 1
1.1552 +
1.1553 +@SYMPREQ 2676
1.1554 +
1.1555 +@SYMREQ 417-56592
1.1556 +
1.1557 +@SYMTestCaseDesc
1.1558 +Negative test. This test is to check the return value and error code when creating
1.1559 +a fixed size non window surface.
1.1560 +
1.1561 +@SYMTestActions
1.1562 +1. Attempt to create a pixmap with scaling attributes specified
1.1563 +2. Attempt to create a pbuffer surface with scaling attributes specified
1.1564 +3. Attempt to create a window surface with scaling attributes specified but
1.1565 + config doesn't support surface scaling
1.1566 +
1.1567 +@SYMTestExpectedResults
1.1568 +1. EGL_NO_SURFACE is returned with error set to EGL_BAD_ATTRIBUTE
1.1569 +2. EGL_NO_SURFACE is returned with error set to EGL_BAD_ATTRIBUTE
1.1570 +3. EGL_NO_SURFACE is returned with error set to EGL_BAD_MATCH
1.1571 +*/
1.1572 +TVerdict CEglTest_SurfaceScaling_Negative_FixedSize_NonWindowSurface::doTestStepL()
1.1573 + {
1.1574 + INFO_PRINTF1(_L("CEglTest_SurfaceScaling_Negative_FixedSize_NonWindowSurface::doTestStepL"));
1.1575 + SetTestStepName(_L("GRAPHICS-EGL-0654"));
1.1576 + SetTestStepID(_L("GRAPHICS-EGL-0654"));
1.1577 +
1.1578 + // Establish the connection to the window server and create
1.1579 + // a WindowGroup and a Window object
1.1580 + CreateAndActivateWindowL(TSize(100, 100));
1.1581 +
1.1582 + // Create bitmap
1.1583 + User::LeaveIfError(RFbsSession::Connect());
1.1584 + CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
1.1585 + CleanupStack::PushL(bitmap);
1.1586 + User::LeaveIfError(bitmap->Create(TSize(20, 20), EColor16MU));
1.1587 +
1.1588 + // Create display object
1.1589 + GetDisplayL();
1.1590 + CreateEglSessionL();
1.1591 + iEglSess->InitializeL();
1.1592 +
1.1593 + EGLConfig config;
1.1594 + EGLSurface surface = EGL_NO_SURFACE;
1.1595 + EGLint numConfigs = 0;
1.1596 +
1.1597 + // Use OpenVG to draw
1.1598 + ASSERT_EGL_TRUE(eglBindAPI(EGL_OPENVG_API));
1.1599 +
1.1600 + const EGLint KFixedSize_surface_attrib_list[] = {
1.1601 + EGL_FIXED_WIDTH_NOK, 100,
1.1602 + EGL_FIXED_HEIGHT_NOK, 100,
1.1603 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1604 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1605 + EGL_TARGET_EXTENT_WIDTH_NOK, 150,
1.1606 + EGL_TARGET_EXTENT_HEIGHT_NOK, 150,
1.1607 + EGL_NONE};
1.1608 +
1.1609 + // If all window surfaces in EGL are scalable, first case must be skipped. Others still valid
1.1610 + TInt index = iAllScalable ? 1 : 0;
1.1611 + for(; index < 3; index++)
1.1612 + {
1.1613 + switch(index)
1.1614 + {
1.1615 + case 0:
1.1616 + INFO_PRINTF1(_L("Calling eglCreateWindowSurface with surface scaling attribute specified in a config that does not support scaling..."));
1.1617 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribs_NoScaling], &config, 1, &numConfigs));
1.1618 + TEST(numConfigs==1);
1.1619 + surface = eglCreateWindowSurface(iDisplay, config, &iWindow, KFixedSize_surface_attrib_list);
1.1620 + TEST_EGL_ERROR(surface == EGL_NO_SURFACE, EGL_BAD_MATCH);
1.1621 + break;
1.1622 + case 1:
1.1623 + INFO_PRINTF1(_L("Calling eglCreatePixmapSurface with surface scaling attribute specified..."));
1.1624 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPixmapAttribsColor16MU], &config, 1, &numConfigs));
1.1625 + TEST(numConfigs==1);
1.1626 + surface = eglCreatePixmapSurface(iDisplay, config, (NativePixmapType)bitmap, KFixedSize_surface_attrib_list);
1.1627 + TEST_EGL_ERROR(surface == EGL_NO_SURFACE, EGL_BAD_ATTRIBUTE);
1.1628 + break;
1.1629 + case 2:
1.1630 + INFO_PRINTF1(_L("Calling eglCreatePbufferSurface with surface scaling attribute specified..."));
1.1631 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPBufferAttribsColor64K], &config, 1, &numConfigs));
1.1632 + TEST(numConfigs==1);
1.1633 + surface = eglCreatePbufferSurface(iDisplay, config, KFixedSize_surface_attrib_list);
1.1634 + TEST_EGL_ERROR(surface == EGL_NO_SURFACE, EGL_BAD_ATTRIBUTE);
1.1635 + break;
1.1636 + }
1.1637 + }
1.1638 +
1.1639 + // cleanup
1.1640 + CleanupStack::PopAndDestroy(bitmap);
1.1641 + CloseWindow();
1.1642 + CleanAll();
1.1643 + RFbsSession::Disconnect();
1.1644 +
1.1645 + INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_Negative_FixedSize_NonWindowSurface::doTestStepL completed!"));
1.1646 + RecordTestResultL();
1.1647 + CloseTMSGraphicsStep();
1.1648 + return TestStepResult();
1.1649 + }
1.1650 +
1.1651 +/**
1.1652 +@SYMTestCaseID GRAPHICS-EGL-0655
1.1653 +
1.1654 +@SYMTestPriority 1
1.1655 +
1.1656 +@SYMPREQ 2676
1.1657 +
1.1658 +@SYMREQ 417-56592
1.1659 +
1.1660 +@SYMTestCaseDesc
1.1661 +Exercising border color set by default.
1.1662 +
1.1663 +@SYMTestActions
1.1664 +1. Create a fixed size EGL Window Surface without border color specified.
1.1665 +2. Create a fixed size EGL Window Surface with border color specified for one channel.
1.1666 +3. Create a fixed size EGL Window Surface with border color specified for two channels.
1.1667 +
1.1668 +@SYMTestExpectedResults
1.1669 +Retrieved border color matches to the value it has been set at surface creation,
1.1670 +if during the surface creation border color has not been specified it is set to black (0x0).
1.1671 +*/
1.1672 +TVerdict CEglTest_SurfaceScalingDefaultBorderColor::doTestStepL()
1.1673 + {
1.1674 + SetTestStepName(_L("GRAPHICS-EGL-0655"));
1.1675 + SetTestStepID(_L("GRAPHICS-EGL-0655"));
1.1676 + INFO_PRINTF1(_L("CEglTest_SurfaceScalingDefaultBorderColor::doTestStepL"));
1.1677 +
1.1678 + // Establish the connection to the window server and create
1.1679 + // a WindowGroup and a Window object
1.1680 + CreateAndActivateWindowL(TSize(100,100));
1.1681 + const TInt KWindowWidth = iWindow.Size().iWidth;
1.1682 + const TInt KWindowHeight = iWindow.Size().iHeight;
1.1683 +
1.1684 + // Create display object
1.1685 + GetDisplayL();
1.1686 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.1687 + iEglSess->InitializeL();
1.1688 +
1.1689 + // Choose EGL config
1.1690 + EGLConfig matchingConfigs[1];
1.1691 + EGLint numConfigs = 0;
1.1692 +
1.1693 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
1.1694 + TESTL (numConfigs == 1); // Abort the test if the EGL config is not supported
1.1695 +
1.1696 + // Make the fixed size surface half width and height of the window
1.1697 + const TInt KSurfaceWidth = KWindowWidth/2;
1.1698 + const TInt KSurfaceHeight = KWindowHeight/2;
1.1699 +
1.1700 + EGLint attrib_list1[] = {
1.1701 + EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
1.1702 + EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
1.1703 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1704 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1705 + EGL_TARGET_EXTENT_WIDTH_NOK, KWindowWidth,
1.1706 + EGL_TARGET_EXTENT_HEIGHT_NOK, KWindowHeight,
1.1707 + EGL_NONE};
1.1708 +
1.1709 + EGLint attrib_list2[] = {
1.1710 + EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
1.1711 + EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
1.1712 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1713 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1714 + EGL_TARGET_EXTENT_WIDTH_NOK, KWindowWidth,
1.1715 + EGL_TARGET_EXTENT_HEIGHT_NOK, KWindowHeight,
1.1716 + EGL_BORDER_COLOR_RED_NOK, 0xf0,
1.1717 + EGL_NONE};
1.1718 +
1.1719 + EGLint attrib_list3[] = {
1.1720 + EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
1.1721 + EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
1.1722 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1723 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1724 + EGL_TARGET_EXTENT_WIDTH_NOK, KWindowWidth,
1.1725 + EGL_TARGET_EXTENT_HEIGHT_NOK, KWindowHeight,
1.1726 + EGL_BORDER_COLOR_BLUE_NOK, 0xf8,
1.1727 + EGL_BORDER_COLOR_GREEN_NOK, 0xfc,
1.1728 + EGL_NONE};
1.1729 +
1.1730 + for(TInt index = 0; index < 3; index++)
1.1731 + {
1.1732 + EGLint* attrib_list = NULL;
1.1733 + EGLint expectedRedChannelColor = 0;
1.1734 + EGLint expectedGreenChannelColor = 0;
1.1735 + EGLint expectedBlueChannelColor = 0;
1.1736 +
1.1737 + switch(index)
1.1738 + {
1.1739 + case 0:
1.1740 + attrib_list = attrib_list1;
1.1741 + break;
1.1742 + case 1:
1.1743 + expectedRedChannelColor = 0xf0;
1.1744 + attrib_list = attrib_list2;
1.1745 + break;
1.1746 + case 2:
1.1747 + expectedBlueChannelColor = 0xf8;
1.1748 + expectedGreenChannelColor = 0xfc;
1.1749 + attrib_list = attrib_list3;
1.1750 + break;
1.1751 + }
1.1752 + // Create the window surface and the egl context and make them current
1.1753 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);
1.1754 +
1.1755 + // Check expected border colours
1.1756 + CheckBorderColorL(expectedRedChannelColor, expectedBlueChannelColor, expectedGreenChannelColor);
1.1757 +
1.1758 + // Cleanup
1.1759 + iEglSess->CleanupSurfaceAndContextL();
1.1760 + }
1.1761 +
1.1762 + CleanAll();
1.1763 + CloseWindow();
1.1764 +
1.1765 + INFO_PRINTF1(_L("....CEglTest_SurfaceScalingDefaultBorderColor::doTestStepL completed!"));
1.1766 + RecordTestResultL();
1.1767 + CloseTMSGraphicsStep();
1.1768 + return TestStepResult();
1.1769 + }
1.1770 +
1.1771 +
1.1772 +/**
1.1773 +@SYMTestCaseID GRAPHICS-EGL-0656
1.1774 +
1.1775 +@SYMTestPriority 1
1.1776 +
1.1777 +@SYMPREQ 2676
1.1778 +
1.1779 +@SYMREQ 417-56592
1.1780 +
1.1781 +@SYMTestCaseDesc
1.1782 +Modifying an existing fixed size surface border color.
1.1783 +
1.1784 +@SYMTestActions
1.1785 +1. Create a fixed size EGL Window Surface with border color specified.
1.1786 +2. Modify border color with the new values.
1.1787 +
1.1788 +@SYMTestExpectedResults
1.1789 +New color will take place only after setting new values.
1.1790 +*/
1.1791 +
1.1792 +TVerdict CEglTest_SurfaceScalingModifyingBorderColor::doTestStepL()
1.1793 + {
1.1794 + SetTestStepName(_L("GRAPHICS-EGL-0656"));
1.1795 + SetTestStepID(_L("GRAPHICS-EGL-0656"));
1.1796 + INFO_PRINTF1(_L("CEglTest_SurfaceScalingModifyingBorderColor::doTestStepL"));
1.1797 +
1.1798 + // Establish the connection to the window server and create
1.1799 + // a WindowGroup and a Window object
1.1800 + CreateAndActivateWindowL(TSize(100,100));
1.1801 +
1.1802 + // Create display object
1.1803 + GetDisplayL();
1.1804 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.1805 + iEglSess->InitializeL();
1.1806 +
1.1807 + // Choose EGL config
1.1808 + EGLConfig matchingConfigs[1];
1.1809 + EGLint numConfigs = 0;
1.1810 +
1.1811 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
1.1812 + TESTL (numConfigs == 1); // Abort the test if the EGL config is not supported
1.1813 +
1.1814 + // Make the fixed size surface half width and height of the window
1.1815 + const TInt KWindowWidth = iWindow.Size().iWidth;
1.1816 + const TInt KWindowHeight = iWindow.Size().iHeight;
1.1817 + const TInt KSurfaceWidth = KWindowWidth/2;
1.1818 + const TInt KSurfaceHeight = KWindowHeight/2;
1.1819 + const TInt KExtentWidth = KSurfaceWidth;
1.1820 + const TInt KExtentHeight = KSurfaceHeight;
1.1821 + const EGLint KRedChannelColor = 0x20;
1.1822 + const EGLint KGreenChannelColor = 0x40;
1.1823 + const EGLint KBlueChannelColor = 0x60;
1.1824 +
1.1825 + EGLint attrib_list[] = {
1.1826 + EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
1.1827 + EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
1.1828 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.1829 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.1830 + EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth,
1.1831 + EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight,
1.1832 + EGL_BORDER_COLOR_RED_NOK, KRedChannelColor,
1.1833 + EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor,
1.1834 + EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor,
1.1835 + EGL_NONE};
1.1836 +
1.1837 + // Create the window surface and the egl context and make them current
1.1838 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);
1.1839 +
1.1840 + CheckBorderColorL(KRedChannelColor, KBlueChannelColor, KGreenChannelColor);
1.1841 +
1.1842 + //modify existing attributes
1.1843 + const EGLint KOffsetColor = 100;
1.1844 + ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, KRedChannelColor + KOffsetColor));
1.1845 + ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor + KOffsetColor));
1.1846 + ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor + KOffsetColor));
1.1847 +
1.1848 + //check that border color has been modified now
1.1849 + CheckBorderColorL(KRedChannelColor+KOffsetColor, KBlueChannelColor+KOffsetColor, KGreenChannelColor+KOffsetColor);
1.1850 +
1.1851 + // Cleanup
1.1852 + iEglSess->CleanupSurfaceAndContextL();
1.1853 + CleanAll();
1.1854 + CloseWindow();
1.1855 +
1.1856 + INFO_PRINTF1(_L("....CEglTest_SurfaceScalingModifyingBorderColor::doTestStepL completed!"));
1.1857 +
1.1858 + RecordTestResultL();
1.1859 + CloseTMSGraphicsStep();
1.1860 + return TestStepResult();
1.1861 + }
1.1862 +
1.1863 +/**
1.1864 +@SYMTestCaseID GRAPHICS-EGL-0657
1.1865 +
1.1866 +@SYMTestPriority 1
1.1867 +
1.1868 +@SYMPREQ 2676
1.1869 +
1.1870 +@SYMREQ 417-56592
1.1871 +
1.1872 +@SYMTestCaseDesc
1.1873 +Negative testing. Modifying an existing non-fixed size surface border color.
1.1874 +
1.1875 +@SYMTestActions
1.1876 +1. Create a non-fixed size EGL Window Surface.
1.1877 +2. Try to set border color after surface creation.
1.1878 +3. Repeat steps 1-2 for pixmap and pbuffer surface
1.1879 +
1.1880 +@SYMTestExpectedResults
1.1881 +Setting border color has no effect.
1.1882 +*/
1.1883 +TVerdict CEglTest_SurfaceScalingModifyingBorderColorNonFixed::doTestStepL()
1.1884 + {
1.1885 + SetTestStepName(_L("GRAPHICS-EGL-0657"));
1.1886 + SetTestStepID(_L("GRAPHICS-EGL-0657"));
1.1887 + INFO_PRINTF1(_L("CEglTest_SurfaceScalingModifyingBorderColorNonFixed::doTestStepL"));
1.1888 +
1.1889 + // Establish the connection to the window server and create
1.1890 + // a WindowGroup and a Window object
1.1891 + CreateAndActivateWindowL(TSize(100,100));
1.1892 +
1.1893 + const TInt KWindowWidth = iWindow.Size().iWidth;
1.1894 + const TInt KWindowHeight = iWindow.Size().iHeight;
1.1895 + const TInt KSurfaceWidth = KWindowWidth;
1.1896 + const TInt KSurfaceHeight = KWindowHeight;
1.1897 +
1.1898 + // Create display object
1.1899 + GetDisplayL();
1.1900 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.1901 + iEglSess->InitializeL();
1.1902 +
1.1903 + // Choose EGL config
1.1904 + EGLConfig matchingConfigs[1];
1.1905 + EGLint numConfigs = 0;
1.1906 +
1.1907 + // If all window surfaces in EGL are scalable, first case must be skipped. Others still valid
1.1908 + TInt index = iAllScalable ? 1 : 0;
1.1909 + for(; index < 3; index++)
1.1910 + {
1.1911 + switch(index)
1.1912 + {
1.1913 + case 0:
1.1914 + // Create the non-fixed size window surface and the egl context and make them current
1.1915 + INFO_PRINTF1(_L("Create the non-fixed size window surface and the egl context and make them current..."));
1.1916 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribs_NoScaling], matchingConfigs, 1, &numConfigs));
1.1917 + TESTL(numConfigs == 1);
1.1918 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow);
1.1919 + break;
1.1920 + case 1:
1.1921 + // Create the pbuffer surface and the egl context and make them current
1.1922 + INFO_PRINTF1(_L("Create the pbuffer surface and the egl context and make them current..."));
1.1923 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPBufferAttribsColor16MU], matchingConfigs, 1, &numConfigs));
1.1924 + TESTL(numConfigs == 1);
1.1925 + iEglSess->CreatePbufferSurfaceAndMakeCurrentL(matchingConfigs[0], TSize(KSurfaceWidth, KSurfaceHeight));
1.1926 + break;
1.1927 + case 2:
1.1928 + // Create the pixmap surface and the egl context and make them current
1.1929 + INFO_PRINTF1(_L("Create the pixmap surface and the egl context and make them current..."));
1.1930 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPixmapAttribsColor16MU], matchingConfigs, 1, &numConfigs));
1.1931 + TESTL(numConfigs == 1);
1.1932 + iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(TSize(KSurfaceWidth, KSurfaceHeight), EColor16MU);
1.1933 + break;
1.1934 + }
1.1935 +
1.1936 + // Set border color values to a non fixed size window (nothing should happen)
1.1937 + const EGLint KRedChannelColor = 0x20;
1.1938 + const EGLint KGreenChannelColor = 0x40;
1.1939 + const EGLint KBlueChannelColor = 0x60;
1.1940 + ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, KRedChannelColor));
1.1941 + ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor));
1.1942 + ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor));
1.1943 +
1.1944 + // Check all attributes (this is a non-fixed size window)
1.1945 + // Note that we cannot use CheckBorderColorL because values are not updated
1.1946 + EGLint redChannelColor = -1;
1.1947 + EGLint greenChannelColor = -2;
1.1948 + EGLint blueChannelColor = -3;
1.1949 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, &redChannelColor));
1.1950 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, &blueChannelColor));
1.1951 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, &greenChannelColor));
1.1952 + TEST(redChannelColor == -1);
1.1953 + TEST(greenChannelColor == -2);
1.1954 + TEST(blueChannelColor == -3);
1.1955 +
1.1956 + // Set invalid border color values to a non fixed size window (nothing should happen)
1.1957 + INFO_PRINTF1(_L("Attempt to set invalid border color values to a non fixed size window..."));
1.1958 + ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, KRedChannelColor+256));
1.1959 + ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor+256));
1.1960 + ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor+256));
1.1961 +
1.1962 + // Check all attributes (this is a non-fixed size window)
1.1963 + // Note that we cannot use CheckBorderColorL because values are not updated
1.1964 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, &redChannelColor));
1.1965 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, &blueChannelColor));
1.1966 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, &greenChannelColor));
1.1967 + TEST(redChannelColor == -1);
1.1968 + TEST(greenChannelColor == -2);
1.1969 + TEST(blueChannelColor == -3);
1.1970 +
1.1971 + // destroy surface and context
1.1972 + iEglSess->CleanupSurfaceAndContextL();
1.1973 + }
1.1974 +
1.1975 + // Cleanup
1.1976 + CleanAll();
1.1977 + CloseWindow();
1.1978 +
1.1979 + INFO_PRINTF1(_L("....CEglTest_SurfaceScalingModifyingBorderColorNonFixed::doTestStepL completed!"));
1.1980 +
1.1981 + RecordTestResultL();
1.1982 + CloseTMSGraphicsStep();
1.1983 + return TestStepResult();
1.1984 + }
1.1985 +
1.1986 +/**
1.1987 +@SYMTestCaseID GRAPHICS-EGL-0658
1.1988 +
1.1989 +@SYMTestPriority 1
1.1990 +
1.1991 +@SYMPREQ 2676
1.1992 +
1.1993 +@SYMREQ 417-56592
1.1994 +
1.1995 +@SYMTestCaseDesc
1.1996 +Negative testing. Attempt to modify an existing fixed size surface border color with invalid values.
1.1997 +
1.1998 +@SYMTestActions
1.1999 +1. Create a fixed size EGL Window Surface with border color specified.
1.2000 +2. Try to modify border color with the negative values.
1.2001 +3. Try to modify border color with the positive values greater than 255.
1.2002 +
1.2003 +@SYMTestExpectedResults
1.2004 +Attempt to modify the border color with the new values will fail with error code EGL_BAD_ATTRIBUTE.
1.2005 +*/
1.2006 +TVerdict CEglTest_SurfaceScalingModifyingInvalidBorderColor::doTestStepL()
1.2007 + {
1.2008 + SetTestStepName(_L("GRAPHICS-EGL-0658"));
1.2009 + SetTestStepID(_L("GRAPHICS-EGL-0658"));
1.2010 + INFO_PRINTF1(_L("CEglTest_SurfaceScalingModifyingInvalidBorderColor::doTestStepL"));
1.2011 +
1.2012 + // Establish the connection to the window server and create
1.2013 + // a WindowGroup and a Window object
1.2014 + CreateAndActivateWindowL(TSize(100,100));
1.2015 + const TInt KWindowWidth = iWindow.Size().iWidth;
1.2016 + const TInt KWindowHeight = iWindow.Size().iHeight;
1.2017 +
1.2018 + // Create display object
1.2019 + GetDisplayL();
1.2020 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.2021 + iEglSess->InitializeL();
1.2022 +
1.2023 + // Choose EGL config
1.2024 + EGLConfig matchingConfigs[1];
1.2025 + EGLint numConfigs = 0;
1.2026 +
1.2027 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
1.2028 + TESTL (numConfigs == 1); // Abort the test if the EGL config is not supported
1.2029 +
1.2030 + // Make the fixed size surface half width and height of the window
1.2031 + const TInt KSurfaceWidth = KWindowWidth/2;
1.2032 + const TInt KSurfaceHeight = KWindowHeight/2;
1.2033 + const EGLint KRedChannelColor = 0x20;
1.2034 + const EGLint KGreenChannelColor = 0x40;
1.2035 + const EGLint KBlueChannelColor = 0x60;
1.2036 +
1.2037 + EGLint attrib_list[] = {
1.2038 + EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
1.2039 + EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
1.2040 + EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
1.2041 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
1.2042 + EGL_TARGET_EXTENT_WIDTH_NOK, KWindowWidth,
1.2043 + EGL_TARGET_EXTENT_HEIGHT_NOK, KWindowHeight,
1.2044 + EGL_BORDER_COLOR_RED_NOK, KRedChannelColor,
1.2045 + EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor,
1.2046 + EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor,
1.2047 + EGL_NONE};
1.2048 +
1.2049 +
1.2050 + // Create the window surface and the egl context and make them current
1.2051 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);
1.2052 +
1.2053 + // check initial values match
1.2054 + CheckBorderColorL(KRedChannelColor, KBlueChannelColor, KGreenChannelColor);
1.2055 +
1.2056 + //modify existing attributes with negative value
1.2057 + INFO_PRINTF1(_L("Attempt to set negative border color values..."));
1.2058 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, -KRedChannelColor) == EGL_FALSE);
1.2059 + ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
1.2060 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, -KBlueChannelColor) == EGL_FALSE);
1.2061 + ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
1.2062 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, -KGreenChannelColor) == EGL_FALSE);
1.2063 + ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
1.2064 +
1.2065 + //check that border color has not been modified
1.2066 + CheckBorderColorL(KRedChannelColor, KBlueChannelColor, KGreenChannelColor);
1.2067 +
1.2068 + //modify existing attributes with very big positive value
1.2069 + INFO_PRINTF1(_L("Attempt to set border color values that are too big..."));
1.2070 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, KRedChannelColor + 256) == EGL_FALSE);
1.2071 + ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
1.2072 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor + 256) == EGL_FALSE);
1.2073 + ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
1.2074 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor + 256) == EGL_FALSE);
1.2075 + ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
1.2076 +
1.2077 + //check that border color has not been modified
1.2078 + CheckBorderColorL(KRedChannelColor, KBlueChannelColor, KGreenChannelColor);
1.2079 +
1.2080 + /// Cleanup
1.2081 + iEglSess->CleanupSurfaceAndContextL();
1.2082 + CleanAll();
1.2083 + CloseWindow();
1.2084 +
1.2085 + INFO_PRINTF1(_L("....CEglTest_SurfaceScalingModifyingInvalidBorderColor::doTestStepL completed!"));
1.2086 + RecordTestResultL();
1.2087 + CloseTMSGraphicsStep();
1.2088 + return TestStepResult();
1.2089 + }
1.2090 +
1.2091 +/**
1.2092 +@SYMTestCaseID GRAPHICS-EGL-0659
1.2093 +
1.2094 +@SYMTestPriority 1
1.2095 +
1.2096 +@SYMPREQ 2676
1.2097 +
1.2098 +@SYMREQ 417-56592
1.2099 +
1.2100 +@SYMTestCaseDesc
1.2101 +Negative testing. Attempt to modify an extent with eglSurfaceAttrib() after surface has been created.
1.2102 +
1.2103 +@SYMTestActions
1.2104 +1. Create a fixed size EGL Window Surface.
1.2105 +2. Try to modify a surface extent parameters with arbitrary values via eglSurfaceAttrib().
1.2106 +
1.2107 +@SYMTestExpectedResults
1.2108 +Attempt to modify the extent will fail with error code EGL_BAD_ATTRIBUTE.
1.2109 +*/
1.2110 +TVerdict CEglTest_SurfaceScalingModifyingExtent::doTestStepL()
1.2111 + {
1.2112 + SetTestStepName(_L("GRAPHICS-EGL-0659"));
1.2113 + SetTestStepID(_L("GRAPHICS-EGL-0659"));
1.2114 + INFO_PRINTF1(_L("CEglTest_SurfaceScalingModifyingExtent::doTestStepL"));
1.2115 +
1.2116 + // Establish the connection to the window server and create
1.2117 + // a WindowGroup and a Window object
1.2118 + CreateAndActivateWindowL(TSize(100,100));
1.2119 +
1.2120 + // Create display object
1.2121 + GetDisplayL();
1.2122 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.2123 + iEglSess->InitializeL();
1.2124 +
1.2125 + INFO_PRINTF1(_L("Attempt to modify surface extent for fixed size surfaces..."));
1.2126 + // Choose EGL config
1.2127 + EGLConfig matchingConfigs[1];
1.2128 + EGLint numConfigs = 0;
1.2129 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
1.2130 + TESTL (numConfigs == 1); // Abort the test if the EGL config is not supported
1.2131 +
1.2132 + const TInt KWindowWidth = iWindow.Size().iWidth;
1.2133 + const TInt KWindowHeight = iWindow.Size().iHeight;
1.2134 + const TInt KSurfaceWidth = KWindowWidth/2;
1.2135 + const TInt KSurfaceHeight = KWindowHeight/2;
1.2136 + const TInt KExtentWidth = KWindowWidth;
1.2137 + const TInt KExtentHeight = KWindowHeight;
1.2138 + const TInt KOffsetX = 10;
1.2139 + const TInt KOffsetY = 20;
1.2140 +
1.2141 + EGLint attrib_list[] = {
1.2142 + EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
1.2143 + EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
1.2144 + EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX,
1.2145 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY,
1.2146 + EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth,
1.2147 + EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight,
1.2148 + EGL_NONE};
1.2149 +
1.2150 + // Create the window surface and the egl context and make them current
1.2151 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);
1.2152 +
1.2153 + // Invalid update - modify existing attributes with any value
1.2154 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_FIXED_WIDTH_NOK, KSurfaceWidth/2) == EGL_FALSE);
1.2155 + ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
1.2156 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_FIXED_HEIGHT_NOK, KSurfaceHeight/2) == EGL_FALSE);
1.2157 + ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
1.2158 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth/2) == EGL_FALSE);
1.2159 + ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
1.2160 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight/2) == EGL_FALSE);
1.2161 + ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
1.2162 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX/2) == EGL_FALSE);
1.2163 + ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
1.2164 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY/2) == EGL_FALSE);
1.2165 + ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
1.2166 +
1.2167 + // check that attributes have not been modified
1.2168 + CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, KOffsetX, KOffsetY);
1.2169 +
1.2170 + /// Cleanup
1.2171 + iEglSess->CleanupSurfaceAndContextL();
1.2172 + CleanAll();
1.2173 + CloseWindow();
1.2174 +
1.2175 + INFO_PRINTF1(_L("....CEglTest_SurfaceScalingModifyingExtent::doTestStepL completed!"));
1.2176 + RecordTestResultL();
1.2177 + CloseTMSGraphicsStep();
1.2178 + return TestStepResult();
1.2179 + }
1.2180 +
1.2181 +/**
1.2182 +@SYMTestCaseID GRAPHICS-EGL-0671
1.2183 +
1.2184 +@SYMTestPriority 1
1.2185 +
1.2186 +@SYMPREQ 2676
1.2187 +
1.2188 +@SYMREQ 417-56592
1.2189 +
1.2190 +@SYMTestCaseDesc
1.2191 +Negative testing. Attempt to modify an extent with eglSurfaceAttrib() after surface has been created.
1.2192 +
1.2193 +@SYMTestActions
1.2194 +1. Create a non fixed size EGL Window Surface.
1.2195 +2. Try to modify a surface extent parameters with arbitrary values via eglSurfaceAttrib().
1.2196 +3. Repeat steps 2-3 for pixmap and pbuffer surface
1.2197 +
1.2198 +@SYMTestExpectedResults
1.2199 +Attempt to modify the extent will fail with error code EGL_BAD_ATTRIBUTE.
1.2200 +*/
1.2201 +TVerdict CEglTest_SurfaceScalingModifyingExtentNonFixed::doTestStepL()
1.2202 + {
1.2203 + SetTestStepName(_L("GRAPHICS-EGL-0671"));
1.2204 + SetTestStepID(_L("GRAPHICS-EGL-0671"));
1.2205 + INFO_PRINTF1(_L("CEglTest_SurfaceScalingModifyingExtentNonFixed::doTestStepL"));
1.2206 +
1.2207 + // Establish the connection to the window server and create
1.2208 + // a WindowGroup and a Window object
1.2209 + CreateAndActivateWindowL(TSize(100,100));
1.2210 +
1.2211 + const TInt KWindowWidth = iWindow.Size().iWidth;
1.2212 + const TInt KWindowHeight = iWindow.Size().iHeight;
1.2213 + const TInt KSurfaceWidth = KWindowWidth;
1.2214 + const TInt KSurfaceHeight = KWindowHeight;
1.2215 + const TInt KExtentWidth = KWindowWidth;
1.2216 + const TInt KExtentHeight = KWindowHeight;
1.2217 + const TInt KOffsetX = 11;
1.2218 + const TInt KOffsetY = 22;
1.2219 +
1.2220 + // Create display object
1.2221 + GetDisplayL();
1.2222 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.2223 + iEglSess->InitializeL();
1.2224 +
1.2225 + // Choose EGL config
1.2226 + EGLConfig matchingConfigs[1];
1.2227 + EGLint numConfigs = 0;
1.2228 +
1.2229 + // If all window surfaces in EGL are scalable, first case must be skipped. Others still valid
1.2230 + TInt index = iAllScalable ? 1 : 0;
1.2231 + for(; index < 3; index++)
1.2232 + {
1.2233 + switch(index)
1.2234 + {
1.2235 + case 0:
1.2236 + // Create the non-fixed size window surface and the egl context and make them current
1.2237 + INFO_PRINTF1(_L("Create the non-fixed size window surface and the egl context and make them current..."));
1.2238 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribs_NoScaling], matchingConfigs, 1, &numConfigs));
1.2239 + TESTL(numConfigs == 1);
1.2240 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow);
1.2241 + break;
1.2242 + case 1:
1.2243 + // Create the pbuffer surface and the egl context and make them current
1.2244 + INFO_PRINTF1(_L("Create the pbuffer surface and the egl context and make them current..."));
1.2245 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPBufferAttribsColor16MU], matchingConfigs, 1, &numConfigs));
1.2246 + TESTL(numConfigs == 1);
1.2247 + iEglSess->CreatePbufferSurfaceAndMakeCurrentL(matchingConfigs[0], TSize(KSurfaceWidth, KSurfaceHeight));
1.2248 + break;
1.2249 + case 2:
1.2250 + // Create the pixmap surface and the egl context and make them current
1.2251 + INFO_PRINTF1(_L("Create the pixmap surface and the egl context and make them current..."));
1.2252 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPixmapAttribsColor16MU], matchingConfigs, 1, &numConfigs));
1.2253 + TESTL(numConfigs == 1);
1.2254 + iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(TSize(KSurfaceWidth, KSurfaceHeight), EColor16MU);
1.2255 + break;
1.2256 + }
1.2257 +
1.2258 + // Invalid update - modify existing attributes with any value
1.2259 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_FIXED_WIDTH_NOK, KSurfaceWidth/2) == EGL_FALSE);
1.2260 + ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
1.2261 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_FIXED_HEIGHT_NOK, KSurfaceHeight/2) == EGL_FALSE);
1.2262 + ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
1.2263 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth/2) == EGL_FALSE);
1.2264 + ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
1.2265 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight/2) == EGL_FALSE);
1.2266 + ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
1.2267 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX/2) == EGL_FALSE);
1.2268 + ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
1.2269 + TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY/2) == EGL_FALSE);
1.2270 + ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
1.2271 +
1.2272 + // destroy surface and context
1.2273 + iEglSess->CleanupSurfaceAndContextL();
1.2274 + }
1.2275 +
1.2276 + /// Cleanup
1.2277 + CleanAll();
1.2278 + CloseWindow();
1.2279 +
1.2280 + INFO_PRINTF1(_L("....CEglTest_SurfaceScalingModifyingExtentNonFixed::doTestStepL completed!"));
1.2281 + RecordTestResultL();
1.2282 + CloseTMSGraphicsStep();
1.2283 + return TestStepResult();
1.2284 + }
1.2285 +
1.2286 +/**
1.2287 +@SYMTestCaseID GRAPHICS-EGL-0660
1.2288 +
1.2289 +@SYMTestPriority 1
1.2290 +
1.2291 +@SYMPREQ 2676
1.2292 +
1.2293 +@SYMREQ 417-56592
1.2294 +
1.2295 +@SYMTestCaseDesc
1.2296 +Query surface attrubutes related to scaling.
1.2297 +
1.2298 +@SYMTestActions
1.2299 +1. Create a non-fixed size EGL Window Surface.
1.2300 +2. Query surface attributes.
1.2301 +
1.2302 +@SYMTestExpectedResults
1.2303 +2. Query surface attributes succeeds and all atributes matches to the expected values.
1.2304 +*/
1.2305 +TVerdict CEglTest_SurfaceScalingQuerySurface::doTestStepL()
1.2306 + {
1.2307 + SetTestStepName(_L("GRAPHICS-EGL-0660"));
1.2308 + SetTestStepID(_L("GRAPHICS-EGL-0660"));
1.2309 + INFO_PRINTF1(_L("CEglTest_SurfaceScalingQuerySurface::doTestStepL"));
1.2310 +
1.2311 + // Establish the connection to the window server and create
1.2312 + // a WindowGroup and a Window object
1.2313 + CreateAndActivateWindowL(TSize(100,100));
1.2314 +
1.2315 + // Create display object
1.2316 + GetDisplayL();
1.2317 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.2318 + iEglSess->InitializeL();
1.2319 +
1.2320 + // Choose EGL config
1.2321 + EGLConfig matchingConfigs[1];
1.2322 + EGLint numConfigs = 0;
1.2323 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
1.2324 + TESTL (numConfigs == 1); // Abort the test if the EGL config is not supported
1.2325 +
1.2326 + const TInt KWindowWidth = iWindow.Size().iWidth;
1.2327 + const TInt KWindowHeight = iWindow.Size().iHeight;
1.2328 + const TInt KSurfaceWidth = KWindowWidth/2;
1.2329 + const TInt KSurfaceHeight = KWindowHeight/2;
1.2330 + const TInt KExtentWidth = KWindowWidth;
1.2331 + const TInt KExtentHeight = KWindowHeight;
1.2332 + const EGLint KXOffset = 10;
1.2333 + const EGLint KYOffset = 20;
1.2334 + const EGLint KBorderColorRed = 0xa0;
1.2335 + const EGLint KBorderColorBlue = 0xf0;
1.2336 + const EGLint KBorderColorGreen = 0xfc;
1.2337 +
1.2338 + EGLint attrib_list[] = {
1.2339 + EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
1.2340 + EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
1.2341 + EGL_TARGET_EXTENT_OFFSET_X_NOK, KXOffset,
1.2342 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, KYOffset,
1.2343 + EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth,
1.2344 + EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight,
1.2345 + EGL_BORDER_COLOR_BLUE_NOK, KBorderColorBlue,
1.2346 + EGL_BORDER_COLOR_GREEN_NOK, KBorderColorGreen,
1.2347 + EGL_BORDER_COLOR_RED_NOK, KBorderColorRed,
1.2348 + EGL_NONE};
1.2349 +
1.2350 + // Create the window surface and the egl context and make them current
1.2351 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);
1.2352 +
1.2353 + INFO_PRINTF1(_L("Query surface attributes and border colour back and check expected values..."));
1.2354 + CheckBorderColorL(KBorderColorRed, KBorderColorBlue, KBorderColorGreen);
1.2355 + CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, KXOffset, KYOffset);
1.2356 +
1.2357 + INFO_PRINTF1(_L("Check EGL_FIXED_WIDTH_NOK and EGL_FIXED_HEIGHT_NOK cannot be queried..."));
1.2358 + EGLint surfaceFixedWidth = -1;
1.2359 + EGLint surfaceFixedHeight = -2;
1.2360 + TEST(EGL_FALSE == eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_FIXED_WIDTH_NOK, &surfaceFixedWidth));
1.2361 + ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
1.2362 + TEST(EGL_FALSE == eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_FIXED_HEIGHT_NOK, &surfaceFixedHeight));
1.2363 + ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
1.2364 + TEST(surfaceFixedWidth == -1);
1.2365 + TEST(surfaceFixedHeight == -2);
1.2366 +
1.2367 + // clean-up
1.2368 + iEglSess->CleanupSurfaceAndContextL();
1.2369 + CloseWindow();
1.2370 + CleanAll();
1.2371 +
1.2372 + INFO_PRINTF1(_L("....CEglTest_SurfaceScalingQuerySurface::doTestStepL completed!"));
1.2373 + RecordTestResultL();
1.2374 + CloseTMSGraphicsStep();
1.2375 + return TestStepResult();
1.2376 + }
1.2377 +
1.2378 +/**
1.2379 +@SYMTestCaseID GRAPHICS-EGL-0662
1.2380 +
1.2381 +@SYMTestPriority 1
1.2382 +
1.2383 +@SYMPREQ 2676
1.2384 +
1.2385 +@SYMREQ 417-56592
1.2386 +
1.2387 +@SYMTestCaseDesc
1.2388 +Negative testing. Query surface attributes which are not supported by this API.
1.2389 +
1.2390 +@SYMTestActions
1.2391 +1. Create a non-fixed size EGL window surface.
1.2392 +2. Query surface attributes.
1.2393 +3. Repeat step 2 for EGL window surface, pixmap and pbuffer surface
1.2394 +
1.2395 +@SYMTestExpectedResults
1.2396 +Query surface attributes will fail with error code EGL_BAD_ATTRIBUTE.
1.2397 +*/
1.2398 +TVerdict CEglTest_SurfaceScalingQuerySurfaceNonFixed::doTestStepL()
1.2399 + {
1.2400 + SetTestStepName(_L("GRAPHICS-EGL-0662"));
1.2401 + SetTestStepID(_L("GRAPHICS-EGL-0662"));
1.2402 + INFO_PRINTF1(_L("CEglTest_SurfaceScalingQuerySurfaceNonFixed::doTestStepL"));
1.2403 +
1.2404 + // Establish the connection to the window server and create
1.2405 + // a WindowGroup and a Window object
1.2406 + CreateAndActivateWindowL(TSize(100,100));
1.2407 +
1.2408 + const TInt KWindowWidth = iWindow.Size().iWidth;
1.2409 + const TInt KWindowHeight = iWindow.Size().iHeight;
1.2410 + const TInt KSurfaceWidth = KWindowWidth;
1.2411 + const TInt KSurfaceHeight = KWindowHeight;
1.2412 +
1.2413 + // Create display object
1.2414 + GetDisplayL();
1.2415 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.2416 + iEglSess->InitializeL();
1.2417 +
1.2418 + // Choose EGL config
1.2419 + EGLConfig matchingConfigs[1];
1.2420 + EGLint numConfigs = 0;
1.2421 +
1.2422 + // If all window surfaces in EGL are scalable, first case must be skipped. Others still valid
1.2423 + TInt index = iAllScalable ? 1 : 0;
1.2424 + for(; index < 3; index++)
1.2425 + {
1.2426 + switch(index)
1.2427 + {
1.2428 + case 0:
1.2429 + // Create the non-fixed size window surface and the egl context and make them current
1.2430 + INFO_PRINTF1(_L("Create the non-fixed size window surface and the egl context and make them current..."));
1.2431 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribs_NoScaling], matchingConfigs, 1, &numConfigs));
1.2432 + TESTL(numConfigs == 1);
1.2433 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow);
1.2434 + break;
1.2435 + case 1:
1.2436 + // Create the pbuffer surface and the egl context and make them current
1.2437 + INFO_PRINTF1(_L("Create the pbuffer surface and the egl context and make them current..."));
1.2438 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPBufferAttribsColor16MU], matchingConfigs, 1, &numConfigs));
1.2439 + TESTL(numConfigs == 1);
1.2440 + iEglSess->CreatePbufferSurfaceAndMakeCurrentL(matchingConfigs[0], TSize(KSurfaceWidth, KSurfaceHeight));
1.2441 + break;
1.2442 + case 2:
1.2443 + // Create the pixmap surface and the egl context and make them current
1.2444 + INFO_PRINTF1(_L("Create the pixmap surface and the egl context and make them current..."));
1.2445 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPixmapAttribsColor16MU], matchingConfigs, 1, &numConfigs));
1.2446 + TESTL(numConfigs == 1);
1.2447 + iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(TSize(KSurfaceWidth, KSurfaceHeight), EColor16MU);
1.2448 + break;
1.2449 + }
1.2450 +
1.2451 + INFO_PRINTF1(_L("Check EGL_FIXED_WIDTH_NOK and EGL_FIXED_HEIGHT_NOK cannot be queried..."));
1.2452 + EGLint surfaceFixedWidth = -1;
1.2453 + EGLint surfaceFixedHeight = -2;
1.2454 + TEST(EGL_FALSE == eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_FIXED_WIDTH_NOK, &surfaceFixedWidth));
1.2455 + ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
1.2456 + TEST(EGL_FALSE == eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_FIXED_HEIGHT_NOK, &surfaceFixedHeight));
1.2457 + ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
1.2458 + TEST(surfaceFixedWidth == -1);
1.2459 + TEST(surfaceFixedHeight == -2);
1.2460 +
1.2461 + INFO_PRINTF1(_L("Check surface size is as we would expect..."));
1.2462 + EGLint surfaceWidth = 0;
1.2463 + EGLint surfaceHeight = 0;
1.2464 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_WIDTH, &surfaceWidth));
1.2465 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_HEIGHT, &surfaceHeight));
1.2466 + TEST(surfaceWidth == KWindowWidth); // non-fixed size surface
1.2467 + TEST(surfaceHeight == KWindowHeight); // non-fixed size surface
1.2468 +
1.2469 + INFO_PRINTF1(_L("Check scaling attributes cannot be queried..."));
1.2470 + EGLint extentOffsetX = -1;
1.2471 + EGLint extentOffsetY = -2;
1.2472 + EGLint extentWidth = -3;
1.2473 + EGLint extentHeight = -4;
1.2474 + EGLint borderColorBlue = -5;
1.2475 + EGLint borderColorRed = -6;
1.2476 + EGLint borderColorGreen = -7;
1.2477 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, &extentOffsetX));
1.2478 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, &extentOffsetY));
1.2479 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, &extentWidth));
1.2480 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, &extentHeight));
1.2481 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, &borderColorBlue));
1.2482 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, &borderColorGreen));
1.2483 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, &borderColorRed));
1.2484 + TEST(extentOffsetX == -1);
1.2485 + TEST(extentOffsetY == -2);
1.2486 + TEST(extentWidth == -3);
1.2487 + TEST(extentHeight == -4);
1.2488 + TEST(borderColorBlue == -5);
1.2489 + TEST(borderColorRed == -6);
1.2490 + TEST(borderColorGreen == -7);
1.2491 +
1.2492 + // destroy surface and context
1.2493 + iEglSess->CleanupSurfaceAndContextL();
1.2494 + }
1.2495 +
1.2496 + // clean-up
1.2497 + CloseWindow();
1.2498 + CleanAll();
1.2499 +
1.2500 + INFO_PRINTF1(_L("....CEglTest_SurfaceScalingQuerySurfaceNonFixed::doTestStepL completed!"));
1.2501 + RecordTestResultL();
1.2502 + CloseTMSGraphicsStep();
1.2503 + return TestStepResult();
1.2504 + }
1.2505 +
1.2506 +/**
1.2507 +@SYMTestCaseID GRAPHICS-EGL-0663
1.2508 +
1.2509 +@SYMTestPriority 1
1.2510 +
1.2511 +@SYMPREQ 2676
1.2512 +
1.2513 +@SYMREQ 417-56592
1.2514 +
1.2515 +@SYMTestCaseDesc
1.2516 +Negative testing. Query surface scaling capability with invalid parameters.
1.2517 +
1.2518 +@SYMTestActions
1.2519 +1. Query surface scaling capability for the different configs.
1.2520 +2. Query surface scaling capability with invalid display.
1.2521 +3. Query surface scaling capability with negative surface width.
1.2522 +4. Query surface scaling capability with negative surface height.
1.2523 +5. Query surface scaling capability with negative target width.
1.2524 +6. Query surface scaling capability with negative target height.
1.2525 +7. Query surface scaling capability with zero surface width.
1.2526 +8. Query surface scaling capability with zero surface height.
1.2527 +9. Query surface scaling capability with zero target width.
1.2528 +10. Query surface scaling capability with zero target height.
1.2529 +
1.2530 +@SYMTestExpectedResults
1.2531 +1. Query surface capability will fail with error code EGL_BAD_MATCH if config doesn't support scaling and succeed otherwise.
1.2532 +2. Query surface capability will fail with error code EGL_BAD_DISPLAY.
1.2533 +3. Query surface capability will fail with error code EGL_BAD_PARAMETER.
1.2534 +4. Query surface capability will fail with error code EGL_BAD_PARAMETER.
1.2535 +5. Query surface capability will fail with error code EGL_BAD_PARAMETER.
1.2536 +6. Query surface capability will fail with error code EGL_BAD_PARAMETER.
1.2537 +7. Query surface capability will fail with error code EGL_BAD_PARAMETER.
1.2538 +8. Query surface capability will fail with error code EGL_BAD_PARAMETER.
1.2539 +9. Query surface capability will fail with error code EGL_BAD_PARAMETER.
1.2540 +10. Query surface capability will fail with error code EGL_BAD_PARAMETER.
1.2541 +*/
1.2542 +TVerdict CEglTest_SurfaceScalingCapability::doTestStepL()
1.2543 + {
1.2544 + SetTestStepName(_L("GRAPHICS-EGL-0663"));
1.2545 + SetTestStepID(_L("GRAPHICS-EGL-0663"));
1.2546 + INFO_PRINTF1(_L("CEglTest_SurfaceScalingCapability::doTestStepL"));
1.2547 +
1.2548 + // Create display object
1.2549 + GetDisplayL();
1.2550 + CreateEglSessionL();
1.2551 + iEglSess->InitializeL();
1.2552 +
1.2553 + // Choose EGL config
1.2554 + EGLConfig matchingConfigs[KMaxEglConfigs];
1.2555 + EGLint numConfigs = 0;
1.2556 +
1.2557 + CreateAndActivateWindowL(TSize(100,100));
1.2558 +
1.2559 + const TInt KWindowWidth = iWindow.Size().iWidth;
1.2560 + const TInt KWindowHeight = iWindow.Size().iHeight;
1.2561 + const TInt KSurfaceWidth = KWindowWidth/2;
1.2562 + const TInt KSurfaceHeight = KWindowHeight/2;
1.2563 + const EGLDisplay KInvalidDisplay = iDisplay - 100;
1.2564 + EGLint capability = -1; //arbitrary number beyond the existing range
1.2565 + EGLConfig config = -1;
1.2566 +
1.2567 + INFO_PRINTF1(_L("Calling eglGetConfigs to get configs..."));
1.2568 + ASSERT_EGL_TRUE(eglGetConfigs(iDisplay, matchingConfigs, KMaxEglConfigs, &numConfigs));
1.2569 + for(TInt index = 0; index < numConfigs; index++)
1.2570 + {
1.2571 + EGLint value = EGL_FALSE;
1.2572 + ASSERT_EGL_TRUE(eglGetConfigAttrib(iDisplay, matchingConfigs[index], EGL_SURFACE_SCALING_NOK, &value));
1.2573 + if(value == EGL_FALSE)
1.2574 + {
1.2575 + TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, matchingConfigs[index], KSurfaceWidth, KSurfaceHeight, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE);
1.2576 + TEST(capability == -1); //make sure that value has not been modified
1.2577 + ASSERT_EGL_ERROR(EGL_BAD_MATCH);
1.2578 + }
1.2579 + else
1.2580 + {
1.2581 + if(config == -1)
1.2582 + {//memorize the first config that supports scaling
1.2583 + config = matchingConfigs[index];
1.2584 + }
1.2585 + ASSERT_EGL_TRUE(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, matchingConfigs[index], KSurfaceWidth, KSurfaceHeight, KWindowWidth, KWindowHeight, &capability));
1.2586 + TEST((capability == EGL_SUPPORTED_NOK) || (capability == EGL_SLOW_NOK));
1.2587 + capability = -1;
1.2588 + }
1.2589 + }
1.2590 + capability = -1;
1.2591 + TEST(config != -1); // make sure that at least one config supports scaling
1.2592 +
1.2593 + //invalid display
1.2594 + TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(KInvalidDisplay, config, KSurfaceWidth, KSurfaceHeight, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE);
1.2595 + TEST(capability == -1); //make sure that value has not been modified
1.2596 + ASSERT_EGL_ERROR(EGL_BAD_DISPLAY);
1.2597 +
1.2598 + //negative width
1.2599 + TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, -KSurfaceWidth, KSurfaceHeight, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE);
1.2600 + TEST(capability == -1); //make sure that value has not been modified
1.2601 + ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
1.2602 + TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, KSurfaceHeight, -KWindowWidth, KWindowHeight, &capability) == EGL_FALSE);
1.2603 + TEST(capability == -1); //make sure that value has not been modified
1.2604 + ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
1.2605 + //negative height
1.2606 + TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, -KSurfaceHeight, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE);
1.2607 + TEST(capability == -1); //make sure that value has not been modified
1.2608 + ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
1.2609 + TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, KSurfaceHeight, KWindowWidth, -KWindowHeight, &capability) == EGL_FALSE);
1.2610 + TEST(capability == -1); //make sure that value has not been modified
1.2611 + ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
1.2612 +
1.2613 + //zero width
1.2614 + TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, -0, KSurfaceHeight, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE);
1.2615 + TEST(capability == -1); //make sure that value has not been modified
1.2616 + ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
1.2617 + TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, KSurfaceHeight, -0, KWindowHeight, &capability) == EGL_FALSE);
1.2618 + TEST(capability == -1); //make sure that value has not been modified
1.2619 + ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
1.2620 + //zero height
1.2621 + TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, -0, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE);
1.2622 + TEST(capability == -1); //make sure that value has not been modified
1.2623 + ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
1.2624 + TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, KSurfaceHeight, KWindowWidth, -0, &capability) == EGL_FALSE);
1.2625 + TEST(capability == -1); //make sure that value has not been modified
1.2626 + ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
1.2627 +
1.2628 + // Cleanup
1.2629 + CloseWindow();
1.2630 + CleanAll();
1.2631 +
1.2632 + INFO_PRINTF1(_L("....CEglTest_SurfaceScalingCapability::doTestStepL completed!"));
1.2633 + RecordTestResultL();
1.2634 + CloseTMSGraphicsStep();
1.2635 + return TestStepResult();
1.2636 + }
1.2637 +
1.2638 +/**
1.2639 +@SYMTestCaseID GRAPHICS-EGL-0664
1.2640 +
1.2641 +@SYMTestPriority 1
1.2642 +
1.2643 +@SYMPREQ 2676
1.2644 +
1.2645 +@SYMREQ 417-56592
1.2646 +
1.2647 +@SYMTestCaseDesc
1.2648 +Call eglSetSurfaceScalingNOK with fixed size surface and a target extent that can be set.
1.2649 +
1.2650 +@SYMTestActions
1.2651 +Retrieve all available EGL configs and for those that support surface scaling
1.2652 +1. Create a window surface with surface scaling attributes and make it current
1.2653 +2. Query these attributes and check they correspond with what is expected
1.2654 +3. Query if surface supports scaling to a different extent
1.2655 +4. Set the new extent and new offset to the surface
1.2656 +5. Query these attributes
1.2657 +
1.2658 +@SYMTestExpectedResults
1.2659 +5. Surface scaling attributes have been updated
1.2660 +*/
1.2661 +TVerdict CEglTest_SurfaceScalingSet::doTestStepL()
1.2662 + {
1.2663 + SetTestStepName(_L("GRAPHICS-EGL-0664"));
1.2664 + SetTestStepID(_L("GRAPHICS-EGL-0664"));
1.2665 + INFO_PRINTF1(_L("CEglTest_SurfaceScalingSet::doTestStepL"));
1.2666 +
1.2667 + // Establish the connection to the window server and create
1.2668 + // a WindowGroup and a Window object
1.2669 + CreateAndActivateWindowL(TSize(100, 100));
1.2670 +
1.2671 + const TInt KWindowWidth = iWindow.Size().iWidth;
1.2672 + const TInt KWindowHeight = iWindow.Size().iHeight;
1.2673 + const TInt KSurfaceWidth = KWindowWidth/2;
1.2674 + const TInt KSurfaceHeight = KWindowHeight/2;
1.2675 + const TInt KExtentWidth = KWindowWidth;
1.2676 + const TInt KExtentHeight = KWindowHeight;
1.2677 + const EGLint KOffsetX = 3;
1.2678 + const EGLint KOffsetY = 7;
1.2679 +
1.2680 + EGLint attrib_list[] = {
1.2681 + EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
1.2682 + EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
1.2683 + EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX,
1.2684 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY,
1.2685 + EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth,
1.2686 + EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight,
1.2687 + EGL_NONE};
1.2688 +
1.2689 + // Create display object
1.2690 + GetDisplayL();
1.2691 + CreateEglSessionL();
1.2692 + iEglSess->InitializeL();
1.2693 +
1.2694 + // Choose EGL config
1.2695 + EGLConfig matchingConfigs[KMaxEglConfigs];
1.2696 + EGLint numConfigs = 0;
1.2697 +
1.2698 + // Query total number of configs
1.2699 + ASSERT_EGL_TRUE(eglGetConfigs(iDisplay, NULL, KMaxTInt, &numConfigs));
1.2700 + TESTL(numConfigs >= 1 && numConfigs <= KMaxEglConfigs);
1.2701 + INFO_PRINTF2(_L("Found %d configs"), numConfigs);
1.2702 +
1.2703 + // Get the configs
1.2704 + ASSERT_EGL_TRUE(eglGetConfigs(iDisplay, matchingConfigs, KMaxEglConfigs, &numConfigs));
1.2705 +
1.2706 + // Check if surface scaling is supported in the config, if so, create surface
1.2707 + for(TInt i=0; i<numConfigs; i++)
1.2708 + {
1.2709 + EGLint value = -32; // arbitraty value which is neither EGL_TRUE nor EGL_FALSE
1.2710 + ASSERT_EGL_TRUE(eglGetConfigAttrib(iDisplay, matchingConfigs[i], EGL_SURFACE_SCALING_NOK, &value));
1.2711 + if (value==EGL_TRUE)
1.2712 + {
1.2713 + INFO_PRINTF2(_L("Config %d supports surface scaling. Create a window surface..."), i);
1.2714 +
1.2715 + // Create the window surface and the egl context and make them current
1.2716 + EGLint renderableType = 0;
1.2717 + ASSERT_EGL_TRUE(eglGetConfigAttrib(iDisplay, matchingConfigs[i], EGL_RENDERABLE_TYPE, &renderableType));
1.2718 + if (renderableType&EGL_OPENVG_BIT)
1.2719 + {
1.2720 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[i], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);
1.2721 + }
1.2722 + else if (renderableType&EGL_OPENGL_ES_BIT)
1.2723 + {
1.2724 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[i], iWindow, EFalse, EGL_OPENGL_ES_API, 1, attrib_list);
1.2725 + }
1.2726 + else
1.2727 + {
1.2728 + WARN_PRINTF2(_L("Config %d does not support either OPENVG or OPENGL_ES. Skip!"), i);
1.2729 + continue;
1.2730 + }
1.2731 +
1.2732 + // Check values are as expected
1.2733 + CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, KOffsetX, KOffsetY);
1.2734 +
1.2735 + // modify target extent atttributes
1.2736 + // 1 - first check that this new extent is supported, should do as we're reducing it
1.2737 + EGLint capability = -1; //arbitrary number beyond the existing range
1.2738 + EGLint newExtentWidth = KExtentWidth / 2;
1.2739 + EGLint newExtentHeight = KExtentHeight / 2;
1.2740 + EGLint newOffsetX = KOffsetX * 2;
1.2741 + EGLint newOffsetY = KOffsetY * 2;
1.2742 + ASSERT_EGL_TRUE(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, matchingConfigs[i], KSurfaceWidth, KSurfaceHeight, newExtentWidth, newExtentHeight, &capability));
1.2743 + TEST((capability == EGL_SUPPORTED_NOK) || (capability == EGL_SLOW_NOK));
1.2744 + // 2 - set new extent
1.2745 + ASSERT_EGL_TRUE(iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), newOffsetX, newOffsetY, newExtentWidth, newExtentHeight));
1.2746 +
1.2747 + // Check attributes have changed
1.2748 + CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, newExtentWidth, newExtentHeight, newOffsetX, newOffsetY);
1.2749 +
1.2750 + // Cleanup
1.2751 + iEglSess->CleanupSurfaceAndContextL();
1.2752 + }
1.2753 + }
1.2754 +
1.2755 + // Cleanup
1.2756 + CloseWindow();
1.2757 + CleanAll();
1.2758 +
1.2759 + INFO_PRINTF1(_L("....CEglTest_SurfaceScalingSet::doTestStepL completed!"));
1.2760 + RecordTestResultL();
1.2761 + CloseTMSGraphicsStep();
1.2762 + return TestStepResult();
1.2763 + }
1.2764 +
1.2765 +/**
1.2766 +@SYMTestCaseID GRAPHICS-EGL-0665
1.2767 +
1.2768 +@SYMTestPriority 1
1.2769 +
1.2770 +@SYMPREQ 2676
1.2771 +
1.2772 +@SYMREQ 417-56592
1.2773 +
1.2774 +@SYMTestCaseDesc
1.2775 +Negative testing. Call eglSetSurfaceScalingNOK with invalid parameters
1.2776 +
1.2777 +@SYMTestActions
1.2778 +1. Set surface scaling with invalid display.
1.2779 +2. Set surface scaling with negative target width.
1.2780 +3. Set surface scaling with negative target height.
1.2781 +3. Set surface scaling with zero target width.
1.2782 +3. Set surface scaling with zero target height.
1.2783 +@SYMTestExpectedResults
1.2784 +1. Set surface scaling will fail with error code EGL_BAD_DISPLAY.
1.2785 +2. Set surface scaling will fail with error code EGL_BAD_PARAMETER.
1.2786 +3. Set surface scaling will fail with error code EGL_BAD_PARAMETER.
1.2787 +4. Set surface scaling will fail with error code EGL_BAD_PARAMETER.
1.2788 +5. Set surface scaling will fail with error code EGL_BAD_PARAMETER.
1.2789 +*/
1.2790 +TVerdict CEglTest_SurfaceScalingSetInvalidAttributes::doTestStepL()
1.2791 + {
1.2792 + SetTestStepName(_L("GRAPHICS-EGL-0665"));
1.2793 + SetTestStepID(_L("GRAPHICS-EGL-0665"));
1.2794 + INFO_PRINTF1(_L("CEglTest_SurfaceScalingSetInvalidAttributes::doTestStepL"));
1.2795 +
1.2796 + // Establish the connection to the window server and create
1.2797 + // a WindowGroup and a Window object
1.2798 + CreateAndActivateWindowL(TSize(100, 100));
1.2799 +
1.2800 + // Create display object
1.2801 + GetDisplayL();
1.2802 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.2803 + iEglSess->InitializeL();
1.2804 +
1.2805 + // Choose EGL config
1.2806 + EGLConfig matchingConfigs[1];
1.2807 + EGLint numConfigs = 0;
1.2808 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
1.2809 + TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported
1.2810 +
1.2811 + const TInt KWindowWidth = iWindow.Size().iWidth;
1.2812 + const TInt KWindowHeight = iWindow.Size().iHeight;
1.2813 + const TInt KSurfaceWidth = KWindowWidth/2;
1.2814 + const TInt KSurfaceHeight = KWindowHeight/2;
1.2815 + const TInt KExtentWidth = KWindowWidth;
1.2816 + const TInt KExtentHeight = KWindowHeight;
1.2817 + const EGLint KOffsetX = 11;
1.2818 + const EGLint KOffsetY = 13;
1.2819 + EGLint attrib_list[] = {
1.2820 + EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
1.2821 + EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
1.2822 + EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX,
1.2823 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY,
1.2824 + EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth,
1.2825 + EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight,
1.2826 + EGL_NONE};
1.2827 +
1.2828 + // Create the window surface and the egl context and make them current
1.2829 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);
1.2830 +
1.2831 + // Check all attributes
1.2832 + CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, KOffsetX, KOffsetY);
1.2833 +
1.2834 + for(TInt index = 0; index < 5; index++)
1.2835 + {
1.2836 + // new attribute values
1.2837 + EGLDisplay newDisplay = iDisplay;
1.2838 + EGLint newExtentWidth = KExtentWidth;
1.2839 + EGLint newExtentHeight = KExtentHeight;
1.2840 + EGLint newOffsetX = KOffsetX;
1.2841 + EGLint newOffsetY = KOffsetY;
1.2842 + // expected error value
1.2843 + EGLint error = EGL_BAD_PARAMETER;
1.2844 +
1.2845 + switch(index)
1.2846 + {
1.2847 + case 0:
1.2848 + // Invalid display - valid extent
1.2849 + newDisplay = newDisplay - 100;
1.2850 + error = EGL_BAD_DISPLAY;
1.2851 + break;
1.2852 + case 1:
1.2853 + // Valid display - Negative extent width
1.2854 + newExtentWidth = -newExtentHeight;
1.2855 + break;
1.2856 + case 2:
1.2857 + // Valid display - Negative extent height
1.2858 + newExtentHeight = -newExtentHeight;
1.2859 + break;
1.2860 + case 3:
1.2861 + // Valid display - zero extent width
1.2862 + newExtentWidth = 0;
1.2863 + break;
1.2864 + case 4:
1.2865 + // Valid display - zero extent height
1.2866 + newExtentHeight = 0;
1.2867 + break;
1.2868 + }
1.2869 +
1.2870 + TEST(EGL_FALSE == iPfnEglSetSurfaceScalingNOK(newDisplay, iEglSess->Surface(), newOffsetX, newOffsetY, newExtentWidth, newExtentHeight));
1.2871 + ASSERT_EGL_ERROR(error);
1.2872 +
1.2873 + // attributes haven't changed
1.2874 + CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, KWindowWidth, KWindowHeight, KOffsetX, KOffsetY);
1.2875 + }
1.2876 +
1.2877 + // Cleanup
1.2878 + CleanAll();
1.2879 + CloseWindow();
1.2880 +
1.2881 + INFO_PRINTF1(_L("....CEglTest_SurfaceScalingSetInvalidAttributes::doTestStepL completed!"));
1.2882 + RecordTestResultL();
1.2883 + CloseTMSGraphicsStep();
1.2884 + return TestStepResult();
1.2885 + }
1.2886 +
1.2887 +/**
1.2888 +@SYMTestCaseID GRAPHICS-EGL-0666
1.2889 +
1.2890 +@SYMTestPriority 1
1.2891 +
1.2892 +@SYMPREQ 2676
1.2893 +
1.2894 +@SYMREQ 417-56592
1.2895 +
1.2896 +@SYMTestCaseDesc
1.2897 +Negative testing. Query scaling attributes in non-fixed size surfaces
1.2898 +
1.2899 +@SYMTestActions
1.2900 +1. Create a window surface from a non-fixed size surface
1.2901 +2. Set surface scaling with valid target extent.
1.2902 +3. Query scaling attributes
1.2903 +4. Repeat step 2-3 for EGL window surface, pixmap and pbuffer surface
1.2904 +
1.2905 +@SYMTestExpectedResults
1.2906 +2. Set surface scaling will fail with error code EGL_BAD_MATCH.
1.2907 +3. Query scaling attributes does not fail, but values not updated
1.2908 +*/
1.2909 +TVerdict CEglTest_SurfaceScalingSetNonFixed::doTestStepL()
1.2910 + {
1.2911 + SetTestStepName(_L("GRAPHICS-EGL-0666"));
1.2912 + SetTestStepID(_L("GRAPHICS-EGL-0666"));
1.2913 + INFO_PRINTF1(_L("CEglTest_SurfaceScalingSetNonFixed::doTestStepL"));
1.2914 +
1.2915 + // Establish the connection to the window server and create
1.2916 + // a WindowGroup and a Window object
1.2917 + CreateAndActivateWindowL(TSize(100, 100));
1.2918 +
1.2919 + const TInt KWindowWidth = iWindow.Size().iWidth;
1.2920 + const TInt KWindowHeight = iWindow.Size().iHeight;
1.2921 + const TInt KSurfaceWidth = KWindowWidth;
1.2922 + const TInt KSurfaceHeight = KWindowHeight;
1.2923 +
1.2924 + // Create display object
1.2925 + GetDisplayL();
1.2926 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.2927 + iEglSess->InitializeL();
1.2928 +
1.2929 + // Choose EGL config - Make sure it DOES NOT support surface scaling
1.2930 + EGLConfig matchingConfigs[1];
1.2931 + EGLint numConfigs = 0;
1.2932 +
1.2933 + // If all window surfaces in EGL are scalable, first case must be skipped. Others still valid
1.2934 + TInt index = iAllScalable ? 1 : 0;
1.2935 + for(; index < 3; index++)
1.2936 + {
1.2937 + switch(index)
1.2938 + {
1.2939 + case 0:
1.2940 + // Create the non-fixed size window surface and the egl context and make them current
1.2941 + INFO_PRINTF1(_L("Create the non-fixed size window surface and the egl context and make them current..."));
1.2942 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribs_NoScaling], matchingConfigs, 1, &numConfigs));
1.2943 + TESTL(numConfigs == 1);
1.2944 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow);
1.2945 + break;
1.2946 + case 1:
1.2947 + // Create the pbuffer surface and the egl context and make them current
1.2948 + INFO_PRINTF1(_L("Create the pbuffer surface and the egl context and make them current..."));
1.2949 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPBufferAttribsColor16MU], matchingConfigs, 1, &numConfigs));
1.2950 + TESTL(numConfigs == 1);
1.2951 + iEglSess->CreatePbufferSurfaceAndMakeCurrentL(matchingConfigs[0], TSize(KSurfaceWidth, KSurfaceHeight));
1.2952 + break;
1.2953 + case 2:
1.2954 + // Create the pixmap surface and the egl context and make them current
1.2955 + INFO_PRINTF1(_L("Create the pixmap surface and the egl context and make them current..."));
1.2956 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPixmapAttribsColor16MU], matchingConfigs, 1, &numConfigs));
1.2957 + TESTL(numConfigs == 1);
1.2958 + iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(TSize(KSurfaceWidth, KSurfaceHeight), EColor16MU);
1.2959 + break;
1.2960 + }
1.2961 +
1.2962 + // Check all attributes (this is a non-fixed size surface) -
1.2963 + // Note that we cannot use CheckScalingAttributesL because values are not updated
1.2964 + EGLint surfaceWidth = 0;
1.2965 + EGLint surfaceHeight = 0;
1.2966 + EGLint extentWidth = -1;
1.2967 + EGLint extentHeight = -2;
1.2968 + EGLint offsetX = -3;
1.2969 + EGLint offsetY = -4;
1.2970 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_WIDTH, &surfaceWidth));
1.2971 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_HEIGHT, &surfaceHeight));
1.2972 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, &extentWidth));
1.2973 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, &extentHeight));
1.2974 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, &offsetX));
1.2975 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, &offsetY));
1.2976 + TEST((surfaceWidth == KWindowWidth) && (surfaceHeight == KWindowHeight));
1.2977 + // following values should not be modified (non fixed size window)
1.2978 + TEST((extentWidth == -1) && (extentHeight == -2));
1.2979 + TEST((offsetX == -3) && (offsetY == -4));
1.2980 +
1.2981 + // new attribute values
1.2982 + EGLint newExtentWidth = extentWidth / 2;
1.2983 + EGLint newExtentHeight = extentHeight / 2;
1.2984 + EGLint newOffsetX = offsetX * 2;
1.2985 + EGLint newOffsetY = offsetY * 2;
1.2986 +
1.2987 + // Valid parameters - But non fixed size surface
1.2988 + TEST(iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), newOffsetX, newOffsetY, newExtentWidth, newExtentHeight) == EGL_FALSE);
1.2989 + ASSERT_EGL_ERROR(EGL_BAD_MATCH);
1.2990 +
1.2991 + // attributes haven't changed
1.2992 + // Note that we cannot use CheckScalingAttributesL because values are not updated
1.2993 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_WIDTH, &surfaceWidth));
1.2994 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_HEIGHT, &surfaceHeight));
1.2995 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, &extentWidth));
1.2996 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, &extentHeight));
1.2997 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, &offsetX));
1.2998 + ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, &offsetY));
1.2999 + TEST((surfaceWidth == KWindowWidth) && (surfaceHeight == KWindowHeight));
1.3000 + TEST((extentWidth == -1) && (extentHeight == -2));
1.3001 + TEST((offsetX == -3) && (offsetY == -4));
1.3002 +
1.3003 + // destroy surface and context
1.3004 + iEglSess->CleanupSurfaceAndContextL();
1.3005 + }
1.3006 +
1.3007 + // Cleanup
1.3008 + CleanAll();
1.3009 + CloseWindow();
1.3010 +
1.3011 + INFO_PRINTF1(_L("....CEglTest_SurfaceScalingSetNonFixed::doTestStepL completed!"));
1.3012 + RecordTestResultL();
1.3013 + CloseTMSGraphicsStep();
1.3014 + return TestStepResult();
1.3015 + }
1.3016 +
1.3017 +/**
1.3018 +@SYMTestCaseID GRAPHICS-EGL-0667
1.3019 +
1.3020 +@SYMTestPriority 1
1.3021 +
1.3022 +@SYMPREQ 2676
1.3023 +
1.3024 +@SYMREQ 417-56592
1.3025 +
1.3026 +@SYMTestCaseDesc
1.3027 +Negative testing. Calling extensions without initialising EGL
1.3028 +
1.3029 +@SYMTestActions
1.3030 +Without initialising EGL
1.3031 +1. Call query surface scaling capability
1.3032 +2. Call set surface scaling
1.3033 +
1.3034 +@SYMTestExpectedResults
1.3035 +1. Query scaling capability will fail with error code EGL_NOT_INITIALIZED.
1.3036 +2. Set surface scaling will fail with error code EGL_NOT_INITIALIZED.
1.3037 +*/
1.3038 +TVerdict CEglTest_SurfaceScalingNotInitialized::doTestStepL()
1.3039 + {
1.3040 + SetTestStepName(_L("GRAPHICS-EGL-0667"));
1.3041 + SetTestStepID(_L("GRAPHICS-EGL-0667"));
1.3042 + INFO_PRINTF1(_L("CEglTest_SurfaceScalingNotInitialized::doTestStepL"));
1.3043 +
1.3044 + // a WindowGroup and a Window object
1.3045 + CreateAndActivateWindowL(TSize(100, 100));
1.3046 +
1.3047 + // Create display object
1.3048 + GetDisplayL();
1.3049 + CreateEglSessionL(); // initialise EGL Session so we can make use of its helper objects
1.3050 + iEglSess->InitializeL();
1.3051 +
1.3052 + // Choose EGL config
1.3053 + EGLConfig matchingConfigs[1];
1.3054 + EGLint numConfigs = 0;
1.3055 + ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
1.3056 + TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported
1.3057 +
1.3058 + const TInt KWindowWidth = iWindow.Size().iWidth;
1.3059 + const TInt KWindowHeight = iWindow.Size().iHeight;
1.3060 + const TInt KSurfaceWidth = KWindowWidth/2;
1.3061 + const TInt KSurfaceHeight = KWindowHeight/2;
1.3062 + const TInt KExtentWidth = KWindowWidth;
1.3063 + const TInt KExtentHeight = KWindowHeight;
1.3064 + const EGLint KOffsetX = 11;
1.3065 + const EGLint KOffsetY = 13;
1.3066 + EGLint attrib_list[] = {
1.3067 + EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
1.3068 + EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
1.3069 + EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX,
1.3070 + EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY,
1.3071 + EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth,
1.3072 + EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight,
1.3073 + EGL_NONE};
1.3074 +
1.3075 + // Create the window surface and the egl context and make them current
1.3076 + iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);
1.3077 +
1.3078 + // First set new offset attributes (fairly simple, so should be supported)
1.3079 + INFO_PRINTF1(_L("Set new offset attributes - should succeed..."));
1.3080 + EGLint capability = -1; //arbitrary number beyond the existing range
1.3081 + ASSERT_EGL_TRUE(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, matchingConfigs[0], KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, &capability));
1.3082 + TEST((capability == EGL_SUPPORTED_NOK) || (capability == EGL_SLOW_NOK));
1.3083 + ASSERT_EGL_TRUE(iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), KOffsetX+1, KOffsetY+1, KExtentWidth, KExtentHeight));
1.3084 +
1.3085 + // Terminate display and try again
1.3086 + INFO_PRINTF1(_L("Terminate display and try again, should fail now..."));
1.3087 + eglTerminate(iDisplay);
1.3088 +
1.3089 + capability = -1; //arbitrary number beyond the existing range
1.3090 + TEST(EGL_FALSE == iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, matchingConfigs[0], KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, &capability));
1.3091 + TEST(capability == -1); //make sure that value has not been modified
1.3092 + ASSERT_EGL_ERROR(EGL_NOT_INITIALIZED);
1.3093 +
1.3094 + TEST(EGL_FALSE == iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), KOffsetX, KOffsetY, KExtentWidth, KExtentHeight));
1.3095 + ASSERT_EGL_ERROR(EGL_NOT_INITIALIZED);
1.3096 +
1.3097 + // Cleanup
1.3098 + CleanAll();
1.3099 + CloseWindow();
1.3100 +
1.3101 + INFO_PRINTF1(_L("....CEglTest_SurfaceScalingNotInitialized::doTestStepL completed!"));
1.3102 + RecordTestResultL();
1.3103 + CloseTMSGraphicsStep();
1.3104 + return TestStepResult();
1.3105 + }
1.3106 +