1 /** |
|
2 * Copyright (c) 2010 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: tester for methods in status pane control |
|
15 * |
|
16 */ |
|
17 |
|
18 // Version : %version: 6 % |
|
19 |
|
20 |
|
21 #include <hbapplication.h> |
|
22 #include <hbinstance.h> |
|
23 #include <hbmenu.h> |
|
24 #include <QDebug> |
|
25 |
|
26 |
|
27 #include "mpxvideoplaybackcontrol.hrh" |
|
28 #include "mpxhelixplaybackplugindefs.h" |
|
29 |
|
30 #include "teststatuspanecontrol.h" |
|
31 |
|
32 #include "mpxvideoplaybackviewfiledetails.h" |
|
33 #include "mpxvideoplaybackcontrolscontroller.h" |
|
34 #include "hbvideobaseplaybackview.h" |
|
35 #include "mpxvideoplaybackdocumentloader.h" |
|
36 #include "hblabel.h" |
|
37 #include "hbgroupbox.h" |
|
38 |
|
39 #define private public |
|
40 #define protected public |
|
41 #include "mpxvideoplaybackstatuspanecontrol.h" |
|
42 #undef protected |
|
43 #undef private |
|
44 |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // main |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 int main(int argc, char *argv[]) |
|
51 { |
|
52 MPX_ENTER_EXIT(_L("TestStatusPaneControl::Main()")); |
|
53 |
|
54 HbApplication app(argc, argv); |
|
55 HbMainWindow window; |
|
56 |
|
57 TestStatusPaneControl tv; |
|
58 |
|
59 char *pass[3]; |
|
60 pass[0] = argv[0]; |
|
61 pass[1] = "-o"; |
|
62 pass[2] = "c:\\data\\TestStatusPaneControl.txt"; |
|
63 |
|
64 int res = QTest::qExec(&tv, 3, pass); |
|
65 |
|
66 return res; |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // init |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 void TestStatusPaneControl::init() |
|
74 { |
|
75 MPX_ENTER_EXIT(_L("TestStatusPaneControl::init()")); |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // main |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 void TestStatusPaneControl::setup() |
|
83 { |
|
84 MPX_ENTER_EXIT(_L("TestStatusPaneControl::setup()")); |
|
85 |
|
86 mBaseVideoView = new HbVideoBasePlaybackView(); |
|
87 |
|
88 mFileDetails = new QMPXVideoPlaybackViewFileDetails(); |
|
89 |
|
90 mControlsController = new QMPXVideoPlaybackControlsController( mBaseVideoView, |
|
91 mFileDetails ); |
|
92 |
|
93 mStatusPane = new QMPXVideoPlaybackStatusPaneControl( mControlsController, |
|
94 EMPXStatusPane, |
|
95 NULL, |
|
96 0 ); |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // cleanup |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 void TestStatusPaneControl::cleanup() |
|
104 { |
|
105 MPX_ENTER_EXIT(_L("TestStatusPaneControl::cleanup()")); |
|
106 |
|
107 if ( mStatusPane ) |
|
108 { |
|
109 delete mStatusPane; |
|
110 mStatusPane = NULL; |
|
111 } |
|
112 |
|
113 if ( mBaseVideoView ) |
|
114 { |
|
115 delete mBaseVideoView; |
|
116 mBaseVideoView = NULL; |
|
117 } |
|
118 |
|
119 if ( mFileDetails ) |
|
120 { |
|
121 delete mFileDetails; |
|
122 mFileDetails = NULL; |
|
123 } |
|
124 |
|
125 if ( mControlsController ) |
|
126 { |
|
127 delete mControlsController; |
|
128 mControlsController = NULL; |
|
129 } |
|
130 } |
|
131 |
|
132 // --------------------------------------------------------------------------- |
|
133 // testSetMenu |
|
134 // --------------------------------------------------------------------------- |
|
135 // |
|
136 void TestStatusPaneControl::testSetMenu() |
|
137 { |
|
138 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSetMenu()")); |
|
139 |
|
140 setup(); |
|
141 |
|
142 mFileDetails->mTvOutConnected = false; |
|
143 mFileDetails->mVideoEnabled = true; |
|
144 |
|
145 mStatusPane->setMenu( mFileDetails ); |
|
146 |
|
147 QVERIFY( mControlsController->view()->menu()->isEmpty() ); |
|
148 |
|
149 cleanup(); |
|
150 } |
|
151 |
|
152 // --------------------------------------------------------------------------- |
|
153 // testSetVisible |
|
154 // --------------------------------------------------------------------------- |
|
155 // |
|
156 void TestStatusPaneControl::testSetVisible() |
|
157 { |
|
158 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSetVisible()")); |
|
159 |
|
160 setup(); |
|
161 mStatusPane->updateControlsWithFileDetails( mFileDetails ); |
|
162 |
|
163 // 1. Set visible |
|
164 mStatusPane->setVisible( true ); |
|
165 QVERIFY( mControlsController->view()->mStatusBarVisible ); |
|
166 QVERIFY( mControlsController->view()->mTitleBarVisible ); |
|
167 QVERIFY( mStatusPane->mTitleLayout->isVisible() ); |
|
168 |
|
169 // 2. Set invisible |
|
170 mStatusPane->setVisible( false ); |
|
171 QVERIFY( mControlsController->view()->menu()->isEmpty() ); |
|
172 QVERIFY( ! mControlsController->view()->mStatusBarVisible ); |
|
173 QVERIFY( ! mControlsController->view()->mTitleBarVisible ); |
|
174 QVERIFY( ! mStatusPane->mTitleLayout->isVisible() ); |
|
175 |
|
176 cleanup(); |
|
177 } |
|
178 |
|
179 // --------------------------------------------------------------------------- |
|
180 // testUpdateControlsWithFileDetails |
|
181 // --------------------------------------------------------------------------- |
|
182 // |
|
183 void TestStatusPaneControl::testUpdateControlsWithFileDetails() |
|
184 { |
|
185 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testUpdateControlsWithFileDetails()")); |
|
186 |
|
187 setup(); |
|
188 |
|
189 QString title = "Title"; |
|
190 |
|
191 // 1. test for full creen mode |
|
192 mControlsController->mViewMode = EFullScreenView; |
|
193 mControlsController->mFileDetails->mTitle = title; |
|
194 mStatusPane->updateControlsWithFileDetails( mFileDetails ); |
|
195 |
|
196 QVERIFY( mStatusPane->mTitleLabel->mString == title ); |
|
197 QVERIFY( mStatusPane->mTitleGroupBox->mString == title ); |
|
198 QVERIFY( mStatusPane->mTitleLabel->isVisible() ); |
|
199 QVERIFY( ! mStatusPane->mTitleGroupBox->isVisible() ); |
|
200 QVERIFY( mControlsController->view()->viewFlags() == |
|
201 HbView::HbViewFlags( HbView::ViewTitleBarTransparent | HbView::ViewStatusBarTransparent )); |
|
202 |
|
203 // 2. test for detial view mode |
|
204 mControlsController->mViewMode = EDetailsView; |
|
205 mStatusPane->updateControlsWithFileDetails( mFileDetails ); |
|
206 |
|
207 QVERIFY( mControlsController->view()->viewFlags() == HbView::ViewFlagNone ); |
|
208 QVERIFY( ! mStatusPane->mTitleLabel->isVisible() ); |
|
209 QVERIFY( mStatusPane->mTitleGroupBox->isVisible() ); |
|
210 |
|
211 // 3. test for audio only mode |
|
212 mControlsController->mViewMode = EAudioOnlyView; |
|
213 mStatusPane->updateControlsWithFileDetails( mFileDetails ); |
|
214 |
|
215 QVERIFY( mControlsController->view()->viewFlags() == HbView::ViewFlagNone ); |
|
216 |
|
217 cleanup(); |
|
218 } |
|
219 |
|
220 // --------------------------------------------------------------------------- |
|
221 // testSetVisibility |
|
222 // --------------------------------------------------------------------------- |
|
223 // |
|
224 void TestStatusPaneControl::testSetVisibility() |
|
225 { |
|
226 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSetVisibility()")); |
|
227 |
|
228 setup(); |
|
229 |
|
230 // 1. test for first block of cases: |
|
231 mStatusPane->setVisibility( EPbStatePaused ); |
|
232 QVERIFY( mControlsController->view()->menu()->isEmpty() ); |
|
233 |
|
234 // 2. test for second block of cases: |
|
235 mStatusPane->setVisibility( EPbStateInitialising ); |
|
236 QVERIFY( mControlsController->view()->menu()->isEmpty() ); |
|
237 |
|
238 cleanup(); |
|
239 } |
|
240 |
|
241 // --------------------------------------------------------------------------- |
|
242 // testControlListUpdated |
|
243 // --------------------------------------------------------------------------- |
|
244 // |
|
245 void TestStatusPaneControl::testControlListUpdated() |
|
246 { |
|
247 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testControlListUpdated()")); |
|
248 |
|
249 setup(); |
|
250 |
|
251 mStatusPane->controlListUpdated( mFileDetails ); |
|
252 |
|
253 QVERIFY( mControlsController->view()->menu()->isEmpty() ); |
|
254 |
|
255 cleanup(); |
|
256 } |
|
257 |
|
258 // --------------------------------------------------------------------------- |
|
259 // testSlot_handleAboutToShow |
|
260 // --------------------------------------------------------------------------- |
|
261 // |
|
262 void TestStatusPaneControl::testSlot_handleAboutToShow() |
|
263 { |
|
264 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSlot_handleAboutToShow()")); |
|
265 |
|
266 setup(); |
|
267 |
|
268 connect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( handleAboutToShow() ) ); |
|
269 |
|
270 emit commandSignal(); |
|
271 |
|
272 QVERIFY( mControlsController->mTimerAction == EMPXTimerCancel ); |
|
273 |
|
274 disconnect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( handleAboutToShow() ) ); |
|
275 |
|
276 cleanup(); |
|
277 } |
|
278 |
|
279 // --------------------------------------------------------------------------- |
|
280 // testSlot_handleAboutToHide |
|
281 // --------------------------------------------------------------------------- |
|
282 // |
|
283 void TestStatusPaneControl::testSlot_handleAboutToHide() |
|
284 { |
|
285 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSlot_handleAboutToHide()")); |
|
286 |
|
287 setup(); |
|
288 |
|
289 connect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( handleAboutToHide() ) ); |
|
290 |
|
291 emit commandSignal(); |
|
292 |
|
293 QVERIFY( mControlsController->mTimerAction == EMPXTimerReset ); |
|
294 |
|
295 disconnect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( handleAboutToHide() ) ); |
|
296 |
|
297 cleanup(); |
|
298 } |
|
299 |
|
300 // --------------------------------------------------------------------------- |
|
301 // testSlot_openFullScreenView |
|
302 // --------------------------------------------------------------------------- |
|
303 // |
|
304 void TestStatusPaneControl::testSlot_openFullScreenView() |
|
305 { |
|
306 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSlot_openFullScreenView()")); |
|
307 |
|
308 setup(); |
|
309 |
|
310 connect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( openFullScreenView() ) ); |
|
311 |
|
312 emit commandSignal(); |
|
313 |
|
314 QVERIFY( mControlsController->mViewMode == EFullScreenView ); |
|
315 |
|
316 disconnect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( openFullScreenView() ) ); |
|
317 |
|
318 cleanup(); |
|
319 } |
|
320 |
|
321 // End of file |
|