41 #include "videoplaybackstatuspanecontrol.h" |
41 #include "videoplaybackstatuspanecontrol.h" |
42 #undef protected |
42 #undef protected |
43 #undef private |
43 #undef private |
44 |
44 |
45 |
45 |
46 // --------------------------------------------------------------------------- |
46 // ------------------------------------------------------------------------------------------------- |
47 // main |
47 // main |
48 // --------------------------------------------------------------------------- |
48 // ------------------------------------------------------------------------------------------------- |
49 // |
49 // |
50 int main(int argc, char *argv[]) |
50 int main(int argc, char *argv[]) |
51 { |
51 { |
52 MPX_ENTER_EXIT(_L("TestStatusPaneControl::Main()")); |
52 MPX_ENTER_EXIT(_L("TestStatusPaneControl::Main()")); |
53 |
53 |
54 HbApplication app(argc, argv); |
54 HbApplication app(argc, argv); |
55 HbMainWindow window; |
55 HbMainWindow window; |
56 |
56 |
57 TestStatusPaneControl tv; |
57 TestStatusPaneControl tv; |
58 |
58 |
59 char *pass[3]; |
59 char *pass[3]; |
60 pass[0] = argv[0]; |
60 pass[0] = argv[0]; |
61 pass[1] = "-o"; |
61 pass[1] = "-o"; |
62 pass[2] = "c:\\data\\teststatuspanecontrol.txt"; |
62 pass[2] = "c:\\data\\teststatuspanecontrol.txt"; |
63 |
63 |
64 int res = QTest::qExec(&tv, 3, pass); |
64 int res = QTest::qExec(&tv, 3, pass); |
65 |
65 |
66 return res; |
66 return res; |
67 } |
67 } |
68 |
68 |
69 // --------------------------------------------------------------------------- |
69 // ------------------------------------------------------------------------------------------------- |
70 // init |
70 // init |
71 // --------------------------------------------------------------------------- |
71 // ------------------------------------------------------------------------------------------------- |
72 // |
72 // |
73 void TestStatusPaneControl::init() |
73 void TestStatusPaneControl::init() |
74 { |
74 { |
75 MPX_ENTER_EXIT(_L("TestStatusPaneControl::init()")); |
75 MPX_ENTER_EXIT(_L("TestStatusPaneControl::init()")); |
76 } |
76 } |
77 |
77 |
78 // --------------------------------------------------------------------------- |
78 // ------------------------------------------------------------------------------------------------- |
79 // main |
79 // main |
80 // --------------------------------------------------------------------------- |
80 // ------------------------------------------------------------------------------------------------- |
81 // |
81 // |
82 void TestStatusPaneControl::setup() |
82 void TestStatusPaneControl::setup() |
83 { |
83 { |
84 MPX_ENTER_EXIT(_L("TestStatusPaneControl::setup()")); |
84 MPX_ENTER_EXIT(_L("TestStatusPaneControl::setup()")); |
85 |
85 |
86 mBaseVideoView = new VideoBasePlaybackView(); |
86 mBaseVideoView = new VideoBasePlaybackView(); |
87 |
87 |
88 mFileDetails = new VideoPlaybackViewFileDetails(); |
88 mFileDetails = new VideoPlaybackViewFileDetails(); |
89 |
89 |
90 mControlsController = new VideoPlaybackControlsController( mBaseVideoView, |
90 mControlsController = new VideoPlaybackControlsController( mBaseVideoView, |
91 mFileDetails ); |
91 mFileDetails ); |
92 |
92 |
93 mStatusPane = new VideoPlaybackStatusPaneControl( mControlsController, |
93 mStatusPane = new VideoPlaybackStatusPaneControl( mControlsController, |
94 EStatusPane, |
94 EStatusPane, |
95 NULL, |
95 NULL, |
96 0 ); |
96 0 ); |
97 } |
97 } |
98 |
98 |
99 // --------------------------------------------------------------------------- |
99 // ------------------------------------------------------------------------------------------------- |
100 // cleanup |
100 // cleanup |
101 // --------------------------------------------------------------------------- |
101 // ------------------------------------------------------------------------------------------------- |
102 // |
102 // |
103 void TestStatusPaneControl::cleanup() |
103 void TestStatusPaneControl::cleanup() |
104 { |
104 { |
105 MPX_ENTER_EXIT(_L("TestStatusPaneControl::cleanup()")); |
105 MPX_ENTER_EXIT(_L("TestStatusPaneControl::cleanup()")); |
106 |
106 |
107 if ( mStatusPane ) |
107 if ( mStatusPane ) |
108 { |
108 { |
109 delete mStatusPane; |
109 delete mStatusPane; |
110 mStatusPane = NULL; |
110 mStatusPane = NULL; |
111 } |
111 } |
112 |
112 |
113 if ( mBaseVideoView ) |
113 if ( mBaseVideoView ) |
114 { |
114 { |
115 delete mBaseVideoView; |
115 delete mBaseVideoView; |
116 mBaseVideoView = NULL; |
116 mBaseVideoView = NULL; |
117 } |
117 } |
118 |
118 |
119 if ( mFileDetails ) |
119 if ( mFileDetails ) |
120 { |
120 { |
121 delete mFileDetails; |
121 delete mFileDetails; |
122 mFileDetails = NULL; |
122 mFileDetails = NULL; |
123 } |
123 } |
124 |
124 |
125 if ( mControlsController ) |
125 if ( mControlsController ) |
126 { |
126 { |
127 delete mControlsController; |
127 delete mControlsController; |
128 mControlsController = NULL; |
128 mControlsController = NULL; |
129 } |
129 } |
130 } |
130 } |
131 |
131 |
132 // --------------------------------------------------------------------------- |
132 // ------------------------------------------------------------------------------------------------- |
133 // testSetMenu |
133 // testSetMenu |
134 // --------------------------------------------------------------------------- |
134 // ------------------------------------------------------------------------------------------------- |
135 // |
135 // |
136 void TestStatusPaneControl::testSetMenu() |
136 void TestStatusPaneControl::testSetMenu() |
137 { |
137 { |
138 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSetMenu()")); |
138 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSetMenu()")); |
139 |
139 |
140 setup(); |
140 setup(); |
141 |
141 |
142 mFileDetails->mTvOutConnected = false; |
142 mFileDetails->mTvOutConnected = false; |
143 mFileDetails->mVideoEnabled = true; |
143 mFileDetails->mVideoEnabled = true; |
144 |
144 |
145 mStatusPane->setMenu( mFileDetails ); |
145 mStatusPane->setMenu( mFileDetails ); |
146 |
146 |
147 QVERIFY( mControlsController->view()->menu()->isEmpty() ); |
147 QVERIFY( mControlsController->view()->menu()->isEmpty() ); |
148 |
148 |
149 cleanup(); |
149 cleanup(); |
150 } |
150 } |
151 |
151 |
152 // --------------------------------------------------------------------------- |
152 // ------------------------------------------------------------------------------------------------- |
153 // testSetVisible |
153 // testSetVisible |
154 // --------------------------------------------------------------------------- |
154 // ------------------------------------------------------------------------------------------------- |
155 // |
155 // |
156 void TestStatusPaneControl::testSetVisible() |
156 void TestStatusPaneControl::testSetVisible() |
157 { |
157 { |
158 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSetVisible()")); |
158 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSetVisible()")); |
159 |
159 |
160 setup(); |
160 setup(); |
161 mStatusPane->updateControlsWithFileDetails( mFileDetails ); |
161 |
162 |
162 mStatusPane->mController->mFileDetailsAdded = true; |
|
163 mStatusPane->updateControlsWithFileDetails( mFileDetails ); |
|
164 |
|
165 // |
163 // 1. Set visible |
166 // 1. Set visible |
164 mStatusPane->setVisible( true ); |
167 // |
165 QVERIFY( mControlsController->view()->mStatusBarVisible ); |
168 mStatusPane->setVisible( true ); |
166 QVERIFY( mControlsController->view()->mTitleBarVisible ); |
169 QVERIFY( mControlsController->view()->mStatusBarVisible ); |
167 QVERIFY( mStatusPane->mTitleLayout->isVisible() ); |
170 QVERIFY( mControlsController->view()->mTitleBarVisible ); |
168 |
171 QVERIFY( mStatusPane->mTitleLayout->isVisible() ); |
|
172 |
|
173 // |
169 // 2. Set invisible |
174 // 2. Set invisible |
|
175 // |
170 mStatusPane->setVisible( false ); |
176 mStatusPane->setVisible( false ); |
171 QVERIFY( mControlsController->view()->menu()->isEmpty() ); |
177 QVERIFY( mControlsController->view()->menu()->isEmpty() ); |
172 QVERIFY( ! mControlsController->view()->mStatusBarVisible ); |
178 QVERIFY( ! mControlsController->view()->mStatusBarVisible ); |
173 QVERIFY( ! mControlsController->view()->mTitleBarVisible ); |
179 QVERIFY( ! mControlsController->view()->mTitleBarVisible ); |
174 QVERIFY( ! mStatusPane->mTitleLayout->isVisible() ); |
180 QVERIFY( ! mStatusPane->mTitleLayout->isVisible() ); |
175 |
181 |
176 cleanup(); |
182 cleanup(); |
177 } |
183 } |
178 |
184 |
179 // --------------------------------------------------------------------------- |
185 // ------------------------------------------------------------------------------------------------- |
180 // testUpdateControlsWithFileDetails |
186 // testUpdateControlsWithFileDetails |
181 // --------------------------------------------------------------------------- |
187 // ------------------------------------------------------------------------------------------------- |
182 // |
188 // |
183 void TestStatusPaneControl::testUpdateControlsWithFileDetails() |
189 void TestStatusPaneControl::testUpdateControlsWithFileDetails() |
184 { |
190 { |
185 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testUpdateControlsWithFileDetails()")); |
191 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testUpdateControlsWithFileDetails()")); |
186 |
192 |
187 setup(); |
193 setup(); |
188 |
194 |
189 QString title = "Title"; |
195 QString title = "Title"; |
190 |
196 |
191 // 1. test for full creen mode |
197 // |
|
198 // 1-1. test for full screen mode + file details hasn't arrived |
|
199 // |
|
200 mStatusPane->mController->mFileDetailsAdded = false; |
|
201 |
|
202 mControlsController->mViewMode = EFullScreenView; |
|
203 mControlsController->mFileDetails->mTitle = title; |
|
204 mStatusPane->updateControlsWithFileDetails( mFileDetails ); |
|
205 |
|
206 QVERIFY( mStatusPane->mTitleLabel == NULL ); |
|
207 QVERIFY( mStatusPane->mTitleGroupBox == NULL ); |
|
208 QVERIFY( mControlsController->view()->viewFlags() == |
|
209 HbView::HbViewFlags( HbView::ViewTitleBarTransparent | HbView::ViewStatusBarTransparent )); |
|
210 |
|
211 // |
|
212 // 1-2. test for full screen mode + file details has arrived |
|
213 // |
|
214 mStatusPane->mController->mFileDetailsAdded = true; |
|
215 |
192 mControlsController->mViewMode = EFullScreenView; |
216 mControlsController->mViewMode = EFullScreenView; |
193 mControlsController->mFileDetails->mTitle = title; |
217 mControlsController->mFileDetails->mTitle = title; |
194 mStatusPane->updateControlsWithFileDetails( mFileDetails ); |
218 mStatusPane->updateControlsWithFileDetails( mFileDetails ); |
195 |
219 |
196 QVERIFY( mStatusPane->mTitleLabel->mString == title ); |
220 QVERIFY( mStatusPane->mTitleLabel->mString == title ); |
197 QVERIFY( mStatusPane->mTitleGroupBox->mString == title ); |
221 QVERIFY( mStatusPane->mTitleGroupBox->mString == title ); |
198 QVERIFY( mStatusPane->mTitleLabel->isVisible() ); |
222 QVERIFY( mStatusPane->mTitleLabel->isVisible() ); |
199 QVERIFY( ! mStatusPane->mTitleGroupBox->isVisible() ); |
223 QVERIFY( ! mStatusPane->mTitleGroupBox->isVisible() ); |
200 QVERIFY( mControlsController->view()->viewFlags() == |
224 QVERIFY( mControlsController->view()->viewFlags() == |
201 HbView::HbViewFlags( HbView::ViewTitleBarTransparent | HbView::ViewStatusBarTransparent )); |
225 HbView::HbViewFlags( HbView::ViewTitleBarTransparent | HbView::ViewStatusBarTransparent )); |
202 |
226 |
203 // 2. test for detial view mode |
227 // |
204 mControlsController->mViewMode = EDetailsView; |
228 // 2. test for detial view mode |
|
229 // |
|
230 mControlsController->mViewMode = EDetailsView; |
205 mStatusPane->updateControlsWithFileDetails( mFileDetails ); |
231 mStatusPane->updateControlsWithFileDetails( mFileDetails ); |
206 |
232 |
207 QVERIFY( mControlsController->view()->viewFlags() == HbView::ViewFlagNone ); |
233 QVERIFY( mControlsController->view()->viewFlags() == HbView::ViewFlagNone ); |
208 QVERIFY( ! mStatusPane->mTitleLabel->isVisible() ); |
234 QVERIFY( ! mStatusPane->mTitleLabel->isVisible() ); |
209 QVERIFY( mStatusPane->mTitleGroupBox->isVisible() ); |
235 QVERIFY( mStatusPane->mTitleGroupBox->isVisible() ); |
210 |
236 |
211 // 3. test for audio only mode |
237 // |
|
238 // 3. test for audio only mode |
|
239 // |
212 mControlsController->mViewMode = EAudioOnlyView; |
240 mControlsController->mViewMode = EAudioOnlyView; |
213 mStatusPane->updateControlsWithFileDetails( mFileDetails ); |
241 mStatusPane->updateControlsWithFileDetails( mFileDetails ); |
214 |
242 |
215 QVERIFY( mControlsController->view()->viewFlags() == HbView::ViewFlagNone ); |
243 QVERIFY( mControlsController->view()->viewFlags() == HbView::ViewFlagNone ); |
216 |
244 |
217 cleanup(); |
245 cleanup(); |
218 } |
246 } |
219 |
247 |
220 // --------------------------------------------------------------------------- |
248 // ------------------------------------------------------------------------------------------------- |
221 // testSetVisibility |
249 // testSetVisibility |
222 // --------------------------------------------------------------------------- |
250 // ------------------------------------------------------------------------------------------------- |
223 // |
251 // |
224 void TestStatusPaneControl::testSetVisibility() |
252 void TestStatusPaneControl::testSetVisibility() |
225 { |
253 { |
226 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSetVisibility()")); |
254 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSetVisibility()")); |
227 |
255 |
228 setup(); |
256 setup(); |
229 |
257 |
230 // 1. test for first block of cases: |
258 // 1. test for first block of cases: |
231 mStatusPane->setVisibility( EPbStatePaused ); |
259 mStatusPane->setVisibility( EPbStatePaused ); |
232 QVERIFY( mControlsController->view()->menu()->isEmpty() ); |
260 QVERIFY( mControlsController->view()->menu()->isEmpty() ); |
233 |
261 |
234 // 2. test for second block of cases: |
262 // 2. test for second block of cases: |
235 mStatusPane->setVisibility( EPbStateInitialising ); |
263 mStatusPane->setVisibility( EPbStateInitialising ); |
236 QVERIFY( mControlsController->view()->menu()->isEmpty() ); |
264 QVERIFY( mControlsController->view()->menu()->isEmpty() ); |
237 |
265 |
238 cleanup(); |
266 cleanup(); |
239 } |
267 } |
240 |
268 |
241 // --------------------------------------------------------------------------- |
269 // ------------------------------------------------------------------------------------------------- |
242 // testControlListUpdated |
270 // testControlListUpdated |
243 // --------------------------------------------------------------------------- |
271 // ------------------------------------------------------------------------------------------------- |
244 // |
272 // |
245 void TestStatusPaneControl::testControlListUpdated() |
273 void TestStatusPaneControl::testControlListUpdated() |
246 { |
274 { |
247 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testControlListUpdated()")); |
275 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testControlListUpdated()")); |
248 |
276 |
249 setup(); |
277 setup(); |
250 |
278 |
251 mStatusPane->controlListUpdated( mFileDetails ); |
279 mStatusPane->controlListUpdated( mFileDetails ); |
252 |
280 |
253 QVERIFY( mControlsController->view()->menu()->isEmpty() ); |
281 QVERIFY( mControlsController->view()->menu()->isEmpty() ); |
254 |
282 |
255 cleanup(); |
283 cleanup(); |
256 } |
284 } |
257 |
285 |
258 // --------------------------------------------------------------------------- |
286 // ------------------------------------------------------------------------------------------------- |
259 // testSlot_handleAboutToShow |
287 // testSlot_handleAboutToShow |
260 // --------------------------------------------------------------------------- |
288 // ------------------------------------------------------------------------------------------------- |
261 // |
289 // |
262 void TestStatusPaneControl::testSlot_handleAboutToShow() |
290 void TestStatusPaneControl::testSlot_handleAboutToShow() |
263 { |
291 { |
264 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSlot_handleAboutToShow()")); |
292 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSlot_handleAboutToShow()")); |
265 |
293 |
266 setup(); |
294 setup(); |
267 |
295 |
268 connect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( handleAboutToShow() ) ); |
296 connect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( handleAboutToShow() ) ); |
269 |
297 |
270 emit commandSignal(); |
298 emit commandSignal(); |
271 |
299 |
272 QVERIFY( mControlsController->mTimerAction == ETimerCancel ); |
300 QVERIFY( mControlsController->mTimerAction == ETimerCancel ); |
273 |
301 |
274 disconnect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( handleAboutToShow() ) ); |
302 disconnect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( handleAboutToShow() ) ); |
275 |
303 |
276 cleanup(); |
304 cleanup(); |
277 } |
305 } |
278 |
306 |
279 // --------------------------------------------------------------------------- |
307 // ------------------------------------------------------------------------------------------------- |
280 // testSlot_handleAboutToHide |
308 // testSlot_handleAboutToHide |
281 // --------------------------------------------------------------------------- |
309 // ------------------------------------------------------------------------------------------------- |
282 // |
310 // |
283 void TestStatusPaneControl::testSlot_handleAboutToHide() |
311 void TestStatusPaneControl::testSlot_handleAboutToHide() |
284 { |
312 { |
285 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSlot_handleAboutToHide()")); |
313 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSlot_handleAboutToHide()")); |
286 |
314 |
287 setup(); |
315 setup(); |
288 |
316 |
289 connect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( handleAboutToHide() ) ); |
317 connect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( handleAboutToHide() ) ); |
290 |
318 |
291 emit commandSignal(); |
319 emit commandSignal(); |
292 |
320 |
293 QVERIFY( mControlsController->mTimerAction == ETimerReset ); |
321 QVERIFY( mControlsController->mTimerAction == ETimerReset ); |
294 |
322 |
295 disconnect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( handleAboutToHide() ) ); |
323 disconnect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( handleAboutToHide() ) ); |
296 |
324 |
297 cleanup(); |
325 cleanup(); |
298 } |
326 } |
299 |
327 |
300 // --------------------------------------------------------------------------- |
328 // ------------------------------------------------------------------------------------------------- |
301 // testSlot_openFullScreenView |
329 // testSlot_openFullScreenView |
302 // --------------------------------------------------------------------------- |
330 // ------------------------------------------------------------------------------------------------- |
303 // |
331 // |
304 void TestStatusPaneControl::testSlot_openFullScreenView() |
332 void TestStatusPaneControl::testSlot_openFullScreenView() |
305 { |
333 { |
306 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSlot_openFullScreenView()")); |
334 MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSlot_openFullScreenView()")); |
307 |
335 |
308 setup(); |
336 setup(); |
309 |
337 |
310 connect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( openFullScreenView() ) ); |
338 connect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( openFullScreenView() ) ); |
311 |
339 |
312 emit commandSignal(); |
340 emit commandSignal(); |
313 |
341 |
314 QVERIFY( mControlsController->mViewMode == EFullScreenView ); |
342 QVERIFY( mControlsController->mViewMode == EFullScreenView ); |
315 |
343 |
316 disconnect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( openFullScreenView() ) ); |
344 disconnect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( openFullScreenView() ) ); |
317 |
345 |
318 cleanup(); |
346 cleanup(); |
319 } |
347 } |
320 |
348 |