1 /* |
|
2 * Copyright (c) 2006-2009 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 case |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 #include <w32std.h> |
|
27 #include <coecntrl.h> |
|
28 #include <AknLists.h> |
|
29 #include <aknsettingitemlist.h> |
|
30 #include <bctestcmdlg.rsg> |
|
31 |
|
32 #include "BCTestMemSelItem.h" |
|
33 #include "BCTestCmDlg.hrh" |
|
34 #include "streamlogger.h" |
|
35 #include "CVRSettingsDialogMMCSupported.h" |
|
36 |
|
37 // ======== MEMBER FUNCTIONS ======== |
|
38 |
|
39 const TInt KItemPosition = 5;// Menu position of the test item |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // Symbian 2nd static Constructor |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 CBCTestMemSelSettingItem* CBCTestMemSelSettingItem::NewL() |
|
46 { |
|
47 CBCTestMemSelSettingItem* self = new( ELeave ) CBCTestMemSelSettingItem(); |
|
48 CleanupStack::PushL( self ); |
|
49 self->ConstructL(); |
|
50 CleanupStack::Pop( self ); |
|
51 return self; |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // C++ default constructor |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 CBCTestMemSelSettingItem::CBCTestMemSelSettingItem():iItem(NULL) |
|
59 { |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // Destructor |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 CBCTestMemSelSettingItem::~CBCTestMemSelSettingItem() |
|
67 { |
|
68 Teardown(); |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // Symbian 2nd Constructor |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 void CBCTestMemSelSettingItem::ConstructL() |
|
76 { |
|
77 BuildScriptL(); |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CBCTestMemSelSettingItem::BuildScriptL |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 void CBCTestMemSelSettingItem::BuildScriptL() |
|
85 { |
|
86 AddTestL( DELAY(1), TEND); |
|
87 |
|
88 // Add script as your need. |
|
89 for(int i=0; i<EBCTestCmdMemSelSettingItemEnd - EBCTestCmdMemSelSettingItemBegin -1; ++i) |
|
90 { |
|
91 AddTestL( LeftCBA, REP( Down, KItemPosition ), Right, TEND ); |
|
92 for(int j=0; j<i; ++j) |
|
93 AddTestL( Down, TEND); |
|
94 AddTestL( LeftCBA, TEND ); |
|
95 if(i == 1) |
|
96 { |
|
97 AddTestL( LeftCBA, WAIT(2),LeftCBA, WAIT(2), LeftCBA, WAIT(2), RightCBA, TEND); |
|
98 } |
|
99 AddOKL(); |
|
100 } |
|
101 } |
|
102 |
|
103 void CBCTestMemSelSettingItem::AddOKL() |
|
104 { |
|
105 // add dlg response sciprts |
|
106 for(int i=0; i<1; ++i) |
|
107 AddTestL( WAIT(5), KeyOK, TEND); |
|
108 } |
|
109 |
|
110 void CBCTestMemSelSettingItem::AddCancelL() |
|
111 { |
|
112 // add dlg response sciprts |
|
113 for(int i=0; i<1; ++i) |
|
114 AddTestL( WAIT(5), RightCBA, TEND); |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // CBCTestMemSelSettingItem::RunL |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 void CBCTestMemSelSettingItem::RunL( TInt aCmd ) |
|
122 { |
|
123 SetupL(); |
|
124 switch(aCmd){ |
|
125 case EBCTestCmdMemSelSettingItemCreate: |
|
126 TestCreateL(); |
|
127 break; |
|
128 case EBCTestCmdMemSelSettingItemEdit: |
|
129 TestEditL(); |
|
130 break; |
|
131 case EBCTestCmdMemSelSettingItemStore: |
|
132 TestStoreL(); |
|
133 break; |
|
134 case EBCTestCmdMemSelSettingItemSetting: |
|
135 TestSettingL(); |
|
136 break; |
|
137 default: |
|
138 break; |
|
139 } |
|
140 Teardown(); |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // CBCTestMemSelSettingItem::ReleaseCaseL |
|
145 // --------------------------------------------------------------------------- |
|
146 // |
|
147 void CBCTestMemSelSettingItem::Teardown() |
|
148 { |
|
149 delete iItem; |
|
150 iItem = NULL; |
|
151 } |
|
152 |
|
153 void CBCTestMemSelSettingItem::TestCreateL() |
|
154 { |
|
155 iItem = new (ELeave) CAknMemorySelectionSettingItem(0, iMemory); |
|
156 AssertNotNullL(iItem, _L("Create in Heap")); |
|
157 iItem->CompleteConstructionL(); |
|
158 AssertTrueL(ETrue, _L("complete construction")); |
|
159 } |
|
160 |
|
161 void CBCTestMemSelSettingItem::TestEditL() |
|
162 { |
|
163 CVRSettingsDialog* settingsDlg = CVRSettingsDialog::NewL(); |
|
164 settingsDlg->ExecuteLD( R_VR_SETTINGS_DIALOG ); |
|
165 } |
|
166 |
|
167 void CBCTestMemSelSettingItem::TestStoreL() |
|
168 { |
|
169 iItem = new (ELeave) CAknMemorySelectionSettingItem(0, iMemory); |
|
170 iItem->StoreL(); |
|
171 AssertTrueL(ETrue, _L("store")); |
|
172 iItem->LoadL(); |
|
173 AssertTrueL(ETrue, _L("laod")); |
|
174 } |
|
175 |
|
176 void CBCTestMemSelSettingItem::TestSettingL() |
|
177 { |
|
178 iItem = new (ELeave) CAknMemorySelectionSettingItem(0, iMemory); |
|
179 TFileName text(iItem->SettingTextL()); |
|
180 text.ZeroTerminate(); |
|
181 AssertTrueL(ETrue, text); |
|
182 } |
|
183 |
|
184 void CBCTestMemSelSettingItem::SetupL() |
|
185 { |
|
186 iMemory = CAknMemorySelectionDialog::EPhoneMemory; |
|
187 } |
|
188 |
|
189 |
|
190 |
|