|
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: Test aknquerycontrol.h |
|
15 * |
|
16 */ |
|
17 |
|
18 //INCLUDE |
|
19 #include <aknquerycontrol.h> |
|
20 #include <aknquerydialog.h> |
|
21 #include <testsdkqueries.rsg> |
|
22 #include <barsread.h> |
|
23 #include <eikimage.h> |
|
24 #include <avkon.mbg> |
|
25 #include <bautils.h> |
|
26 #include <in_sock.h> |
|
27 |
|
28 #include "testsdkqueries.h" |
|
29 #include "testsdkaknquerydialogprotected.h" |
|
30 #include "testsdkqueriescontainer.h" |
|
31 #include "testsdkaknquerycontrolprotected.h" |
|
32 |
|
33 const TUint32 KMaxAddrValue = 0xffffffff; |
|
34 const TInt KZero = 0; |
|
35 const TInt KOne = 1; |
|
36 const TInt KFive = 5; |
|
37 const TReal KRealvalue = 2.12345; |
|
38 const TReal KCompareValue = 0.0; |
|
39 const TReal KMinRealTime = 1000.5456; |
|
40 const TReal KMaxRealTime = 3000.2321; |
|
41 const TInt KTwo = 2; |
|
42 const TInt KTen = 10; |
|
43 const TInt KBufSize = 32; |
|
44 const TInt KHundred = 100; |
|
45 const TInt KIntervalue = 3000; |
|
46 |
|
47 _LIT( KTestString, "It is a test!" ); |
|
48 _LIT( KTestTime, "20000111:200600.000000" ); |
|
49 _LIT( KTestMinTime, "10000000:000000.000000" ); |
|
50 _LIT( KTestMaxTime, "30000000:000000.000000" ); |
|
51 _LIT( KTestMbmFile,"\\resource\\apps\\avkon2.mbm" ); |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CTestSDKQueries::TestQcConstructorL |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 TInt CTestSDKQueries::TestQcConstructorL( CStifItemParser& /*aItem*/ ) |
|
58 { |
|
59 CAknQueryControl* dlg = new( ELeave ) CAknQueryControl; |
|
60 CleanupStack::PushL( dlg ); |
|
61 STIF_ASSERT_NOT_NULL( dlg ); |
|
62 CleanupStack::PopAndDestroy( dlg ); |
|
63 return KErrNone; |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CTestSDKQueries::TestQcDestructorL |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 TInt CTestSDKQueries::TestQcDestructorL( CStifItemParser& /*aItem*/ ) |
|
71 { |
|
72 CAknQueryControl* dlg = new( ELeave ) CAknQueryControl; |
|
73 CleanupStack::PushL( dlg ); |
|
74 CleanupStack::PopAndDestroy( dlg ); |
|
75 return KErrNone; |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CTestSDKQueries::TestQcConstructFromResourceL |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 TInt CTestSDKQueries::TestQcConstructFromResourceL( CStifItemParser& /*aItem*/ ) |
|
83 { |
|
84 CAknQueryControl* dlg = new( ELeave ) CAknQueryControl; |
|
85 CleanupStack::PushL( dlg ); |
|
86 |
|
87 TResourceReader reader; |
|
88 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_CONFIRMATION_QUERY ); |
|
89 dlg->ConstructFromResourceL( reader ); |
|
90 |
|
91 CleanupStack::PopAndDestroy( KTwo ); |
|
92 return KErrNone; |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CTestSDKQueries::TestQcSetQueryControlObserverL |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 TInt CTestSDKQueries::TestQcSetQueryControlObserverL( CStifItemParser& /*aItem*/ ) |
|
100 { |
|
101 CAknQueryControl* dlgControl = new( ELeave ) CAknQueryControl; |
|
102 CleanupStack::PushL( dlgControl ); |
|
103 |
|
104 CAknQueryDialog* dlg = CAknQueryDialog::NewL( CAknQueryDialog::ENoTone ); |
|
105 dlg->PrepareLC( R_QUERY_DIALOG ); |
|
106 |
|
107 dlgControl->SetQueryControlObserver( dlg ); |
|
108 |
|
109 CleanupStack::PopAndDestroy( dlg ); |
|
110 CleanupStack::PopAndDestroy( dlgControl ); |
|
111 return KErrNone; |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CTestSDKQueries::TestQcReadPromptL |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 TInt CTestSDKQueries::TestQcReadPromptL( CStifItemParser& aItem ) |
|
119 { |
|
120 TInt err = TestQcConstructFromResourceL( aItem ); |
|
121 return err; |
|
122 } |
|
123 |
|
124 // ----------------------------------------------------------------------------- |
|
125 // CTestSDKQueries::TestQcSetPromptL |
|
126 // ----------------------------------------------------------------------------- |
|
127 // |
|
128 TInt CTestSDKQueries::TestQcSetPromptL( CStifItemParser& /*aItem*/ ) |
|
129 { |
|
130 CAknQueryControl* dlg = new( ELeave ) CAknQueryControl; |
|
131 CleanupStack::PushL( dlg ); |
|
132 |
|
133 TResourceReader reader; |
|
134 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_CONFIRMATION_QUERY ); |
|
135 dlg->ConstructFromResourceL( reader ); |
|
136 |
|
137 TBuf< KBufSize > message( KTestString ); |
|
138 dlg->SetPromptL( message ); |
|
139 |
|
140 CleanupStack::PopAndDestroy( KTwo ); |
|
141 return KErrNone; |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // CTestSDKQueries::TestQcGetTextL |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 TInt CTestSDKQueries::TestQcGetTextL( CStifItemParser& aItem ) |
|
149 { |
|
150 TInt err = TestQcSetTextL( aItem ); |
|
151 return err; |
|
152 } |
|
153 |
|
154 // ----------------------------------------------------------------------------- |
|
155 // CTestSDKQueries::TestQcGetTimeL |
|
156 // ----------------------------------------------------------------------------- |
|
157 // |
|
158 TInt CTestSDKQueries::TestQcGetTimeL( CStifItemParser& /*aItem*/ ) |
|
159 { |
|
160 TTime time( KTestTime ); |
|
161 CAknTimeQueryDialog* timeDlg = CAknTimeQueryDialog::NewL( time, CAknQueryDialog::ENoTone); |
|
162 timeDlg->PrepareLC( R_AKNEXQUERY_TIME_QUERY ); |
|
163 |
|
164 CTestCAknTimeQueryDialog* testTimeDlg = static_cast<CTestCAknTimeQueryDialog*>( timeDlg ); |
|
165 CAknQueryControl* dlgControl = testTimeDlg->QueryControl(); |
|
166 |
|
167 TTime compareTime( KZero ); |
|
168 TTime returnTime = dlgControl->GetTime(); |
|
169 STIF_ASSERT_NOT_EQUALS( compareTime, returnTime ); |
|
170 |
|
171 dlgControl->SetTime( time ); |
|
172 returnTime = dlgControl->GetTime(); |
|
173 STIF_ASSERT_NOT_EQUALS( compareTime, returnTime ); |
|
174 |
|
175 CleanupStack::PopAndDestroy( timeDlg ); |
|
176 |
|
177 TBuf< KBufSize > message( KTestString ); |
|
178 TTime topDateTime; |
|
179 topDateTime.Set( message ); |
|
180 topDateTime.HomeTime(); |
|
181 TTimeIntervalSeconds bottomDuration = KHundred; |
|
182 |
|
183 CAknMultiLineDataQueryDialog* dateDlg = CAknMultiLineDataQueryDialog::NewL(topDateTime,bottomDuration); |
|
184 dateDlg->PrepareLC( R_AKNEXQUERY_MULTI_LINE_DATE_AND_DURATION_LAYOUT ); |
|
185 |
|
186 CTestCAknMultiLineDataQueryDialog* testDateDlg = static_cast<CTestCAknMultiLineDataQueryDialog*>( dateDlg ); |
|
187 dlgControl = testDateDlg->QueryControl(); |
|
188 returnTime = dlgControl->GetTime(); |
|
189 STIF_ASSERT_NOT_EQUALS( compareTime, returnTime ); |
|
190 |
|
191 dlgControl->SetTime( time ); |
|
192 returnTime = dlgControl->GetTime(); |
|
193 STIF_ASSERT_NOT_EQUALS( compareTime, returnTime ); |
|
194 |
|
195 CleanupStack::PopAndDestroy( dateDlg ); |
|
196 return KErrNone; |
|
197 } |
|
198 |
|
199 // ----------------------------------------------------------------------------- |
|
200 // CTestSDKQueries::TestQcGetNumberL |
|
201 // ----------------------------------------------------------------------------- |
|
202 // |
|
203 TInt CTestSDKQueries::TestQcGetNumberL( CStifItemParser& /*aItem*/ ) |
|
204 { |
|
205 TInt number = KTwo; |
|
206 CAknNumberQueryDialog* numberDlg = new (ELeave) CAknNumberQueryDialog ( number ); |
|
207 numberDlg->PrepareLC( R_AKNEXQUERY_NUMBER_LAYOUT ); |
|
208 |
|
209 CTestCAknNumberQueryDialog* testNumberDlg = static_cast<CTestCAknNumberQueryDialog*>( numberDlg ); |
|
210 CAknQueryControl* dlgControl = testNumberDlg->QueryControl(); |
|
211 |
|
212 TBuf< KBufSize > message( KTestString ); |
|
213 TInt returnNumber = dlgControl->GetNumber(); |
|
214 STIF_ASSERT_NOT_EQUALS( KZero, returnNumber ); |
|
215 |
|
216 dlgControl->SetNumberL( KHundred ); |
|
217 returnNumber = dlgControl->GetNumber(); |
|
218 STIF_ASSERT_EQUALS( KHundred, returnNumber ); |
|
219 |
|
220 CleanupStack::PopAndDestroy( numberDlg ); |
|
221 return KErrNone; |
|
222 } |
|
223 |
|
224 // ----------------------------------------------------------------------------- |
|
225 // CTestSDKQueries::TestQcGetFloatingPointNumberL |
|
226 // ----------------------------------------------------------------------------- |
|
227 // |
|
228 TInt CTestSDKQueries::TestQcGetFloatingPointNumberL( CStifItemParser& /*aItem*/ ) |
|
229 { |
|
230 TReal value = KRealvalue; |
|
231 CAknFloatingPointQueryDialog* floatDlg = new (ELeave) CAknFloatingPointQueryDialog ( value ); |
|
232 floatDlg->PrepareLC( R_DEMO_FLOATING_QUERY ); |
|
233 |
|
234 CTestCAknFloatingPointQueryDialog* testfloatDlg = static_cast<CTestCAknFloatingPointQueryDialog*>( floatDlg ); |
|
235 CAknQueryControl* dlgControl = testfloatDlg->QueryControl(); |
|
236 |
|
237 TReal returnValue = dlgControl->GetFloatingPointNumberL(); |
|
238 TReal compareValue = KCompareValue; |
|
239 STIF_ASSERT_EQUALS( compareValue, returnValue ); |
|
240 |
|
241 dlgControl->SetFloatingPointNumberL( &value ); |
|
242 returnValue = dlgControl->GetFloatingPointNumberL(); |
|
243 STIF_ASSERT_EQUALS( value, returnValue ); |
|
244 |
|
245 CleanupStack::PopAndDestroy( floatDlg ); |
|
246 return KErrNone; |
|
247 } |
|
248 |
|
249 // ----------------------------------------------------------------------------- |
|
250 // CTestSDKQueries::TestQcGetDurationL |
|
251 // ----------------------------------------------------------------------------- |
|
252 // |
|
253 TInt CTestSDKQueries::TestQcGetDurationL( CStifItemParser& /*aItem*/ ) |
|
254 { |
|
255 TTimeIntervalSeconds duration; |
|
256 |
|
257 CAknDurationQueryDialog* durationDlg = CAknDurationQueryDialog::NewL( duration, CAknQueryDialog::ENoTone ); |
|
258 durationDlg->PrepareLC( R_AKNEXQUERY_DURATION_LAYOUT ); |
|
259 |
|
260 CTestCAknDurationQueryDialog* testDurationDlg = static_cast<CTestCAknDurationQueryDialog*>( durationDlg ); |
|
261 CAknQueryControl* dlgControl = testDurationDlg->QueryControl(); |
|
262 |
|
263 TTimeIntervalSeconds returnDuration = dlgControl->GetDuration(); |
|
264 TTimeIntervalSeconds compareDuration = KZero; |
|
265 STIF_ASSERT_EQUALS( compareDuration, returnDuration ); |
|
266 |
|
267 TTimeIntervalSeconds bottomDuration = KHundred; |
|
268 dlgControl->SetDuration( bottomDuration ); |
|
269 returnDuration = dlgControl->GetDuration(); |
|
270 STIF_ASSERT_EQUALS( bottomDuration, returnDuration ); |
|
271 |
|
272 CleanupStack::PopAndDestroy( durationDlg ); |
|
273 return KErrNone; |
|
274 } |
|
275 |
|
276 |
|
277 // ----------------------------------------------------------------------------- |
|
278 // CTestSDKQueries::TestQcGetLocationL |
|
279 // ----------------------------------------------------------------------------- |
|
280 // |
|
281 TInt CTestSDKQueries::TestQcGetLocationL( CStifItemParser& /*aItem*/ ) |
|
282 { |
|
283 CAknQueryControl* dlg = new( ELeave ) CAknQueryControl; |
|
284 CleanupStack::PushL( dlg ); |
|
285 |
|
286 TResourceReader reader; |
|
287 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_CONFIRMATION_QUERY ); |
|
288 dlg->ConstructFromResourceL( reader ); |
|
289 |
|
290 TTime time( KTestTime ); |
|
291 TCoordinate coord( 01.00, 01.0 ); |
|
292 TLocality loc( coord, 0.1 ); |
|
293 TPosition position( loc, time ); |
|
294 TPosition returnPosition; |
|
295 |
|
296 dlg->SetLocation( position ); |
|
297 dlg->GetLocation( returnPosition ); |
|
298 |
|
299 CleanupStack::PopAndDestroy( KTwo ); |
|
300 return KErrNone; |
|
301 } |
|
302 |
|
303 |
|
304 // ----------------------------------------------------------------------------- |
|
305 // CTestSDKQueries::TestQcSetTextL |
|
306 // ----------------------------------------------------------------------------- |
|
307 // |
|
308 TInt CTestSDKQueries::TestQcSetTextL( CStifItemParser& /*aItem*/ ) |
|
309 { |
|
310 TInt number = KTwo; |
|
311 CAknNumberQueryDialog* numberDlg = new (ELeave) CAknNumberQueryDialog ( number ); |
|
312 numberDlg->PrepareLC( R_AKNEXQUERY_NUMBER_LAYOUT ); |
|
313 |
|
314 CTestCAknNumberQueryDialog* testNumberDlg = static_cast<CTestCAknNumberQueryDialog*>( numberDlg ); |
|
315 CTestCAknQueryControl* dlgControl = |
|
316 static_cast<CTestCAknQueryControl*>( testNumberDlg->QueryControl() ); |
|
317 |
|
318 TBuf< KBufSize > message( KTestString ); |
|
319 TBuf< KBufSize > getMessage; |
|
320 |
|
321 dlgControl->iNumberEdwin->SetMaxLength( KHundred ); |
|
322 |
|
323 dlgControl->SetTextL( message ); |
|
324 dlgControl->GetText( getMessage ); |
|
325 STIF_ASSERT_EQUALS( message, getMessage ); |
|
326 |
|
327 CleanupStack::PopAndDestroy( numberDlg ); |
|
328 |
|
329 TBuf< KBufSize > text; |
|
330 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
331 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
332 |
|
333 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
334 dlgControl = static_cast<CTestCAknQueryControl*>( testTextDlg->QueryControl() ); |
|
335 |
|
336 dlgControl->iEdwin->SetMaxLength( KHundred ); |
|
337 |
|
338 dlgControl->SetTextL( message ); |
|
339 dlgControl->GetText( getMessage ); |
|
340 STIF_ASSERT_EQUALS( message, getMessage ); |
|
341 |
|
342 CleanupStack::PopAndDestroy( textDlg ); |
|
343 |
|
344 TReal value = KRealvalue; |
|
345 CAknFloatingPointQueryDialog* floatDlg = new (ELeave) CAknFloatingPointQueryDialog ( value ); |
|
346 floatDlg->PrepareLC( R_DEMO_FLOATING_QUERY ); |
|
347 |
|
348 CTestCAknFloatingPointQueryDialog* testfloatDlg = static_cast<CTestCAknFloatingPointQueryDialog*>( floatDlg ); |
|
349 dlgControl = static_cast<CTestCAknQueryControl*>( testfloatDlg->QueryControl() ); |
|
350 |
|
351 dlgControl->iFloatingPointEditor->SetMaxLength( KHundred ); |
|
352 |
|
353 dlgControl->SetTextL( message ); |
|
354 dlgControl->GetText( getMessage ); |
|
355 STIF_ASSERT_EQUALS( message, getMessage ); |
|
356 |
|
357 CleanupStack::PopAndDestroy( floatDlg ); |
|
358 return KErrNone; |
|
359 } |
|
360 |
|
361 // ----------------------------------------------------------------------------- |
|
362 // CTestSDKQueries::TestQcSetTimeL |
|
363 // ----------------------------------------------------------------------------- |
|
364 // |
|
365 TInt CTestSDKQueries::TestQcSetTimeL( CStifItemParser& aItem ) |
|
366 { |
|
367 TInt err = TestQcGetTimeL( aItem ); |
|
368 return err; |
|
369 } |
|
370 |
|
371 // ----------------------------------------------------------------------------- |
|
372 // CTestSDKQueries::TestQcSetDurationL |
|
373 // ----------------------------------------------------------------------------- |
|
374 // |
|
375 TInt CTestSDKQueries::TestQcSetDurationL( CStifItemParser& aItem ) |
|
376 { |
|
377 TInt err = TestQcGetDurationL( aItem ); |
|
378 return err; |
|
379 } |
|
380 |
|
381 // ----------------------------------------------------------------------------- |
|
382 // CTestSDKQueries::TestQcSetNumberL |
|
383 // ----------------------------------------------------------------------------- |
|
384 // |
|
385 TInt CTestSDKQueries::TestQcSetNumberL( CStifItemParser& aItem ) |
|
386 { |
|
387 TInt err = TestQcGetNumberL( aItem ); |
|
388 return err; |
|
389 } |
|
390 |
|
391 // ----------------------------------------------------------------------------- |
|
392 // CTestSDKQueries::TestQcSetFloatingPointNumberL |
|
393 // ----------------------------------------------------------------------------- |
|
394 // |
|
395 TInt CTestSDKQueries::TestQcSetFloatingPointNumberL( CStifItemParser& aItem ) |
|
396 { |
|
397 TInt err = TestQcGetFloatingPointNumberL( aItem ); |
|
398 return err; |
|
399 } |
|
400 |
|
401 //some problem |
|
402 // ----------------------------------------------------------------------------- |
|
403 // CTestSDKQueries::TestQcSetLocationL |
|
404 // ----------------------------------------------------------------------------- |
|
405 // |
|
406 TInt CTestSDKQueries::TestQcSetLocationL( CStifItemParser& aItem ) |
|
407 { |
|
408 TInt err = TestQcGetLocationL( aItem ); |
|
409 return err; |
|
410 } |
|
411 |
|
412 // ----------------------------------------------------------------------------- |
|
413 // CTestSDKQueries::TestQcSetTextEntryLengthL |
|
414 // ----------------------------------------------------------------------------- |
|
415 // |
|
416 TInt CTestSDKQueries::TestQcSetTextEntryLengthL( CStifItemParser& /*aItem*/ ) |
|
417 { |
|
418 TInt number = KTwo; |
|
419 CAknNumberQueryDialog* numberDlg = new (ELeave) CAknNumberQueryDialog ( number ); |
|
420 numberDlg->PrepareLC( R_AKNEXQUERY_NUMBER_LAYOUT ); |
|
421 |
|
422 CTestCAknNumberQueryDialog* testNumberDlg = static_cast<CTestCAknNumberQueryDialog*>( numberDlg ); |
|
423 CAknQueryControl* dlgControl = testNumberDlg->QueryControl(); |
|
424 |
|
425 dlgControl->SetTextEntryLength( KHundred ); |
|
426 TInt length = dlgControl->GetTextEntryLength(); |
|
427 STIF_ASSERT_EQUALS( KHundred, length ); |
|
428 |
|
429 CleanupStack::PopAndDestroy( numberDlg ); |
|
430 |
|
431 TBuf< KBufSize > text; |
|
432 TBuf< KBufSize > message( KTestString ); |
|
433 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
434 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
435 |
|
436 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
437 dlgControl = testTextDlg->QueryControl(); |
|
438 |
|
439 length = KZero; |
|
440 dlgControl->SetTextEntryLength( KHundred ); |
|
441 length = dlgControl->GetTextEntryLength(); |
|
442 STIF_ASSERT_EQUALS( KHundred, length ); |
|
443 |
|
444 CleanupStack::PopAndDestroy( textDlg ); |
|
445 |
|
446 TReal value = KRealvalue; |
|
447 CAknFloatingPointQueryDialog* floatDlg = new (ELeave) CAknFloatingPointQueryDialog ( value ); |
|
448 floatDlg->PrepareLC( R_DEMO_FLOATING_QUERY ); |
|
449 |
|
450 CTestCAknFloatingPointQueryDialog* testfloatDlg = static_cast<CTestCAknFloatingPointQueryDialog*>( floatDlg ); |
|
451 dlgControl = testfloatDlg->QueryControl(); |
|
452 |
|
453 length = KZero; |
|
454 dlgControl->SetTextEntryLength( KHundred ); |
|
455 length = dlgControl->GetTextEntryLength(); |
|
456 STIF_ASSERT_EQUALS( KHundred, length ); |
|
457 |
|
458 CleanupStack::PopAndDestroy( floatDlg ); |
|
459 return KErrNone; |
|
460 } |
|
461 |
|
462 // ----------------------------------------------------------------------------- |
|
463 // CTestSDKQueries::TestQcGetTextEntryLengthL |
|
464 // ----------------------------------------------------------------------------- |
|
465 // |
|
466 TInt CTestSDKQueries::TestQcGetTextEntryLengthL( CStifItemParser& aItem ) |
|
467 { |
|
468 TInt err = TestQcSetTextEntryLengthL( aItem ); |
|
469 return err; |
|
470 } |
|
471 |
|
472 // ----------------------------------------------------------------------------- |
|
473 // CTestSDKQueries::TestQcSetMinimumAndMaximumOneL |
|
474 // ----------------------------------------------------------------------------- |
|
475 // |
|
476 TInt CTestSDKQueries::TestQcSetMinimumAndMaximumOneL( CStifItemParser& /*aItem*/ ) |
|
477 { |
|
478 TTime minTime( KTestMinTime ); |
|
479 TTime maxTime( KTestMaxTime ); |
|
480 |
|
481 CAknTimeQueryDialog* timeDlg = CAknTimeQueryDialog::NewL( minTime, CAknQueryDialog::ENoTone ); |
|
482 timeDlg->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_TIME ); |
|
483 |
|
484 CTestCAknTimeQueryDialog* testTimeDlg = static_cast<CTestCAknTimeQueryDialog*>( timeDlg ); |
|
485 CAknQueryControl* dlgControl = testTimeDlg->QueryControl(); |
|
486 |
|
487 dlgControl->SetMinimumAndMaximum( minTime, maxTime ); |
|
488 |
|
489 CleanupStack::PopAndDestroy( timeDlg ); |
|
490 |
|
491 TBuf< KBufSize > message( KTestString ); |
|
492 TTime topDateTime; |
|
493 topDateTime.Set( message ); |
|
494 topDateTime.HomeTime(); |
|
495 TTimeIntervalSeconds bottomDuration = KHundred; |
|
496 |
|
497 CAknMultiLineDataQueryDialog* dateDlg = CAknMultiLineDataQueryDialog::NewL(topDateTime,bottomDuration); |
|
498 dateDlg->PrepareLC( R_AKNEXQUERY_MULTI_LINE_DATE_AND_DURATION_LAYOUT ); |
|
499 |
|
500 CTestCAknMultiLineDataQueryDialog* testDateDlg = static_cast<CTestCAknMultiLineDataQueryDialog*>( dateDlg ); |
|
501 dlgControl = testDateDlg->QueryControl(); |
|
502 |
|
503 dlgControl->SetMinimumAndMaximum( minTime, maxTime ); |
|
504 |
|
505 CleanupStack::PopAndDestroy( dateDlg ); |
|
506 return KErrNone; |
|
507 } |
|
508 |
|
509 // ----------------------------------------------------------------------------- |
|
510 // CTestSDKQueries::TestQcSetMinimumAndMaximumTwoL |
|
511 // ----------------------------------------------------------------------------- |
|
512 // |
|
513 TInt CTestSDKQueries::TestQcSetMinimumAndMaximumTwoL( CStifItemParser& /*aItem*/ ) |
|
514 { |
|
515 TTimeIntervalSeconds time( KIntervalue ); |
|
516 |
|
517 CAknDurationQueryDialog* durationDlg = CAknDurationQueryDialog::NewL( time, CAknQueryDialog::ENoTone ); |
|
518 durationDlg->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_DURATION ); |
|
519 |
|
520 CTestCAknDurationQueryDialog* testDurationDlg = static_cast<CTestCAknDurationQueryDialog*>( durationDlg ); |
|
521 CAknQueryControl* dlgControl = testDurationDlg->QueryControl(); |
|
522 |
|
523 TTimeIntervalSeconds maxTime = KTwo*KIntervalue; |
|
524 dlgControl->SetMinimumAndMaximum( time, maxTime ); |
|
525 |
|
526 CleanupStack::PopAndDestroy( durationDlg ); |
|
527 return KErrNone; |
|
528 } |
|
529 |
|
530 // ----------------------------------------------------------------------------- |
|
531 // CTestSDKQueries::TestQcSetMinimumAndMaximumThreeL |
|
532 // ----------------------------------------------------------------------------- |
|
533 // |
|
534 TInt CTestSDKQueries::TestQcSetMinimumAndMaximumThreeL( CStifItemParser& /*aItem*/ ) |
|
535 { |
|
536 TInt number = KTen; |
|
537 CAknNumberQueryDialog* numDlg = CAknNumberQueryDialog::NewL( number, CAknQueryDialog::ENoTone ); |
|
538 numDlg->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ); |
|
539 |
|
540 CTestCAknNumberQueryDialog* testnumDlg = static_cast<CTestCAknNumberQueryDialog*>( numDlg ); |
|
541 CAknQueryControl* dlgControl = testnumDlg->QueryControl(); |
|
542 |
|
543 dlgControl->SetMinimumAndMaximum( KZero, KIntervalue ); |
|
544 |
|
545 CleanupStack::PopAndDestroy( numDlg ); |
|
546 return KErrNone; |
|
547 } |
|
548 |
|
549 // ----------------------------------------------------------------------------- |
|
550 // CTestSDKQueries::TestQcCheckNumberL |
|
551 // ----------------------------------------------------------------------------- |
|
552 // |
|
553 TInt CTestSDKQueries::TestQcCheckNumberL( CStifItemParser& /*aItem*/ ) |
|
554 { |
|
555 TInt number = KTen; |
|
556 CAknNumberQueryDialog* numDlg = CAknNumberQueryDialog::NewL( number, CAknQueryDialog::ENoTone ); |
|
557 numDlg->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ); |
|
558 |
|
559 CTestCAknNumberQueryDialog* testnumDlg = static_cast<CTestCAknNumberQueryDialog*>( numDlg ); |
|
560 CAknQueryControl* dlgControl = testnumDlg->QueryControl(); |
|
561 |
|
562 TBool mIfLegal = dlgControl->CheckNumber(); |
|
563 STIF_ASSERT_TRUE( mIfLegal ); |
|
564 |
|
565 CleanupStack::PopAndDestroy( numDlg ); |
|
566 return KErrNone; |
|
567 } |
|
568 |
|
569 // ----------------------------------------------------------------------------- |
|
570 // CTestSDKQueries::TestQcSetNumberOfEditorLinesL |
|
571 // ----------------------------------------------------------------------------- |
|
572 // |
|
573 TInt CTestSDKQueries::TestQcSetNumberOfEditorLinesL( CStifItemParser& /*aItem*/ ) |
|
574 { |
|
575 CAknQueryControl* dlg = new( ELeave ) CAknQueryControl; |
|
576 CleanupStack::PushL( dlg ); |
|
577 dlg->SetNumberOfEditorLines( KTen ); |
|
578 CleanupStack::PopAndDestroy( dlg ); |
|
579 return KErrNone; |
|
580 } |
|
581 |
|
582 // ----------------------------------------------------------------------------- |
|
583 // CTestSDKQueries::TestQcSetMinimumAndMaximumL |
|
584 // ----------------------------------------------------------------------------- |
|
585 // |
|
586 TInt CTestSDKQueries::TestQcSetMinimumAndMaximumL( CStifItemParser& /*aItem*/ ) |
|
587 { |
|
588 TReal minRealTime = KMinRealTime; |
|
589 |
|
590 CAknFloatingPointQueryDialog* floatDlg = |
|
591 CAknFloatingPointQueryDialog::NewL( minRealTime, CAknQueryDialog::ENoTone ); |
|
592 floatDlg->PrepareLC( R_DEMO_FLOATING_QUERY ); |
|
593 |
|
594 CTestCAknFloatingPointQueryDialog* testFloatDlg = |
|
595 static_cast<CTestCAknFloatingPointQueryDialog*>( floatDlg ); |
|
596 CAknQueryControl* dlgControl = testFloatDlg->QueryControl(); |
|
597 |
|
598 dlgControl->SetMinimumAndMaximum( KMinRealTime, KMaxRealTime ); |
|
599 |
|
600 CleanupStack::PopAndDestroy( floatDlg ); |
|
601 return KErrNone; |
|
602 } |
|
603 |
|
604 // ----------------------------------------------------------------------------- |
|
605 // CTestSDKQueries::TestQcGetTextLengthL |
|
606 // ----------------------------------------------------------------------------- |
|
607 // |
|
608 TInt CTestSDKQueries::TestQcGetTextLengthL( CStifItemParser& /*aItem*/ ) |
|
609 { |
|
610 TInt number = KTwo; |
|
611 CAknNumberQueryDialog* numberDlg = new (ELeave) CAknNumberQueryDialog ( number ); |
|
612 numberDlg->PrepareLC( R_AKNEXQUERY_NUMBER_LAYOUT ); |
|
613 |
|
614 CTestCAknNumberQueryDialog* testNumberDlg = static_cast<CTestCAknNumberQueryDialog*>( numberDlg ); |
|
615 CAknQueryControl* dlgControl = testNumberDlg->QueryControl(); |
|
616 |
|
617 TBuf< KBufSize > compareMessage( KTestString ); |
|
618 TBuf< KBufSize > message( KTestString ); |
|
619 |
|
620 TInt length = dlgControl->GetTextLength(); |
|
621 STIF_ASSERT_EQUALS( KZero, length ); |
|
622 |
|
623 CleanupStack::PopAndDestroy( numberDlg ); |
|
624 |
|
625 TBuf< KBufSize > text; |
|
626 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
627 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
628 |
|
629 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
630 dlgControl = testTextDlg->QueryControl(); |
|
631 |
|
632 length = dlgControl->GetTextLength(); |
|
633 STIF_ASSERT_EQUALS( KZero, length ); |
|
634 |
|
635 CleanupStack::PopAndDestroy( textDlg ); |
|
636 |
|
637 TReal value = KRealvalue; |
|
638 CAknFloatingPointQueryDialog* floatDlg = new (ELeave) CAknFloatingPointQueryDialog ( value ); |
|
639 floatDlg->PrepareLC( R_DEMO_FLOATING_QUERY ); |
|
640 |
|
641 CTestCAknFloatingPointQueryDialog* testfloatDlg = static_cast<CTestCAknFloatingPointQueryDialog*>( floatDlg ); |
|
642 dlgControl = testfloatDlg->QueryControl(); |
|
643 |
|
644 length = dlgControl->GetTextLength(); |
|
645 STIF_ASSERT_NOT_EQUALS( KZero, length ); |
|
646 |
|
647 CleanupStack::PopAndDestroy( floatDlg ); |
|
648 return KErrNone; |
|
649 } |
|
650 |
|
651 // ----------------------------------------------------------------------------- |
|
652 // CTestSDKQueries::TestQcNbrOfEditorLinesL |
|
653 // ----------------------------------------------------------------------------- |
|
654 // |
|
655 TInt CTestSDKQueries::TestQcNbrOfEditorLinesL( CStifItemParser& /*aItem*/ ) |
|
656 { |
|
657 TBuf< KBufSize > text; |
|
658 TBuf< KBufSize > message( KTestString ); |
|
659 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
660 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
661 |
|
662 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
663 CAknQueryControl* dlgControl = testTextDlg->QueryControl(); |
|
664 |
|
665 TInt numberOfLine = dlgControl->NbrOfEditorLines(); |
|
666 STIF_ASSERT_EQUALS( KOne, numberOfLine ); |
|
667 |
|
668 CleanupStack::PopAndDestroy( textDlg ); |
|
669 return KErrNone; |
|
670 } |
|
671 |
|
672 // ----------------------------------------------------------------------------- |
|
673 // CTestSDKQueries::TestQcNbrOfPromptLinesL |
|
674 // ----------------------------------------------------------------------------- |
|
675 // |
|
676 TInt CTestSDKQueries::TestQcNbrOfPromptLinesL( CStifItemParser& /*aItem*/ ) |
|
677 { |
|
678 TBuf< KBufSize > text; |
|
679 TBuf< KBufSize > message( KTestString ); |
|
680 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
681 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
682 |
|
683 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
684 CAknQueryControl* dlgControl = testTextDlg->QueryControl(); |
|
685 |
|
686 TInt numberOfLine = dlgControl->NbrOfPromptLines(); |
|
687 STIF_ASSERT_EQUALS( KOne, numberOfLine ); |
|
688 |
|
689 CleanupStack::PopAndDestroy( textDlg ); |
|
690 |
|
691 CAknQueryControl* dlg = new( ELeave ) CAknQueryControl; |
|
692 CleanupStack::PushL( dlg ); |
|
693 |
|
694 numberOfLine = dlg->NbrOfPromptLines(); |
|
695 STIF_ASSERT_EQUALS( KOne, numberOfLine ); |
|
696 |
|
697 CleanupStack::PopAndDestroy( dlg ); |
|
698 return KErrNone; |
|
699 } |
|
700 |
|
701 // ----------------------------------------------------------------------------- |
|
702 // CTestSDKQueries::TestQcControlByLayoutOrNullL |
|
703 // ----------------------------------------------------------------------------- |
|
704 // |
|
705 TInt CTestSDKQueries::TestQcControlByLayoutOrNullL( CStifItemParser& /*aItem*/ ) |
|
706 { |
|
707 TBuf< KBufSize > text; |
|
708 TBuf< KBufSize > message( KTestString ); |
|
709 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
710 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
711 |
|
712 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
713 CAknQueryControl* dlgControl = testTextDlg->QueryControl(); |
|
714 |
|
715 CCoeControl* control = dlgControl->ControlByLayoutOrNull( EStaticSizeDataLayout ); |
|
716 STIF_ASSERT_NOT_NULL( control ); |
|
717 |
|
718 control = dlgControl->ControlByLayoutOrNull( ECodeLayout ); |
|
719 STIF_ASSERT_NULL( control ); |
|
720 |
|
721 control = dlgControl->ControlByLayoutOrNull( EDateLayout ); |
|
722 STIF_ASSERT_NULL( control ); |
|
723 |
|
724 control = dlgControl->ControlByLayoutOrNull( ETimeLayout ); |
|
725 STIF_ASSERT_NULL( control ); |
|
726 |
|
727 control = dlgControl->ControlByLayoutOrNull( EDurationLayout ); |
|
728 STIF_ASSERT_NULL( control ); |
|
729 |
|
730 control = dlgControl->ControlByLayoutOrNull( ENumberLayout ); |
|
731 STIF_ASSERT_NULL( control ); |
|
732 |
|
733 control = dlgControl->ControlByLayoutOrNull( EPinLayout ); |
|
734 STIF_ASSERT_NULL( control ); |
|
735 |
|
736 control = dlgControl->ControlByLayoutOrNull( EFloatingPointLayout ); |
|
737 STIF_ASSERT_NULL( control ); |
|
738 |
|
739 control = dlgControl->ControlByLayoutOrNull( ELocationLayout ); |
|
740 STIF_ASSERT_NULL( control ); |
|
741 |
|
742 CleanupStack::PopAndDestroy( textDlg ); |
|
743 return KErrNone; |
|
744 } |
|
745 |
|
746 // ----------------------------------------------------------------------------- |
|
747 // CTestSDKQueries::TestQcSetImageL |
|
748 // ----------------------------------------------------------------------------- |
|
749 // |
|
750 TInt CTestSDKQueries::TestQcSetImageL( CStifItemParser& /*aItem*/ ) |
|
751 { |
|
752 TBuf< KBufSize > text; |
|
753 TBuf< KBufSize > message( KTestString ); |
|
754 |
|
755 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
756 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
757 |
|
758 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
759 CAknQueryControl* dlgControl = testTextDlg->QueryControl(); |
|
760 |
|
761 CEikImage* mImage = new( ELeave ) CEikImage; |
|
762 CleanupStack::PushL( mImage ); |
|
763 |
|
764 dlgControl->SetImageL( mImage ); |
|
765 |
|
766 CleanupStack::Pop( mImage ); |
|
767 CleanupStack::PopAndDestroy( textDlg ); |
|
768 return KErrNone; |
|
769 } |
|
770 |
|
771 // ----------------------------------------------------------------------------- |
|
772 // CTestSDKQueries::TestQcSetImageFullL |
|
773 // ----------------------------------------------------------------------------- |
|
774 // |
|
775 TInt CTestSDKQueries::TestQcSetImageFullL( CStifItemParser& /*aItem*/ ) |
|
776 { |
|
777 TBuf< KBufSize > text; |
|
778 TBuf< KBufSize > message( KTestString ); |
|
779 |
|
780 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
781 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
782 |
|
783 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
784 CAknQueryControl* dlgControl = testTextDlg->QueryControl(); |
|
785 |
|
786 TFileName file( KTestMbmFile ); |
|
787 User::LeaveIfError( CompleteWithAppPath( file ) ); |
|
788 |
|
789 dlgControl->SetImageL( file, EMbmAvkonQgn_indi_mic, EMbmAvkonQgn_indi_mic_mask ); |
|
790 |
|
791 CleanupStack::PopAndDestroy( textDlg ); |
|
792 return KErrNone; |
|
793 } |
|
794 |
|
795 //There is a problem here |
|
796 // ----------------------------------------------------------------------------- |
|
797 // CTestSDKQueries::TestQcSetAnimationL |
|
798 // ----------------------------------------------------------------------------- |
|
799 // |
|
800 TInt CTestSDKQueries::TestQcSetAnimationL( CStifItemParser& /*aItem*/ ) |
|
801 { |
|
802 TBuf< KBufSize > text; |
|
803 TBuf< KBufSize > message( KTestString ); |
|
804 |
|
805 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
806 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
807 |
|
808 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
809 CAknQueryControl* dlgControl = testTextDlg->QueryControl(); |
|
810 |
|
811 dlgControl->SetAnimationL( R_TESTQUERY_BMP_ANIMATION ); |
|
812 |
|
813 CleanupStack::PopAndDestroy( textDlg ); |
|
814 return KErrNone; |
|
815 } |
|
816 |
|
817 //There is a problem here |
|
818 // ----------------------------------------------------------------------------- |
|
819 // CTestSDKQueries::TestQcStartAnimationL |
|
820 // ----------------------------------------------------------------------------- |
|
821 // |
|
822 TInt CTestSDKQueries::TestQcStartAnimationL( CStifItemParser& /*aItem*/ ) |
|
823 { |
|
824 TBuf< KBufSize > text; |
|
825 TBuf< KBufSize > message( KTestString ); |
|
826 |
|
827 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
828 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
829 |
|
830 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
831 CAknQueryControl* dlgControl = testTextDlg->QueryControl(); |
|
832 |
|
833 dlgControl->SetAnimationL( R_TESTQUERY_BMP_ANIMATION ); |
|
834 dlgControl->StartAnimationL(); |
|
835 |
|
836 CleanupStack::PopAndDestroy( textDlg ); |
|
837 return KErrNone; |
|
838 } |
|
839 |
|
840 // ----------------------------------------------------------------------------- |
|
841 // CTestSDKQueries::TestQcCancelAnimationL |
|
842 // ----------------------------------------------------------------------------- |
|
843 // |
|
844 TInt CTestSDKQueries::TestQcCancelAnimationL( CStifItemParser& /*aItem*/ ) |
|
845 { |
|
846 TBuf< KBufSize > text; |
|
847 TBuf< KBufSize > message( KTestString ); |
|
848 |
|
849 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
850 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
851 |
|
852 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
853 CAknQueryControl* dlgControl = testTextDlg->QueryControl(); |
|
854 |
|
855 TInt captureErr = dlgControl->CancelAnimation(); |
|
856 STIF_ASSERT_EQUALS( KErrGeneral, captureErr ); |
|
857 |
|
858 dlgControl->SetAnimationL( R_TESTQUERY_BMP_ANIMATION ); |
|
859 captureErr = dlgControl->CancelAnimation(); |
|
860 STIF_ASSERT_NOT_EQUALS( KErrGeneral, captureErr ); |
|
861 |
|
862 CleanupStack::PopAndDestroy( textDlg ); |
|
863 return KErrNone; |
|
864 } |
|
865 |
|
866 // ----------------------------------------------------------------------------- |
|
867 // CTestSDKQueries::TestQcOfferKeyEventL |
|
868 // ----------------------------------------------------------------------------- |
|
869 // |
|
870 TInt CTestSDKQueries::TestQcOfferKeyEventL( CStifItemParser& /*aItem*/ ) |
|
871 { |
|
872 TBuf< KBufSize > text; |
|
873 TBuf< KBufSize > message( KTestString ); |
|
874 |
|
875 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
876 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
877 |
|
878 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
879 CAknQueryControl* dlgControl = testTextDlg->QueryControl(); |
|
880 |
|
881 TKeyEvent event; |
|
882 event.iCode = EKeyYes; |
|
883 TKeyResponse response = dlgControl->OfferKeyEventL( event, EEventKey ); |
|
884 STIF_ASSERT_EQUALS( EKeyWasConsumed, response ); |
|
885 |
|
886 CleanupStack::PopAndDestroy( textDlg ); |
|
887 return KErrNone; |
|
888 } |
|
889 |
|
890 // ----------------------------------------------------------------------------- |
|
891 // CTestSDKQueries::TestQcMinimumSizeL |
|
892 // ----------------------------------------------------------------------------- |
|
893 // |
|
894 TInt CTestSDKQueries::TestQcMinimumSizeL( CStifItemParser& /*aItem*/ ) |
|
895 { |
|
896 TBuf< KBufSize > text; |
|
897 TBuf< KBufSize > message( KTestString ); |
|
898 |
|
899 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
900 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
901 |
|
902 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
903 CAknQueryControl* dlgControl = testTextDlg->QueryControl(); |
|
904 |
|
905 TSize size = dlgControl->MinimumSize(); |
|
906 TSize returnSize( KZero, KZero ); |
|
907 STIF_ASSERT_NOT_EQUALS( returnSize, size ); |
|
908 |
|
909 CleanupStack::PopAndDestroy( textDlg ); |
|
910 return KErrNone; |
|
911 } |
|
912 |
|
913 // ----------------------------------------------------------------------------- |
|
914 // CTestSDKQueries::TestQcHandleEdwinEventL |
|
915 // ----------------------------------------------------------------------------- |
|
916 // |
|
917 TInt CTestSDKQueries::TestQcHandleEdwinEventL( CStifItemParser& /*aItem*/ ) |
|
918 { |
|
919 TBuf< KBufSize > text; |
|
920 TBuf< KBufSize > message( KTestString ); |
|
921 |
|
922 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
923 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
924 |
|
925 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
926 CAknQueryControl* dlgControl = testTextDlg->QueryControl(); |
|
927 |
|
928 CEikEdwin* edwin = new( ELeave ) CEikEdwin; |
|
929 CleanupStack::PushL( edwin ); |
|
930 |
|
931 dlgControl->HandleEdwinEventL( edwin, MEikEdwinObserver::EEventFormatChanged ); |
|
932 |
|
933 CleanupStack::PopAndDestroy( KTwo ); |
|
934 return KErrNone; |
|
935 } |
|
936 |
|
937 // ----------------------------------------------------------------------------- |
|
938 // CTestSDKQueries::TestQcHandleEdwinSizeEventL |
|
939 // ----------------------------------------------------------------------------- |
|
940 // |
|
941 TInt CTestSDKQueries::TestQcHandleEdwinSizeEventL( CStifItemParser& /*aItem*/ ) |
|
942 { |
|
943 TBuf< KBufSize > text; |
|
944 TBuf< KBufSize > message( KTestString ); |
|
945 |
|
946 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
947 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
948 |
|
949 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
950 CAknQueryControl* dlgControl = testTextDlg->QueryControl(); |
|
951 |
|
952 CEikEdwin* edwin = new( ELeave ) CEikEdwin; |
|
953 CleanupStack::PushL( edwin ); |
|
954 TSize size( KZero, KZero ); |
|
955 |
|
956 TBool flag = dlgControl->HandleEdwinSizeEventL( edwin, |
|
957 MEikEdwinSizeObserver::EEventSizeChanging, size ); |
|
958 STIF_ASSERT_FALSE( flag ); |
|
959 |
|
960 CleanupStack::PopAndDestroy( KTwo ); |
|
961 return KErrNone; |
|
962 } |
|
963 |
|
964 // ----------------------------------------------------------------------------- |
|
965 // CTestSDKQueries::TestQcHandleControlEventL |
|
966 // ----------------------------------------------------------------------------- |
|
967 // |
|
968 TInt CTestSDKQueries::TestQcHandleControlEventL( CStifItemParser& /*aItem*/ ) |
|
969 { |
|
970 TBuf< KBufSize > text; |
|
971 TBuf< KBufSize > message( KTestString ); |
|
972 |
|
973 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
974 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
975 |
|
976 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
977 CAknQueryControl* dlgControl = testTextDlg->QueryControl(); |
|
978 |
|
979 CCoeControl* control = NULL; |
|
980 dlgControl->HandleControlEventL( control, MCoeControlObserver::EEventStateChanged ); |
|
981 |
|
982 CleanupStack::PopAndDestroy( textDlg ); |
|
983 return KErrNone; |
|
984 } |
|
985 |
|
986 // ----------------------------------------------------------------------------- |
|
987 // CTestSDKQueries::TestQcQueryTypeL |
|
988 // ----------------------------------------------------------------------------- |
|
989 // |
|
990 TInt CTestSDKQueries::TestQcQueryTypeL( CStifItemParser& /*aItem*/ ) |
|
991 { |
|
992 CAknQueryControl* dlg = new( ELeave ) CAknQueryControl; |
|
993 CleanupStack::PushL( dlg ); |
|
994 |
|
995 TResourceReader reader; |
|
996 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_CONFIRMATION_QUERY ); |
|
997 dlg->ConstructFromResourceL( reader ); |
|
998 |
|
999 TInt queryType = dlg->QueryType(); |
|
1000 TInt compareType = EConfirmationQueryLayout; |
|
1001 STIF_ASSERT_EQUALS( compareType, queryType ); |
|
1002 |
|
1003 CleanupStack::PopAndDestroy( KTwo ); |
|
1004 return KErrNone; |
|
1005 } |
|
1006 |
|
1007 // ----------------------------------------------------------------------------- |
|
1008 // CTestSDKQueries::TestQcHandlePointerEventL |
|
1009 // ----------------------------------------------------------------------------- |
|
1010 // |
|
1011 TInt CTestSDKQueries::TestQcHandlePointerEventL( CStifItemParser& /*aItem*/ ) |
|
1012 { |
|
1013 TBuf< KBufSize > text; |
|
1014 TBuf< KBufSize > message( KTestString ); |
|
1015 |
|
1016 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
1017 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
1018 |
|
1019 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
1020 CAknQueryControl* dlgControl = testTextDlg->QueryControl(); |
|
1021 |
|
1022 TPointerEvent event; |
|
1023 event.iType = TPointerEvent::EButton1Down; |
|
1024 event.iModifiers = KZero; |
|
1025 TPoint eventPos( 10, 30 ); |
|
1026 event.iPosition = eventPos; |
|
1027 event.iParentPosition = eventPos; |
|
1028 TInt err = KErrNone; |
|
1029 TRAP( err, dlgControl->HandlePointerEventL( event ) ); |
|
1030 |
|
1031 CleanupStack::PopAndDestroy( textDlg ); |
|
1032 return KErrNone; |
|
1033 } |
|
1034 |
|
1035 //There is a problem with animation id |
|
1036 // ----------------------------------------------------------------------------- |
|
1037 // CTestSDKQueries::TestQcHandleResourceChangeL |
|
1038 // ----------------------------------------------------------------------------- |
|
1039 // |
|
1040 TInt CTestSDKQueries::TestQcHandleResourceChangeL( CStifItemParser& /*aItem*/ ) |
|
1041 { |
|
1042 TBuf< KBufSize > text; |
|
1043 TBuf< KBufSize > message( KTestString ); |
|
1044 |
|
1045 CAknTextQueryDialog* textDlg = new( ELeave ) CAknTextQueryDialog( text, message ); |
|
1046 textDlg->PrepareLC( R_DEMO_DATA_QUERY ); |
|
1047 |
|
1048 CTestCAknTextQueryDialog* testTextDlg = static_cast<CTestCAknTextQueryDialog*>( textDlg ); |
|
1049 CAknQueryControl* dlgControl = testTextDlg->QueryControl(); |
|
1050 |
|
1051 dlgControl->SetAnimationL( R_TESTQUERY_BMP_ANIMATION ); |
|
1052 |
|
1053 dlgControl->HandleResourceChange( KAknsMessageSkinChange ); |
|
1054 dlgControl->HandleResourceChange( KEikDynamicLayoutVariantSwitch ); |
|
1055 |
|
1056 CleanupStack::PopAndDestroy( textDlg ); |
|
1057 return KErrNone; |
|
1058 } |
|
1059 |
|
1060 // ----------------------------------------------------------------------------- |
|
1061 // CTestSDKQueries::TestExtQcConstructorL |
|
1062 // ----------------------------------------------------------------------------- |
|
1063 // |
|
1064 TInt CTestSDKQueries::TestExtQcConstructorL( CStifItemParser& /*aItem*/ ) |
|
1065 { |
|
1066 CAknExtQueryControl* extControl = new( ELeave ) CAknExtQueryControl(); |
|
1067 CleanupStack::PushL( extControl ); |
|
1068 STIF_ASSERT_NOT_NULL( extControl ); |
|
1069 CleanupStack::PopAndDestroy( extControl ); |
|
1070 return KErrNone; |
|
1071 } |
|
1072 |
|
1073 // ----------------------------------------------------------------------------- |
|
1074 // CTestSDKQueries::TestExtQcDestructorL |
|
1075 // ----------------------------------------------------------------------------- |
|
1076 // |
|
1077 TInt CTestSDKQueries::TestExtQcDestructorL( CStifItemParser& /*aItem*/ ) |
|
1078 { |
|
1079 CAknExtQueryControl* extControl = new( ELeave ) CAknExtQueryControl(); |
|
1080 CleanupStack::PushL( extControl ); |
|
1081 CleanupStack::PopAndDestroy( extControl ); |
|
1082 return KErrNone; |
|
1083 } |
|
1084 |
|
1085 // ----------------------------------------------------------------------------- |
|
1086 // CTestSDKQueries::TestExtQcGetInetAddressL |
|
1087 // ----------------------------------------------------------------------------- |
|
1088 // |
|
1089 TInt CTestSDKQueries::TestExtQcGetInetAddressL( CStifItemParser& /*aItem*/ ) |
|
1090 { |
|
1091 TInetAddr mAddr; |
|
1092 TInetAddr minAddr( KZero, KZero ); |
|
1093 |
|
1094 CAknIpAddressQueryDialog* dlg = CAknIpAddressQueryDialog::NewL( mAddr, CAknIpAddressQueryDialog::ENoTone ); |
|
1095 dlg->PrepareLC( R_TESTQUERY_IP_ADDRESS ); |
|
1096 |
|
1097 CTestCAknIpAddressQueryDialog* testDlg = static_cast<CTestCAknIpAddressQueryDialog*>( dlg ); |
|
1098 CAknExtQueryControl* dlgControl = static_cast<CAknExtQueryControl*>( testDlg->QueryControl() ); |
|
1099 |
|
1100 dlgControl->SetInetAddress( minAddr ); |
|
1101 TInetAddr returnAddr = dlgControl->GetInetAddress(); |
|
1102 STIF_ASSERT_EQUALS( minAddr, returnAddr ); |
|
1103 |
|
1104 CleanupStack::PopAndDestroy( dlg ); |
|
1105 |
|
1106 CAknExtQueryControl* extCtrl = new( ELeave ) CAknExtQueryControl(); |
|
1107 CleanupStack::PushL( extCtrl ); |
|
1108 |
|
1109 extCtrl->SetInetAddress( minAddr ); |
|
1110 returnAddr = extCtrl->GetInetAddress(); |
|
1111 STIF_ASSERT_NOT_EQUALS( minAddr, returnAddr ); |
|
1112 |
|
1113 CleanupStack::PopAndDestroy( extCtrl ); |
|
1114 return KErrNone; |
|
1115 } |
|
1116 |
|
1117 // ----------------------------------------------------------------------------- |
|
1118 // CTestSDKQueries::TestExtQcSetInetAddressL |
|
1119 // ----------------------------------------------------------------------------- |
|
1120 // |
|
1121 TInt CTestSDKQueries::TestExtQcSetInetAddressL( CStifItemParser& aItem ) |
|
1122 { |
|
1123 TInt err = TestExtQcGetInetAddressL( aItem ); |
|
1124 return err; |
|
1125 } |
|
1126 |
|
1127 // ----------------------------------------------------------------------------- |
|
1128 // CTestSDKQueries::TestExtQcGetFixedPointNumberL |
|
1129 // ----------------------------------------------------------------------------- |
|
1130 // |
|
1131 TInt CTestSDKQueries::TestExtQcGetFixedPointNumberL( CStifItemParser& /*aItem*/ ) |
|
1132 { |
|
1133 TInt mInitial = KFive; |
|
1134 CAknFixedPointQueryDialog* dlg = CAknFixedPointQueryDialog::NewL( mInitial, CAknFixedPointQueryDialog::ENoTone ); |
|
1135 dlg->PrepareLC( R_TESTQUERY_FIXED_POINT ); |
|
1136 |
|
1137 CTestCAknFixedPointQueryDialog* testDlg = static_cast<CTestCAknFixedPointQueryDialog*>( dlg ); |
|
1138 CAknExtQueryControl* dlgControl = static_cast<CAknExtQueryControl*>( testDlg->QueryControl() ); |
|
1139 |
|
1140 dlgControl->SetFixedPointNumberL( &mInitial ); |
|
1141 TInt number = dlgControl->GetFixedPointNumber(); |
|
1142 STIF_ASSERT_EQUALS( KFive, number ); |
|
1143 |
|
1144 CleanupStack::PopAndDestroy( dlg ); |
|
1145 |
|
1146 CAknExtQueryControl* extCtrl = new( ELeave ) CAknExtQueryControl(); |
|
1147 CleanupStack::PushL( extCtrl ); |
|
1148 |
|
1149 extCtrl->SetFixedPointNumberL( &mInitial ); |
|
1150 number = extCtrl->GetFixedPointNumber(); |
|
1151 STIF_ASSERT_NOT_EQUALS( KFive, number ); |
|
1152 |
|
1153 CleanupStack::PopAndDestroy( extCtrl ); |
|
1154 return KErrNone; |
|
1155 } |
|
1156 |
|
1157 // ----------------------------------------------------------------------------- |
|
1158 // CTestSDKQueries::TestExtQcSetFixedPointNumberL |
|
1159 // ----------------------------------------------------------------------------- |
|
1160 // |
|
1161 TInt CTestSDKQueries::TestExtQcSetFixedPointNumberL( CStifItemParser& aItem ) |
|
1162 { |
|
1163 TInt err = TestExtQcGetFixedPointNumberL( aItem ); |
|
1164 return err; |
|
1165 } |
|
1166 |
|
1167 // ----------------------------------------------------------------------------- |
|
1168 // CTestSDKQueries::TestExtQcSetMinimumAndMaximumL |
|
1169 // ----------------------------------------------------------------------------- |
|
1170 // |
|
1171 TInt CTestSDKQueries::TestExtQcSetMinimumAndMaximumL( CStifItemParser& /*aItem*/ ) |
|
1172 { |
|
1173 TInetAddr mAddr; |
|
1174 TInetAddr minAddr( KZero, KZero ); |
|
1175 TInetAddr maxAddr( KMaxAddrValue ); |
|
1176 |
|
1177 CAknIpAddressQueryDialog* dlg = CAknIpAddressQueryDialog::NewL( mAddr, CAknIpAddressQueryDialog::ENoTone ); |
|
1178 dlg->PrepareLC( R_TESTQUERY_IP_ADDRESS ); |
|
1179 |
|
1180 CTestCAknIpAddressQueryDialog* testDlg = static_cast<CTestCAknIpAddressQueryDialog*>( dlg ); |
|
1181 CAknExtQueryControl* dlgControl = static_cast<CAknExtQueryControl*>( testDlg->QueryControl() ); |
|
1182 |
|
1183 dlgControl->SetMinimumAndMaximum( minAddr, maxAddr ); |
|
1184 |
|
1185 CleanupStack::PopAndDestroy( dlg ); |
|
1186 return KErrNone; |
|
1187 } |
|
1188 |
|
1189 // ----------------------------------------------------------------------------- |
|
1190 // CTestSDKQueries::TestExtQcSetMinimumAndMaximumLL |
|
1191 // ----------------------------------------------------------------------------- |
|
1192 // |
|
1193 TInt CTestSDKQueries::TestExtQcSetMinimumAndMaximumLL( CStifItemParser& /*aItem*/ ) |
|
1194 { |
|
1195 TInt mInitial = KFive; |
|
1196 CAknFixedPointQueryDialog* dlg = CAknFixedPointQueryDialog::NewL( mInitial, CAknFixedPointQueryDialog::ENoTone ); |
|
1197 dlg->PrepareLC( R_TESTQUERY_FIXED_POINT ); |
|
1198 |
|
1199 CTestCAknFixedPointQueryDialog* testDlg = static_cast<CTestCAknFixedPointQueryDialog*>( dlg ); |
|
1200 CAknExtQueryControl* dlgControl = static_cast<CAknExtQueryControl*>( testDlg->QueryControl() ); |
|
1201 |
|
1202 dlgControl->SetMinimumAndMaximum( KZero, KIntervalue ); |
|
1203 |
|
1204 CleanupStack::PopAndDestroy( dlg ); |
|
1205 return KErrNone; |
|
1206 } |
|
1207 |
|
1208 // ----------------------------------------------------------------------------- |
|
1209 // CTestSDKQueries::TestExtQcControlByLayoutOrNullL |
|
1210 // ----------------------------------------------------------------------------- |
|
1211 // |
|
1212 TInt CTestSDKQueries::TestExtQcControlByLayoutOrNullL( CStifItemParser& /*aItem*/ ) |
|
1213 { |
|
1214 TInt mInitial = KFive; |
|
1215 CAknFixedPointQueryDialog* dlg = CAknFixedPointQueryDialog::NewL( mInitial, CAknFixedPointQueryDialog::ENoTone ); |
|
1216 dlg->PrepareLC( R_TESTQUERY_FIXED_POINT ); |
|
1217 |
|
1218 CTestCAknFixedPointQueryDialog* testDlg = static_cast<CTestCAknFixedPointQueryDialog*>( dlg ); |
|
1219 CAknExtQueryControl* dlgControl = static_cast<CAknExtQueryControl*>( testDlg->QueryControl() ); |
|
1220 |
|
1221 CCoeControl* control = dlgControl->ControlByLayoutOrNull( EIpLayout ); |
|
1222 STIF_ASSERT_NULL( control ); |
|
1223 |
|
1224 control = dlgControl->ControlByLayoutOrNull( EFixedPointLayout ); |
|
1225 STIF_ASSERT_NOT_NULL( control ); |
|
1226 |
|
1227 CleanupStack::PopAndDestroy( dlg ); |
|
1228 return KErrNone; |
|
1229 } |
|
1230 |
|
1231 // ----------------------------------------------------------------------------- |
|
1232 // CTestSDKQueries::TestExtQcHandleControlEventL |
|
1233 // ----------------------------------------------------------------------------- |
|
1234 // |
|
1235 TInt CTestSDKQueries::TestExtQcHandleControlEventL( CStifItemParser& /*aItem*/ ) |
|
1236 { |
|
1237 TInt mInitial = KFive; |
|
1238 CAknFixedPointQueryDialog* dlg = CAknFixedPointQueryDialog::NewL( mInitial, CAknFixedPointQueryDialog::ENoTone ); |
|
1239 dlg->PrepareLC( R_TESTQUERY_FIXED_POINT ); |
|
1240 |
|
1241 CTestCAknFixedPointQueryDialog* testDlg = static_cast<CTestCAknFixedPointQueryDialog*>( dlg ); |
|
1242 CAknExtQueryControl* dlgControl = static_cast<CAknExtQueryControl*>( testDlg->QueryControl() ); |
|
1243 |
|
1244 CCoeControl* control = NULL; |
|
1245 dlgControl->HandleControlEventL( control, MCoeControlObserver::EEventStateChanged ); |
|
1246 |
|
1247 CleanupStack::PopAndDestroy( dlg ); |
|
1248 return KErrNone; |
|
1249 } |
|
1250 |
|
1251 // ----------------------------------------------------------------------------- |
|
1252 // CTestSDKQueries::TestExtQcHandlePointerEventL |
|
1253 // ----------------------------------------------------------------------------- |
|
1254 // |
|
1255 TInt CTestSDKQueries::TestExtQcHandlePointerEventL( CStifItemParser& /*aItem*/ ) |
|
1256 { |
|
1257 TInt mInitial = KFive; |
|
1258 CAknFixedPointQueryDialog* dlg = CAknFixedPointQueryDialog::NewL( mInitial, CAknFixedPointQueryDialog::ENoTone ); |
|
1259 dlg->PrepareLC( R_TESTQUERY_FIXED_POINT ); |
|
1260 |
|
1261 CTestCAknFixedPointQueryDialog* testDlg = static_cast<CTestCAknFixedPointQueryDialog*>( dlg ); |
|
1262 CAknExtQueryControl* dlgControl = static_cast<CAknExtQueryControl*>( testDlg->QueryControl() ); |
|
1263 |
|
1264 TPointerEvent event; |
|
1265 event.iType = TPointerEvent::EButton1Down; |
|
1266 event.iModifiers = KZero; |
|
1267 TPoint eventPos( 10, 30 ); |
|
1268 event.iPosition = eventPos; |
|
1269 event.iParentPosition = eventPos; |
|
1270 TInt err = KErrNone; |
|
1271 TRAP( err, dlgControl->HandlePointerEventL( event ) ); |
|
1272 |
|
1273 CleanupStack::PopAndDestroy( dlg ); |
|
1274 return KErrNone; |
|
1275 } |
|
1276 |
|
1277 //End file |
|
1278 |
|
1279 |
|
1280 |