|
1 /* |
|
2 * Copyright (c) 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 the License "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: This file contains testclass implementation.* |
|
15 */ |
|
16 |
|
17 |
|
18 // INCLUDES |
|
19 #include <e32svr.h> |
|
20 #include <StifParser.h> |
|
21 #include <Stiftestinterface.h> |
|
22 |
|
23 #include "VcxHgMyVideosMainViewTest.h" |
|
24 |
|
25 |
|
26 #include <coemain.h> |
|
27 #include <aknappui.h> |
|
28 #include <aknviewappui.h> |
|
29 #include <aknview.h> |
|
30 #include "vcxviewmessageutility.h" |
|
31 #include <akntitle.h> |
|
32 |
|
33 #define private public |
|
34 #include "vcxhgmyvideosmainview.h" |
|
35 #undef private |
|
36 |
|
37 // ============================ MEMBER FUNCTIONS =============================== |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CVcxHgMyVideosMainViewTest::Delete |
|
41 // Delete here all resources allocated and opened from test methods. |
|
42 // Called from destructor. |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 void CVcxHgMyVideosMainViewTest::Delete() |
|
46 { |
|
47 } |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // CVcxHgMyVideosMainViewTest::RunMethodL |
|
51 // Run specified method. Contains also table of test mothods and their names. |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 TInt CVcxHgMyVideosMainViewTest::RunMethodL( |
|
55 CStifItemParser& aItem ) |
|
56 { |
|
57 |
|
58 static TStifFunctionInfo const KFunctions[] = |
|
59 { |
|
60 // Copy this line for every implemented function. |
|
61 // First string is the function name used in TestScripter script file. |
|
62 // Second is the actual implementation member function. |
|
63 ENTRY( "create" , CVcxHgMyVideosMainViewTest::CreateL ), |
|
64 ENTRY( "delete" , CVcxHgMyVideosMainViewTest::DeleteL ), |
|
65 ENTRY( "appui" , CVcxHgMyVideosMainViewTest::AppUi ), |
|
66 ENTRY( "cba" , CVcxHgMyVideosMainViewTest::Cba ), |
|
67 ENTRY( "titlepane" , CVcxHgMyVideosMainViewTest::TitlePaneL ), |
|
68 ENTRY( "playerwrapper" , CVcxHgMyVideosMainViewTest::PlayerWrapperL ), |
|
69 ENTRY( "categorylist" , CVcxHgMyVideosMainViewTest::CategoryListL ), |
|
70 ENTRY( "videolist" , CVcxHgMyVideosMainViewTest::VideoListL ), |
|
71 ENTRY( "activatecategorylist" , CVcxHgMyVideosMainViewTest::ActivateCategoryListL ), |
|
72 ENTRY( "activatevideolist" , CVcxHgMyVideosMainViewTest::ActivateVideoListL ), |
|
73 ENTRY( "handlecommand" , CVcxHgMyVideosMainViewTest::HandleCommandL ), |
|
74 ENTRY( "updatemsktoolbar" , CVcxHgMyVideosMainViewTest::UpdateMSKToolbarL ), |
|
75 ENTRY( "handlekeyevent" , CVcxHgMyVideosMainViewTest::HandleKeyEventL ), |
|
76 ENTRY( "dyninitmsk" , CVcxHgMyVideosMainViewTest::DynInitMskL ), |
|
77 ENTRY( "maketoolbarvisible" , CVcxHgMyVideosMainViewTest::MakeToolbarVisibleL ), |
|
78 ENTRY( "dyninittoolbar" , CVcxHgMyVideosMainViewTest::DynInitToolbarL ), |
|
79 ENTRY( "handlecustomviewmessage" , CVcxHgMyVideosMainViewTest::HandleCustomViewMessageL ), |
|
80 ENTRY( "doactivate" , CVcxHgMyVideosMainViewTest::DoActivateL ), |
|
81 ENTRY( "dodeactivate" , CVcxHgMyVideosMainViewTest::DoDeactivateL ), |
|
82 }; |
|
83 |
|
84 const TInt count = sizeof( KFunctions ) / |
|
85 sizeof( TStifFunctionInfo ); |
|
86 |
|
87 return RunInternalL( KFunctions, count, aItem ); |
|
88 |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CVcxHgMyVideosMainViewTest:: |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 TInt CVcxHgMyVideosMainViewTest::CreateL( CStifItemParser& aItem ) |
|
96 { |
|
97 iView = CVcxHgMyVideosMainView::NewL(); |
|
98 |
|
99 return KErrNone; |
|
100 } |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // CVcxHgMyVideosMainViewTest:: |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 TInt CVcxHgMyVideosMainViewTest::DeleteL( CStifItemParser& aItem ) |
|
107 { |
|
108 delete iView; |
|
109 iView = NULL; |
|
110 |
|
111 return KErrNone; |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CVcxHgMyVideosMainViewTest:: |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 TInt CVcxHgMyVideosMainViewTest::AppUi( CStifItemParser& aItem ) |
|
119 { |
|
120 iView->AppUi(); |
|
121 |
|
122 return KErrNone; |
|
123 } |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // CVcxHgMyVideosMainViewTest:: |
|
127 // ----------------------------------------------------------------------------- |
|
128 // |
|
129 TInt CVcxHgMyVideosMainViewTest::Cba( CStifItemParser& aItem ) |
|
130 { |
|
131 iView->Cba(); |
|
132 |
|
133 return KErrNone; |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CVcxHgMyVideosMainViewTest:: |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 TInt CVcxHgMyVideosMainViewTest::TitlePaneL( CStifItemParser& aItem ) |
|
141 { |
|
142 iView->TitlePaneL(); |
|
143 |
|
144 return KErrNone; |
|
145 } |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CVcxHgMyVideosMainViewTest:: |
|
149 // ----------------------------------------------------------------------------- |
|
150 // |
|
151 TInt CVcxHgMyVideosMainViewTest::PlayerWrapperL( CStifItemParser& aItem ) |
|
152 { |
|
153 iView->PlayerWrapperL(); |
|
154 |
|
155 return KErrNone; |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CVcxHgMyVideosMainViewTest:: |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 TInt CVcxHgMyVideosMainViewTest::CategoryListL( CStifItemParser& aItem ) |
|
163 { |
|
164 iView->CategoryListL(); |
|
165 |
|
166 return KErrNone; |
|
167 } |
|
168 |
|
169 // ----------------------------------------------------------------------------- |
|
170 // CVcxHgMyVideosMainViewTest:: |
|
171 // ----------------------------------------------------------------------------- |
|
172 // |
|
173 TInt CVcxHgMyVideosMainViewTest::VideoListL( CStifItemParser& aItem ) |
|
174 { |
|
175 iView->VideoListL(); |
|
176 |
|
177 return KErrNone; |
|
178 } |
|
179 |
|
180 // ----------------------------------------------------------------------------- |
|
181 // CVcxHgMyVideosMainViewTest:: |
|
182 // ----------------------------------------------------------------------------- |
|
183 // |
|
184 TInt CVcxHgMyVideosMainViewTest::ActivateCategoryListL( CStifItemParser& aItem ) |
|
185 { |
|
186 iView->ActivateCategoryListL(); |
|
187 |
|
188 return KErrNone; |
|
189 } |
|
190 |
|
191 // ----------------------------------------------------------------------------- |
|
192 // CVcxHgMyVideosMainViewTest:: |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 TInt CVcxHgMyVideosMainViewTest::ActivateVideoListL( CStifItemParser& aItem ) |
|
196 { |
|
197 TInt param1; |
|
198 aItem.GetNextInt(param1); |
|
199 |
|
200 iView->ActivateVideoListL( param1 ); |
|
201 |
|
202 return KErrNone; |
|
203 } |
|
204 |
|
205 // ----------------------------------------------------------------------------- |
|
206 // CVcxHgMyVideosMainViewTest:: |
|
207 // ----------------------------------------------------------------------------- |
|
208 // |
|
209 TInt CVcxHgMyVideosMainViewTest::HandleCommandL( CStifItemParser& aItem ) |
|
210 { |
|
211 TInt param1; |
|
212 aItem.GetNextInt(param1); |
|
213 |
|
214 iView->HandleCommandL( param1 ); |
|
215 |
|
216 return KErrNone; |
|
217 } |
|
218 |
|
219 // ----------------------------------------------------------------------------- |
|
220 // CVcxHgMyVideosMainViewTest:: |
|
221 // ----------------------------------------------------------------------------- |
|
222 // |
|
223 TInt CVcxHgMyVideosMainViewTest::UpdateMSKToolbarL( CStifItemParser& aItem ) |
|
224 { |
|
225 iView->UpdateMSKToolbarL(); |
|
226 |
|
227 return KErrNone; |
|
228 } |
|
229 |
|
230 // ----------------------------------------------------------------------------- |
|
231 // CVcxHgMyVideosMainViewTest:: |
|
232 // ----------------------------------------------------------------------------- |
|
233 // |
|
234 TInt CVcxHgMyVideosMainViewTest::HandleKeyEventL( CStifItemParser& aItem ) |
|
235 { |
|
236 TInt param1; |
|
237 aItem.GetNextInt(param1); |
|
238 TInt param2; |
|
239 aItem.GetNextInt(param2); |
|
240 TInt param3; |
|
241 aItem.GetNextInt(param3); |
|
242 TInt param4; |
|
243 aItem.GetNextInt(param4); |
|
244 |
|
245 TKeyEvent event; |
|
246 |
|
247 event.iCode = param1; |
|
248 event.iScanCode = param2; |
|
249 event.iRepeats = param3; |
|
250 |
|
251 iView->HandleKeyEventL( event, ( TEventCode )param4 ); |
|
252 |
|
253 return KErrNone; |
|
254 } |
|
255 |
|
256 // ----------------------------------------------------------------------------- |
|
257 // CVcxHgMyVideosMainViewTest:: |
|
258 // ----------------------------------------------------------------------------- |
|
259 // |
|
260 TInt CVcxHgMyVideosMainViewTest::DynInitMskL( CStifItemParser& aItem ) |
|
261 { |
|
262 iView->DynInitMskL(); |
|
263 |
|
264 return KErrNone; |
|
265 } |
|
266 |
|
267 // ----------------------------------------------------------------------------- |
|
268 // CVcxHgMyVideosMainViewTest:: |
|
269 // ----------------------------------------------------------------------------- |
|
270 // |
|
271 TInt CVcxHgMyVideosMainViewTest::MakeToolbarVisibleL( CStifItemParser& aItem ) |
|
272 { |
|
273 TInt param; |
|
274 aItem.GetNextInt(param); |
|
275 |
|
276 iView->MakeToolbarVisibleL( param ); |
|
277 |
|
278 return KErrNone; |
|
279 } |
|
280 |
|
281 // ----------------------------------------------------------------------------- |
|
282 // CVcxHgMyVideosMainViewTest:: |
|
283 // ----------------------------------------------------------------------------- |
|
284 // |
|
285 TInt CVcxHgMyVideosMainViewTest::DynInitToolbarL( CStifItemParser& aItem ) |
|
286 { |
|
287 iView->DynInitToolbarL(); |
|
288 |
|
289 return KErrNone; |
|
290 } |
|
291 |
|
292 // ----------------------------------------------------------------------------- |
|
293 // CVcxHgMyVideosMainViewTest:: |
|
294 // ----------------------------------------------------------------------------- |
|
295 // |
|
296 TInt CVcxHgMyVideosMainViewTest::HandleCustomViewMessageL( CStifItemParser& aItem ) |
|
297 { |
|
298 TInt param1; |
|
299 aItem.GetNextInt(param1); |
|
300 |
|
301 TPtrC param2; |
|
302 aItem.GetNextString(param2); |
|
303 |
|
304 HBufC8* pbuf = HBufC8::NewLC( param2.Length() ); |
|
305 pbuf->Des().Copy( param2 ); |
|
306 |
|
307 iView->HandleCustomViewMessageL( TUid::Uid( param1 ), *pbuf ); |
|
308 |
|
309 CleanupStack::PopAndDestroy( pbuf ); |
|
310 |
|
311 return KErrNone; |
|
312 } |
|
313 |
|
314 // ----------------------------------------------------------------------------- |
|
315 // CVcxHgMyVideosMainViewTest:: |
|
316 // ----------------------------------------------------------------------------- |
|
317 // |
|
318 TInt CVcxHgMyVideosMainViewTest::DoActivateL( CStifItemParser& aItem ) |
|
319 { |
|
320 TVwsViewId vid; |
|
321 |
|
322 TInt param1; |
|
323 aItem.GetNextInt(param1); |
|
324 TUid uid = TUid::Uid ( param1 ); |
|
325 |
|
326 TPtrC param2; |
|
327 aItem.GetNextString(param2); |
|
328 HBufC8* pbuf = HBufC8::NewLC( param2.Length() ); |
|
329 pbuf->Des().Copy( param2 ); |
|
330 |
|
331 iView->DoActivateL( vid, |
|
332 uid, |
|
333 *pbuf ); |
|
334 |
|
335 CleanupStack::PopAndDestroy( pbuf ); |
|
336 |
|
337 return KErrNone; |
|
338 } |
|
339 |
|
340 // ----------------------------------------------------------------------------- |
|
341 // CVcxHgMyVideosMainViewTest:: |
|
342 // ----------------------------------------------------------------------------- |
|
343 // |
|
344 TInt CVcxHgMyVideosMainViewTest::DoDeactivateL( CStifItemParser& aItem ) |
|
345 { |
|
346 iView->DoDeactivate(); |
|
347 |
|
348 return KErrNone; |
|
349 } |