sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Test class that allows a scriopt to set global values sl@0: // sl@0: // sl@0: sl@0: #include "globalsettings.h" sl@0: #include sl@0: sl@0: TGlobalSettings settings_instance={0,0}; sl@0: const TGlobalSettings& TGlobalSettings::Instance() sl@0: { sl@0: return settings_instance; sl@0: } sl@0: sl@0: // Create a suite of all the tests sl@0: CTestSuite* CGlobalSettings::CreateSuiteL(const TDesC& aName) sl@0: { sl@0: SUB_SUITE_OPT(CGlobalSettings,NULL); sl@0: sl@0: ADD_TEST_STEP_PARAM_RANGE(SetScreenNoL,0,9); sl@0: ADD_TEST_STEP_PARAM_BOOL(ExpectDisconnectedScreenL); sl@0: sl@0: END_SUITE; sl@0: } sl@0: sl@0: void CGlobalSettings::SetScreenNoL(TInt aScreenNo) sl@0: { sl@0: RWsSession session; sl@0: ASSERT_EQUALS(session.Connect(), KErrNone); sl@0: TInt maxScreens=session.NumberOfScreens(); sl@0: sl@0: if (maxScreens>aScreenNo) sl@0: { sl@0: INFO_PRINTF2(_L("New screen number for all output selected: %i"),aScreenNo); sl@0: { sl@0: CWsScreenDevice screen(session); sl@0: screen.Construct(aScreenNo); sl@0: screen.SetCurrentRotations(0,CFbsBitGc::TGraphicsOrientation(0)); sl@0: screen.SetScreenMode(0); sl@0: screen.SetAppScreenMode(0); sl@0: } sl@0: settings_instance.iScreen=aScreenNo; sl@0: session.Flush(); sl@0: session.Close(); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("**************************")); sl@0: INFO_PRINTF1(_L("")); sl@0: INFO_PRINTF3(_L("Can't set screen output to %i. Only got %i screens"),aScreenNo,maxScreens); sl@0: INFO_PRINTF2(_L("Screen number for all output remains at: %i"),settings_instance.iScreen); sl@0: sl@0: INFO_PRINTF1(_L("")); sl@0: INFO_PRINTF1(_L("**************************")); sl@0: session.Flush(); sl@0: session.Close(); sl@0: User::Leave(KErrTEFUnitFail); sl@0: } sl@0: } sl@0: sl@0: void CGlobalSettings::ExpectDisconnectedScreenL(TBool aValue) sl@0: { sl@0: settings_instance.iDisconnected=aValue; sl@0: }