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 AknCommonDialogs.h |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // [INCLUDE FILES] |
|
20 #include <caknmemoryselectiondialog.h> |
|
21 #include <cakncommondialogsbase.h> |
|
22 |
|
23 #include "testsdkcfd.h" |
|
24 #include "testsdkcfdmaknmemoryselectionobserver.h" |
|
25 |
|
26 |
|
27 const TInt KRootPathLength = 16; |
|
28 const TInt KDefaultFolderLength = 512; |
|
29 const TInt KItemDiscriptor = 512; |
|
30 |
|
31 // ============================ MEMBER FUNCTIONS =============================== |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CTestSDKCFD::TestMSDNewL |
|
35 // ----------------------------------------------------------------------------- |
|
36 TInt CTestSDKCFD::TestMSDNewL( CStifItemParser& /*aItem*/ ) |
|
37 { |
|
38 |
|
39 _LIT( KTitle, "Class <MemorySelectionDialog>" ); |
|
40 _LIT( KCall, "Test MemorySelectionDialog::TestMSDNewL" ); |
|
41 |
|
42 iLog->Log( KTitle ); |
|
43 iLog->Log( KCall ); |
|
44 |
|
45 CAknMemorySelectionDialog* memorySelectionDialog = |
|
46 CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, ETrue ); |
|
47 CleanupStack::PushL( memorySelectionDialog ); |
|
48 STIF_ASSERT_NOT_NULL( memorySelectionDialog ); |
|
49 |
|
50 CleanupStack::PopAndDestroy( memorySelectionDialog ); |
|
51 |
|
52 return KErrNone; |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CTestSDKCFD::TestMSDNewWithResourceL |
|
57 // ----------------------------------------------------------------------------- |
|
58 TInt CTestSDKCFD::TestMSDNewWithResourceL( CStifItemParser& /*aItem*/ ) |
|
59 { |
|
60 _LIT( KTitle, "Class <MemorySelectionDialog>" ); |
|
61 _LIT( KCall, "Test MemorySelectionDialog::TestMSDNewWithResourceL" ); |
|
62 |
|
63 iLog->Log( KTitle ); |
|
64 iLog->Log( KCall ); |
|
65 |
|
66 CAknMemorySelectionDialog* memorySelectionDialog = |
|
67 CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, 0, ETrue ); |
|
68 CleanupStack::PushL( memorySelectionDialog ); |
|
69 STIF_ASSERT_NOT_NULL( memorySelectionDialog ); |
|
70 |
|
71 CleanupStack::PopAndDestroy( memorySelectionDialog ); |
|
72 |
|
73 return KErrNone; |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CTestSDKCFD::TestMSDNewWithMediaL |
|
78 // ----------------------------------------------------------------------------- |
|
79 TInt CTestSDKCFD::TestMSDNewWithMediaL( CStifItemParser& /*aItem*/ ) |
|
80 { |
|
81 _LIT( KTitle, "Class <MemorySelectionDialog>" ); |
|
82 _LIT( KCall, "Test MemorySelectionDialog::TestMSDNewWithMediaL" ); |
|
83 |
|
84 iLog->Log( KTitle ); |
|
85 iLog->Log( KCall ); |
|
86 TInt media = 1; |
|
87 CAknMemorySelectionDialog* memorySelectionDialog = |
|
88 CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, 0, ETrue, |
|
89 media ); |
|
90 CleanupStack::PushL( memorySelectionDialog ); |
|
91 STIF_ASSERT_NOT_NULL( memorySelectionDialog ); |
|
92 |
|
93 CleanupStack::PopAndDestroy( memorySelectionDialog ); |
|
94 |
|
95 return KErrNone; |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // CTestSDKCFD::TestMSDSetTitleL |
|
100 // ----------------------------------------------------------------------------- |
|
101 TInt CTestSDKCFD::TestMSDSetTitleL( CStifItemParser& /*aItem*/ ) |
|
102 { |
|
103 _LIT( KTitle, "Class <MemorySelectionDialog>" ); |
|
104 _LIT( KCall, "Test MemorySelectionDialog::SetTitleL" ); |
|
105 |
|
106 iLog->Log( KTitle ); |
|
107 iLog->Log( KCall ); |
|
108 |
|
109 CAknMemorySelectionDialog* memorySelectionDialog = |
|
110 CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, ETrue ); |
|
111 CleanupStack::PushL( memorySelectionDialog ); |
|
112 STIF_ASSERT_NOT_NULL( memorySelectionDialog ); |
|
113 |
|
114 _LIT( KDialogTitle, "Hello Dialog!" ); |
|
115 TDesC dialogTitle(KDialogTitle); |
|
116 memorySelectionDialog->SetTitleL( dialogTitle ); |
|
117 |
|
118 CleanupStack::PopAndDestroy( memorySelectionDialog ); |
|
119 |
|
120 return KErrNone; |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // CTestSDKCFD::TestMSDSetLeftSoftkeyL |
|
125 // ----------------------------------------------------------------------------- |
|
126 TInt CTestSDKCFD::TestMSDSetLeftSoftkeyL( CStifItemParser& /*aItem*/ ) |
|
127 { |
|
128 |
|
129 _LIT( KTitle, "Class <MemorySelectionDialog>" ); |
|
130 _LIT( KCall1, "Test MemorySelectionDialog::SetLeftSoftkeyL" ); |
|
131 iLog->Log( KTitle ); |
|
132 iLog->Log( KCall1 ); |
|
133 |
|
134 CAknMemorySelectionDialog* memorySelectionDialog = |
|
135 CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, ETrue ); |
|
136 CleanupStack::PushL( memorySelectionDialog ); |
|
137 STIF_ASSERT_NOT_NULL( memorySelectionDialog ); |
|
138 |
|
139 _LIT( KLeftKey, "Enter" ); |
|
140 TDesC dialogLeftKey( KLeftKey ); |
|
141 |
|
142 memorySelectionDialog->SetLeftSoftkeyL( dialogLeftKey ); |
|
143 |
|
144 CleanupStack::PopAndDestroy( memorySelectionDialog ); |
|
145 |
|
146 return KErrNone; |
|
147 } |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CTestSDKCFD::TestMSDSetRightSoftkeyL |
|
151 // ----------------------------------------------------------------------------- |
|
152 TInt CTestSDKCFD::TestMSDSetRightSoftkeyL( CStifItemParser& /*aItem*/ ) |
|
153 { |
|
154 |
|
155 _LIT( KTitle, "Class <MemorySelectionDialog>" ); |
|
156 _LIT( KCall1, "Test MemorySelectionDialog::SetRightSoftkeyL" ); |
|
157 iLog->Log( KTitle ); |
|
158 iLog->Log( KCall1 ); |
|
159 |
|
160 CAknMemorySelectionDialog* memorySelectionDialog = |
|
161 CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, ETrue ); |
|
162 CleanupStack::PushL( memorySelectionDialog ); |
|
163 STIF_ASSERT_NOT_NULL( memorySelectionDialog ); |
|
164 |
|
165 _LIT( KRightKey, "Enter" ); |
|
166 TDesC dialogRightKey( KRightKey ); |
|
167 |
|
168 memorySelectionDialog->SetRightSoftkeyL( dialogRightKey ); |
|
169 |
|
170 CleanupStack::PopAndDestroy( memorySelectionDialog ); |
|
171 |
|
172 return KErrNone; |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // CTestSDKCFD::TestMSDSetObserverL |
|
177 // ----------------------------------------------------------------------------- |
|
178 TInt CTestSDKCFD::TestMSDSetObserverL( CStifItemParser& /*aItem*/ ) |
|
179 { |
|
180 |
|
181 _LIT( KTitle, "Class <MemorySelectionDialog>" ); |
|
182 _LIT( KCall1, "Test MemorySelectionDialog::SetObserver" ); |
|
183 |
|
184 iLog->Log( KTitle ); |
|
185 iLog->Log( KCall1 ); |
|
186 |
|
187 CAknMemorySelectionDialog* memorySelectionDialog = |
|
188 CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, ETrue ); |
|
189 CleanupStack::PushL( memorySelectionDialog ); |
|
190 STIF_ASSERT_NOT_NULL( memorySelectionDialog ); |
|
191 |
|
192 CTestSDKCFDMAknMemorySelectionOberver* msobserver= |
|
193 CTestSDKCFDMAknMemorySelectionOberver::NewL( ); |
|
194 CleanupStack::PushL( msobserver ); |
|
195 STIF_ASSERT_NOT_NULL( msobserver ); |
|
196 |
|
197 memorySelectionDialog->SetObserver( msobserver ); |
|
198 |
|
199 CleanupStack::PopAndDestroy( 2 ); |
|
200 |
|
201 return KErrNone; |
|
202 } |
|
203 |
|
204 // ----------------------------------------------------------------------------- |
|
205 // CTestSDKCFD::TestMSDExecuteL |
|
206 // ----------------------------------------------------------------------------- |
|
207 TInt CTestSDKCFD::TestMSDExecuteL( CStifItemParser& /*aItem*/ ) |
|
208 { |
|
209 |
|
210 _LIT( KTitle, "Class <MemorySelectionDialog>" ); |
|
211 _LIT( KCall1, "Test MemorySelectionDialog::ExecuteL" ); |
|
212 iLog->Log( KTitle ); |
|
213 iLog->Log( KCall1 ); |
|
214 |
|
215 CAknMemorySelectionDialog* memorySelectionDialog = |
|
216 CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, ETrue ); |
|
217 CleanupStack::PushL( memorySelectionDialog ); |
|
218 STIF_ASSERT_NOT_NULL( memorySelectionDialog ); |
|
219 |
|
220 _LIT( KCallExecuteL1True, "MemorySelectionDialog::ExecuteL Return ETrue" ); |
|
221 _LIT( KCallExecuteL1False, "MemorySelectionDialog::ExecuteL Return EFalse" ); |
|
222 |
|
223 CAknMemorySelectionDialog::TMemory memType = |
|
224 CAknMemorySelectionDialog::EPhoneMemory; |
|
225 CAknCommonDialogsBase::TReturnKey returnKey; |
|
226 |
|
227 returnKey = memorySelectionDialog->ExecuteL( memType ); |
|
228 |
|
229 CleanupStack::PopAndDestroy( memorySelectionDialog ); |
|
230 |
|
231 if ( returnKey ) |
|
232 { |
|
233 iLog->Log( KCallExecuteL1True ); |
|
234 } |
|
235 else |
|
236 { |
|
237 iLog->Log( KCallExecuteL1False ); |
|
238 } |
|
239 |
|
240 return KErrNone; |
|
241 } |
|
242 // ----------------------------------------------------------------------------- |
|
243 // CTestSDKCFD::TestMSDExecuteLDefaultFolderL |
|
244 // ----------------------------------------------------------------------------- |
|
245 TInt CTestSDKCFD::TestMSDExecuteLDefaultFolderL( CStifItemParser& /*aItem*/ ) |
|
246 { |
|
247 _LIT( KTitle, "Class <MemorySelectionDialog>" ); |
|
248 _LIT( KCall1, "Test MemorySelectionDialog::TestMSDExecuteLDefaultFolderL" ); |
|
249 |
|
250 iLog->Log( KTitle ); |
|
251 iLog->Log( KCall1 ); |
|
252 |
|
253 CAknMemorySelectionDialog* memorySelectionDialog = |
|
254 CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, ETrue ); |
|
255 CleanupStack::PushL( memorySelectionDialog ); |
|
256 STIF_ASSERT_NOT_NULL( memorySelectionDialog ); |
|
257 |
|
258 _LIT( KCallExecuteL1True, "MemorySelectionDialog::ExecuteL Return ETrue" ); |
|
259 _LIT( KCallExecuteL1False, "MemorySelectionDialog::ExecuteL Return EFalse" ); |
|
260 CAknMemorySelectionDialog::TMemory memType = |
|
261 CAknMemorySelectionDialog::EPhoneMemory; |
|
262 _LIT( KRootPath, "C:\\" ); |
|
263 _LIT( KDefaultFolder, " " ); |
|
264 TBuf<KRootPathLength> rootBuf( KRootPath ); |
|
265 TBuf<KDefaultFolderLength> defaultBuf( KDefaultFolder ); |
|
266 |
|
267 CAknCommonDialogsBase::TReturnKey returnKey; |
|
268 returnKey = memorySelectionDialog->ExecuteL( memType, &rootBuf, |
|
269 &defaultBuf ); |
|
270 |
|
271 if ( returnKey ) |
|
272 { |
|
273 iLog->Log( KCallExecuteL1True ); |
|
274 } |
|
275 else |
|
276 { |
|
277 iLog->Log( KCallExecuteL1False ); |
|
278 } |
|
279 |
|
280 CleanupStack::PopAndDestroy( memorySelectionDialog ); |
|
281 |
|
282 return KErrNone; |
|
283 } |
|
284 // ----------------------------------------------------------------------------- |
|
285 // CTestSDKCFD::TestMSDRunDlgLD |
|
286 // ----------------------------------------------------------------------------- |
|
287 TInt CTestSDKCFD::TestMSDRunDlgLD( CStifItemParser& /*aItem*/ ) |
|
288 { |
|
289 _LIT( KTitle, "Class <MemorySelectionDialog>" ); |
|
290 _LIT( KCall1, "Test MemorySelectionDialog::NewL1" ); |
|
291 iLog->Log( KTitle ); |
|
292 iLog->Log( KCall1 ); |
|
293 CAknMemorySelectionDialog* memorySelectionDialog = |
|
294 CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, ETrue ); |
|
295 CleanupStack::PushL( memorySelectionDialog ); |
|
296 STIF_ASSERT_NOT_NULL( memorySelectionDialog ); |
|
297 |
|
298 CTestSDKCFDMAknMemorySelectionOberver* msobserver= |
|
299 CTestSDKCFDMAknMemorySelectionOberver::NewL( ); |
|
300 CleanupStack::PushL( msobserver ); |
|
301 STIF_ASSERT_NOT_NULL( msobserver ); |
|
302 |
|
303 CAknMemorySelectionDialog::TMemory memType = |
|
304 CAknMemorySelectionDialog::EPhoneMemory; |
|
305 CAknMemorySelectionDialog::RunDlgLD( memType, msobserver ); |
|
306 |
|
307 CleanupStack::PopAndDestroy( 2 ); |
|
308 |
|
309 return KErrNone; |
|
310 } |
|
311 |
|
312 // ----------------------------------------------------------------------------- |
|
313 // CTestSDKCFD::TestNewMemorySelectionDialog |
|
314 // ----------------------------------------------------------------------------- |
|
315 TInt CTestSDKCFD::TestMSDRunDlgLDTitleL( CStifItemParser& /*aItem*/ ) |
|
316 { |
|
317 |
|
318 _LIT( KTitle, "Class <MemorySelectionDialog>" ); |
|
319 _LIT( KCall1, "Test MemorySelectionDialog::TestMSDRunDlgLDTitleL" ); |
|
320 |
|
321 iLog->Log( KTitle ); |
|
322 iLog->Log( KCall1 ); |
|
323 |
|
324 CAknMemorySelectionDialog* memorySelectionDialog = |
|
325 CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, ETrue ); |
|
326 CleanupStack::PushL( memorySelectionDialog ); |
|
327 STIF_ASSERT_NOT_NULL( memorySelectionDialog ); |
|
328 |
|
329 _LIT( KDialogTitle, "Hello Dialog!" ); |
|
330 TBuf<KMaxFileName> dialogTitle( KDialogTitle ); |
|
331 |
|
332 CTestSDKCFDMAknMemorySelectionOberver* msobserver = |
|
333 CTestSDKCFDMAknMemorySelectionOberver::NewL( ); |
|
334 CleanupStack::PushL( msobserver ); |
|
335 STIF_ASSERT_NOT_NULL( msobserver ); |
|
336 |
|
337 CAknMemorySelectionDialog::TMemory memType = |
|
338 CAknMemorySelectionDialog::EPhoneMemory; |
|
339 |
|
340 CAknMemorySelectionDialog::RunDlgLD( memType, dialogTitle, msobserver ); |
|
341 |
|
342 CleanupStack::PopAndDestroy( 2 ); |
|
343 |
|
344 return KErrNone; |
|
345 } |
|
346 |
|
347 // ----------------------------------------------------------------------------- |
|
348 // CTestSDKCFD::TestNewMemorySelectionDialog |
|
349 // ----------------------------------------------------------------------------- |
|
350 TInt CTestSDKCFD::TestMSDRunDlgLDResourceL( CStifItemParser& /*aItem*/ ) |
|
351 { |
|
352 _LIT( KTitle, "Class <MemorySelectionDialog>" ); |
|
353 _LIT( KCall1, "Test MemorySelectionDialog::TestMSDRunDlgLDResourceL" ); |
|
354 iLog->Log( KTitle ); |
|
355 iLog->Log( KCall1 ); |
|
356 |
|
357 CAknMemorySelectionDialog* memorySelectionDialog = |
|
358 CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, ETrue ); |
|
359 CleanupStack::PushL( memorySelectionDialog ); |
|
360 STIF_ASSERT_NOT_NULL( memorySelectionDialog ); |
|
361 |
|
362 CTestSDKCFDMAknMemorySelectionOberver* msobserver= |
|
363 CTestSDKCFDMAknMemorySelectionOberver::NewL( ); |
|
364 CleanupStack::PushL( msobserver ); |
|
365 STIF_ASSERT_NOT_NULL( msobserver ); |
|
366 |
|
367 CAknMemorySelectionDialog::TMemory memType = |
|
368 CAknMemorySelectionDialog::EPhoneMemory; |
|
369 |
|
370 _LIT( KRootPath, "C:\\" ); |
|
371 _LIT( KDefaultFolder, " " ); |
|
372 |
|
373 TBuf<KRootPathLength> rootBuf( KRootPath ); |
|
374 TBuf<KDefaultFolderLength> defaultBuf( KDefaultFolder ); |
|
375 CAknMemorySelectionDialog::RunDlgLD( memType, 0, &rootBuf, |
|
376 &defaultBuf, msobserver ); |
|
377 |
|
378 CleanupStack::PopAndDestroy( 2 ); |
|
379 |
|
380 return KErrNone; |
|
381 } |
|
382 |
|
383 // ============================ MEMBER FUNCTIONS =============================== |
|
384 |
|
385 // ----------------------------------------------------------------------------- |
|
386 // CTestSDKCFD::TestMSDGetItemL |
|
387 // ----------------------------------------------------------------------------- |
|
388 TInt CTestSDKCFD::TestMSDGetItemL( CStifItemParser& /*aItem*/ ) |
|
389 { |
|
390 _LIT( KTitle, "Class <MemorySelectionDialog>" ); |
|
391 _LIT( KCall1, "Test MemorySelectionDialog::TestMSDGetItemL" ); |
|
392 |
|
393 iLog->Log( KTitle ); |
|
394 iLog->Log( KCall1 ); |
|
395 |
|
396 CAknMemorySelectionDialog* memorySelectionDialog = |
|
397 CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, ETrue ); |
|
398 CleanupStack::PushL( memorySelectionDialog ); |
|
399 STIF_ASSERT_NOT_NULL( memorySelectionDialog ); |
|
400 |
|
401 TInt index = 0; |
|
402 TBuf<KItemDiscriptor> itemdes; |
|
403 memorySelectionDialog->GetItem( index, itemdes ); |
|
404 |
|
405 CleanupStack::PopAndDestroy( memorySelectionDialog ); |
|
406 |
|
407 return KErrNone; |
|
408 } |
|
409 // ============================ MEMBER FUNCTIONS =============================== |
|
410 |
|
411 // ----------------------------------------------------------------------------- |
|
412 // CTestSDKCFD::TestMSDGetMemoriesL |
|
413 // ----------------------------------------------------------------------------- |
|
414 TInt CTestSDKCFD::TestMSDGetMemoriesL( CStifItemParser& /*aItem*/ ) |
|
415 { |
|
416 |
|
417 _LIT( KTitle, "Class <MemorySelectionDialog>" ); |
|
418 _LIT( KCall1, "Test MemorySelectionDialog::TestMSDGetMemoriesL" ); |
|
419 |
|
420 iLog->Log( KTitle ); |
|
421 iLog->Log( KCall1 ); |
|
422 |
|
423 CAknMemorySelectionDialog* memorySelectionDialog = |
|
424 CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, ETrue ); |
|
425 CleanupStack::PushL( memorySelectionDialog ); |
|
426 STIF_ASSERT_NOT_NULL( memorySelectionDialog ); |
|
427 |
|
428 CAknMemorySelectionDialog::TMemory memType = |
|
429 CAknMemorySelectionDialog::EPhoneMemory; |
|
430 |
|
431 _LIT( KRootPath, "C:\\" ); |
|
432 _LIT( KDefaultFolder, "" ); |
|
433 TBuf<KRootPathLength> rootBuf(KRootPath); |
|
434 TBuf<KDefaultFolderLength> defaultBuf(KDefaultFolder); |
|
435 memorySelectionDialog->GetMemories( memType, &rootBuf, &defaultBuf ); |
|
436 |
|
437 CleanupStack::PopAndDestroy( memorySelectionDialog ); |
|
438 |
|
439 return KErrNone; |
|
440 } |
|
441 |
|
442 // [End of File] |
|