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