34
|
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 QMPXVideoPlaybackFullScreenControl
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
36
|
18 |
// Version : %version: 3 %
|
34
|
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 "mpxvideoplaybackviewfiledetails.h"
|
|
30 |
#include "mpxvideoplaybackcontrolscontroller.h"
|
35
|
31 |
#include "mpxvideoplaybackcontrolbar.h"
|
34
|
32 |
|
|
33 |
|
|
34 |
#define private public
|
|
35 |
#define protected public
|
|
36 |
#include "mpxvideoplaybackfullscreencontrol.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(TMPXVideoPlaybackControls control)
|
|
78 |
{
|
|
79 |
MPX_ENTER_EXIT(_L("TestFullScreenControl::setup()"));
|
|
80 |
|
36
|
81 |
|
|
82 |
mControlsController = new QMPXVideoPlaybackControlsController();
|
34
|
83 |
|
|
84 |
createControl( control );
|
|
85 |
}
|
|
86 |
|
|
87 |
// ---------------------------------------------------------------------------
|
|
88 |
// createControl
|
|
89 |
// ---------------------------------------------------------------------------
|
|
90 |
//
|
|
91 |
void TestFullScreenControl::createControl(TMPXVideoPlaybackControls control)
|
|
92 |
{
|
|
93 |
MPX_ENTER_EXIT(_L("TestFullScreenControl::createControl()"));
|
|
94 |
|
|
95 |
switch ( control )
|
|
96 |
{
|
|
97 |
case EMPXStatusPane:
|
|
98 |
{
|
|
99 |
mFullScreenControl = new QMPXVideoPlaybackFullScreenControl( mControlsController,
|
|
100 |
control,
|
|
101 |
NULL,
|
|
102 |
0 );
|
|
103 |
break;
|
|
104 |
}
|
35
|
105 |
case EMPXControlBar:
|
34
|
106 |
{
|
35
|
107 |
QMPXVideoPlaybackControlBar *controlBar =
|
|
108 |
new QMPXVideoPlaybackControlBar( mControlsController );
|
34
|
109 |
|
|
110 |
mFullScreenControl = new QMPXVideoPlaybackFullScreenControl( mControlsController,
|
|
111 |
control,
|
35
|
112 |
controlBar,
|
34
|
113 |
0 );
|
|
114 |
|
|
115 |
break;
|
|
116 |
}
|
|
117 |
case EMPXDetailsViewPlaybackWindow:
|
|
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( EMPXStatusPane );
|
|
154 |
|
|
155 |
QVERIFY( mFullScreenControl->controlIndex() == EMPXStatusPane );
|
|
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;
|
35
|
169 |
setup( EMPXControlBar );
|
34
|
170 |
QVERIFY( mFullScreenControl->durationChanged( 100 ) );
|
35
|
171 |
QVERIFY( static_cast<QMPXVideoPlaybackControlBar*>(mFullScreenControl->mControl)->mDuration == 100 );
|
34
|
172 |
|
|
173 |
// test for something other than progress bar
|
|
174 |
delete mFullScreenControl;
|
|
175 |
mFullScreenControl = NULL;
|
|
176 |
setup( EMPXStatusPane );
|
|
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;
|
35
|
192 |
setup( EMPXControlBar );
|
34
|
193 |
QVERIFY( mFullScreenControl->positionChanged( 100 ) );
|
35
|
194 |
QVERIFY( static_cast<QMPXVideoPlaybackControlBar*>(mFullScreenControl->mControl)->mPosition == 100 );
|
34
|
195 |
|
|
196 |
// test for something other than progress bar
|
|
197 |
delete mFullScreenControl;
|
|
198 |
mFullScreenControl = NULL;
|
|
199 |
setup( EMPXStatusPane );
|
|
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;
|
35
|
214 |
setup( EMPXControlBar );
|
34
|
215 |
QVERIFY( mFullScreenControl->aspectRatioChanged( 3 ) ); // EMMFNatural
|
35
|
216 |
QVERIFY( static_cast<QMPXVideoPlaybackControlBar*>(mFullScreenControl->mControl)->mAspectRatio == 3 );
|
34
|
217 |
|
|
218 |
// test for something other than button bar
|
|
219 |
delete mFullScreenControl;
|
|
220 |
mFullScreenControl = NULL;
|
|
221 |
setup( EMPXStatusPane );
|
|
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;
|
35
|
235 |
setup( EMPXControlBar );
|
34
|
236 |
mFullScreenControl->updateState( EPbStatePaused );
|
35
|
237 |
QVERIFY( static_cast<QMPXVideoPlaybackControlBar*>(mFullScreenControl->mControl)->mState == EPbStatePaused );
|
34
|
238 |
}
|
|
239 |
|
|
240 |
// ---------------------------------------------------------------------------
|
|
241 |
// testUpdateControlsWithFileDetails
|
|
242 |
// ---------------------------------------------------------------------------
|
|
243 |
//
|
|
244 |
void TestFullScreenControl::testUpdateControlsWithFileDetails()
|
|
245 |
{
|
|
246 |
MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateControlsWithFileDetails()"));
|
|
247 |
|
36
|
248 |
QMPXVideoPlaybackViewFileDetails *fileDetails = new QMPXVideoPlaybackViewFileDetails();
|
|
249 |
|
35
|
250 |
setup( EMPXControlBar );
|
34
|
251 |
|
36
|
252 |
fileDetails->mPausableStream = true;
|
34
|
253 |
|
36
|
254 |
mFullScreenControl->updateControlsWithFileDetails( fileDetails );
|
34
|
255 |
|
35
|
256 |
QVERIFY( static_cast<QMPXVideoPlaybackControlBar*>(mFullScreenControl->mControl)->mFileDetails->mPausableStream );
|
36
|
257 |
|
|
258 |
if ( fileDetails )
|
|
259 |
{
|
|
260 |
delete fileDetails;
|
|
261 |
fileDetails = NULL;
|
|
262 |
}
|
34
|
263 |
}
|
|
264 |
|
|
265 |
// ---------------------------------------------------------------------------
|
|
266 |
// testUpdateControlProperties
|
|
267 |
// ---------------------------------------------------------------------------
|
|
268 |
//
|
|
269 |
void TestFullScreenControl::testUpdateControlProperties()
|
|
270 |
{
|
|
271 |
MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateControlProperties()"));
|
|
272 |
|
|
273 |
setup(EMPXStatusPane);
|
|
274 |
|
|
275 |
mFullScreenControl->updateControlProperties( 1 );
|
|
276 |
|
|
277 |
QVERIFY( mFullScreenControl != NULL );
|
|
278 |
|
|
279 |
QVERIFY( mFullScreenControl->mProperties == 1 );
|
35
|
280 |
}
|
34
|
281 |
|
|
282 |
// End of file
|