58 int res = QTest::qExec(&tv, 3, pass); |
58 int res = QTest::qExec(&tv, 3, pass); |
59 |
59 |
60 return res; |
60 return res; |
61 } |
61 } |
62 |
62 |
63 // --------------------------------------------------------------------------- |
63 // ------------------------------------------------------------------------------------------------- |
64 // init |
64 // init |
65 // --------------------------------------------------------------------------- |
65 // ------------------------------------------------------------------------------------------------- |
66 // |
66 // |
67 void TestControlConfiguration::init() |
67 void TestControlConfiguration::init() |
68 { |
68 { |
69 MPX_ENTER_EXIT(_L("TestControlConfiguration::init()")); |
69 MPX_ENTER_EXIT(_L("TestControlConfiguration::init()")); |
70 } |
70 } |
71 |
71 |
72 // --------------------------------------------------------------------------- |
72 // ------------------------------------------------------------------------------------------------- |
73 // init |
73 // setup |
74 // --------------------------------------------------------------------------- |
74 // ------------------------------------------------------------------------------------------------- |
75 // |
75 // |
76 void TestControlConfiguration::setup() |
76 void TestControlConfiguration::setup() |
77 { |
77 { |
78 MPX_ENTER_EXIT(_L("TestControlConfiguration::setup()")); |
78 MPX_ENTER_EXIT(_L("TestControlConfiguration::setup()")); |
79 |
79 |
109 delete mControlConfig; |
109 delete mControlConfig; |
110 mControlConfig = NULL; |
110 mControlConfig = NULL; |
111 } |
111 } |
112 } |
112 } |
113 |
113 |
114 // --------------------------------------------------------------------------- |
114 // ------------------------------------------------------------------------------------------------- |
115 // testControlList |
115 // testControlList |
116 // --------------------------------------------------------------------------- |
116 // ------------------------------------------------------------------------------------------------- |
117 // |
117 // |
118 void TestControlConfiguration::testControlList() |
118 void TestControlConfiguration::testControlList() |
119 { |
119 { |
120 MPX_ENTER_EXIT(_L("TestControlConfiguration::testControlList()")); |
120 MPX_ENTER_EXIT(_L("TestControlConfiguration::testControlList()")); |
121 |
121 |
122 setup(); |
122 setup(); |
|
123 |
|
124 QSignalSpy spy( mControlConfig, SIGNAL( controlListUpdated() ) ); |
|
125 QCOMPARE( spy.count(), 0 ); |
123 |
126 |
124 // |
127 // |
125 // Streaming case |
128 // Streaming case |
126 // |
129 // |
127 mFileDetails->mPlaybackMode = EMPXVideoStreaming; |
130 mFileDetails->mPlaybackMode = EMPXVideoStreaming; |
148 |
151 |
149 QVERIFY( controlsList.contains( EStatusPane ) ); |
152 QVERIFY( controlsList.contains( EStatusPane ) ); |
150 QVERIFY( controlsList.contains( ERealLogoBitmap ) ); |
153 QVERIFY( controlsList.contains( ERealLogoBitmap ) ); |
151 QVERIFY( ! controlsList.contains( EBufferingAnimation ) ); |
154 QVERIFY( ! controlsList.contains( EBufferingAnimation ) ); |
152 |
155 |
153 cleanup(); |
156 QCOMPARE( spy.count(), 2 ); |
154 |
157 |
155 // |
158 // |
156 // local + non RN |
159 // local + non RN |
157 // |
160 // |
158 setup(); |
161 mControlConfig->mControlsList.clear(); |
159 |
162 |
160 mFileDetails->mPlaybackMode = EMPXVideoLocal; |
163 mFileDetails->mPlaybackMode = EMPXVideoLocal; |
161 mFileDetails->mRNFormat = false; |
164 mFileDetails->mRNFormat = false; |
162 |
165 |
163 mControlConfig->createControlList(); |
166 mControlConfig->createControlList(); |
164 controlsList = mControlConfig->controlList(); |
167 controlsList = mControlConfig->controlList(); |
165 |
168 |
166 QVERIFY( controlsList.contains( EStatusPane ) ); |
169 QVERIFY( controlsList.contains( EStatusPane ) ); |
167 QVERIFY( ! controlsList.contains( ERealLogoBitmap ) ); |
170 QVERIFY( ! controlsList.contains( ERealLogoBitmap ) ); |
168 QVERIFY( ! controlsList.contains( EBufferingAnimation ) ); |
171 QVERIFY( ! controlsList.contains( EBufferingAnimation ) ); |
|
172 QCOMPARE( spy.count(), 2 ); |
|
173 |
|
174 spy.clear(); |
169 |
175 |
170 cleanup(); |
176 cleanup(); |
171 } |
177 } |
172 |
178 |
173 // --------------------------------------------------------------------------- |
179 // ------------------------------------------------------------------------------------------------- |
174 // testUpdateControlsWithFileDetails |
180 // testUpdateControlsWithFileDetails |
175 // --------------------------------------------------------------------------- |
181 // ------------------------------------------------------------------------------------------------- |
176 // |
182 // |
177 void TestControlConfiguration::testUpdateControlsWithFileDetails() |
183 void TestControlConfiguration::testUpdateControlsWithFileDetails() |
178 { |
184 { |
179 MPX_ENTER_EXIT(_L("TestControlConfiguration::testUpdateControlsWithFileDetails()")); |
185 MPX_ENTER_EXIT(_L("TestControlConfiguration::testUpdateControlsWithFileDetails()")); |
180 |
186 |
181 setup(); |
187 setup(); |
182 mControlConfig->createControlList(); |
188 mControlConfig->createControlList(); |
183 |
189 |
184 // |
190 QSignalSpy spy( mControlConfig, SIGNAL( controlListUpdated() ) ); |
185 // 1. test with mVideoEnabled = false |
191 QCOMPARE( spy.count(), 0 ); |
186 // |
|
187 mControlsController->mFileDetails->mVideoEnabled = false; |
|
188 |
192 |
189 mControlConfig->updateControlsWithFileDetails(); |
193 mControlConfig->updateControlsWithFileDetails(); |
190 |
194 |
191 QList<TVideoPlaybackControls> controlsList = mControlConfig->controlList(); |
195 QList<TVideoPlaybackControls> controlsList = mControlConfig->controlList(); |
192 |
196 |
193 QVERIFY( controlsList.contains( EControlBar ) ); |
197 QVERIFY( controlsList.contains( EControlBar ) ); |
194 |
198 QCOMPARE( spy.count(), 1 ); |
195 // |
199 |
196 // 2. test with mVideoEnabled = true |
200 spy.clear(); |
197 // |
|
198 mControlsController->mFileDetails->mVideoEnabled = false; |
|
199 |
|
200 mControlConfig->updateControlsWithFileDetails(); |
|
201 |
|
202 QVERIFY( controlsList.contains( EControlBar ) ); |
|
203 |
|
204 QGraphicsWidget *widget = |
|
205 mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) ); |
|
206 |
|
207 QVERIFY( widget->isVisible() ); |
|
208 |
201 |
209 cleanup(); |
202 cleanup(); |
210 } |
203 } |
211 |
204 |
212 // --------------------------------------------------------------------------- |
205 // ------------------------------------------------------------------------------------------------- |
213 // testUpdateControlList |
206 // testUpdateControlList |
214 // --------------------------------------------------------------------------- |
207 // ------------------------------------------------------------------------------------------------- |
215 // |
208 // |
216 void TestControlConfiguration::testUpdateControlList() |
209 void TestControlConfiguration::testUpdateControlList() |
217 { |
210 { |
218 MPX_ENTER_EXIT(_L("TestControlConfiguration::testUpdateControlList()")); |
211 MPX_ENTER_EXIT(_L("TestControlConfiguration::testUpdateControlList()")); |
219 |
212 |
220 setup(); |
213 setup(); |
|
214 |
|
215 QSignalSpy spy( mControlConfig, SIGNAL( controlListUpdated() ) ); |
|
216 QCOMPARE( spy.count(), 0 ); |
|
217 |
221 mControlConfig->createControlList(); |
218 mControlConfig->createControlList(); |
222 |
219 |
223 QGraphicsWidget *widget = |
220 QGraphicsWidget *widget = |
224 mControlConfig->mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) ); |
221 mControlConfig->mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) ); |
225 // |
222 // |
265 |
265 |
266 QVERIFY( ! widget->isVisible() ); |
266 QVERIFY( ! widget->isVisible() ); |
267 QVERIFY( ! controlsList.contains( EDetailsViewPlaybackWindow ) ); |
267 QVERIFY( ! controlsList.contains( EDetailsViewPlaybackWindow ) ); |
268 QVERIFY( controlsList.contains( EIndicatorBitmap ) ); |
268 QVERIFY( controlsList.contains( EIndicatorBitmap ) ); |
269 QVERIFY( controlsList.contains( EFileDetailsWidget ) ); |
269 QVERIFY( controlsList.contains( EFileDetailsWidget ) ); |
|
270 QCOMPARE( spy.count(), 4 ); |
270 |
271 |
271 // |
272 // |
272 // 4. RN log gets removed |
273 // 4. RN log gets removed |
273 // |
274 // |
274 mControlConfig->updateControlList( EControlCmdAudionOnlyViewOpened ); |
275 mControlConfig->updateControlList( EControlCmdAudionOnlyViewOpened ); |
275 controlsList = mControlConfig->controlList(); |
276 controlsList = mControlConfig->controlList(); |
276 |
277 |
277 QVERIFY( ! controlsList.contains( ERealLogoBitmap ) ); |
278 QVERIFY( ! controlsList.contains( ERealLogoBitmap ) ); |
|
279 QCOMPARE( spy.count(), 5 ); |
278 |
280 |
279 // |
281 // |
280 // 5. Surface attached |
282 // 5. Surface attached |
281 // |
283 // |
282 mControlConfig->updateControlList( EControlCmdSurfaceAttached ); |
284 mControlConfig->updateControlList( EControlCmdSurfaceAttached ); |
283 controlsList = mControlConfig->controlList(); |
285 controlsList = mControlConfig->controlList(); |
284 |
286 |
285 QVERIFY( widget->isVisible() ); |
287 QVERIFY( widget->isVisible() ); |
|
288 QCOMPARE( spy.count(), 5 ); |
286 |
289 |
287 // |
290 // |
288 // 6. Surface detached |
291 // 6. Surface detached |
289 // |
292 // |
290 mControlConfig->updateControlList( EControlCmdSurfaceDetached ); |
293 mControlConfig->updateControlList( EControlCmdSurfaceDetached ); |
291 controlsList = mControlConfig->controlList(); |
294 controlsList = mControlConfig->controlList(); |
292 |
295 |
293 QVERIFY( ! widget->isVisible() ); |
296 QVERIFY( ! widget->isVisible() ); |
|
297 QCOMPARE( spy.count(), 5 ); |
|
298 |
|
299 spy.clear(); |
|
300 |
294 cleanup(); |
301 cleanup(); |
295 } |
302 } |
296 |
303 |
297 // End of file |
304 // End of file |