36 #include "videoplaybackfullscreencontrol.h" |
36 #include "videoplaybackfullscreencontrol.h" |
37 #undef protected |
37 #undef protected |
38 #undef private |
38 #undef private |
39 |
39 |
40 |
40 |
41 // --------------------------------------------------------------------------- |
41 // ------------------------------------------------------------------------------------------------- |
42 // main |
42 // main |
43 // --------------------------------------------------------------------------- |
43 // ------------------------------------------------------------------------------------------------- |
44 // |
44 // |
45 int main(int argc, char *argv[]) |
45 int main(int argc, char *argv[]) |
46 { |
46 { |
47 MPX_ENTER_EXIT(_L("TestFullScreenControl::Main()")); |
47 MPX_ENTER_EXIT(_L("TestFullScreenControl::Main()")); |
48 |
48 |
49 HbApplication app(argc, argv); |
49 HbApplication app(argc, argv); |
50 HbMainWindow window; |
50 HbMainWindow window; |
51 |
51 |
52 TestFullScreenControl tv; |
52 TestFullScreenControl tv; |
53 |
53 |
54 char *pass[3]; |
54 char *pass[3]; |
55 pass[0] = argv[0]; |
55 pass[0] = argv[0]; |
56 pass[1] = "-o"; |
56 pass[1] = "-o"; |
57 pass[2] = "c:\\data\\testfullscreencontrol.txt"; |
57 pass[2] = "c:\\data\\testfullscreencontrol.txt"; |
58 |
58 |
59 int res = QTest::qExec(&tv, 3, pass); |
59 int res = QTest::qExec(&tv, 3, pass); |
60 |
60 |
61 return res; |
61 return res; |
62 } |
62 } |
63 |
63 |
64 // --------------------------------------------------------------------------- |
64 // ------------------------------------------------------------------------------------------------- |
65 // init |
65 // init |
66 // --------------------------------------------------------------------------- |
66 // ------------------------------------------------------------------------------------------------- |
67 // |
67 // |
68 void TestFullScreenControl::init() |
68 void TestFullScreenControl::init() |
69 { |
69 { |
70 MPX_ENTER_EXIT(_L("TestFullScreenControl::init()")); |
70 MPX_ENTER_EXIT(_L("TestFullScreenControl::init()")); |
71 } |
71 } |
72 |
72 |
73 // --------------------------------------------------------------------------- |
73 // ------------------------------------------------------------------------------------------------- |
74 // setup |
74 // setup |
75 // --------------------------------------------------------------------------- |
75 // ------------------------------------------------------------------------------------------------- |
76 // |
76 // |
77 void TestFullScreenControl::setup( TVideoPlaybackControls control ) |
77 void TestFullScreenControl::setup( TVideoPlaybackControls control ) |
78 { |
78 { |
79 MPX_ENTER_EXIT(_L("TestFullScreenControl::setup()")); |
79 MPX_ENTER_EXIT(_L("TestFullScreenControl::setup()")); |
80 |
80 |
81 |
81 |
82 mControlsController = new VideoPlaybackControlsController(); |
82 mControlsController = new VideoPlaybackControlsController(); |
83 |
83 |
84 createControl( control ); |
84 createControl( control ); |
85 } |
85 } |
86 |
86 |
87 // --------------------------------------------------------------------------- |
87 // ------------------------------------------------------------------------------------------------- |
88 // createControl |
88 // createControl |
89 // --------------------------------------------------------------------------- |
89 // ------------------------------------------------------------------------------------------------- |
90 // |
90 // |
91 void TestFullScreenControl::createControl( TVideoPlaybackControls control ) |
91 void TestFullScreenControl::createControl( TVideoPlaybackControls control ) |
92 { |
92 { |
93 MPX_ENTER_EXIT(_L("TestFullScreenControl::createControl()")); |
93 MPX_ENTER_EXIT(_L("TestFullScreenControl::createControl()")); |
94 |
94 |
95 switch ( control ) |
95 switch ( control ) |
96 { |
96 { |
97 case EStatusPane: |
97 case EStatusPane: |
98 { |
98 { |
99 mFullScreenControl = new VideoPlaybackFullScreenControl( mControlsController, |
99 mFullScreenControl = new VideoPlaybackFullScreenControl( mControlsController, |
100 control, |
100 control, |
101 NULL, |
101 NULL, |
102 0 ); |
102 0 ); |
103 break; |
103 break; |
104 } |
104 } |
105 case EControlBar: |
105 case EControlBar: |
106 { |
106 { |
107 VideoPlaybackControlBar *controlBar = |
107 VideoPlaybackControlBar *controlBar = |
108 new VideoPlaybackControlBar( mControlsController ); |
108 new VideoPlaybackControlBar( mControlsController ); |
109 |
109 |
110 mFullScreenControl = new VideoPlaybackFullScreenControl( mControlsController, |
110 mFullScreenControl = new VideoPlaybackFullScreenControl( mControlsController, |
111 control, |
111 control, |
112 controlBar, |
112 controlBar, |
113 0 ); |
113 0 ); |
114 |
114 |
115 break; |
115 break; |
116 } |
116 } |
117 case EDetailsViewPlaybackWindow: |
117 case EDetailsViewPlaybackWindow: |
118 { |
118 { |
119 break; |
119 break; |
120 } |
120 } |
121 } |
121 } |
122 } |
122 } |
123 |
123 |
124 // --------------------------------------------------------------------------- |
124 // ------------------------------------------------------------------------------------------------- |
125 // cleanup |
125 // cleanup |
126 // --------------------------------------------------------------------------- |
126 // ------------------------------------------------------------------------------------------------- |
127 // |
127 // |
128 void TestFullScreenControl::cleanup() |
128 void TestFullScreenControl::cleanup() |
129 { |
129 { |
130 MPX_ENTER_EXIT(_L("TestFullScreenControl::cleanup()")); |
130 MPX_ENTER_EXIT(_L("TestFullScreenControl::cleanup()")); |
131 |
131 |
|
132 if ( mFullScreenControl ) |
|
133 { |
|
134 delete mFullScreenControl; |
|
135 mFullScreenControl = NULL; |
|
136 } |
|
137 |
132 if ( mControlsController ) |
138 if ( mControlsController ) |
133 { |
139 { |
134 delete mControlsController; |
140 delete mControlsController; |
135 mControlsController = NULL; |
141 mControlsController = NULL; |
136 } |
142 } |
137 |
143 } |
138 if ( mFullScreenControl ) |
144 |
139 { |
145 // ------------------------------------------------------------------------------------------------- |
140 delete mFullScreenControl; |
|
141 mFullScreenControl = NULL; |
|
142 } |
|
143 } |
|
144 |
|
145 // --------------------------------------------------------------------------- |
|
146 // testControlIndex |
146 // testControlIndex |
147 // --------------------------------------------------------------------------- |
147 // ------------------------------------------------------------------------------------------------- |
148 // |
148 // |
149 void TestFullScreenControl::testControlIndex() |
149 void TestFullScreenControl::testControlIndex() |
150 { |
150 { |
151 MPX_ENTER_EXIT(_L("TestFullScreenControl::testControlIndex()")); |
151 MPX_ENTER_EXIT(_L("TestFullScreenControl::testControlIndex()")); |
152 |
152 |
153 setup( EStatusPane ); |
153 setup( EStatusPane ); |
154 |
154 |
155 QVERIFY( mFullScreenControl->controlIndex() == EStatusPane ); |
155 QVERIFY( mFullScreenControl->controlIndex() == EStatusPane ); |
156 } |
156 |
157 |
157 cleanup(); |
158 // --------------------------------------------------------------------------- |
158 } |
|
159 |
|
160 // ------------------------------------------------------------------------------------------------- |
159 // testDurationChanged |
161 // testDurationChanged |
160 // --------------------------------------------------------------------------- |
162 // ------------------------------------------------------------------------------------------------- |
161 // |
163 // |
162 void TestFullScreenControl::testDurationChanged() |
164 void TestFullScreenControl::testDurationChanged() |
163 { |
165 { |
164 MPX_ENTER_EXIT(_L("TestFullScreenControl::testDurationChanged()")); |
166 MPX_ENTER_EXIT(_L("TestFullScreenControl::testDurationChanged()")); |
165 |
167 |
166 // test for progress bar |
168 // test for progress bar |
167 delete mFullScreenControl; |
169 delete mFullScreenControl; |
168 mFullScreenControl = NULL; |
170 mFullScreenControl = NULL; |
169 setup( EControlBar ); |
171 setup( EControlBar ); |
170 QVERIFY( mFullScreenControl->durationChanged( 100 ) ); |
172 QVERIFY( mFullScreenControl->durationChanged( 100 ) ); |
171 QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mDuration == 100 ); |
173 QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mDuration == 100 ); |
172 |
174 |
173 // test for something other than progress bar |
175 // test for something other than progress bar |
174 delete mFullScreenControl; |
176 delete mFullScreenControl; |
175 mFullScreenControl = NULL; |
177 mFullScreenControl = NULL; |
176 setup( EStatusPane ); |
178 setup( EStatusPane ); |
177 QVERIFY( ! mFullScreenControl->durationChanged( 100 ) ); |
179 QVERIFY( ! mFullScreenControl->durationChanged( 100 ) ); |
178 |
180 |
179 } |
181 cleanup(); |
180 |
182 } |
181 // --------------------------------------------------------------------------- |
183 |
|
184 // ------------------------------------------------------------------------------------------------- |
182 // testPositionChanged |
185 // testPositionChanged |
183 // --------------------------------------------------------------------------- |
186 // ------------------------------------------------------------------------------------------------- |
184 // |
187 // |
185 void TestFullScreenControl::testPositionChanged() |
188 void TestFullScreenControl::testPositionChanged() |
186 { |
189 { |
187 MPX_ENTER_EXIT(_L("TestFullScreenControl::testPositionChanged()")); |
190 MPX_ENTER_EXIT(_L("TestFullScreenControl::testPositionChanged()")); |
188 |
191 |
189 // test for progress bar |
192 // test for progress bar |
190 delete mFullScreenControl; |
193 delete mFullScreenControl; |
191 mFullScreenControl = NULL; |
194 mFullScreenControl = NULL; |
192 setup( EControlBar ); |
195 setup( EControlBar ); |
193 QVERIFY( mFullScreenControl->positionChanged( 100 ) ); |
196 QVERIFY( mFullScreenControl->positionChanged( 100 ) ); |
194 QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mPosition == 100 ); |
197 QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mPosition == 100 ); |
195 |
198 |
196 // test for something other than progress bar |
199 // test for something other than progress bar |
197 delete mFullScreenControl; |
200 delete mFullScreenControl; |
198 mFullScreenControl = NULL; |
201 mFullScreenControl = NULL; |
199 setup( EStatusPane ); |
202 setup( EStatusPane ); |
200 QVERIFY( ! mFullScreenControl->positionChanged( 100 ) ); |
203 QVERIFY( ! mFullScreenControl->positionChanged( 100 ) ); |
201 } |
204 |
202 |
205 cleanup(); |
203 // --------------------------------------------------------------------------- |
206 } |
|
207 |
|
208 // ------------------------------------------------------------------------------------------------- |
204 // testAspectRatioChanged |
209 // testAspectRatioChanged |
205 // --------------------------------------------------------------------------- |
210 // ------------------------------------------------------------------------------------------------- |
206 // |
211 // |
207 void TestFullScreenControl::testAspectRatioChanged() |
212 void TestFullScreenControl::testAspectRatioChanged() |
208 { |
213 { |
209 MPX_ENTER_EXIT(_L("TestFullScreenControl::testAspectRatioChanged()")); |
214 MPX_ENTER_EXIT(_L("TestFullScreenControl::testAspectRatioChanged()")); |
210 |
215 |
211 // test for button bar |
216 setup( EControlBar ); |
212 delete mFullScreenControl; |
|
213 mFullScreenControl = NULL; |
|
214 setup( EControlBar ); |
|
215 QVERIFY( mFullScreenControl->aspectRatioChanged( 3 ) ); // EMMFNatural |
217 QVERIFY( mFullScreenControl->aspectRatioChanged( 3 ) ); // EMMFNatural |
216 QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mAspectRatio == 3 ); |
218 QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mAspectRatio == 3 ); |
217 |
219 |
218 // test for something other than button bar |
220 // test for something other than button bar |
219 delete mFullScreenControl; |
221 if ( mFullScreenControl ) |
220 mFullScreenControl = NULL; |
222 { |
221 setup( EStatusPane ); |
223 delete mFullScreenControl; |
|
224 mFullScreenControl = NULL; |
|
225 } |
|
226 |
|
227 setup( EStatusPane ); |
222 QVERIFY( ! mFullScreenControl->aspectRatioChanged( 3 ) ); // EMMFNatural |
228 QVERIFY( ! mFullScreenControl->aspectRatioChanged( 3 ) ); // EMMFNatural |
223 } |
229 |
224 |
230 cleanup(); |
225 // --------------------------------------------------------------------------- |
231 } |
|
232 |
|
233 // ------------------------------------------------------------------------------------------------- |
226 // testUpdateState |
234 // testUpdateState |
227 // --------------------------------------------------------------------------- |
235 // ------------------------------------------------------------------------------------------------- |
228 // |
236 // |
229 void TestFullScreenControl::testUpdateState() |
237 void TestFullScreenControl::testUpdateState() |
230 { |
238 { |
231 MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateState()")); |
239 MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateState()")); |
232 |
240 |
233 delete mFullScreenControl; |
241 setup( EControlBar ); |
234 mFullScreenControl = NULL; |
242 |
235 setup( EControlBar ); |
243 mFullScreenControl->updateState( EPbStatePaused ); |
236 mFullScreenControl->updateState( EPbStatePaused ); |
244 QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mState == EPbStatePaused ); |
237 QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mState == EPbStatePaused ); |
245 |
238 } |
246 cleanup(); |
239 |
247 } |
240 // --------------------------------------------------------------------------- |
248 |
|
249 // ------------------------------------------------------------------------------------------------- |
241 // testUpdateControlsWithFileDetails |
250 // testUpdateControlsWithFileDetails |
242 // --------------------------------------------------------------------------- |
251 // ------------------------------------------------------------------------------------------------- |
243 // |
252 // |
244 void TestFullScreenControl::testUpdateControlsWithFileDetails() |
253 void TestFullScreenControl::testUpdateControlsWithFileDetails() |
245 { |
254 { |
246 MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateControlsWithFileDetails()")); |
255 MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateControlsWithFileDetails()")); |
247 |
256 |
248 VideoPlaybackViewFileDetails *fileDetails = new VideoPlaybackViewFileDetails(); |
257 VideoPlaybackViewFileDetails *fileDetails = new VideoPlaybackViewFileDetails(); |
249 |
258 |
250 setup( EControlBar ); |
259 setup( EControlBar ); |
251 |
260 |
252 fileDetails->mPausableStream = true; |
261 fileDetails->mPausableStream = true; |
253 |
262 |
254 mFullScreenControl->updateControlsWithFileDetails( fileDetails ); |
263 mFullScreenControl->updateControlsWithFileDetails( fileDetails ); |
255 |
264 |
256 QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mFileDetails->mPausableStream ); |
265 QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mFileDetails->mPausableStream ); |
257 |
266 |
258 if ( fileDetails ) |
267 if ( fileDetails ) |
259 { |
268 { |
260 delete fileDetails; |
269 delete fileDetails; |
261 fileDetails = NULL; |
270 fileDetails = NULL; |
262 } |
271 } |
263 } |
272 |
264 |
273 cleanup(); |
265 // --------------------------------------------------------------------------- |
274 } |
|
275 |
|
276 // ------------------------------------------------------------------------------------------------- |
266 // testUpdateControlProperties |
277 // testUpdateControlProperties |
267 // --------------------------------------------------------------------------- |
278 // ------------------------------------------------------------------------------------------------- |
268 // |
279 // |
269 void TestFullScreenControl::testUpdateControlProperties() |
280 void TestFullScreenControl::testUpdateControlProperties() |
270 { |
281 { |
271 MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateControlProperties()")); |
282 MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateControlProperties()")); |
272 |
283 |
273 setup( EStatusPane ); |
284 setup( EStatusPane ); |
274 |
285 |
275 mFullScreenControl->updateControlProperties( 1 ); |
286 mFullScreenControl->updateControlProperties( 1 ); |
276 |
287 |
277 QVERIFY( mFullScreenControl != NULL ); |
288 QVERIFY( mFullScreenControl != NULL ); |
278 |
289 |
279 QVERIFY( mFullScreenControl->mProperties == 1 ); |
290 QVERIFY( mFullScreenControl->mProperties == 1 ); |
280 } |
291 |
281 |
292 cleanup(); |
|
293 } |
|
294 |
|
295 // ------------------------------------------------------------------------------------------------- |
|
296 // testResetControl |
|
297 // ------------------------------------------------------------------------------------------------- |
|
298 // |
|
299 void TestFullScreenControl::testResetControl() |
|
300 { |
|
301 MPX_ENTER_EXIT(_L("TestFullScreenControl::testResetControl()")); |
|
302 |
|
303 setup( EControlBar ); |
|
304 |
|
305 QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mReset == false ); |
|
306 |
|
307 mFullScreenControl->resetControl(); |
|
308 |
|
309 QVERIFY( mFullScreenControl != NULL ); |
|
310 |
|
311 QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mReset ); |
|
312 |
|
313 cleanup(); |
|
314 } |
|
315 |
282 // End of file |
316 // End of file |