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