|
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 <eikctgrp.h> |
|
25 #include <s32mem.h> |
|
26 #include <testsdkmisccontrols.rsg> |
|
27 #include "testsdkmisccontrols.h" |
|
28 #include "testsdkgroupprotectedclass.h" |
|
29 |
|
30 // ============================ MEMBER FUNCTIONS =============================== |
|
31 // ----------------------------------------------------------------------------- |
|
32 // CTestSDKMiscControls::TestGCConstructorL |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 TInt CTestSDKMiscControls::TestGCConstructorL( CStifItemParser& /*aItem*/ ) |
|
36 { |
|
37 |
|
38 // Print to UI |
|
39 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
40 _LIT( KTestGCConstructorL, "In TestGCConstructorL" ); |
|
41 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestGCConstructorL ); |
|
42 // Print to log file |
|
43 iLog->Log( KTestGCConstructorL ); |
|
44 |
|
45 iGroupControl = new (ELeave) TEikGroupControl(); |
|
46 STIF_ASSERT_NOT_NULL( iGroupControl ); |
|
47 return KErrNone; |
|
48 |
|
49 } |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CTestSDKMiscControls::TestGCConstructorWithControlL |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 TInt CTestSDKMiscControls::TestGCConstructorWithControlL( CStifItemParser& /*aItem*/ ) |
|
55 { |
|
56 |
|
57 // Print to UI |
|
58 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
59 _LIT( KTestGCConstructorWithControlL, "In TestGCConstructorWithControlL" ); |
|
60 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestGCConstructorWithControlL ); |
|
61 // Print to log file |
|
62 iLog->Log( KTestGCConstructorWithControlL ); |
|
63 |
|
64 CCoeControl* control = new (ELeave) CCoeControl(); |
|
65 TInt cId = 0; |
|
66 TInt length = 0; |
|
67 TInt flags = 0; |
|
68 iGroupControl = new (ELeave) TEikGroupControl( control, cId, length, flags ); |
|
69 STIF_ASSERT_NOT_NULL( iGroupControl ); |
|
70 return KErrNone; |
|
71 |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CTestSDKMiscControls::TestGCIsLengthSet |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 TInt CTestSDKMiscControls::TestGCIsLengthSet( CStifItemParser& /*aItem*/ ) |
|
79 { |
|
80 |
|
81 // Print to UI |
|
82 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
83 _LIT( KTestGCIsLengthSet, "In TestGCIsLengthSet" ); |
|
84 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestGCIsLengthSet ); |
|
85 // Print to log file |
|
86 iLog->Log( KTestGCIsLengthSet ); |
|
87 |
|
88 TBool lengthSet = iGroupControl->IsLengthSet(); |
|
89 return KErrNone; |
|
90 |
|
91 } |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CTestSDKMiscControls::TestGCLength |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 TInt CTestSDKMiscControls::TestGCLength( CStifItemParser& /*aItem*/ ) |
|
97 { |
|
98 |
|
99 // Print to UI |
|
100 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
101 _LIT( KTestGCLength, "In TestGCLength" ); |
|
102 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestGCLength ); |
|
103 // Print to log file |
|
104 iLog->Log( KTestGCLength ); |
|
105 |
|
106 TInt length = iGroupControl->Length(); |
|
107 return KErrNone; |
|
108 |
|
109 } |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CTestSDKMiscControls::TestGCIsStretchable |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 TInt CTestSDKMiscControls::TestGCIsStretchable( CStifItemParser& /*aItem*/ ) |
|
115 { |
|
116 |
|
117 // Print to UI |
|
118 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
119 _LIT( KTestGCIsStretchable, "In TestGCIsStretchable" ); |
|
120 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestGCIsStretchable ); |
|
121 // Print to log file |
|
122 iLog->Log( KTestGCIsStretchable ); |
|
123 |
|
124 TBool stretchable = iGroupControl->IsStretchable(); |
|
125 return KErrNone; |
|
126 |
|
127 } |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CTestSDKMiscControls::TestGCSetLength |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 TInt CTestSDKMiscControls::TestGCSetLength( CStifItemParser& /*aItem*/ ) |
|
133 { |
|
134 |
|
135 // Print to UI |
|
136 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
137 _LIT( KTestGCSetLength, "In TestGCSetLength" ); |
|
138 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestGCSetLength ); |
|
139 // Print to log file |
|
140 iLog->Log( KTestGCSetLength ); |
|
141 TInt length = iGroupControl->Length(); |
|
142 iGroupControl->SetLength( length ); |
|
143 return KErrNone; |
|
144 |
|
145 } |
|
146 // ----------------------------------------------------------------------------- |
|
147 // CTestSDKMiscControls::TestGCSetStretchable |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 TInt CTestSDKMiscControls::TestGCSetStretchable( CStifItemParser& /*aItem*/ ) |
|
151 { |
|
152 |
|
153 // Print to UI |
|
154 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
155 _LIT( KTestGCSetStretchable, "In TestGCSetStretchable" ); |
|
156 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestGCSetStretchable ); |
|
157 // Print to log file |
|
158 iLog->Log( KTestGCSetStretchable ); |
|
159 |
|
160 iGroupControl->SetStretchable(); |
|
161 return KErrNone; |
|
162 |
|
163 } |
|
164 // ----------------------------------------------------------------------------- |
|
165 // CTestSDKMiscControls::TestCGConstructorL |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 TInt CTestSDKMiscControls::TestCGConstructorL( CStifItemParser& /*aItem*/ ) |
|
169 { |
|
170 |
|
171 // Print to UI |
|
172 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
173 _LIT( KTestCGConstructorL, "In TestCGConstructorL" ); |
|
174 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGConstructorL ); |
|
175 // Print to log file |
|
176 iLog->Log( KTestCGConstructorL ); |
|
177 iControlGroup = new (ELeave) CEikControlGroup(); |
|
178 STIF_ASSERT_NOT_NULL( iControlGroup ); |
|
179 |
|
180 return KErrNone; |
|
181 |
|
182 } |
|
183 // ----------------------------------------------------------------------------- |
|
184 // CTestSDKMiscControls::TestCGDestructor |
|
185 // ----------------------------------------------------------------------------- |
|
186 // |
|
187 TInt CTestSDKMiscControls::TestCGDestructor( CStifItemParser& /*aItem*/ ) |
|
188 { |
|
189 |
|
190 // Print to UI |
|
191 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
192 _LIT( KTestCGDestructor, "In TestCGDestructor" ); |
|
193 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGDestructor ); |
|
194 // Print to log file |
|
195 iLog->Log( KTestCGDestructor ); |
|
196 delete iControlGroup; |
|
197 iControlGroup = NULL; |
|
198 return KErrNone; |
|
199 |
|
200 } |
|
201 // ----------------------------------------------------------------------------- |
|
202 // CTestSDKMiscControls::TestCGConstructL |
|
203 // ----------------------------------------------------------------------------- |
|
204 // |
|
205 TInt CTestSDKMiscControls::TestCGConstructL( CStifItemParser& /*aItem*/ ) |
|
206 { |
|
207 |
|
208 // Print to UI |
|
209 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
210 _LIT( KTestCGConstructL, "In TestCGConstructL" ); |
|
211 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGConstructL ); |
|
212 // Print to log file |
|
213 iLog->Log( KTestCGConstructL ); |
|
214 TBool err = KErrNone; |
|
215 TRAP( err, iControlGroup->ConstructL( CEikControlGroup::EFromTopLeft, |
|
216 CEikControlGroup::ELayHorizontally ) ); |
|
217 |
|
218 return err; |
|
219 |
|
220 } |
|
221 // ----------------------------------------------------------------------------- |
|
222 // CTestSDKMiscControls::TestCGAddControlL |
|
223 // ----------------------------------------------------------------------------- |
|
224 // |
|
225 TInt CTestSDKMiscControls::TestCGAddControlL( CStifItemParser& /*aItem*/ ) |
|
226 { |
|
227 |
|
228 // Print to UI |
|
229 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
230 _LIT( KTestCGAddControlL, "In TestCGAddControlL" ); |
|
231 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGAddControlL ); |
|
232 // Print to log file |
|
233 iLog->Log( KTestCGAddControlL ); |
|
234 TBool err = KErrNone; |
|
235 CCoeControl* coeControl = new( ELeave ) CCoeControl(); |
|
236 CleanupStack::PushL( coeControl ); |
|
237 TInt cId = 1; |
|
238 |
|
239 TRAP( err, iControlGroup->AddControlL( coeControl, cId ) ); |
|
240 CleanupStack::Pop( coeControl ); |
|
241 return err; |
|
242 |
|
243 } |
|
244 // ----------------------------------------------------------------------------- |
|
245 // CTestSDKMiscControls::TestCGAddControlWithGroupControlL |
|
246 // ----------------------------------------------------------------------------- |
|
247 // |
|
248 TInt CTestSDKMiscControls::TestCGAddControlWithGroupControlL( CStifItemParser& /*aItem*/ ) |
|
249 { |
|
250 |
|
251 // Print to UI |
|
252 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
253 _LIT( KTestCGAddControlWithGroupControlL, "In TestCGAddControlWithGroupControlL" ); |
|
254 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGAddControlWithGroupControlL ); |
|
255 // Print to log file |
|
256 iLog->Log( KTestCGAddControlWithGroupControlL ); |
|
257 TBool err = KErrNone; |
|
258 CCoeControl* control = new( ELeave ) CCoeControl(); |
|
259 CleanupStack::PushL( control ); |
|
260 TEikGroupControl ctrl; |
|
261 ctrl.iControl = control; |
|
262 ctrl.iId = 2; |
|
263 TRAP( err, iControlGroup->AddControlL( ctrl ) ); |
|
264 CleanupStack::Pop(); |
|
265 |
|
266 return err; |
|
267 |
|
268 } |
|
269 // ----------------------------------------------------------------------------- |
|
270 // CTestSDKMiscControls::TestCGInsertControlL |
|
271 // ----------------------------------------------------------------------------- |
|
272 // |
|
273 TInt CTestSDKMiscControls::TestCGInsertControlL( CStifItemParser& /*aItem*/ ) |
|
274 { |
|
275 |
|
276 // Print to UI |
|
277 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
278 _LIT( KTestCGInsertControlL, "In TestCGInsertControlL" ); |
|
279 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGInsertControlL ); |
|
280 // Print to log file |
|
281 iLog->Log( KTestCGInsertControlL ); |
|
282 TBool err = KErrNone; |
|
283 CCoeControl* control = new( ELeave ) CCoeControl(); |
|
284 CleanupStack::PushL( control ); |
|
285 TEikGroupControl ctrl; |
|
286 ctrl.iControl = control; |
|
287 ctrl.iId = 1; |
|
288 TInt cIndex = 0; |
|
289 TRAP( err, iControlGroup->InsertControlL( ctrl, cIndex ) ); |
|
290 CleanupStack::Pop(); |
|
291 |
|
292 return err; |
|
293 |
|
294 } |
|
295 // ----------------------------------------------------------------------------- |
|
296 // CTestSDKMiscControls::TestCGDeleteControl |
|
297 // ----------------------------------------------------------------------------- |
|
298 // |
|
299 TInt CTestSDKMiscControls::TestCGDeleteControl( CStifItemParser& /*aItem*/ ) |
|
300 { |
|
301 |
|
302 // Print to UI |
|
303 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
304 _LIT( KTestCGDeleteControl, "In TestCGDeleteControl" ); |
|
305 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGDeleteControl ); |
|
306 // Print to log file |
|
307 iLog->Log( KTestCGDeleteControl ); |
|
308 |
|
309 TInt cIndex = 0; |
|
310 TInt count =1; |
|
311 iControlGroup->DeleteControl( cIndex, count ); |
|
312 |
|
313 return KErrNone; |
|
314 |
|
315 } |
|
316 // ----------------------------------------------------------------------------- |
|
317 // CTestSDKMiscControls::TestCGSetLengthInPixels |
|
318 // ----------------------------------------------------------------------------- |
|
319 // |
|
320 TInt CTestSDKMiscControls::TestCGSetLengthInPixels( CStifItemParser& /*aItem*/ ) |
|
321 { |
|
322 |
|
323 // Print to UI |
|
324 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
325 _LIT( KTestCGSetLengthInPixels, "In TestCGSetLengthInPixels" ); |
|
326 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGSetLengthInPixels ); |
|
327 // Print to log file |
|
328 iLog->Log( KTestCGSetLengthInPixels ); |
|
329 TInt length = 1; |
|
330 iControlGroup->SetLengthInPixels( length ); |
|
331 |
|
332 return KErrNone; |
|
333 |
|
334 } |
|
335 // ----------------------------------------------------------------------------- |
|
336 // CTestSDKMiscControls::TestCGSetBreadthInPixels |
|
337 // ----------------------------------------------------------------------------- |
|
338 // |
|
339 TInt CTestSDKMiscControls::TestCGSetBreadthInPixels( CStifItemParser& /*aItem*/ ) |
|
340 { |
|
341 |
|
342 // Print to UI |
|
343 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
344 _LIT( KTestCGSetBreadthInPixels, "In TestCGSetBreadthInPixels" ); |
|
345 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGSetBreadthInPixels ); |
|
346 // Print to log file |
|
347 iLog->Log( KTestCGSetBreadthInPixels ); |
|
348 TInt breadth = 1; |
|
349 iControlGroup->SetBreadthInPixels( breadth ); |
|
350 |
|
351 return KErrNone; |
|
352 |
|
353 } |
|
354 // ----------------------------------------------------------------------------- |
|
355 // CTestSDKMiscControls::TestCGSetControlSpacing |
|
356 // ----------------------------------------------------------------------------- |
|
357 // |
|
358 TInt CTestSDKMiscControls::TestCGSetControlSpacing( CStifItemParser& /*aItem*/ ) |
|
359 { |
|
360 |
|
361 // Print to UI |
|
362 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
363 _LIT( KTestCGSetControlSpacing, "In TestCGSetControlSpacing" ); |
|
364 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGSetControlSpacing ); |
|
365 // Print to log file |
|
366 iLog->Log( KTestCGSetControlSpacing ); |
|
367 TInt hSpacing = 3; |
|
368 TInt vSpacing = 3; |
|
369 iControlGroup->SetControlSpacing( hSpacing, vSpacing ); |
|
370 |
|
371 return KErrNone; |
|
372 |
|
373 } |
|
374 // ----------------------------------------------------------------------------- |
|
375 // CTestSDKMiscControls::TestCGSetControlLayout |
|
376 // ----------------------------------------------------------------------------- |
|
377 // |
|
378 TInt CTestSDKMiscControls::TestCGSetControlLayout( CStifItemParser& /*aItem*/ ) |
|
379 { |
|
380 |
|
381 // Print to UI |
|
382 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
383 _LIT( KTestCGSetControlLayout, "In TestCGSetControlLayout" ); |
|
384 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGSetControlLayout ); |
|
385 // Print to log file |
|
386 iLog->Log( KTestCGSetControlLayout ); |
|
387 |
|
388 iControlGroup->SetControlLayout( CEikControlGroup::EFromTopLeft, |
|
389 CEikControlGroup::ELayHorizontally ); |
|
390 |
|
391 return KErrNone; |
|
392 |
|
393 } |
|
394 // ----------------------------------------------------------------------------- |
|
395 // CTestSDKMiscControls::TestCGSetNumberOfLines |
|
396 // ----------------------------------------------------------------------------- |
|
397 // |
|
398 TInt CTestSDKMiscControls::TestCGSetNumberOfLines( CStifItemParser& /*aItem*/ ) |
|
399 { |
|
400 |
|
401 // Print to UI |
|
402 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
403 _LIT( KTestCGSetNumberOfLines, "In TestCGSetNumberOfLines" ); |
|
404 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGSetNumberOfLines ); |
|
405 // Print to log file |
|
406 iLog->Log( KTestCGSetNumberOfLines ); |
|
407 TInt numLines = 1; |
|
408 TBool distributeEvenly = ETrue; |
|
409 iControlGroup->SetNumberOfLines( numLines, distributeEvenly ); |
|
410 return KErrNone; |
|
411 |
|
412 } |
|
413 // ----------------------------------------------------------------------------- |
|
414 // CTestSDKMiscControls::TestCGSetControlsAllSameSize |
|
415 // ----------------------------------------------------------------------------- |
|
416 // |
|
417 TInt CTestSDKMiscControls::TestCGSetControlsAllSameSize( CStifItemParser& /*aItem*/ ) |
|
418 { |
|
419 |
|
420 // Print to UI |
|
421 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
422 _LIT( KTestCGSetControlsAllSameSize, "In TestCGSetControlsAllSameSize" ); |
|
423 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGSetControlsAllSameSize ); |
|
424 // Print to log file |
|
425 iLog->Log( KTestCGSetControlsAllSameSize ); |
|
426 |
|
427 iControlGroup->SetControlsAllSameSize(); |
|
428 return KErrNone; |
|
429 |
|
430 } |
|
431 // ----------------------------------------------------------------------------- |
|
432 // CTestSDKMiscControls::TestCGLayoutControls |
|
433 // ----------------------------------------------------------------------------- |
|
434 // |
|
435 TInt CTestSDKMiscControls::TestCGLayoutControls( CStifItemParser& /*aItem*/ ) |
|
436 { |
|
437 |
|
438 // Print to UI |
|
439 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
440 _LIT( KTestCGLayoutControls, "In TestCGLayoutControls" ); |
|
441 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGLayoutControls ); |
|
442 // Print to log file |
|
443 iLog->Log( KTestCGLayoutControls ); |
|
444 |
|
445 iControlGroup->LayoutControls(); |
|
446 return KErrNone; |
|
447 |
|
448 } |
|
449 // ----------------------------------------------------------------------------- |
|
450 // CTestSDKMiscControls::TestCGControlByIdL |
|
451 // ----------------------------------------------------------------------------- |
|
452 // |
|
453 TInt CTestSDKMiscControls::TestCGControlByIdL( CStifItemParser& /*aItem*/ ) |
|
454 { |
|
455 |
|
456 // Print to UI |
|
457 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
458 _LIT( KTestCGControlByIdL, "In TestCGControlByIdL" ); |
|
459 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGControlByIdL ); |
|
460 // Print to log file |
|
461 iLog->Log( KTestCGControlByIdL ); |
|
462 TInt cId = 0; |
|
463 CCoeControl* control = iControlGroup->ControlById( cId ); |
|
464 STIF_ASSERT_NULL( control ); |
|
465 return KErrNone; |
|
466 |
|
467 } |
|
468 // ----------------------------------------------------------------------------- |
|
469 // CTestSDKMiscControls::TestCGIndexById |
|
470 // ----------------------------------------------------------------------------- |
|
471 // |
|
472 TInt CTestSDKMiscControls::TestCGIndexById( CStifItemParser& /*aItem*/ ) |
|
473 { |
|
474 |
|
475 // Print to UI |
|
476 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
477 _LIT( KTestCGIndexById, "In TestCGIndexById" ); |
|
478 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGIndexById ); |
|
479 // Print to log file |
|
480 iLog->Log( KTestCGIndexById ); |
|
481 TInt cId = 0; |
|
482 TInt cIndex = iControlGroup->IndexById( cId ); |
|
483 return KErrNone; |
|
484 |
|
485 } |
|
486 // ----------------------------------------------------------------------------- |
|
487 // CTestSDKMiscControls::TestCGReset |
|
488 // ----------------------------------------------------------------------------- |
|
489 // |
|
490 TInt CTestSDKMiscControls::TestCGReset( CStifItemParser& /*aItem*/ ) |
|
491 { |
|
492 |
|
493 // Print to UI |
|
494 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
495 _LIT( KTestCGReset, "In TestCGReset" ); |
|
496 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGReset ); |
|
497 // Print to log file |
|
498 iLog->Log( KTestCGReset ); |
|
499 |
|
500 iControlGroup->Reset(); |
|
501 return KErrNone; |
|
502 |
|
503 } |
|
504 // ----------------------------------------------------------------------------- |
|
505 // CTestSDKMiscControls::TestCGControlId |
|
506 // ----------------------------------------------------------------------------- |
|
507 // |
|
508 TInt CTestSDKMiscControls::TestCGControlId( CStifItemParser& /*aItem*/ ) |
|
509 { |
|
510 |
|
511 // Print to UI |
|
512 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
513 _LIT( KTestCGControlId, "In TestCGControlId" ); |
|
514 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGControlId ); |
|
515 // Print to log file |
|
516 iLog->Log( KTestCGControlId ); |
|
517 CCoeControl* control = iControlGroup->ControlById( 0 ); |
|
518 TInt ctl = iControlGroup->ControlId( control ); |
|
519 return KErrNone; |
|
520 |
|
521 } |
|
522 // ----------------------------------------------------------------------------- |
|
523 // CTestSDKMiscControls::TestCGControlL |
|
524 // ----------------------------------------------------------------------------- |
|
525 // |
|
526 TInt CTestSDKMiscControls::TestCGControlL( CStifItemParser& /*aItem*/ ) |
|
527 { |
|
528 |
|
529 // Print to UI |
|
530 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
531 _LIT( KTestCGControl, "In TestCGControl" ); |
|
532 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGControl ); |
|
533 // Print to log file |
|
534 iLog->Log( KTestCGControl ); |
|
535 TInt cId = 1; |
|
536 TInt cIndex = iControlGroup->IndexById( cId ); |
|
537 |
|
538 CCoeControl* ctl = iControlGroup->Control( cIndex ); |
|
539 STIF_ASSERT_NOT_NULL( ctl ); |
|
540 return KErrNone; |
|
541 |
|
542 } |
|
543 // ----------------------------------------------------------------------------- |
|
544 // CTestSDKMiscControls::TestCGControlArrayL |
|
545 // ----------------------------------------------------------------------------- |
|
546 // |
|
547 TInt CTestSDKMiscControls::TestCGControlArrayL( CStifItemParser& /*aItem*/ ) |
|
548 { |
|
549 |
|
550 // Print to UI |
|
551 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
552 _LIT( KTestCGControlArrayL, "In TestCGControlArrayL" ); |
|
553 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGControlArrayL ); |
|
554 // Print to log file |
|
555 iLog->Log( KTestCGControlArrayL ); |
|
556 TInt cId = 1; |
|
557 TInt cIndex = iControlGroup->IndexById( cId ); |
|
558 |
|
559 CArrayFix<TEikGroupControl>* ctl = iControlGroup->ControlArray(); |
|
560 STIF_ASSERT_NOT_NULL( ctl ); |
|
561 return KErrNone; |
|
562 |
|
563 } |
|
564 // ----------------------------------------------------------------------------- |
|
565 // CTestSDKMiscControls::TestCGOrientation |
|
566 // ----------------------------------------------------------------------------- |
|
567 // |
|
568 TInt CTestSDKMiscControls::TestCGOrientation( CStifItemParser& /*aItem*/ ) |
|
569 { |
|
570 |
|
571 // Print to UI |
|
572 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
573 _LIT( KTestCGOrientation, "In TestCGOrientation" ); |
|
574 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGOrientation ); |
|
575 // Print to log file |
|
576 iLog->Log( KTestCGOrientation ); |
|
577 CEikControlGroup::TOrientation orientation = iControlGroup->Orientation(); |
|
578 |
|
579 return KErrNone; |
|
580 |
|
581 } |
|
582 // ----------------------------------------------------------------------------- |
|
583 // CTestSDKMiscControls::TestCGControlSpacing |
|
584 // ----------------------------------------------------------------------------- |
|
585 // |
|
586 TInt CTestSDKMiscControls::TestCGControlSpacing( CStifItemParser& /*aItem*/ ) |
|
587 { |
|
588 |
|
589 // Print to UI |
|
590 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
591 _LIT( KTestCGControlSpacing, "In TestCGControlSpacing" ); |
|
592 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGControlSpacing ); |
|
593 // Print to log file |
|
594 iLog->Log( KTestCGControlSpacing ); |
|
595 TInt vSpacing; |
|
596 TInt hSpacing; |
|
597 iControlGroup->ControlSpacing( vSpacing, hSpacing ); |
|
598 |
|
599 return KErrNone; |
|
600 |
|
601 } |
|
602 // ----------------------------------------------------------------------------- |
|
603 // CTestSDKMiscControls::TestCGMinimumSize |
|
604 // ----------------------------------------------------------------------------- |
|
605 // |
|
606 TInt CTestSDKMiscControls::TestCGMinimumSize( CStifItemParser& /*aItem*/ ) |
|
607 { |
|
608 |
|
609 // Print to UI |
|
610 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
611 _LIT( KTestCGMinimumSize, "In TestCGMinimumSize" ); |
|
612 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGMinimumSize ); |
|
613 // Print to log file |
|
614 iLog->Log( KTestCGMinimumSize ); |
|
615 |
|
616 TSize size = iControlGroup->MinimumSize(); |
|
617 |
|
618 return KErrNone; |
|
619 |
|
620 } |
|
621 // ----------------------------------------------------------------------------- |
|
622 // CTestSDKMiscControls::TestCGCountComponentControls |
|
623 // ----------------------------------------------------------------------------- |
|
624 // |
|
625 TInt CTestSDKMiscControls::TestCGCountComponentControls( CStifItemParser& /*aItem*/ ) |
|
626 { |
|
627 |
|
628 // Print to UI |
|
629 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
630 _LIT( KTestCGCountComponentControls, "In TestCGCountComponentControls" ); |
|
631 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGCountComponentControls ); |
|
632 // Print to log file |
|
633 iLog->Log( KTestCGCountComponentControls ); |
|
634 |
|
635 TInt count = iControlGroup->CountComponentControls(); |
|
636 |
|
637 return KErrNone; |
|
638 |
|
639 } |
|
640 // ----------------------------------------------------------------------------- |
|
641 // CTestSDKMiscControls::TestCGGetColorUseListL |
|
642 // ----------------------------------------------------------------------------- |
|
643 // |
|
644 TInt CTestSDKMiscControls::TestCGGetColorUseListL( CStifItemParser& /*aItem*/ ) |
|
645 { |
|
646 |
|
647 // Print to UI |
|
648 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
649 _LIT( KTestCGGetColorUseListL, "In TestCGGetColorUseListL" ); |
|
650 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGGetColorUseListL ); |
|
651 // Print to log file |
|
652 iLog->Log( KTestCGGetColorUseListL ); |
|
653 CArrayFixFlat<TCoeColorUse>* colorUseList = new( ELeave ) |
|
654 CArrayFixFlat<TCoeColorUse>( 4 ); |
|
655 CleanupStack::PushL( colorUseList ); |
|
656 TBool err = KErrNone; |
|
657 TRAP( err, iControlGroup->GetColorUseListL( *colorUseList ) ); |
|
658 colorUseList->Reset(); |
|
659 CleanupStack::PopAndDestroy( colorUseList ); |
|
660 |
|
661 return err; |
|
662 |
|
663 } |
|
664 // ----------------------------------------------------------------------------- |
|
665 // CTestSDKMiscControls::TestCGHandleResourceChange |
|
666 // ----------------------------------------------------------------------------- |
|
667 // |
|
668 TInt CTestSDKMiscControls::TestCGHandleResourceChange( CStifItemParser& /*aItem*/ ) |
|
669 { |
|
670 |
|
671 // Print to UI |
|
672 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
673 _LIT( KTestCGHandleResourceChange, "In TestCGHandleResourceChange" ); |
|
674 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGHandleResourceChange ); |
|
675 // Print to log file |
|
676 iLog->Log( KTestCGHandleResourceChange ); |
|
677 TInt type = 0; |
|
678 iControlGroup->HandleResourceChange( type ); |
|
679 |
|
680 return KErrNone; |
|
681 |
|
682 } |
|
683 // ----------------------------------------------------------------------------- |
|
684 // CTestSDKMiscControls::TestCGHandlePointerEventL |
|
685 // ----------------------------------------------------------------------------- |
|
686 // |
|
687 TInt CTestSDKMiscControls::TestCGHandlePointerEventL( CStifItemParser& /*aItem*/ ) |
|
688 { |
|
689 |
|
690 // Print to UI |
|
691 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
692 _LIT( KTestCGHandlePointerEventL, "In TestCGHandlePointerEventL" ); |
|
693 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGHandlePointerEventL ); |
|
694 // Print to log file |
|
695 iLog->Log( KTestCGHandlePointerEventL ); |
|
696 TPointerEvent pointEvent; |
|
697 TBool err = KErrNone; |
|
698 pointEvent.iType = TPointerEvent::EButton1Down; |
|
699 TRAP( err, iControlGroup->HandlePointerEventL( pointEvent ) ); |
|
700 |
|
701 return err; |
|
702 |
|
703 } |
|
704 // ----------------------------------------------------------------------------- |
|
705 // CTestSDKMiscControls::TestCGComponentControlL |
|
706 // ----------------------------------------------------------------------------- |
|
707 // |
|
708 TInt CTestSDKMiscControls::TestCGComponentControlL( CStifItemParser& /*aItem*/ ) |
|
709 { |
|
710 |
|
711 // Print to UI |
|
712 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
713 _LIT( KTestCGComponentControlL, "In TestCGComponentControlL" ); |
|
714 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGComponentControlL ); |
|
715 // Print to log file |
|
716 iLog->Log( KTestCGComponentControlL ); |
|
717 CTestControlGroup* controlGroup = new (ELeave) CTestControlGroup(); |
|
718 CleanupStack::PushL( controlGroup ); |
|
719 controlGroup->ConstructL( CEikControlGroup::EFromTopLeft, |
|
720 CEikControlGroup::ELayHorizontally ); |
|
721 CCoeControl* coeControl = new( ELeave ) CCoeControl(); |
|
722 CleanupStack::PushL( coeControl ); |
|
723 TInt cId = 1; |
|
724 controlGroup->AddControlL( coeControl, cId ); |
|
725 TInt count = controlGroup->CountComponentControls(); |
|
726 CCoeControl* control = controlGroup->ComponentControl( count-1 ); |
|
727 STIF_ASSERT_NOT_NULL( control ); |
|
728 CleanupStack::Pop( coeControl ); |
|
729 CleanupStack::PopAndDestroy(); |
|
730 |
|
731 return KErrNone; |
|
732 |
|
733 } |
|
734 // ----------------------------------------------------------------------------- |
|
735 // CTestSDKMiscControls::TestCGWriteInternalStateL |
|
736 // ----------------------------------------------------------------------------- |
|
737 // |
|
738 TInt CTestSDKMiscControls::TestCGWriteInternalStateL( CStifItemParser& /*aItem*/ ) |
|
739 { |
|
740 |
|
741 // Print to UI |
|
742 _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); |
|
743 _LIT( KTestCGWriteInternalStateL, "In TestCGWriteInternalStateL" ); |
|
744 TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGWriteInternalStateL ); |
|
745 // Print to log file |
|
746 iLog->Log( KTestCGWriteInternalStateL ); |
|
747 CTestControlGroup* controlGroup = new (ELeave) CTestControlGroup(); |
|
748 CleanupStack::PushL( controlGroup ); |
|
749 controlGroup->ConstructL( CEikControlGroup::EFromTopLeft, |
|
750 CEikControlGroup::ELayHorizontally ); |
|
751 CBufFlat* buf = CBufFlat::NewL( 200 ); |
|
752 CleanupStack::PushL( buf ); |
|
753 RBufWriteStream stream; |
|
754 stream.Open( *buf ); |
|
755 TBool err = KErrNone; |
|
756 TRAP( err, controlGroup->WriteInternalStateL( stream ) ); |
|
757 stream.Close(); |
|
758 CleanupStack::PopAndDestroy( buf ); |
|
759 CleanupStack::PopAndDestroy(); |
|
760 return err; |
|
761 } |