1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/tdevicerotation.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,823 @@
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 +// Set of tests for Tracing Device Rotation. These tests generally test
1.18 +// RWsSession::IndicateAppOrientation(...).
1.19 +//
1.20 +
1.21 +/**
1.22 + @file
1.23 + @test
1.24 + @internalComponent - Internal Nokia test code
1.25 +*/
1.26 +
1.27 +#include "tdevicerotation.h"
1.28 +#include "themeserverpropertydefine.h"
1.29 +#include "..\..\nga\server\renderorientationtracker.h"
1.30 +#include <hal.h>
1.31 +#include <hal_data.h>
1.32 +#include <w32std.h>
1.33 +
1.34 +const TInt KPublishTimeout = 1000000; // 1 second in microseconds
1.35 +
1.36 +//
1.37 +// CTDeviceRotation Definition
1.38 +//
1.39 +
1.40 +CTDeviceRotation::CTDeviceRotation(CTestStep* aStep):
1.41 + CTGraphicsBase(aStep), iWaitForPublishOnNextTest(ETrue)
1.42 + {
1.43 + }
1.44 +
1.45 +CTDeviceRotation::~CTDeviceRotation()
1.46 + {
1.47 + iPublishTimer.Close();
1.48 +
1.49 + iChildWindow.Close();
1.50 + iWindowGroup.Close();
1.51 + iWs.Close();
1.52 +
1.53 + iSecondChildWindow.Close();
1.54 + iSecondWindowGroup.Close();
1.55 + iSecondWs.Close();
1.56 +
1.57 + /* This Process called with the argument KThemeServerPropertyDefineCmdDelete, deletes
1.58 + the theme server RProperty. This is because an RProperty can only be defined and
1.59 + deleted from within a process with the same UID3 as the RProperty catogory you are
1.60 + trying to define/delete.*/
1.61 + RProcess themeServerPropertyDefine;
1.62 + TInt err = themeServerPropertyDefine.Create(KThemeServerPropertyDefine,
1.63 + KThemeServerPropertyDefineCmdDelete);
1.64 + if (KErrNone != err)
1.65 + {
1.66 + _LIT(KLog, "themeServerPropertyDefine.Create() failed with error: %d");
1.67 + INFO_PRINTF2(KLog, err);
1.68 + TEST(EFalse);
1.69 + }
1.70 + //wait for themeServerPropertyDefine process to terminate
1.71 + TRequestStatus themeServerPropertyDefineLogonStatus;
1.72 + themeServerPropertyDefine.Logon(themeServerPropertyDefineLogonStatus);
1.73 + themeServerPropertyDefine.Resume();
1.74 + User::WaitForRequest(themeServerPropertyDefineLogonStatus);
1.75 + if (themeServerPropertyDefineLogonStatus != KErrNone)
1.76 + {
1.77 + _LIT(KLog, "themeServerPropertyDefine.Logon() failed with error: %d");
1.78 + INFO_PRINTF2(KLog, themeServerPropertyDefineLogonStatus);
1.79 + TEST(EFalse);
1.80 + }
1.81 + themeServerPropertyDefine.Close();
1.82 +
1.83 + iRenderOrientationProperty.Delete(KRenderOrientationCategory, KRenderOrientationKey);
1.84 + iRenderOrientationProperty.Close();
1.85 + iThemeServerOrientationProperty.Close();
1.86 + }
1.87 +
1.88 +void CTDeviceRotation::ConstructL()
1.89 + {
1.90 + TInt err = iWs.Connect();
1.91 + TESTL(err == KErrNone);
1.92 +
1.93 + err = iSecondWs.Connect();
1.94 + TESTL(KErrNone == err);
1.95 +
1.96 + iWs.SetAutoFlush(ETrue);
1.97 + iSecondWs.SetAutoFlush(ETrue);
1.98 +
1.99 + iWindowGroup = RWindowGroup(iWs);
1.100 + err = iWindowGroup.Construct(iWs.Handle());
1.101 + TESTL(KErrNone == err);
1.102 + iWindowGroup.SetOrdinalPosition(0,1);
1.103 +
1.104 + iChildWindow = RWindow(iWs);
1.105 + err = iChildWindow.Construct(iWindowGroup, reinterpret_cast<TUint32>(&iChildWindow));
1.106 + TESTL(KErrNone == err);
1.107 +
1.108 + iSecondWindowGroup = RWindowGroup(iSecondWs);
1.109 + err = iSecondWindowGroup.Construct(iSecondWs.Handle());
1.110 + TESTL(KErrNone == err);
1.111 + iSecondWindowGroup.SetOrdinalPosition(1,1);
1.112 +
1.113 + iSecondChildWindow = RWindow(iSecondWs);
1.114 + err = iSecondChildWindow.Construct(iSecondWindowGroup, reinterpret_cast<TUint32>(&iSecondChildWindow));
1.115 + TESTL(KErrNone == err);
1.116 +
1.117 + err= iRenderOrientationProperty.Attach(KRenderOrientationCategory, KRenderOrientationKey, EOwnerThread);
1.118 + TESTL(KErrNone == err);
1.119 + iRenderOrientationProperty.Subscribe(iRenderOrientationStatus);
1.120 +
1.121 + /* This Process called with the argument KThemeServerPropertyDefineCmdDefine, defines
1.122 + the theme server catagory to be the same as the theme servers process ID. This is
1.123 + because an RProperty can only be defined and deleted from within a process with the
1.124 + same UID3 as the RProperty catogory you are trying to define/delete.*/
1.125 + RProcess themeServerPropertyDefine;
1.126 + err = themeServerPropertyDefine.Create(KThemeServerPropertyDefine,KThemeServerPropertyDefineCmdDefine);
1.127 + TESTL(KErrNone == err);
1.128 + TRequestStatus themeServerPropertyDefineLogonStatus;
1.129 + themeServerPropertyDefine.Logon(themeServerPropertyDefineLogonStatus);
1.130 + themeServerPropertyDefine.Resume();
1.131 + User::WaitForRequest(themeServerPropertyDefineLogonStatus);
1.132 + TESTL(KErrNone == themeServerPropertyDefineLogonStatus.Int());
1.133 + themeServerPropertyDefine.Close();
1.134 +
1.135 + err = iThemeServerOrientationProperty.Attach(KThemeOrientationCategory, KThemeOrientationKey, EOwnerThread);
1.136 + TESTL(KErrNone == err);
1.137 +
1.138 + SimulateThemeServerOrientation(EDisplayOrientationNormal);
1.139 +
1.140 + iPublishTimer.CreateLocal();
1.141 + }
1.142 +
1.143 +void CTDeviceRotation::SimulateThemeServerOrientation(TRenderOrientation aOrientation)
1.144 + {
1.145 + _LIT(KFunctionInfo, "SimulateThemeServerOrientation(aOrientation = %d)");
1.146 + INFO_PRINTF2(KFunctionInfo, aOrientation);
1.147 + TInt err = iThemeServerOrientationProperty.Set(aOrientation);
1.148 + if (KErrNone != err)
1.149 + {
1.150 + _LIT(KLog,"iThemeServerOrientationProperty.Set(%d) failed with err %d");
1.151 + INFO_PRINTF3(KLog,aOrientation,err);
1.152 + TEST(EFalse);
1.153 + }
1.154 + switch(aOrientation)
1.155 + {
1.156 + case EDisplayOrientationNormal:
1.157 + case EDisplayOrientation90CW:
1.158 + case EDisplayOrientation180:
1.159 + case EDisplayOrientation270CW:
1.160 + {
1.161 + if(KErrNone == err)
1.162 + {
1.163 + iCurrentThemeServerOrientation = aOrientation;
1.164 + }
1.165 + break;
1.166 + }
1.167 + default:
1.168 + _LIT(KLog, "This orientation is not supported by theme server.");
1.169 + INFO_PRINTF1(KLog);
1.170 + }
1.171 + }
1.172 +
1.173 +void CTDeviceRotation::IsOrientationCorrect(TRenderOrientation aExpectedOrientation)
1.174 + {
1.175 + // timer to timeout when nothing is published
1.176 + iPublishTimer.After(iPublishTimerStatus, KPublishTimeout);
1.177 +
1.178 + // wait for either
1.179 + User::WaitForRequest(iRenderOrientationStatus, iPublishTimerStatus);
1.180 +
1.181 + // check that the orientation was published or not, as expected
1.182 + if(iWaitForPublishOnNextTest)
1.183 + {
1.184 + // Check that it really has published
1.185 + if(iRenderOrientationStatus.Int()==KErrNone && iPublishTimerStatus.Int()==KRequestPending)
1.186 + {
1.187 + iPublishTimer.Cancel();
1.188 + // re-subscribe
1.189 + iRenderOrientationProperty.Subscribe(iRenderOrientationStatus);
1.190 + }
1.191 + else
1.192 + {
1.193 + _LIT(KLog,"Timed out (%d) while waiting for render orientation %d to be published");
1.194 + INFO_PRINTF3(KLog,iRenderOrientationStatus.Int(),aExpectedOrientation);
1.195 + TEST(EFalse);
1.196 + }
1.197 + }
1.198 + else
1.199 + {
1.200 + // Check that it really hasn't published
1.201 + if(iRenderOrientationStatus.Int()!=KRequestPending)
1.202 + {
1.203 + _LIT(KLog,"Render Orientation %d was published (%d) when not expected (timeout = %d)");
1.204 + INFO_PRINTF4(KLog,aExpectedOrientation, iRenderOrientationStatus.Int(),iPublishTimerStatus.Int());
1.205 + iPublishTimer.Cancel();
1.206 + TEST(EFalse);
1.207 + }
1.208 + else if(iPublishTimerStatus.Int()!=KErrNone)
1.209 + {
1.210 + _LIT(KLog,"Timeout failure %d");
1.211 + INFO_PRINTF2(KLog,iPublishTimerStatus.Int());
1.212 + TEST(EFalse);
1.213 + }
1.214 +
1.215 + // reset to default
1.216 + iWaitForPublishOnNextTest = ETrue;
1.217 + }
1.218 +
1.219 + // Retrieve the value.
1.220 + TInt orientation;
1.221 + TInt err = iRenderOrientationProperty.Get(orientation);
1.222 + if(KErrNone != err)
1.223 + {
1.224 + _LIT(KLog,"iThemeServerOrientationProperty.Get(...) failed with err %d");
1.225 + INFO_PRINTF2(KLog,err);
1.226 + TEST(EFalse);
1.227 + }
1.228 + else if(aExpectedOrientation == EDisplayOrientationAuto)
1.229 + {
1.230 + TEST(orientation == iCurrentThemeServerOrientation);
1.231 + CheckHalSetting(iCurrentThemeServerOrientation);
1.232 + }
1.233 + else
1.234 + {
1.235 + TEST(orientation == aExpectedOrientation);
1.236 + CheckHalSetting(static_cast<TRenderOrientation>(orientation));
1.237 + }
1.238 + }
1.239 +
1.240 +void CTDeviceRotation::CheckHalSetting(TRenderOrientation aOrientation)
1.241 + {
1.242 + HALData::TDigitiserOrientation halOrientationExp = static_cast<HALData::TDigitiserOrientation>
1.243 + (HALData::EDigitiserOrientation_000 + (aOrientation - EDisplayOrientationNormal));
1.244 + TInt halOrientation;
1.245 + TInt err = HAL::Get(iWs.GetFocusScreen(), HALData::EDigitiserOrientation, halOrientation);
1.246 + if (err != KErrNotSupported)
1.247 + {
1.248 + if (err != KErrNone)
1.249 + {
1.250 + _LIT(KLog,"Getting HAL orientation attribute returned error %d when no error expected");
1.251 + INFO_PRINTF2(KLog,err);
1.252 + }
1.253 + TEST(err==KErrNone);
1.254 + if (halOrientationExp != halOrientation)
1.255 + {
1.256 + _LIT(KLog,"HAL orientation is %d when expected to be %d");
1.257 + INFO_PRINTF3(KLog, halOrientation, halOrientationExp);
1.258 + }
1.259 + TEST(halOrientationExp==halOrientation);
1.260 + }
1.261 + else
1.262 + {
1.263 + _LIT(KLog,"HAL-Orientation HALData::EDigitiserOrientation isn't supported by Driver");
1.264 + INFO_PRINTF1(KLog);
1.265 + }
1.266 + }
1.267 +
1.268 +void CTDeviceRotation::TestIndicateAppOrientation(TRenderOrientation aOrientation)
1.269 + {
1.270 + _LIT(KTestInfo, "TestIndicateAppOrientation(aOrientation = %d)");
1.271 + INFO_PRINTF2(KTestInfo, aOrientation);
1.272 + if (EDisplayOrientationIgnore == aOrientation)
1.273 + {
1.274 + TEST(EFalse);
1.275 + _LIT(KLog, "TestIndicateAppOrientation(TRenderOrientation aOrientation) cannot be used with EDisplayOrientationIgnore");
1.276 + INFO_PRINTF1(KLog);
1.277 + }
1.278 + iWs.IndicateAppOrientation(aOrientation);
1.279 + iWindowGroup.SetOrdinalPosition(0);
1.280 + IsOrientationCorrect(aOrientation);
1.281 + }
1.282 +
1.283 +void CTDeviceRotation::TestIndicateAppOrientation(TRenderOrientation aOrientation, TRenderOrientation aSecondOrientation)
1.284 + {
1.285 + _LIT(KTestInfo, "TestIndicateAppOrientation(aOrientation = %d, aSecondOrientation = %d)");
1.286 + INFO_PRINTF3(KTestInfo, aOrientation, aSecondOrientation);
1.287 + //Inform window serve the orientation status
1.288 + iWs.IndicateAppOrientation(aOrientation);
1.289 + iSecondWs.IndicateAppOrientation(aSecondOrientation);
1.290 +
1.291 + iWindowGroup.SetOrdinalPosition(0,1);
1.292 + iSecondWindowGroup.SetOrdinalPosition(1,1);
1.293 +
1.294 + if(aOrientation != EDisplayOrientationIgnore)
1.295 + {
1.296 + IsOrientationCorrect(aOrientation);
1.297 + }
1.298 + else
1.299 + {
1.300 + IsOrientationCorrect(aSecondOrientation);
1.301 + }
1.302 + }
1.303 +
1.304 +void CTDeviceRotation::TestAppOrientationOnSwap(TRenderOrientation aOrientation, TRenderOrientation aSecondOrientation)
1.305 + {
1.306 + _LIT(KTestInfo, "TestAppOrientationOnSwap(aOrientation = %d, aSecondOrientation = %d)");
1.307 + INFO_PRINTF3(KTestInfo, aOrientation, aSecondOrientation);
1.308 +
1.309 + iWs.IndicateAppOrientation(aOrientation);
1.310 + iSecondWs.IndicateAppOrientation(aSecondOrientation);
1.311 +
1.312 + iSecondWindowGroup.SetOrdinalPosition(0);
1.313 + if (aSecondOrientation != EDisplayOrientationIgnore)
1.314 + {
1.315 + IsOrientationCorrect(aSecondOrientation);
1.316 + }
1.317 + else
1.318 + {
1.319 + IsOrientationCorrect(aOrientation);
1.320 + }
1.321 + }
1.322 +
1.323 +void CTDeviceRotation::RunTestCaseL(TInt aCurTestCase)
1.324 + {
1.325 + _LIT(KNewLine, "\n");
1.326 + (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KUnknownSYMTestCaseIDName);
1.327 + switch(aCurTestCase)
1.328 + {
1.329 + case 1:
1.330 + _LIT(KTestStepID1,"Test Initial Orientations");
1.331 + (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID1);
1.332 + INFO_PRINTF1(KNewLine);
1.333 + INFO_PRINTF1(KTestStepID1);
1.334 + TestInitialOrientation();
1.335 + break;
1.336 + case 2:
1.337 + _LIT(KTestStepID2,"Test Fixed Orientations");
1.338 + (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID2);
1.339 + INFO_PRINTF1(KNewLine);
1.340 + INFO_PRINTF1(KTestStepID2);
1.341 + TestFixedOrientations();
1.342 + break;
1.343 + case 3:
1.344 + _LIT(KTestStepID3,"Test Auto Orientation");
1.345 + (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID3);
1.346 + INFO_PRINTF1(KNewLine);
1.347 + INFO_PRINTF1(KTestStepID3);
1.348 + TestAutoOrientation();
1.349 + break;
1.350 + case 4:
1.351 + _LIT(KTestStepID4,"Test Ignore Orientation");
1.352 + (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID4);
1.353 + INFO_PRINTF1(KNewLine);
1.354 + INFO_PRINTF1(KTestStepID4);
1.355 + TestIgnoreOrientation();
1.356 + break;
1.357 + case 5:
1.358 + _LIT(KTestStepID5,"Test Swap Orientations");
1.359 + (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID5);
1.360 + INFO_PRINTF1(KNewLine);
1.361 + INFO_PRINTF1(KTestStepID5);
1.362 + TestFixedOrientationsOnWindowSwap();
1.363 + break;
1.364 + case 6:
1.365 + _LIT(KTestStepID6,"Test Auto Swap Orientations");
1.366 + (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID6);
1.367 + INFO_PRINTF1(KNewLine);
1.368 + INFO_PRINTF1(KTestStepID6);
1.369 + TestAutoOrientationOnWindowSwap();
1.370 + break;
1.371 + case 7:
1.372 + _LIT(KTestStepID7,"Test Ignore Swap Orientations");
1.373 + (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID7);
1.374 + INFO_PRINTF1(KNewLine);
1.375 + INFO_PRINTF1(KTestStepID7);
1.376 + TestIgnoreOrientationOnWindowSwap();
1.377 + break;
1.378 + case 8:
1.379 + _LIT(KTestStepID8,"Test Auto Swap Orientations");
1.380 + (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID8);
1.381 + INFO_PRINTF1(KNewLine);
1.382 + INFO_PRINTF1(KTestStepID8);
1.383 + TestIgnoreAutoOrientationOnWindowSwap();
1.384 + break;
1.385 + case 9:
1.386 + _LIT(KTestStepID9,"Test Invalid App Orientations");
1.387 + (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID9);
1.388 + INFO_PRINTF1(KNewLine);
1.389 + INFO_PRINTF1(KTestStepID9);
1.390 + TestInvalidAppOrientation();
1.391 + break;
1.392 + case 10:
1.393 + _LIT(KTestStepID10,"Test Invalid Theme Server Orientations");
1.394 + (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID10);
1.395 + INFO_PRINTF1(KNewLine);
1.396 + INFO_PRINTF1(KTestStepID10);
1.397 + TestInvalidThemeServerOrientation();
1.398 + break;
1.399 + default:
1.400 + (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KNotATestSYMTestCaseIDName);
1.401 + (reinterpret_cast<CTDeviceRotationStep*>(iStep))->CloseTMSGraphicsStep();
1.402 + TestComplete();
1.403 + }
1.404 + (reinterpret_cast<CTDeviceRotationStep*>(iStep))->RecordTestResultL();
1.405 + }
1.406 +
1.407 +
1.408 +/**
1.409 + @SYMTestCaseID GRAPHICS-WSERV-DEVICEROTATION-0001
1.410 + @SYMTestCaseDesc Test Auto Orientation
1.411 + @SYMPREQ 460936 Tracking Device Rotation
1.412 + @SYMTestPriority 1
1.413 + @SYMTestPurpose To test that we can return the correct initial orientation value from
1.414 + the windwoserver.
1.415 + @SYMPrerequisites An RProperty is set up to subscribe to notifications of
1.416 + windowserver orientation changes.
1.417 + We have set up an RWindowGroup at the foreground and not altered its
1.418 + indicated orientation.
1.419 + @SYMTestActions 1) Get the value of the orientation as published by window server.
1.420 +
1.421 + @SYMTestExpectedResults The windowserver should return EDisplayOrientationNormal
1.422 + */
1.423 +void CTDeviceRotation::TestInitialOrientation()
1.424 + {
1.425 + iWaitForPublishOnNextTest = EFalse;
1.426 + IsOrientationCorrect(EDisplayOrientationNormal);
1.427 + }
1.428 +
1.429 +/**
1.430 + @SYMTestCaseID GRAPHICS-WSERV-DEVICEROTATION-0002
1.431 + @SYMTestCaseDesc Test Fixed Orientations
1.432 + @SYMPREQ 460936 Tracking Device Rotation
1.433 + @SYMTestPriority 1
1.434 + @SYMTestPurpose To test that we can return the correct orientation value from
1.435 + the windwoserver after we indicate the application orientation
1.436 + as fixed values using RWsSession::IndicateAppOrientation. Any
1.437 + theme server orientations should be ignored.
1.438 + @SYMPrerequisites An RProperty is set up to subscribe to notifications of
1.439 + windowserver orientation changes.
1.440 + An RProperty is set up to publish Theme server Orientation changes.
1.441 + We have set up an RWindowGroup in the foreground.
1.442 + Windowserver orientation currently set to EDisplayOrientationNormal.
1.443 +
1.444 + @SYMTestActions 1) Set Theme Server orientation to EDisplayOrientation90CW.
1.445 + 2) Set the RWindowgroup in ordinal position 0 to a fixed orientation.
1.446 + 3) Check the published orinetation value in windowserver.
1.447 + 4) Repeat steps 2) and 3) for all fixed orientations
1.448 + 3) Set Theme Server orientation to EDisplayOrientationNormal.
1.449 + 4) Repeat Steps 2-4).
1.450 +
1.451 + @SYMTestExpectedResults The orientation set in step 2) should always be the same as the
1.452 + orientation set in step 2)
1.453 + */
1.454 +void CTDeviceRotation::TestFixedOrientations()
1.455 + {
1.456 + iWaitForPublishOnNextTest = EFalse;
1.457 + SimulateThemeServerOrientation(EDisplayOrientation90CW);
1.458 + TestIndicateAppOrientation(EDisplayOrientationNormal);
1.459 + TestIndicateAppOrientation(EDisplayOrientation90CW);
1.460 + TestIndicateAppOrientation(EDisplayOrientation180);
1.461 + TestIndicateAppOrientation(EDisplayOrientation270CW);
1.462 +
1.463 + SimulateThemeServerOrientation(EDisplayOrientationNormal);
1.464 + TestIndicateAppOrientation(EDisplayOrientationNormal);
1.465 + TestIndicateAppOrientation(EDisplayOrientation90CW);
1.466 + TestIndicateAppOrientation(EDisplayOrientation180);
1.467 + TestIndicateAppOrientation(EDisplayOrientation270CW);
1.468 +
1.469 + SimulateThemeServerOrientation(EDisplayOrientation180);
1.470 + TestIndicateAppOrientation(EDisplayOrientationNormal);
1.471 + TestIndicateAppOrientation(EDisplayOrientation90CW);
1.472 + TestIndicateAppOrientation(EDisplayOrientation180);
1.473 + TestIndicateAppOrientation(EDisplayOrientation270CW);
1.474 +
1.475 + SimulateThemeServerOrientation(EDisplayOrientation270CW);
1.476 + TestIndicateAppOrientation(EDisplayOrientationNormal);
1.477 + TestIndicateAppOrientation(EDisplayOrientation90CW);
1.478 + TestIndicateAppOrientation(EDisplayOrientation180);
1.479 + TestIndicateAppOrientation(EDisplayOrientation270CW);
1.480 + }
1.481 +
1.482 +/**
1.483 + @SYMTestCaseID GRAPHICS-WSERV-DEVICEROTATION-0003
1.484 + @SYMTestCaseDesc Test Auto Orientation
1.485 + @SYMPREQ 460936 Tracking Device Rotation
1.486 + @SYMTestPriority 1
1.487 + @SYMTestPurpose To test that we can return the correct orientation value from
1.488 + the windwoserver after we indicate the application orientation
1.489 + as auto values using RWsSession::IndicateAppOrientation. The wserv
1.490 + should publish the theme server orientation changes only.
1.491 + @SYMPrerequisites An RProperty is set up to subscribe to notifications of
1.492 + windowserver orientation changes.
1.493 + An RProperty is set up to publish Theme server Orientation changes.
1.494 + We have set up an RWindowGroup in the foreground.
1.495 + WindowServer orinetation is not set to EDisplayOrientation90CW.
1.496 +
1.497 + @SYMTestActions 1) Set Theme Server orientation to EDisplayOrientation90CW.
1.498 + 2) Set the RWindowgroup in ordinal position 0 to auto orientation.
1.499 + 3) Check the published orinetation value in windowserver.
1.500 + 4) Set Theme Server orientation to EDisplayOrientationNormal.
1.501 + 5) Check the value of the orientation as published by window server.
1.502 + 6) Repeat 4) and 5) for EDisplayOrientation180 and
1.503 + EDisplayOrientation270CW
1.504 + 7) repeat 4) and 5) again for EDisplayOrientation270CW
1.505 +
1.506 + @SYMTestExpectedResults We should get expected notifications where orientations have changed.
1.507 + The orientation checked in step 3) should be the theme server
1.508 + orientation set in step 1).
1.509 + The orientations checked in step 5) should be the theme server
1.510 + orientations set in step 4).
1.511 + We should recieve no notification for step 7).
1.512 + */
1.513 +void CTDeviceRotation::TestAutoOrientation()
1.514 + {
1.515 + SimulateThemeServerOrientation(EDisplayOrientation90CW);
1.516 + TestIndicateAppOrientation(EDisplayOrientationAuto);
1.517 + SimulateThemeServerOrientation(EDisplayOrientationNormal);
1.518 + IsOrientationCorrect(iCurrentThemeServerOrientation);
1.519 + // Now flip it upside down to ensure that nothing assumes this will only be updated incrementally
1.520 + SimulateThemeServerOrientation(EDisplayOrientation180);
1.521 + IsOrientationCorrect(iCurrentThemeServerOrientation);
1.522 + SimulateThemeServerOrientation(EDisplayOrientation270CW);
1.523 + IsOrientationCorrect(iCurrentThemeServerOrientation);
1.524 +
1.525 + // And check that wserv doesn't publish if the theme server publishes the existing orientation
1.526 + SimulateThemeServerOrientation(EDisplayOrientation270CW);
1.527 + iWaitForPublishOnNextTest = EFalse;
1.528 + IsOrientationCorrect(iCurrentThemeServerOrientation);
1.529 + }
1.530 +
1.531 +/**
1.532 + @SYMTestCaseID GRAPHICS-WSERV-DEVICEROTATION-0004
1.533 + @SYMTestCaseDesc Test Ignore Orientation
1.534 + @SYMPREQ 460936 Tracking Device Rotation
1.535 + @SYMTestPriority 1
1.536 + @SYMTestPurpose To test that we can return the correct orientation value from
1.537 + the windwoserver after we indicate the front applications
1.538 + orientation as ignore.
1.539 + @SYMPrerequisites An RProperty is set up to subscribe to notifications of
1.540 + windowserver orientation changes.
1.541 + An RProperty is set up to publish Theme server Orientation changes.
1.542 + We have set up two RWindowGroups in the ordinal positions 0 and 1.
1.543 + WindowServer orinetation is not set to EDisplayOrientationNormal.
1.544 +
1.545 + @SYMTestActions 1) Set Theme Server orientation to EDisplayOrientation90CW.
1.546 + 2) Set the RWindowGroup in ordinal position 0 to a ignore orientation.
1.547 + 3) Set the RWindowgroup in ordinal position 1 to a fixed orientation.
1.548 + 4) Check the published orinetation value in windowserver.
1.549 + 5) Repeat steps 2-4) varying the fixed orientation set in step 2).
1.550 + 6) Set Theme Server orientation to EDisplayOrientation90CW.
1.551 + 7) Set the RWindowGroup in ordinal position 0 to a ignore orientation.
1.552 + 8) Set the RWindowgroup in ordinal position 1 to a fixed orientation.
1.553 + 9) Check the published orinetation value in windowserver.
1.554 + 10) Set Theme Server orientation to EDisplayOrientationNormal.
1.555 + 11) Check the published orinetation value in windowserver.
1.556 +
1.557 + @SYMTestExpectedResults We should get expected notifications where orientations have changed.
1.558 + All orientations checked in step 4) should be the fixed orientations
1.559 + of the windows in ordinal position 1, as set in step 3).
1.560 + The orientation checked in step 9) should be the theme server
1.561 + orientation set in step 6).
1.562 + The orientation checked in step 11) should be the theme server
1.563 + orientation set in step 10).
1.564 + */
1.565 +void CTDeviceRotation::TestIgnoreOrientation()
1.566 + {
1.567 + SimulateThemeServerOrientation(EDisplayOrientation90CW);
1.568 + TestIndicateAppOrientation(EDisplayOrientationIgnore, EDisplayOrientationNormal);
1.569 + TestIndicateAppOrientation(EDisplayOrientationIgnore, EDisplayOrientation90CW);
1.570 + TestIndicateAppOrientation(EDisplayOrientationIgnore, EDisplayOrientation180);
1.571 + TestIndicateAppOrientation(EDisplayOrientationIgnore, EDisplayOrientation270CW);
1.572 +
1.573 + SimulateThemeServerOrientation(EDisplayOrientation90CW);
1.574 + TestIndicateAppOrientation(EDisplayOrientationIgnore, EDisplayOrientationAuto);
1.575 + SimulateThemeServerOrientation(EDisplayOrientationNormal);
1.576 + IsOrientationCorrect(iCurrentThemeServerOrientation);
1.577 + }
1.578 +
1.579 +/**
1.580 + @SYMTestCaseID GRAPHICS-WSERV-DEVICEROTATION-0005
1.581 + @SYMTestCaseDesc Test Fixed Orientations On Swap
1.582 + @SYMPREQ 460936 Tracking Device Rotation
1.583 + @SYMTestPriority 1
1.584 + @SYMTestPurpose To test that we get notifactation of a change in orientation and can
1.585 + return the correct orientation value from the windwoserver after we
1.586 + swap windows with varying fixed orienations.
1.587 + @SYMPrerequisites An RProperty is set up to subscribe to notifications of
1.588 + windowserver orientation changes.
1.589 + We have set up two RWindowGroups in the ordinal positions 0 and 1.
1.590 +
1.591 + @SYMTestActions 1) Set the RWindowGroup in ordinal position 0 to a fixed orientation.
1.592 + 2) Set the RWindowgroup in ordinal position 1 to a fixed orientation.
1.593 + 3) Check the published orinetation value in windowserver.
1.594 + 4) Move the RWindowGroup ordinal position 1 to the ordinal position 0.
1.595 + 5) Check the published orinetation value in windowserver.
1.596 + 6) Repeat steps 1-5 but vary the values the fixed orientation of the
1.597 + RWindows set in steps 1) and 2)
1.598 +
1.599 + @SYMTestExpectedResults We should get expected notifications where orientations have changed.
1.600 + All orientations checked in step 3) should be the fixed orientations
1.601 + of the windows in ordinal position 0, as set in step 1).
1.602 + The orientations checked in step 5) should be the fixed orientations
1.603 + of the windows which was in ordinal position 1 before each swap, as
1.604 + set in step 2).
1.605 + */
1.606 +void CTDeviceRotation::TestFixedOrientationsOnWindowSwap()
1.607 + {
1.608 + iWaitForPublishOnNextTest = EFalse;
1.609 + TestIndicateAppOrientation(EDisplayOrientationNormal, EDisplayOrientationNormal);
1.610 + iWaitForPublishOnNextTest = EFalse;
1.611 + TestAppOrientationOnSwap(EDisplayOrientationNormal, EDisplayOrientationNormal);
1.612 + TestIndicateAppOrientation(EDisplayOrientationNormal, EDisplayOrientation90CW);
1.613 + TestAppOrientationOnSwap(EDisplayOrientationNormal, EDisplayOrientation90CW);
1.614 + TestIndicateAppOrientation(EDisplayOrientation90CW, EDisplayOrientationNormal);
1.615 + TestAppOrientationOnSwap(EDisplayOrientation90CW, EDisplayOrientationNormal);
1.616 + }
1.617 +
1.618 +/**
1.619 + @SYMTestCaseID GRAPHICS-WSERV-DEVICEROTATION-0006
1.620 + @SYMTestCaseDesc Test Auto Orientations On Swap
1.621 + @SYMPREQ 460936 Tracking Device Rotation
1.622 + @SYMTestPriority 1
1.623 + @SYMTestPurpose To test that we get notifactation of a change in orientation and can
1.624 + return the correct orientation value from the windwoserver after we
1.625 + swap windows with auto orienations.
1.626 + @SYMPrerequisites An RProperty is set up to subscribe to notifications of
1.627 + windowserver orientation changes.
1.628 + An RProperty is set up to publish Theme server Orientation changes.
1.629 + We have set up two RWindowGroups in the ordinal positions 0 and 1.
1.630 + WindowServer orinetation is not set to EDisplayOrientation270CW.
1.631 +
1.632 + @SYMTestActions 1) Set the theme server orientation.
1.633 + 2) Set the RWindowGroup in ordinal position 0 to a fixed orientation.
1.634 + 3) Set the RWindowGroup in ordinal position 1 to auto orientation.
1.635 + 4) Check the published orinetation value in windowserver.
1.636 + 5) Move the RWindowGroup ordinal position 1 to the ordinal position 0.
1.637 + 6) Check the published orinetation value in windowserver.
1.638 + 7) Repeat steps 1-6 but vary the values of the theme server
1.639 + orientation in step 1) and the fixed orientation of the frontwindow
1.640 + in 2)
1.641 + @SYMTestExpectedResults We should get expected notifications where orientations have changed.
1.642 + All orientations checked in step 4) should be the fixed orientations
1.643 + of the front windows, which have been set in step 2).
1.644 + All orientations checked in step 6) should be the theme server
1.645 + orientations set in step 1)
1.646 + */
1.647 +void CTDeviceRotation::TestAutoOrientationOnWindowSwap()
1.648 + {
1.649 + SimulateThemeServerOrientation(EDisplayOrientation90CW);
1.650 + TestIndicateAppOrientation(EDisplayOrientation270CW, EDisplayOrientationAuto);
1.651 + TestAppOrientationOnSwap(EDisplayOrientation270CW, EDisplayOrientationAuto);
1.652 + SimulateThemeServerOrientation(EDisplayOrientationNormal);
1.653 + TestIndicateAppOrientation(EDisplayOrientationAuto, EDisplayOrientation180);
1.654 + TestAppOrientationOnSwap(EDisplayOrientationAuto, EDisplayOrientation180);
1.655 +
1.656 + SimulateThemeServerOrientation(EDisplayOrientation90CW);
1.657 + TestIndicateAppOrientation(EDisplayOrientation90CW, EDisplayOrientationAuto);
1.658 + iWaitForPublishOnNextTest = EFalse;
1.659 + TestAppOrientationOnSwap(EDisplayOrientation90CW, EDisplayOrientationAuto);
1.660 + SimulateThemeServerOrientation(EDisplayOrientationNormal);
1.661 + TestIndicateAppOrientation(EDisplayOrientationAuto, EDisplayOrientationNormal);
1.662 + iWaitForPublishOnNextTest = EFalse;
1.663 + TestAppOrientationOnSwap(EDisplayOrientationAuto, EDisplayOrientationNormal);
1.664 + }
1.665 +
1.666 +/**
1.667 + @SYMTestCaseID GRAPHICS-WSERV-DEVICEROTATION-0007
1.668 + @SYMTestCaseDesc Test Swap Orientations with Ignore Orientation
1.669 + @SYMPREQ 460936 Tracking Device Rotation
1.670 + @SYMTestPriority 1
1.671 + @SYMTestPurpose To test that we get notifactation of a change in orientation and can
1.672 + return the correct orientation value from the windwoserver after we
1.673 + swap windows with ignore orienations.
1.674 + @SYMPrerequisites An RProperty is set up to subscribe to notifications of
1.675 + windowserver orientation changes.
1.676 + An RProperty is set up to publish Theme server Orientation changes.
1.677 + We have set up two RWindowGroups in the ordinal positions 0 and 1.
1.678 +
1.679 + @SYMTestActions 1) Set the theme server orientation.
1.680 + 2) Set the RWindowGroup in ordinal position 0 to ignore orientation.
1.681 + 3) Set the RWindowGroup in ordinal position 1 to a fixed orientation.
1.682 + 4) Check the published orinetation value in windowserver.
1.683 + 5) Move the RWindowGroup ordinal position 1 to the ordinal position 0.
1.684 + 6) Check the published orinetation value in windowserver.
1.685 + 7) Repeat steps 1-6 but vary the values of the theme server
1.686 + orientation in step 1) and the fixed orientation of the frontwindow
1.687 + in 3)
1.688 + 8) Set the theme server orientation.
1.689 + 9) Set the RWindowGroup in ordinal position 0 to a fixedorientation.
1.690 + 10) Set the RWindowGroup in ordinal position 1 to ignore orienation.
1.691 + 11) Repeat steps 4-6)
1.692 + 12) Repeat steps 8-11) but vary the values of the theme server
1.693 + orientation in step 8) and the fixed orientation of the
1.694 + RwindowGroup in 9)
1.695 +
1.696 + @SYMTestExpectedResults We should get expected notifications where orientations have changed.
1.697 + All orientations checked in step 4) and 6) should be the fixed
1.698 + orientations RWindowGroups which have been set in step 3).
1.699 + All orientations checked in step 11) should be the fixed orientations
1.700 + of the front RWindowGroups which have been set in step 9).
1.701 +*/
1.702 +void CTDeviceRotation::TestIgnoreOrientationOnWindowSwap()
1.703 + {
1.704 + SimulateThemeServerOrientation(EDisplayOrientation90CW);
1.705 + TestIndicateAppOrientation(EDisplayOrientationIgnore, EDisplayOrientation270CW);
1.706 + TestAppOrientationOnSwap(EDisplayOrientationIgnore, EDisplayOrientation180);
1.707 +
1.708 + SimulateThemeServerOrientation(EDisplayOrientationNormal);
1.709 + TestIndicateAppOrientation(EDisplayOrientationIgnore, EDisplayOrientationNormal);
1.710 + TestAppOrientationOnSwap(EDisplayOrientationIgnore, EDisplayOrientation90CW);
1.711 +
1.712 + SimulateThemeServerOrientation(EDisplayOrientation90CW);
1.713 + TestIndicateAppOrientation(EDisplayOrientation270CW, EDisplayOrientationIgnore);
1.714 + TestAppOrientationOnSwap(EDisplayOrientation180, EDisplayOrientationIgnore);
1.715 +
1.716 + SimulateThemeServerOrientation(EDisplayOrientationNormal);
1.717 + TestIndicateAppOrientation(EDisplayOrientationNormal, EDisplayOrientationIgnore);
1.718 + TestAppOrientationOnSwap(EDisplayOrientation90CW, EDisplayOrientationIgnore);
1.719 + }
1.720 +
1.721 +/**
1.722 + @SYMTestCaseID GRAPHICS-WSERV-DEVICEROTATION-0008
1.723 + @SYMTestCaseDesc Test Swap Orientations with Auto and Ignore Orientations
1.724 + @SYMPREQ 460936 Tracking Device Rotation
1.725 + @SYMTestPriority 1
1.726 + @SYMTestPurpose To test that we get notifactation of a change in orientation and can
1.727 + return the correct orientation value from the windwoserver after we
1.728 + swap windows with auto and ignore orienations.
1.729 + @SYMPrerequisites An RProperty is set up to subscribe to notifications of
1.730 + windowserver orientation changes.
1.731 + An RProperty is set up to publish Theme server Orientation changes.
1.732 + We have set up two RWindowGroups in the ordinal positions 0 and 1.
1.733 + @SYMTestActions 1) Set the theme server orientation to EDisplayOrientationNormal.
1.734 + 2) Set the RWindowGroup in ordinal position 0 to auto orientation.
1.735 + 3) Set the RWindowGroup in ordinal position 1 to ignore orientation.
1.736 + 4) Check the published orinetation value in windowserver.
1.737 + 5) Set the theme server orientation to EDisplayOrientation90CW.
1.738 + 6) Check the published orinetation value in windowserver.
1.739 + 7) Set the theme server orientation to EDisplayOrientationNormal.
1.740 + 8) Move the RWindowGroup in ordinal position 1 to ordinal position 0.
1.741 + 9) Check the published orinetation value in windowserver.
1.742 + 10) Set the theme server orientation to EDisplayOrientation90CW.
1.743 + 11) Check the published orinetation value in windowserver.
1.744 +
1.745 + @SYMTestExpectedResults We should get expected notifications where orientations have changed.
1.746 + The orientations checked in step 4), 6), 9) and 11) should all be
1.747 + the orientations set to the themeserver in steps 1), 5), 8) and 10)
1.748 + respecvtively.
1.749 +*/
1.750 +void CTDeviceRotation::TestIgnoreAutoOrientationOnWindowSwap()
1.751 + {
1.752 + SimulateThemeServerOrientation(EDisplayOrientationNormal);
1.753 + TestIndicateAppOrientation(EDisplayOrientationAuto, EDisplayOrientationIgnore);
1.754 + SimulateThemeServerOrientation(EDisplayOrientation90CW);
1.755 + IsOrientationCorrect(iCurrentThemeServerOrientation);
1.756 +
1.757 + SimulateThemeServerOrientation(EDisplayOrientationNormal);
1.758 + iSecondWindowGroup.SetOrdinalPosition(0);
1.759 + IsOrientationCorrect(iCurrentThemeServerOrientation);
1.760 + SimulateThemeServerOrientation(EDisplayOrientation90CW);
1.761 + IsOrientationCorrect(iCurrentThemeServerOrientation);
1.762 + }
1.763 +
1.764 +/**
1.765 + @SYMTestCaseID GRAPHICS-WSERV-DEVICEROTATION-0009
1.766 + @SYMTestCaseDesc Test Invalid App Orientation
1.767 + @SYMPREQ ###TrackingDeviceRotation### TODO replace me
1.768 + @SYMTestPriority 1
1.769 + @SYMTestPurpose To test that an invalid orientation is ignored.
1.770 + @SYMPrerequisites An RProperty is set up to subscribe to notifications of
1.771 + windowserver orientation changes.
1.772 + An RProperty is set up to publish Theme server Orientation changes.
1.773 + We have set up an RWindowGroup in ordinal position 0.
1.774 + @SYMTestActions 1) Set the theme server orientation to EDisplayOrientationNormal.
1.775 + 2) Set the RWindowGroup in ordinal position 0 to
1.776 + EDisplayOrientation90CW.
1.777 + 4) Check the published orinetation value in windowserver.
1.778 + 5) Set the RWindowGroup in ordinal position 0 to an invalid
1.779 + orientation.
1.780 + 6) Check the published orinetation value in windowserver.
1.781 +
1.782 + @SYMTestExpectedResults Wserv should publish an orientation change for 2) but not for 5).
1.783 + The orientations checked in steps 4) and 6) should both be the
1.784 + orientation set in step 2).
1.785 +*/
1.786 +void CTDeviceRotation::TestInvalidAppOrientation()
1.787 + {
1.788 + SimulateThemeServerOrientation(EDisplayOrientationNormal);
1.789 + TestIndicateAppOrientation(EDisplayOrientation90CW);
1.790 + iWs.IndicateAppOrientation(static_cast<TRenderOrientation>(1000));
1.791 + iWaitForPublishOnNextTest = EFalse;
1.792 + IsOrientationCorrect(EDisplayOrientation90CW);
1.793 + }
1.794 +
1.795 +/**
1.796 + @SYMTestCaseID GRAPHICS-WSERV-DEVICEROTATION-0010
1.797 + @SYMTestCaseDesc Test Invalid Theme Server Orientation
1.798 + @SYMPREQ ###TrackingDeviceRotation### TODO replace me
1.799 + @SYMTestPriority 1
1.800 + @SYMTestPurpose To test that an invalid theme server orientation is ignored when
1.801 + the app orientation has been set to auto.
1.802 + @SYMPrerequisites An RProperty is set up to subscribe to notifications of
1.803 + windowserver orientation changes.
1.804 + An RProperty is set up to publish Theme server Orientation changes.
1.805 + We have set up an RWindowGroup in ordinal position 0.
1.806 + @SYMTestActions 1) Set the theme server orientation to EDisplayOrientationNormal.
1.807 + 2) Set the RWindowGroup in ordinal position 0 to
1.808 + EDisplayOrientationAuto.
1.809 + 4) Check the published orinetation value in windowserver.
1.810 + 5) Set the theme server orientation to an invalid orientation.
1.811 + 6) Check the published orinetation value in windowserver.
1.812 +
1.813 + @SYMTestExpectedResults Wserv should publish an orientation change for 2) but not for 5).
1.814 + The orientations checked in steps 4) and 6) should both be the
1.815 + theme server orientation set in step 1).
1.816 +*/
1.817 +void CTDeviceRotation::TestInvalidThemeServerOrientation()
1.818 + {
1.819 + SimulateThemeServerOrientation(EDisplayOrientationNormal);
1.820 + TestIndicateAppOrientation(EDisplayOrientationAuto);
1.821 + SimulateThemeServerOrientation(static_cast<TRenderOrientation>(5000));
1.822 + iWaitForPublishOnNextTest = EFalse;
1.823 + IsOrientationCorrect(EDisplayOrientationNormal);
1.824 + }
1.825 +
1.826 +__CONSTRUCT_STEP__(DeviceRotation)