|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Test class that allows a scriopt to set global values |
|
15 // |
|
16 // |
|
17 |
|
18 #include "globalsettings.h" |
|
19 #include <test/extendtef.h> |
|
20 |
|
21 TGlobalSettings settings_instance={0,0}; |
|
22 const TGlobalSettings& TGlobalSettings::Instance() |
|
23 { |
|
24 return settings_instance; |
|
25 } |
|
26 |
|
27 // Create a suite of all the tests |
|
28 CTestSuite* CGlobalSettings::CreateSuiteL(const TDesC& aName) |
|
29 { |
|
30 SUB_SUITE_OPT(CGlobalSettings,NULL); |
|
31 |
|
32 ADD_TEST_STEP_PARAM_RANGE(SetScreenNoL,0,9); |
|
33 ADD_TEST_STEP_PARAM_BOOL(ExpectDisconnectedScreenL); |
|
34 |
|
35 END_SUITE; |
|
36 } |
|
37 |
|
38 void CGlobalSettings::SetScreenNoL(TInt aScreenNo) |
|
39 { |
|
40 RWsSession session; |
|
41 ASSERT_EQUALS(session.Connect(), KErrNone); |
|
42 TInt maxScreens=session.NumberOfScreens(); |
|
43 |
|
44 if (maxScreens>aScreenNo) |
|
45 { |
|
46 INFO_PRINTF2(_L("New screen number for all output selected: %i"),aScreenNo); |
|
47 { |
|
48 CWsScreenDevice screen(session); |
|
49 screen.Construct(aScreenNo); |
|
50 screen.SetCurrentRotations(0,CFbsBitGc::TGraphicsOrientation(0)); |
|
51 screen.SetScreenMode(0); |
|
52 screen.SetAppScreenMode(0); |
|
53 } |
|
54 settings_instance.iScreen=aScreenNo; |
|
55 session.Flush(); |
|
56 session.Close(); |
|
57 } |
|
58 else |
|
59 { |
|
60 INFO_PRINTF1(_L("**************************")); |
|
61 INFO_PRINTF1(_L("")); |
|
62 INFO_PRINTF3(_L("Can't set screen output to %i. Only got %i screens"),aScreenNo,maxScreens); |
|
63 INFO_PRINTF2(_L("Screen number for all output remains at: %i"),settings_instance.iScreen); |
|
64 |
|
65 INFO_PRINTF1(_L("")); |
|
66 INFO_PRINTF1(_L("**************************")); |
|
67 session.Flush(); |
|
68 session.Close(); |
|
69 User::Leave(KErrTEFUnitFail); |
|
70 } |
|
71 } |
|
72 |
|
73 void CGlobalSettings::ExpectDisconnectedScreenL(TBool aValue) |
|
74 { |
|
75 settings_instance.iDisconnected=aValue; |
|
76 } |