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 VideoSortFilterProxyModel
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include <hbapplication.h>
|
|
20 |
#include <hbinstance.h>
|
|
21 |
#include <qdebug>
|
|
22 |
#include <qgraphicswidget>
|
|
23 |
|
|
24 |
#include "mpxvideoplaybackcontrol.hrh"
|
|
25 |
#include "mpxhelixplaybackplugindefs.h"
|
|
26 |
|
|
27 |
#include "testcontrolconfiguration.h"
|
|
28 |
|
|
29 |
#include "mpxvideoplaybackviewfiledetails.h"
|
|
30 |
#include "mpxvideoplaybackcontrolscontroller.h"
|
|
31 |
#include "mpxvideoplaybackdocumentloader.h"
|
|
32 |
|
|
33 |
|
|
34 |
#define private public
|
|
35 |
#include "mpxvideoplaybackcontrolconfiguration.h"
|
|
36 |
#undef private
|
|
37 |
|
|
38 |
|
|
39 |
// ---------------------------------------------------------------------------
|
|
40 |
// main
|
|
41 |
// ---------------------------------------------------------------------------
|
|
42 |
//
|
|
43 |
int main(int argc, char *argv[])
|
|
44 |
{
|
|
45 |
MPX_ENTER_EXIT(_L("TestControlConfiguration::Main()"));
|
|
46 |
|
|
47 |
HbApplication app(argc, argv);
|
|
48 |
HbMainWindow window;
|
|
49 |
|
|
50 |
TestControlConfiguration tv;
|
|
51 |
|
|
52 |
char *pass[3];
|
|
53 |
pass[0] = argv[0];
|
|
54 |
pass[1] = "-o";
|
|
55 |
pass[2] = "c:\\data\\TestControlConfiguration.txt";
|
|
56 |
|
|
57 |
int res = QTest::qExec(&tv, 3, pass);
|
|
58 |
|
|
59 |
return res;
|
|
60 |
}
|
|
61 |
|
|
62 |
// ---------------------------------------------------------------------------
|
|
63 |
// init
|
|
64 |
// ---------------------------------------------------------------------------
|
|
65 |
//
|
|
66 |
void TestControlConfiguration::init()
|
|
67 |
{
|
|
68 |
MPX_ENTER_EXIT(_L("TestControlConfiguration::init()"));
|
|
69 |
}
|
|
70 |
|
|
71 |
// ---------------------------------------------------------------------------
|
|
72 |
// init
|
|
73 |
// ---------------------------------------------------------------------------
|
|
74 |
//
|
|
75 |
void TestControlConfiguration::setup()
|
|
76 |
{
|
|
77 |
MPX_ENTER_EXIT(_L("TestControlConfiguration::setup()"));
|
|
78 |
|
|
79 |
mFileDetails = new QMPXVideoPlaybackViewFileDetails();
|
|
80 |
|
|
81 |
mControlsController = new QMPXVideoPlaybackControlsController( mFileDetails );
|
|
82 |
|
|
83 |
mControlConfig = new QMPXVideoPlaybackControlConfiguration( mControlsController );
|
|
84 |
}
|
|
85 |
|
|
86 |
// ---------------------------------------------------------------------------
|
|
87 |
// cleanup
|
|
88 |
// ---------------------------------------------------------------------------
|
|
89 |
//
|
|
90 |
void TestControlConfiguration::cleanup()
|
|
91 |
{
|
|
92 |
MPX_ENTER_EXIT(_L("TestControlConfiguration::cleanup()"));
|
|
93 |
|
|
94 |
if ( mFileDetails )
|
|
95 |
{
|
|
96 |
delete mFileDetails;
|
|
97 |
mFileDetails = NULL;
|
|
98 |
}
|
|
99 |
|
|
100 |
if ( mControlsController )
|
|
101 |
{
|
|
102 |
delete mControlsController;
|
|
103 |
mControlsController = NULL;
|
|
104 |
}
|
|
105 |
|
|
106 |
if ( mControlConfig )
|
|
107 |
{
|
|
108 |
delete mControlConfig;
|
|
109 |
mControlConfig = NULL;
|
|
110 |
}
|
|
111 |
}
|
|
112 |
|
|
113 |
// ---------------------------------------------------------------------------
|
|
114 |
// testControlList
|
|
115 |
// ---------------------------------------------------------------------------
|
|
116 |
//
|
|
117 |
void TestControlConfiguration::testControlList()
|
|
118 |
{
|
|
119 |
MPX_ENTER_EXIT(_L("TestControlConfiguration::testControlList()"));
|
|
120 |
|
|
121 |
setup();
|
|
122 |
|
|
123 |
QList<TMPXVideoPlaybackControls> controlsList = mControlConfig->controlList();
|
|
124 |
|
|
125 |
QVERIFY( controlsList.contains( EMPXStatusPane ) );
|
|
126 |
|
|
127 |
}
|
|
128 |
|
|
129 |
// ---------------------------------------------------------------------------
|
|
130 |
// testUpdateControlsWithFileDetails
|
|
131 |
// ---------------------------------------------------------------------------
|
|
132 |
//
|
|
133 |
void TestControlConfiguration::testUpdateControlsWithFileDetails()
|
|
134 |
{
|
|
135 |
MPX_ENTER_EXIT(_L("TestControlConfiguration::testUpdateControlsWithFileDetails()"));
|
|
136 |
|
|
137 |
setup();
|
|
138 |
|
|
139 |
// 1. test with mVideoEnabled = false
|
|
140 |
mControlsController->mFileDetails->mVideoEnabled = false;
|
|
141 |
|
|
142 |
mControlConfig->updateControlsWithFileDetails();
|
|
143 |
|
|
144 |
QList<TMPXVideoPlaybackControls> controlsList = mControlConfig->controlList();
|
|
145 |
|
35
|
146 |
QVERIFY( controlsList.contains( EMPXControlBar ) );
|
34
|
147 |
|
|
148 |
// 2. test with mVideoEnabled = true
|
|
149 |
mControlsController->mFileDetails->mVideoEnabled = false;
|
|
150 |
|
|
151 |
mControlConfig->updateControlsWithFileDetails();
|
|
152 |
|
35
|
153 |
QVERIFY( controlsList.contains( EMPXControlBar ) );
|
34
|
154 |
|
|
155 |
QGraphicsWidget *widget =
|
|
156 |
mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) );
|
|
157 |
|
|
158 |
QVERIFY( widget->isVisible() );
|
|
159 |
}
|
|
160 |
|
|
161 |
// ---------------------------------------------------------------------------
|
|
162 |
// testUpdateControlList
|
|
163 |
// ---------------------------------------------------------------------------
|
|
164 |
//
|
|
165 |
void TestControlConfiguration::testUpdateControlList()
|
|
166 |
{
|
|
167 |
MPX_ENTER_EXIT(_L("TestControlConfiguration::testUpdateControlList()"));
|
|
168 |
|
|
169 |
setup();
|
|
170 |
|
|
171 |
// 1. Test for Details View
|
|
172 |
mControlConfig->updateControlList( EMPXControlCmdDetailsViewOpened );
|
|
173 |
|
|
174 |
QList<TMPXVideoPlaybackControls> controlsList = mControlConfig->controlList();
|
|
175 |
|
|
176 |
QVERIFY( controlsList.contains( EMPXFileDetailsWidget ) );
|
|
177 |
|
|
178 |
|
|
179 |
// 2. Test for Fullscreen View
|
|
180 |
mControlConfig->updateControlList( EMPXControlCmdFullScreenViewOpened );
|
|
181 |
|
|
182 |
controlsList = mControlConfig->controlList();
|
|
183 |
|
|
184 |
QVERIFY( ! controlsList.contains( EMPXFileDetailsWidget ) );
|
|
185 |
|
|
186 |
|
|
187 |
// 3. Test for Audio Only View
|
|
188 |
mControlConfig->updateControlList( EMPXControlCmdAudionOnlyViewOpened );
|
|
189 |
|
|
190 |
controlsList = mControlConfig->controlList();
|
|
191 |
|
|
192 |
QVERIFY( ! controlsList.contains( EMPXDetailsViewPlaybackWindow ) );
|
|
193 |
QVERIFY( controlsList.contains( EMPXIndicatorBitmap ) );
|
|
194 |
}
|
|
195 |
|
|
196 |
// End of file
|