|
1 // Copyright (c) 2007-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 // Negative tests for APIs that enable multiple displays |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @test |
|
21 @internalComponent - Internal Symbian test code |
|
22 */ |
|
23 |
|
24 |
|
25 #include "TMulScreensApp.h" |
|
26 |
|
27 |
|
28 const TUid KUidTMulScreensApp = { 0x1020820C }; |
|
29 |
|
30 _LIT8(KScreenDevice,"ScreenDevice"); |
|
31 _LIT8(KWindowGroup,"WindowGroup"); |
|
32 const TInt KMulScreensAppTestFailed = -666; |
|
33 const TInt KInvalidScreenNumber = 3; |
|
34 |
|
35 |
|
36 |
|
37 /* |
|
38 ----- CMulScreensTestAppUi |
|
39 **/ |
|
40 void CMulScreensTestAppUi::ConstructL() |
|
41 { |
|
42 BaseConstructL(ENoAppResourceFile | ENoScreenFurniture); |
|
43 } |
|
44 |
|
45 CMulScreensTestAppUi::~CMulScreensTestAppUi() |
|
46 { |
|
47 } |
|
48 |
|
49 void CMulScreensTestAppUi::HandleCommandL(TInt /*aCommand*/) |
|
50 { |
|
51 } |
|
52 |
|
53 void CMulScreensTestAppUi::HandleSystemEventL(const TWsEvent& /*aEvent*/) |
|
54 { |
|
55 } |
|
56 |
|
57 TBool CMulScreensTestAppUi::ProcessCommandParametersL(CApaCommandLine& aCommandLine) |
|
58 { |
|
59 TPtrC8 tailEnd = aCommandLine.TailEnd(); |
|
60 if(tailEnd.Compare(KScreenDevice) == 0) |
|
61 { |
|
62 RDebug::Print(_L("**** MultipleScreensAppTest - ScreenDevice: This should panic with ECoePanicInvalidScreenNumber")); |
|
63 CCoeEnv::Static()->ScreenDevice(KInvalidScreenNumber); |
|
64 } |
|
65 else if(tailEnd.Compare(KWindowGroup) == 0) |
|
66 { |
|
67 RDebug::Print(_L("**** MultipleScreensAppTest - WindowGroup: This should panic with ECoePanicInvalidScreenNumber")); |
|
68 CCoeEnv::Static()->RootWin(KInvalidScreenNumber); |
|
69 } |
|
70 else |
|
71 { |
|
72 RDebug::Print(_L("MultipleScreensAppTest - Bad arguments, failing test....")); |
|
73 RProcess().Terminate(KMulScreensAppTestFailed); |
|
74 } |
|
75 |
|
76 return ETrue; |
|
77 } |
|
78 |
|
79 |
|
80 /* |
|
81 ----- CMulScreensTestDocument |
|
82 **/ |
|
83 CMulScreensTestDocument::CMulScreensTestDocument(CEikApplication& aApp) |
|
84 : CEikDocument(aApp) |
|
85 { |
|
86 } |
|
87 |
|
88 CEikAppUi* CMulScreensTestDocument::CreateAppUiL() |
|
89 { |
|
90 return new(ELeave) CMulScreensTestAppUi; |
|
91 } |
|
92 |
|
93 |
|
94 /* |
|
95 ----- CMulScreensTestApp |
|
96 **/ |
|
97 |
|
98 TUid CMulScreensTestApp::AppDllUid() const |
|
99 { |
|
100 return KUidTMulScreensApp; |
|
101 } |
|
102 |
|
103 |
|
104 TFileName CMulScreensTestApp::ResourceFileName() const |
|
105 { |
|
106 return TFileName(); // this app doesn't have a resource file |
|
107 } |
|
108 |
|
109 CApaDocument* CMulScreensTestApp::CreateDocumentL() |
|
110 { |
|
111 return new (ELeave) CMulScreensTestDocument(*this); |
|
112 } |
|
113 |
|
114 |
|
115 /* |
|
116 ----- Main |
|
117 **/ |
|
118 |
|
119 LOCAL_C CApaApplication* NewApplication() |
|
120 { |
|
121 return new CMulScreensTestApp; |
|
122 } |
|
123 |
|
124 GLDEF_C TInt E32Main() |
|
125 { |
|
126 return EikStart::RunApplication(NewApplication); |
|
127 }//lint !e714 Symbol 'E32Main(void)' not referenced |
|
128 |