|
1 /* |
|
2 * Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: misc_controls_api |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // [INCLUDE FILES] |
|
21 #include <e32svr.h> |
|
22 #include <stifparser.h> |
|
23 #include <stiftestinterface.h> |
|
24 #include <eikmover.h> |
|
25 #include <eikenv.h> |
|
26 #include <testsdkmisccontrols.rsg> |
|
27 #include <s32mem.h> |
|
28 #include <barsread.h> |
|
29 #include "testsdkmisccontrolcontainer.h" |
|
30 #include "testsdkmisccontrols.h" |
|
31 #include "testsdkmoverprotectedclass.h" |
|
32 |
|
33 // ============================ MEMBER FUNCTIONS =============================== |
|
34 // ----------------------------------------------------------------------------- |
|
35 // CTestSDKMiscControls::TestEMConstructorL |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 TInt CTestSDKMiscControls::TestEMConstructorL( CStifItemParser& /*aItem*/ ) |
|
39 { |
|
40 |
|
41 // Print to UI |
|
42 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
43 _LIT( KTestEMConstructorL, "In TestEMConstructorL" ); |
|
44 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestEMConstructorL ); |
|
45 // Print to log file |
|
46 iLog->Log( KTestEMConstructorL ); |
|
47 iMover = new (ELeave) CEikMover(); |
|
48 STIF_ASSERT_NOT_NULL( iMover ); |
|
49 return KErrNone; |
|
50 |
|
51 } |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CTestSDKMiscControls::TestEMDestructor |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 TInt CTestSDKMiscControls::TestEMDestructor( CStifItemParser& /*aItem*/ ) |
|
57 { |
|
58 |
|
59 // Print to UI |
|
60 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
61 _LIT( KTestEMDestructor, "In TestEMDestructor" ); |
|
62 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestEMDestructor ); |
|
63 // Print to log file |
|
64 iLog->Log( KTestEMDestructor ); |
|
65 delete iMover; |
|
66 iMover = NULL; |
|
67 return KErrNone; |
|
68 |
|
69 } |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CTestSDKMiscControls::TestEMSetTextNoL |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 TInt CTestSDKMiscControls::TestEMSetTextNoL( CStifItemParser& /*aItem*/ ) |
|
75 { |
|
76 |
|
77 // Print to UI |
|
78 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
79 _LIT( KTestEMSetTextNoL, "In TestEMSetTextNoL" ); |
|
80 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestEMSetTextNoL ); |
|
81 // Print to log file |
|
82 iLog->Log( KTestEMSetTextNoL ); |
|
83 TBufC<20> statckbuf( KTestEMSetTextNoL ); |
|
84 HBufC* heapBuf = statckbuf.AllocL(); |
|
85 iMover->SetText( heapBuf ); |
|
86 |
|
87 return KErrNone; |
|
88 |
|
89 } |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CTestSDKMiscControls::TestEMSetTextL |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 TInt CTestSDKMiscControls::TestEMSetTextL( CStifItemParser& /*aItem*/ ) |
|
95 { |
|
96 |
|
97 // Print to UI |
|
98 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
99 _LIT( KTestEMSetTextL, "In TestEMSetTextL" ); |
|
100 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestEMSetTextL ); |
|
101 // Print to log file |
|
102 iLog->Log( KTestEMSetTextL ); |
|
103 |
|
104 iMover->SetTextL( KTestEMSetTextL ); |
|
105 |
|
106 return KErrNone; |
|
107 |
|
108 } |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CTestSDKMiscControls::TestEMSetActive |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 TInt CTestSDKMiscControls::TestEMSetActive( CStifItemParser& /*aItem*/ ) |
|
114 { |
|
115 |
|
116 // Print to UI |
|
117 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
118 _LIT( KTestEMSetActive, "In TestEMSetActive" ); |
|
119 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestEMSetActive ); |
|
120 // Print to log file |
|
121 iLog->Log( KTestEMSetActive ); |
|
122 |
|
123 iMover->SetActive( ETrue ); |
|
124 |
|
125 return KErrNone; |
|
126 |
|
127 } |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CTestSDKMiscControls::TestEMActive |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 TInt CTestSDKMiscControls::TestEMActive( CStifItemParser& /*aItem*/ ) |
|
133 { |
|
134 |
|
135 // Print to UI |
|
136 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
137 _LIT( KTestEMActive, "In TestEMActive" ); |
|
138 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestEMActive ); |
|
139 // Print to log file |
|
140 iLog->Log( KTestEMActive ); |
|
141 |
|
142 TBool status = iMover->Active(); |
|
143 |
|
144 return KErrNone; |
|
145 |
|
146 } |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CTestSDKMiscControls::TestEMSetFontL |
|
149 // ----------------------------------------------------------------------------- |
|
150 // |
|
151 TInt CTestSDKMiscControls::TestEMSetFontL( CStifItemParser& /*aItem*/ ) |
|
152 { |
|
153 |
|
154 // Print to UI |
|
155 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
156 _LIT( KTestEMSetFontL, "In TestEMSetFontL" ); |
|
157 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestEMSetFontL ); |
|
158 // Print to log file |
|
159 iLog->Log( KTestEMSetFontL ); |
|
160 iConsoleContainer = new (ELeave) CMiscControlsContainer(); |
|
161 |
|
162 CEikonEnv* eikEnv = static_cast<CEikonEnv*> ( iConsoleContainer->GetCoeEnv() ); |
|
163 CleanupStack::PushL( eikEnv ); |
|
164 const CFont* font = eikEnv->TitleFont(); |
|
165 iMover->SetFont( font ); |
|
166 CleanupStack::Pop( ); |
|
167 |
|
168 return KErrNone; |
|
169 |
|
170 } |
|
171 // ----------------------------------------------------------------------------- |
|
172 // CTestSDKMiscControls::TestEMSetTitleLeftMargin |
|
173 // ----------------------------------------------------------------------------- |
|
174 // |
|
175 TInt CTestSDKMiscControls::TestEMSetTitleLeftMargin( CStifItemParser& /*aItem*/ ) |
|
176 { |
|
177 |
|
178 // Print to UI |
|
179 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
180 _LIT( KTestEMSetTitleLeftMargin, "In TestEMSetTitleLeftMargin" ); |
|
181 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestEMSetTitleLeftMargin ); |
|
182 // Print to log file |
|
183 iLog->Log( KTestEMSetTitleLeftMargin ); |
|
184 TInt leftMargin = 5; |
|
185 |
|
186 iMover->SetTitleLeftMargin( leftMargin ); |
|
187 |
|
188 return KErrNone; |
|
189 |
|
190 } |
|
191 // ----------------------------------------------------------------------------- |
|
192 // CTestSDKMiscControls::TestEMConstructFromResourceL |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 TInt CTestSDKMiscControls::TestEMConstructFromResourceL( CStifItemParser& /*aItem*/ ) |
|
196 { |
|
197 |
|
198 // Print to UI |
|
199 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
200 _LIT( KTestEMConstructFromResourceL, "In TestEMConstructFromResourceL" ); |
|
201 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestEMConstructFromResourceL ); |
|
202 // Print to log file |
|
203 iLog->Log( KTestEMConstructFromResourceL ); |
|
204 TResourceReader reader; |
|
205 CCoeEnv::Static()->CreateResourceReaderLC( |
|
206 reader, R_EIK_MOVER_DIALOG ); |
|
207 TBool err = KErrNone; |
|
208 TRAP( err, iMover->ConstructFromResourceL( reader ) ); |
|
209 CleanupStack::PopAndDestroy(); |
|
210 |
|
211 return err; |
|
212 |
|
213 } |
|
214 // ----------------------------------------------------------------------------- |
|
215 // CTestSDKMiscControls::TestEMMinimumSize |
|
216 // ----------------------------------------------------------------------------- |
|
217 // |
|
218 TInt CTestSDKMiscControls::TestEMMinimumSize( CStifItemParser& /*aItem*/ ) |
|
219 { |
|
220 |
|
221 // Print to UI |
|
222 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
223 _LIT( KTestEMMinimumSize, "In TestEMMinimumSize" ); |
|
224 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestEMMinimumSize ); |
|
225 // Print to log file |
|
226 iLog->Log( KTestEMMinimumSize ); |
|
227 |
|
228 TSize size = iMover->MinimumSize( ); |
|
229 |
|
230 return KErrNone; |
|
231 |
|
232 } |
|
233 // ----------------------------------------------------------------------------- |
|
234 // CTestSDKMiscControls::TestEMSetContainerWindowL |
|
235 // ----------------------------------------------------------------------------- |
|
236 // |
|
237 TInt CTestSDKMiscControls::TestEMSetContainerWindowL( CStifItemParser& /*aItem*/ ) |
|
238 { |
|
239 |
|
240 // Print to UI |
|
241 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
242 _LIT( KTestEMSetContainerWindowL, "In TestEMSetContainerWindowL" ); |
|
243 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestEMSetContainerWindowL ); |
|
244 // Print to log file |
|
245 iLog->Log( KTestEMSetContainerWindowL ); |
|
246 TBool err = KErrNone; |
|
247 iConsoleContainer = new (ELeave) CMiscControlsContainer(); |
|
248 |
|
249 TRAP( err, iMover->SetContainerWindowL( *iConsoleContainer ) ); |
|
250 |
|
251 return err; |
|
252 |
|
253 } |
|
254 // ----------------------------------------------------------------------------- |
|
255 // CTestSDKMiscControls::TestEMGetColorUseListL |
|
256 // ----------------------------------------------------------------------------- |
|
257 // |
|
258 TInt CTestSDKMiscControls::TestEMGetColorUseListL( CStifItemParser& /*aItem*/ ) |
|
259 { |
|
260 |
|
261 // Print to UI |
|
262 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
263 _LIT( KTestEMGetColorUseListL, "In TestEMGetColorUseListL" ); |
|
264 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestEMGetColorUseListL ); |
|
265 // Print to log file |
|
266 iLog->Log( KTestEMGetColorUseListL ); |
|
267 TBool err = KErrNone; |
|
268 CArrayFixFlat<TCoeColorUse>* colorUseList = new( ELeave ) |
|
269 CArrayFixFlat<TCoeColorUse>( 4 ); |
|
270 CleanupStack::PushL( colorUseList ); |
|
271 TRAP( err, iMover->GetColorUseListL( *colorUseList ) ); |
|
272 colorUseList->Reset(); |
|
273 CleanupStack::PopAndDestroy( colorUseList ); |
|
274 return err; |
|
275 |
|
276 } |
|
277 // ----------------------------------------------------------------------------- |
|
278 // CTestSDKMiscControls::TestEMHandleResourceChange |
|
279 // ----------------------------------------------------------------------------- |
|
280 // |
|
281 TInt CTestSDKMiscControls::TestEMHandleResourceChange( CStifItemParser& /*aItem*/ ) |
|
282 { |
|
283 |
|
284 // Print to UI |
|
285 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
286 _LIT( KTestEMHandleResourceChange, "In TestEMHandleResourceChange" ); |
|
287 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestEMHandleResourceChange ); |
|
288 // Print to log file |
|
289 iLog->Log( KTestEMHandleResourceChange ); |
|
290 TInt type = 0; |
|
291 iMover->HandleResourceChange( type ); |
|
292 |
|
293 return KErrNone; |
|
294 |
|
295 } |
|
296 |
|
297 // ----------------------------------------------------------------------------- |
|
298 // CTestSDKMiscControls::TestEMHandlePointerEventL |
|
299 // ----------------------------------------------------------------------------- |
|
300 // |
|
301 TInt CTestSDKMiscControls::TestEMHandlePointerEventL( CStifItemParser& /*aItem*/ ) |
|
302 { |
|
303 |
|
304 // Print to UI |
|
305 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
306 _LIT( KTestEMHandlePointerEventL, "In TestEMHandlePointerEventL" ); |
|
307 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestEMHandlePointerEventL ); |
|
308 // Print to log file |
|
309 iLog->Log( KTestEMHandlePointerEventL ); |
|
310 TBool err = KErrNone; |
|
311 TPointerEvent event; |
|
312 event.iType = TPointerEvent::EButton1Down; |
|
313 TRAP( err, iMover->HandlePointerEventL( event ) ); |
|
314 |
|
315 return err; |
|
316 |
|
317 } |
|
318 // ----------------------------------------------------------------------------- |
|
319 // CTestSDKMiscControls::TestEMWriteInternalStateL |
|
320 // ----------------------------------------------------------------------------- |
|
321 // |
|
322 TInt CTestSDKMiscControls::TestEMWriteInternalStateL( CStifItemParser& /*aItem*/ ) |
|
323 { |
|
324 |
|
325 // Print to UI |
|
326 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
327 _LIT( KTestEMWriteInternalStateL, "In TestEMWriteInternalStateL" ); |
|
328 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestEMWriteInternalStateL ); |
|
329 // Print to log file |
|
330 iLog->Log( KTestEMWriteInternalStateL ); |
|
331 TBool err = KErrNone; |
|
332 CBufFlat* buf = CBufFlat::NewL( 200 ); |
|
333 CleanupStack::PushL( buf ); |
|
334 RBufWriteStream stream; |
|
335 stream.Open( *buf ); |
|
336 CTestMover* testMover = new (ELeave) CTestMover(); |
|
337 CleanupStack::PushL( testMover ); |
|
338 TRAP( err, testMover->WriteInternalStateL( stream ) ); |
|
339 stream.Close(); |
|
340 CleanupStack::PopAndDestroy( 2 ); |
|
341 |
|
342 return err; |
|
343 |
|
344 } |