35
|
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 TestMPXVideoPlaybackControlBar
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
37
|
18 |
// Version : %version: 2 %
|
35
|
19 |
|
|
20 |
|
|
21 |
#include <qdebug>
|
|
22 |
#include <hbmainwindow.h>
|
|
23 |
#include <hbapplication.h>
|
|
24 |
|
37
|
25 |
#include "mpxvideoplaybacktoolbar.h"
|
35
|
26 |
#include "mpxvideoplaybackprogressbar.h"
|
|
27 |
#include "testmpxvideoplaybackcontrolbar.h"
|
|
28 |
#include "mpxvideoplaybackviewfiledetails.h"
|
|
29 |
#include "mpxvideoplaybackcontrolscontroller.h"
|
|
30 |
|
|
31 |
#define private public
|
|
32 |
#include "mpxvideoplaybackcontrolbar.h"
|
|
33 |
#undef private
|
|
34 |
|
|
35 |
// ---------------------------------------------------------------------------
|
|
36 |
// main
|
|
37 |
// ---------------------------------------------------------------------------
|
|
38 |
//
|
|
39 |
int main(int argc, char *argv[])
|
|
40 |
{
|
|
41 |
MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlBar::Main()"));
|
|
42 |
|
|
43 |
HbApplication app(argc, argv);
|
|
44 |
HbMainWindow window;
|
|
45 |
|
|
46 |
TestMPXVideoPlaybackControlBar tv;
|
|
47 |
|
|
48 |
char *pass[3];
|
|
49 |
pass[0] = argv[0];
|
|
50 |
pass[1] = "-o";
|
|
51 |
pass[2] = "c:\\data\\testmpxvideoplaybackcontrolbar.txt";
|
|
52 |
|
|
53 |
int res = QTest::qExec(&tv, 3, pass);
|
|
54 |
|
|
55 |
return res;
|
|
56 |
}
|
|
57 |
|
|
58 |
|
|
59 |
// ---------------------------------------------------------------------------
|
|
60 |
// init
|
|
61 |
// ---------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
void TestMPXVideoPlaybackControlBar::init()
|
|
64 |
{
|
|
65 |
MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlBar::init()"));
|
|
66 |
|
|
67 |
mController = new QMPXVideoPlaybackControlsController();
|
|
68 |
mControlBar = new QMPXVideoPlaybackControlBar( mController );
|
|
69 |
|
|
70 |
mControlBar->initialize();
|
|
71 |
}
|
|
72 |
|
|
73 |
// ---------------------------------------------------------------------------
|
|
74 |
// cleanup
|
|
75 |
// ---------------------------------------------------------------------------
|
|
76 |
//
|
|
77 |
void TestMPXVideoPlaybackControlBar::cleanup()
|
|
78 |
{
|
|
79 |
MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlBar::cleanup()"));
|
|
80 |
|
|
81 |
if ( mController )
|
|
82 |
{
|
|
83 |
delete mController;
|
|
84 |
mController = NULL;
|
|
85 |
}
|
|
86 |
|
|
87 |
if ( mControlBar )
|
|
88 |
{
|
|
89 |
delete mControlBar;
|
|
90 |
mControlBar = NULL;
|
|
91 |
}
|
|
92 |
}
|
|
93 |
|
|
94 |
// ---------------------------------------------------------------------------
|
|
95 |
// testupdateState
|
|
96 |
// ---------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
void TestMPXVideoPlaybackControlBar::testupdateState()
|
|
99 |
{
|
|
100 |
MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlBar::testupdateState()"));
|
|
101 |
|
|
102 |
init();
|
|
103 |
|
|
104 |
TMPXPlaybackState state = EPbStatePlaying;
|
|
105 |
mControlBar->updateState( state );
|
37
|
106 |
QVERIFY( mControlBar->mToolBar->mState == EPbStatePlaying );
|
35
|
107 |
|
|
108 |
state = EPbStatePaused;
|
|
109 |
mControlBar->updateState( state );
|
37
|
110 |
QVERIFY( mControlBar->mToolBar->mState == EPbStatePaused );
|
35
|
111 |
|
|
112 |
cleanup();
|
|
113 |
}
|
|
114 |
|
|
115 |
// ---------------------------------------------------------------------------
|
|
116 |
// testaspectRatioChanged
|
|
117 |
// ---------------------------------------------------------------------------
|
|
118 |
//
|
|
119 |
void TestMPXVideoPlaybackControlBar::testaspectRatioChanged()
|
|
120 |
{
|
|
121 |
MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlBar::testaspectRatioChanged()"));
|
|
122 |
|
|
123 |
init();
|
|
124 |
|
|
125 |
int aspectRatio = 1;
|
|
126 |
mControlBar->aspectRatioChanged( aspectRatio );
|
37
|
127 |
QVERIFY( mControlBar->mToolBar->mAspectRatio == aspectRatio );
|
35
|
128 |
|
|
129 |
cleanup();
|
|
130 |
}
|
|
131 |
|
|
132 |
// ---------------------------------------------------------------------------
|
|
133 |
// testUpdateWithFileDetails
|
|
134 |
// ---------------------------------------------------------------------------
|
|
135 |
//
|
|
136 |
void TestMPXVideoPlaybackControlBar::testUpdateWithFileDetails()
|
|
137 |
{
|
|
138 |
MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlBar::testUpdateWithFileDetails()"));
|
|
139 |
|
|
140 |
init();
|
|
141 |
|
|
142 |
QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
|
|
143 |
details->mSeekable = false;
|
|
144 |
details->mVideoEnabled = true;
|
|
145 |
|
|
146 |
mControlBar->updateWithFileDetails( details );
|
|
147 |
|
37
|
148 |
QVERIFY( mControlBar->mToolBar->mFileDetails->mSeekable == details->mSeekable );
|
35
|
149 |
QVERIFY( mControlBar->mProgressBar->mFileDetails->mVideoEnabled == details->mVideoEnabled );
|
|
150 |
|
|
151 |
cleanup();
|
|
152 |
}
|
|
153 |
|
|
154 |
// ---------------------------------------------------------------------------
|
|
155 |
// testSetVisibleToControlBar
|
|
156 |
// ---------------------------------------------------------------------------
|
|
157 |
//
|
|
158 |
void TestMPXVideoPlaybackControlBar::testSetVisibleToControlBar()
|
|
159 |
{
|
|
160 |
MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlBar::testSetVisibleToControlBar()"));
|
|
161 |
|
|
162 |
init();
|
|
163 |
|
|
164 |
//
|
|
165 |
// Make visible
|
|
166 |
//
|
|
167 |
mControlBar->setVisible( false );
|
|
168 |
mControlBar->setVisibleToControlBar( true );
|
|
169 |
QVERIFY( mControlBar->isVisible() == true );
|
|
170 |
|
|
171 |
//
|
|
172 |
// Make invisible
|
|
173 |
//
|
|
174 |
mControlBar->setVisible( true );
|
|
175 |
mControlBar->setVisibleToControlBar( false );
|
|
176 |
QVERIFY( mControlBar->isVisible() == false );
|
|
177 |
|
|
178 |
cleanup();
|
|
179 |
}
|
|
180 |
|
|
181 |
// ---------------------------------------------------------------------------
|
|
182 |
// testDurationChanged
|
|
183 |
// ---------------------------------------------------------------------------
|
|
184 |
//
|
|
185 |
void TestMPXVideoPlaybackControlBar::testDurationChanged()
|
|
186 |
{
|
|
187 |
MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlBar::testDurationChanged()"));
|
|
188 |
|
|
189 |
init();
|
|
190 |
|
|
191 |
int duration = 12345;
|
|
192 |
mControlBar->durationChanged( duration );
|
|
193 |
QVERIFY( mControlBar->mProgressBar->mDuration == duration );
|
|
194 |
|
|
195 |
cleanup();
|
|
196 |
}
|
|
197 |
|
|
198 |
// ---------------------------------------------------------------------------
|
|
199 |
// testPositionChanged
|
|
200 |
// ---------------------------------------------------------------------------
|
|
201 |
//
|
|
202 |
void TestMPXVideoPlaybackControlBar::testPositionChanged()
|
|
203 |
{
|
|
204 |
MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlBar::testPositionChanged()"));
|
|
205 |
|
|
206 |
init();
|
|
207 |
|
|
208 |
int position = 54321;
|
|
209 |
mControlBar->positionChanged( position );
|
|
210 |
QVERIFY( mControlBar->mProgressBar->mPosition == position );
|
|
211 |
|
|
212 |
cleanup();
|
|
213 |
}
|
|
214 |
|
|
215 |
// End of file
|