os/graphics/windowing/windowserver/test/tdynamicres/src/globalsettings.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserver/test/tdynamicres/src/globalsettings.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,76 @@
     1.4 +// Copyright (c) 2008-2009 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 +// Test class that allows a scriopt to set global values 
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#include "globalsettings.h"
    1.22 +#include <test/extendtef.h>
    1.23 +
    1.24 +TGlobalSettings	settings_instance={0,0};
    1.25 +const TGlobalSettings& TGlobalSettings::Instance()
    1.26 +	{
    1.27 +	return settings_instance;
    1.28 +	}
    1.29 +
    1.30 +// Create a suite of all the tests
    1.31 +CTestSuite* CGlobalSettings::CreateSuiteL(const TDesC& aName)
    1.32 +	{
    1.33 +	SUB_SUITE_OPT(CGlobalSettings,NULL);
    1.34 +
    1.35 +		ADD_TEST_STEP_PARAM_RANGE(SetScreenNoL,0,9);
    1.36 +		ADD_TEST_STEP_PARAM_BOOL(ExpectDisconnectedScreenL);
    1.37 +
    1.38 +	END_SUITE;	
    1.39 +	}
    1.40 +
    1.41 +void CGlobalSettings::SetScreenNoL(TInt aScreenNo)
    1.42 +	{
    1.43 +	RWsSession session;
    1.44 +	ASSERT_EQUALS(session.Connect(), KErrNone);
    1.45 +	TInt maxScreens=session.NumberOfScreens();
    1.46 +	
    1.47 +	if (maxScreens>aScreenNo)
    1.48 +		{
    1.49 +		INFO_PRINTF2(_L("New screen number for all output selected: %i"),aScreenNo);
    1.50 +			{
    1.51 +			CWsScreenDevice screen(session);
    1.52 +			screen.Construct(aScreenNo);
    1.53 +			screen.SetCurrentRotations(0,CFbsBitGc::TGraphicsOrientation(0));
    1.54 +			screen.SetScreenMode(0);
    1.55 +			screen.SetAppScreenMode(0);
    1.56 +			}
    1.57 +		settings_instance.iScreen=aScreenNo;
    1.58 +		session.Flush();
    1.59 +		session.Close();
    1.60 +		}
    1.61 +	else
    1.62 +		{
    1.63 +		INFO_PRINTF1(_L("**************************"));
    1.64 +		INFO_PRINTF1(_L(""));
    1.65 +		INFO_PRINTF3(_L("Can't set screen output to %i. Only got %i screens"),aScreenNo,maxScreens);
    1.66 +		INFO_PRINTF2(_L("Screen number for all output remains at: %i"),settings_instance.iScreen);
    1.67 +
    1.68 +		INFO_PRINTF1(_L(""));
    1.69 +		INFO_PRINTF1(_L("**************************"));
    1.70 +		session.Flush();
    1.71 +		session.Close();
    1.72 +		User::Leave(KErrTEFUnitFail);
    1.73 +		}
    1.74 +	}
    1.75 +
    1.76 +void CGlobalSettings::ExpectDisconnectedScreenL(TBool aValue)
    1.77 +	{
    1.78 +	settings_instance.iDisconnected=aValue;
    1.79 +	}