|
1 // Copyright (c) 2005-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 // Tests border drawing using border colour & style.\n |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent - Internal Symbian test code |
|
21 */ |
|
22 #include <e32keys.h> |
|
23 #include <basched.h> |
|
24 #include <gdi.h> |
|
25 #include <gulutil.h> |
|
26 #include <gulbordr.h> |
|
27 #include <coecntrl.h> |
|
28 #include <coeutils.h> |
|
29 #include <eikenv.h> |
|
30 #include <eikappui.h> |
|
31 #include <eikdef.h> |
|
32 #include <eikdoc.h> |
|
33 #include <eikapp.h> |
|
34 #include <ecom/ecom.h> |
|
35 |
|
36 #include "appfwk_test_utils.h" |
|
37 #include "T_NonFocusStep.h" |
|
38 |
|
39 /** |
|
40 Destructor |
|
41 */ |
|
42 CSimpleNonFocusControl::~CSimpleNonFocusControl() |
|
43 { |
|
44 } |
|
45 |
|
46 |
|
47 /** |
|
48 Auxiliary function for all Test Cases |
|
49 |
|
50 This method creates the user interface control on which tests are carried |
|
51 out. |
|
52 |
|
53 */ |
|
54 void CSimpleNonFocusControl::ConstructL() |
|
55 { |
|
56 CreateWindowL(); |
|
57 SetExtentToWholeScreen(); |
|
58 ActivateL(); |
|
59 } |
|
60 |
|
61 |
|
62 /** |
|
63 Auxilliary function for all Test Cases |
|
64 |
|
65 This method is an override from CCoeControl. It is used to handle key |
|
66 events for the control. |
|
67 |
|
68 */ |
|
69 TKeyResponse CSimpleNonFocusControl::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode aType) |
|
70 { |
|
71 if (aType!=EEventKey) |
|
72 return(EKeyWasNotConsumed); |
|
73 |
|
74 return(EKeyWasConsumed); |
|
75 } |
|
76 |
|
77 /** |
|
78 Auxiliary function for all Test Cases |
|
79 |
|
80 This method prepares the test step's user interface and prepares it |
|
81 to start the tests. As part of user interface it creates a control |
|
82 on which the tests are carried out. |
|
83 |
|
84 */ |
|
85 void CSimpleNonFocusAppUi::ConstructL() |
|
86 { |
|
87 //BaseConstructL(ENoAppResourceFile); |
|
88 CTestCoeAppUi::ConstructL(); |
|
89 |
|
90 iSimpleNonFocusControl=new(ELeave) CSimpleNonFocusControl; |
|
91 iSimpleNonFocusControl->ConstructL(); |
|
92 AddToStackL(iSimpleNonFocusControl); |
|
93 |
|
94 AutoTestManager().StartAutoTest(); |
|
95 } |
|
96 |
|
97 CSimpleNonFocusAppUi::~CSimpleNonFocusAppUi() |
|
98 /** |
|
99 Destructor |
|
100 */ |
|
101 { |
|
102 RemoveFromStack(iSimpleNonFocusControl); |
|
103 delete iSimpleNonFocusControl; |
|
104 } |
|
105 |
|
106 /** |
|
107 Auxiliary function for all Test Cases |
|
108 |
|
109 The method is an override from CTestAppUi. The method initiates border |
|
110 drawing tests. |
|
111 |
|
112 */ |
|
113 void CSimpleNonFocusAppUi::RunTestStepL(TInt aNextStep) |
|
114 { |
|
115 switch(aNextStep) |
|
116 { |
|
117 case 1: |
|
118 { |
|
119 INFO_PRINTF1(_L("Test non focus")); |
|
120 TBool isNonFocusing = iSimpleNonFocusControl->IsNonFocusing(); |
|
121 TEST(isNonFocusing); |
|
122 if (!isNonFocusing) |
|
123 { |
|
124 INFO_PRINTF1(_L("IsNonFocusing() returned EFalse, ETrue expected")); |
|
125 } |
|
126 } |
|
127 break; |
|
128 case 2: |
|
129 AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass); |
|
130 break; |
|
131 default: |
|
132 break; |
|
133 } |
|
134 } |
|
135 |
|
136 /** |
|
137 Constructor |
|
138 */ |
|
139 CTestNonFocusStep::CTestNonFocusStep() |
|
140 { |
|
141 SetTestStepName(KTestNonFocusStep); |
|
142 } |
|
143 |
|
144 /** |
|
145 Destructor |
|
146 */ |
|
147 CTestNonFocusStep::~CTestNonFocusStep() |
|
148 { |
|
149 } |
|
150 |
|
151 /** |
|
152 Auxiliary function for all Test Cases |
|
153 |
|
154 The method creates & sets the application's user interface object. |
|
155 |
|
156 */ |
|
157 void CTestNonFocusStep::ConstructAppL(CEikonEnv* aCoe) |
|
158 { // runs inside a TRAP harness |
|
159 aCoe->ConstructL(); |
|
160 |
|
161 CSimpleNonFocusAppUi* appUi= new (ELeave) CSimpleNonFocusAppUi(this); |
|
162 aCoe->SetAppUi(appUi); |
|
163 appUi->ConstructL(); |
|
164 } |
|
165 |
|
166 /** |
|
167 Auxiliary function for all Test Cases |
|
168 |
|
169 The method creates & sets the test step's user interface object and |
|
170 launches the test step. |
|
171 |
|
172 */ |
|
173 TVerdict CTestNonFocusStep::doTestStepL() // main function called by E32 |
|
174 { |
|
175 PreallocateHALBuffer(); |
|
176 __UHEAP_MARK; |
|
177 |
|
178 // Before creating the CEikonEnv we must create C:\focus.txt. |
|
179 // The presence of this file will modify the behaviour of |
|
180 // staticsettingsinit |
|
181 RSmlTestUtils utils; |
|
182 User::LeaveIfError(utils.Connect()); |
|
183 CleanupClosePushL(utils); |
|
184 _LIT(KFile, "c:\\focus.txt"); |
|
185 utils.CreateFileL(KFile); |
|
186 |
|
187 CEikonEnv* coe=new CEikonEnv; |
|
188 TRAPD(err,ConstructAppL(coe)); |
|
189 |
|
190 if (!err) |
|
191 coe->ExecuteD(); |
|
192 |
|
193 utils.DeleteFileL(KFile); |
|
194 CleanupStack::PopAndDestroy(&utils); |
|
195 |
|
196 REComSession::FinalClose(); |
|
197 |
|
198 |
|
199 __UHEAP_MARKEND; |
|
200 |
|
201 |
|
202 return TestStepResult(); |
|
203 } |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |