30
|
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:
|
|
15 |
* Control Panel WLAN AP plugin unit testing.
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <HbApplication>
|
|
19 |
#include <HbMainWindow>
|
|
20 |
#include <HbView>
|
|
21 |
#include <HbDialog>
|
|
22 |
#include <HbRadioButtonList>
|
|
23 |
#include <HbAction>
|
|
24 |
#include <HbDataForm>
|
|
25 |
#include <HbDataFormModel>
|
|
26 |
#include <HbDataFormModelItem>
|
|
27 |
#include <QtTest/QtTest>
|
|
28 |
#include <cmmanager_shim.h>
|
|
29 |
#include <cmconnectionmethod_shim.h>
|
|
30 |
#include <cpplugininterface.h>
|
|
31 |
#include <cppluginutility.h>
|
|
32 |
#include <cpitemdatahelper.h>
|
|
33 |
#include <cpsettingformitemdata.h>
|
|
34 |
|
|
35 |
//#include "cmapplsettingsui_p.h"
|
|
36 |
//#include "cmradiodialog.h"
|
|
37 |
//#include "cpdestinationplugin.h"
|
|
38 |
|
|
39 |
#include "hbautotest.h"
|
|
40 |
#include "testcpdestinationplugin.h"
|
|
41 |
|
|
42 |
// -----------------------------------------------------------------------------
|
|
43 |
// STATIC TEST DATA
|
|
44 |
// -----------------------------------------------------------------------------
|
|
45 |
|
|
46 |
static const QString pluginDir =
|
|
47 |
"\\resource\\qt\\plugins\\controlpanel";
|
|
48 |
|
|
49 |
static const QString pluginName = "cpdestinationplugin.dll";
|
|
50 |
|
|
51 |
// Time to wait before continuing after an UI step
|
|
52 |
static const int waitTime = 10;
|
|
53 |
|
|
54 |
static const QString navigationButton = "HbNavigationButton";
|
|
55 |
|
|
56 |
// UI coordinates
|
|
57 |
static const QPoint destinationGroup(175,30);
|
|
58 |
static const QPoint internetDestination(175,100);
|
|
59 |
static const QPoint internetFirstAp(175,130);
|
|
60 |
static const QPoint internetFirstApMove(175,160);
|
|
61 |
static const QPoint internetFirstApDelete(175,210);
|
|
62 |
static const QPoint internetFirstApShare(175,260);
|
|
63 |
|
|
64 |
static const QPoint deleteDialogOk(100,300);
|
|
65 |
|
|
66 |
static const QPoint tbButton(175,550);
|
|
67 |
static const QPoint arrangeFirstAp(175,30);
|
|
68 |
static const QPoint arrangeDragEnd(175,140);
|
|
69 |
|
|
70 |
static const QPoint uncatDestination(175,455);
|
|
71 |
static const QPoint uncatAp(175,120);
|
|
72 |
static const QPoint uncatMenuMove(175,140);
|
|
73 |
static const QPoint uncatMenuDelete(175,180);
|
|
74 |
|
|
75 |
static const QPoint destDialogOk(100,370);
|
|
76 |
static const QPoint destDialogSecond(100,255);
|
|
77 |
static const QPoint destDialogThird(100,315);
|
|
78 |
static const QPoint destDialogNewDest(100,345);
|
|
79 |
|
|
80 |
static const QPoint addDestination(175,410);
|
|
81 |
static const QPoint addDialog(175,235);
|
|
82 |
static const QPoint addDialogOk(100,300);
|
|
83 |
static const QPoint newDestinationRename(175,445);
|
|
84 |
static const QPoint newDestinationDelete(175,490);
|
|
85 |
|
|
86 |
static const QPoint addDialogKb(175,155);
|
|
87 |
static const QPoint addDialogOkKb(100,225);
|
|
88 |
|
|
89 |
static const QPoint secondDestination(175,195);
|
|
90 |
static const QPoint thirdDestination(175,275);
|
|
91 |
static const QPoint fourthDestination(175,355);
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
#if 0
|
|
96 |
// Destination list item for Connection Method selection
|
|
97 |
static const QString dedicatedAccessPoint = "Dedicated access point";
|
|
98 |
|
|
99 |
static const QStringList allDestinations = QStringList() <<
|
|
100 |
"Internet" <<
|
|
101 |
"My Snap" <<
|
|
102 |
dedicatedAccessPoint;
|
|
103 |
|
|
104 |
static const QStringList allConnectionMethods = QStringList()
|
|
105 |
<< "Home WLAN"
|
|
106 |
<< "packet data 1"
|
|
107 |
<< "packet data 2"
|
|
108 |
<< "packet data 3"
|
|
109 |
<< "Streaming"
|
|
110 |
<< "WLAN IAP 1"
|
|
111 |
<< "WLAN IAP 2"
|
|
112 |
<< "WLAN IAP 3";
|
|
113 |
|
|
114 |
static const QStringList gprsConnectionMethods = QStringList()
|
|
115 |
<< "packet data 1"
|
|
116 |
<< "packet data 2"
|
|
117 |
<< "packet data 3"
|
|
118 |
<< "Streaming";
|
|
119 |
|
|
120 |
static const QStringList wlanConnectionMethods = QStringList()
|
|
121 |
<< "Home WLAN"
|
|
122 |
<< "WLAN IAP 1"
|
|
123 |
<< "WLAN IAP 2"
|
|
124 |
<< "WLAN IAP 3";
|
|
125 |
#endif
|
|
126 |
|
|
127 |
// -----------------------------------------------------------------------------
|
|
128 |
// FRAMEWORK FUNCTIONS
|
|
129 |
// -----------------------------------------------------------------------------
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Test main function. Runs all test cases.
|
|
133 |
*/
|
|
134 |
#ifndef TESTCMAPPLSETTINGSUI_NO_OUTPUT_REDIRECT
|
|
135 |
int main(int argc, char *argv[])
|
|
136 |
{
|
|
137 |
HbApplication app(argc, argv);
|
|
138 |
app.setApplicationName("TestCpDestinationPlugin");
|
|
139 |
|
|
140 |
char *pass[3];
|
|
141 |
pass[0] = argv[0];
|
|
142 |
pass[1] = "-o";
|
|
143 |
pass[2] = "c:\\data\\TestCpDestinationPlugin.txt";
|
|
144 |
|
|
145 |
TestCpDestinationPlugin tc;
|
|
146 |
int res = QTest::qExec(&tc, 3, pass);
|
|
147 |
|
|
148 |
return res;
|
|
149 |
}
|
|
150 |
#else
|
|
151 |
QTEST_MAIN(TestCpDestinationPlugin)
|
|
152 |
#endif
|
|
153 |
|
|
154 |
/**
|
|
155 |
* This function is be called before the first test case is executed.
|
|
156 |
*/
|
|
157 |
void TestCpDestinationPlugin::initTestCase()
|
|
158 |
{
|
|
159 |
mMainWindow = new HbAutoTestMainWindow;
|
|
160 |
mMainWindow->show();
|
|
161 |
|
|
162 |
// Load plugin
|
|
163 |
QDir dir(pluginDir);
|
|
164 |
QPluginLoader loader(dir.absoluteFilePath(pluginName));
|
|
165 |
mPlugin = QSharedPointer<CpPluginInterface>
|
|
166 |
(qobject_cast<CpPluginInterface *>(loader.instance()));
|
|
167 |
//QVERIFY(mPlugin != NULL);
|
|
168 |
|
|
169 |
|
|
170 |
// Create destinations view
|
|
171 |
subCreateSettingsView();
|
|
172 |
|
|
173 |
HbAutoTest::mouseClick(mMainWindow, mView, destinationGroup, waitTime);
|
|
174 |
QTest::qWait(200);
|
|
175 |
}
|
|
176 |
|
|
177 |
/**
|
|
178 |
* This function is be called after the last test case was executed.
|
|
179 |
*/
|
|
180 |
void TestCpDestinationPlugin::cleanupTestCase()
|
|
181 |
{
|
|
182 |
delete mMainWindow;
|
|
183 |
mMainWindow = 0;
|
|
184 |
}
|
|
185 |
|
|
186 |
/**
|
|
187 |
* This function is be called before each test case is executed.
|
|
188 |
*/
|
|
189 |
void TestCpDestinationPlugin::init()
|
|
190 |
{
|
|
191 |
// Expand settings group
|
|
192 |
// mTestView->mForm->setExpanded(
|
|
193 |
// mTestView->mModel->indexFromItem(mTestView->mApSettingsGroupItem),
|
|
194 |
// true);
|
|
195 |
}
|
|
196 |
|
|
197 |
/**
|
|
198 |
* This function is be called after each test case is executed.
|
|
199 |
*/
|
|
200 |
void TestCpDestinationPlugin::cleanup()
|
|
201 |
{
|
|
202 |
|
|
203 |
}
|
|
204 |
|
|
205 |
// -----------------------------------------------------------------------------
|
|
206 |
// TEST CASES
|
|
207 |
// -----------------------------------------------------------------------------
|
|
208 |
void TestCpDestinationPlugin::tcArrangeAps()
|
|
209 |
{
|
|
210 |
// Open Internet destination
|
|
211 |
HbAutoTest::mouseClick(mMainWindow, mView, internetDestination, waitTime);
|
|
212 |
QTest::qWait(500);
|
|
213 |
|
|
214 |
// Activate arrange mode
|
|
215 |
HbAutoTest::mouseClick(mMainWindow, mView, tbButton, waitTime);
|
|
216 |
QTest::qWait(500);
|
|
217 |
|
|
218 |
// Drag
|
|
219 |
HbAutoTest::mousePress(mMainWindow, mView, arrangeFirstAp, waitTime);
|
|
220 |
QTest::qWait(300);
|
|
221 |
HbAutoTest::mouseMove(mMainWindow, mView, arrangeDragEnd, waitTime);
|
|
222 |
QTest::qWait(300);
|
|
223 |
HbAutoTest::mouseRelease(mMainWindow, mView, arrangeDragEnd, waitTime);
|
|
224 |
|
|
225 |
HbAutoTest::mouseClick(mMainWindow, mView, arrangeDragEnd, waitTime);
|
|
226 |
QTest::qWait(500);
|
|
227 |
|
|
228 |
// Cancel
|
|
229 |
subClickWidget(navigationButton);
|
|
230 |
QTest::qWait(500);
|
|
231 |
|
|
232 |
// Activate arrange mode again
|
|
233 |
HbAutoTest::mouseClick(mMainWindow, mView, tbButton, waitTime);
|
|
234 |
QTest::qWait(500);
|
|
235 |
|
|
236 |
// Drag
|
|
237 |
HbAutoTest::mousePress(mMainWindow, mView, arrangeFirstAp, waitTime);
|
|
238 |
QTest::qWait(300);
|
|
239 |
HbAutoTest::mouseMove(mMainWindow, mView, arrangeDragEnd, waitTime);
|
|
240 |
QTest::qWait(300);
|
|
241 |
// HbAutoTest::mouseRelease(mMainWindow, mView, arrangeDragEnd, waitTime);
|
|
242 |
|
|
243 |
HbAutoTest::mouseClick(mMainWindow, mView, arrangeDragEnd, waitTime);
|
|
244 |
QTest::qWait(500);
|
|
245 |
|
|
246 |
// OK
|
|
247 |
HbAutoTest::mouseClick(mMainWindow, mView, tbButton, waitTime);
|
|
248 |
QTest::qWait(500);
|
|
249 |
|
|
250 |
// Back to main view
|
|
251 |
subClickWidget(navigationButton);
|
|
252 |
QTest::qWait(500);
|
|
253 |
|
|
254 |
}
|
|
255 |
|
|
256 |
void TestCpDestinationPlugin::tcMoveAp()
|
|
257 |
{
|
|
258 |
// Open uncategorised aps
|
|
259 |
HbAutoTest::mouseClick(mMainWindow, mView, uncatDestination, waitTime);
|
|
260 |
QTest::qWait(500);
|
|
261 |
|
|
262 |
// Activate context menu
|
|
263 |
HbAutoTest::mouseClick(mMainWindow, mView, uncatAp, 700);
|
|
264 |
QTest::qWait(50);
|
|
265 |
|
|
266 |
// Select move
|
|
267 |
HbAutoTest::mouseClick(mMainWindow, mView, uncatMenuMove, waitTime);
|
|
268 |
QTest::qWait(300);
|
|
269 |
|
|
270 |
// Select ok
|
|
271 |
HbAutoTest::mouseClick(mMainWindow, mView, destDialogOk, waitTime);
|
|
272 |
QTest::qWait(2000);
|
|
273 |
|
|
274 |
// Back to destination view
|
|
275 |
subClickWidget(navigationButton);
|
|
276 |
QTest::qWait(500);
|
|
277 |
}
|
|
278 |
|
|
279 |
void TestCpDestinationPlugin::tcShareDeleteAp()
|
|
280 |
{
|
|
281 |
// Open Internet destination
|
|
282 |
HbAutoTest::mouseClick(mMainWindow, mView, internetDestination, waitTime);
|
|
283 |
QTest::qWait(500);
|
|
284 |
|
|
285 |
// Activate context menu
|
|
286 |
HbAutoTest::mouseClick(mMainWindow, mView, internetFirstAp, 700);
|
|
287 |
QTest::qWait(50);
|
|
288 |
|
|
289 |
// Select share
|
|
290 |
HbAutoTest::mouseClick(mMainWindow, mView, internetFirstApShare, waitTime);
|
|
291 |
QTest::qWait(300);
|
|
292 |
|
|
293 |
// Select ok
|
|
294 |
HbAutoTest::mouseClick(mMainWindow, mView, destDialogOk, waitTime);
|
|
295 |
QTest::qWait(2000);
|
|
296 |
|
|
297 |
// Activate context menu
|
|
298 |
HbAutoTest::mouseClick(mMainWindow, mView, internetFirstAp, 700);
|
|
299 |
QTest::qWait(50);
|
|
300 |
|
|
301 |
// Select share
|
|
302 |
HbAutoTest::mouseClick(mMainWindow, mView, internetFirstApDelete, waitTime);
|
|
303 |
QTest::qWait(300);
|
|
304 |
|
|
305 |
// Select ok
|
|
306 |
HbAutoTest::mouseClick(mMainWindow, mView, deleteDialogOk, waitTime);
|
|
307 |
QTest::qWait(2000);
|
|
308 |
|
|
309 |
// Back to destination view
|
|
310 |
subClickWidget(navigationButton);
|
|
311 |
QTest::qWait(500);
|
|
312 |
}
|
|
313 |
|
|
314 |
void TestCpDestinationPlugin::tcAddDestination()
|
|
315 |
{
|
|
316 |
// Add Destination
|
|
317 |
HbAutoTest::mouseClick(mMainWindow, mView, addDestination, waitTime);
|
|
318 |
QTest::qWait(500);
|
|
319 |
|
|
320 |
// Click OK -> Error note
|
|
321 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
|
|
322 |
QTest::qWait(500);
|
|
323 |
|
|
324 |
// Click OK -> errorNote disappears
|
|
325 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
|
|
326 |
QTest::qWait(500);
|
|
327 |
|
|
328 |
// Activate keyboard
|
|
329 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialog, waitTime);
|
|
330 |
QTest::qWait(500);
|
|
331 |
|
|
332 |
// Activate line-edit
|
|
333 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogKb, waitTime);
|
|
334 |
QTest::qWait(500);
|
|
335 |
|
|
336 |
// Input text
|
|
337 |
HbAutoTest::keyClicks(mMainWindow, "Internet", 0, waitTime);
|
|
338 |
QTest::qWait(2000);
|
|
339 |
|
|
340 |
// Select ok
|
|
341 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOkKb, waitTime);
|
|
342 |
QTest::qWait(500);
|
|
343 |
|
|
344 |
// Select ok again -> Error note
|
|
345 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
|
|
346 |
QTest::qWait(500);
|
|
347 |
|
|
348 |
// Click OK -> errorNote disappears
|
|
349 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
|
|
350 |
QTest::qWait(500);
|
|
351 |
|
|
352 |
// Activate keyboard
|
|
353 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialog, waitTime);
|
|
354 |
QTest::qWait(500);
|
|
355 |
|
|
356 |
// Activate line-edit
|
|
357 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogKb, waitTime);
|
|
358 |
QTest::qWait(500);
|
|
359 |
|
|
360 |
// Input text
|
|
361 |
HbAutoTest::keyClicks(mMainWindow, "foo", 0, waitTime);
|
|
362 |
QTest::qWait(2000);
|
|
363 |
|
|
364 |
// Select ok
|
|
365 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOkKb, waitTime);
|
|
366 |
QTest::qWait(500);
|
|
367 |
|
|
368 |
// Select ok again
|
|
369 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
|
|
370 |
QTest::qWait(500);
|
|
371 |
}
|
|
372 |
|
|
373 |
void TestCpDestinationPlugin::tcDestinationRename()
|
|
374 |
{
|
|
375 |
// Open context menu
|
|
376 |
HbAutoTest::mouseClick(mMainWindow, mView, addDestination, 700);
|
|
377 |
QTest::qWait(50);
|
|
378 |
|
|
379 |
// Click OK -> Error note
|
|
380 |
HbAutoTest::mouseClick(mMainWindow, mView, newDestinationRename, waitTime);
|
|
381 |
QTest::qWait(300);
|
|
382 |
|
|
383 |
// Click OK -> error note shown
|
|
384 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
|
|
385 |
QTest::qWait(300);
|
|
386 |
|
|
387 |
// Click OK -> errorNote disappears
|
|
388 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
|
|
389 |
QTest::qWait(500);
|
|
390 |
|
|
391 |
// Activate keyboard
|
|
392 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialog, waitTime);
|
|
393 |
QTest::qWait(500);
|
|
394 |
|
|
395 |
// Activate line-edit
|
|
396 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogKb, waitTime);
|
|
397 |
QTest::qWait(500);
|
|
398 |
|
|
399 |
// Input text
|
|
400 |
HbAutoTest::keyClicks(mMainWindow, "Internet", 0, waitTime);
|
|
401 |
QTest::qWait(2000);
|
|
402 |
|
|
403 |
// Select ok
|
|
404 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOkKb, waitTime);
|
|
405 |
QTest::qWait(500);
|
|
406 |
|
|
407 |
// Select ok again -> Error note
|
|
408 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
|
|
409 |
QTest::qWait(500);
|
|
410 |
|
|
411 |
// Click OK -> errorNote disappears
|
|
412 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
|
|
413 |
QTest::qWait(500);
|
|
414 |
|
|
415 |
// Activate keyboard
|
|
416 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialog, waitTime);
|
|
417 |
QTest::qWait(500);
|
|
418 |
|
|
419 |
// Activate line-edit
|
|
420 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogKb, waitTime);
|
|
421 |
QTest::qWait(500);
|
|
422 |
|
|
423 |
// Input text
|
|
424 |
HbAutoTest::keyClicks(mMainWindow, "bar", 0, waitTime);
|
|
425 |
QTest::qWait(2000);
|
|
426 |
|
|
427 |
// Select ok
|
|
428 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOkKb, waitTime);
|
|
429 |
QTest::qWait(500);
|
|
430 |
|
|
431 |
// Select ok again
|
|
432 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
|
|
433 |
QTest::qWait(500);
|
|
434 |
|
|
435 |
// TODO: remove
|
|
436 |
subClickWidget(navigationButton);
|
|
437 |
QTest::qWait(500);
|
|
438 |
}
|
|
439 |
|
|
440 |
void TestCpDestinationPlugin::tcDestinationDelete()
|
|
441 |
{
|
|
442 |
// Open context menu
|
|
443 |
HbAutoTest::mouseClick(mMainWindow, mView, addDestination, 700);
|
|
444 |
QTest::qWait(50);
|
|
445 |
|
|
446 |
// Click OK -> Error note
|
|
447 |
HbAutoTest::mouseClick(mMainWindow, mView, newDestinationDelete, waitTime);
|
|
448 |
QTest::qWait(300);
|
|
449 |
|
|
450 |
// Click OK -> error note shown
|
|
451 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
|
|
452 |
QTest::qWait(1000);
|
|
453 |
|
|
454 |
// TODO: remove
|
|
455 |
subClickWidget(navigationButton);
|
|
456 |
QTest::qWait(500);
|
|
457 |
}
|
|
458 |
|
|
459 |
void TestCpDestinationPlugin::tcCreateAndDeleteDestination()
|
|
460 |
{
|
|
461 |
// Add Destination
|
|
462 |
HbAutoTest::mouseClick(mMainWindow, mView, addDestination, waitTime);
|
|
463 |
QTest::qWait(500);
|
|
464 |
|
|
465 |
// Activate keyboard
|
|
466 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialog, waitTime);
|
|
467 |
QTest::qWait(500);
|
|
468 |
|
|
469 |
// Activate line-edit
|
|
470 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogKb, waitTime);
|
|
471 |
QTest::qWait(500);
|
|
472 |
|
|
473 |
// Input text
|
|
474 |
HbAutoTest::keyClicks(mMainWindow, "foo", 0, waitTime);
|
|
475 |
QTest::qWait(2000);
|
|
476 |
|
|
477 |
// Select ok
|
|
478 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOkKb, waitTime);
|
|
479 |
QTest::qWait(500);
|
|
480 |
|
|
481 |
// Select ok again
|
|
482 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
|
|
483 |
QTest::qWait(500);
|
|
484 |
|
|
485 |
// Open Internet destination
|
|
486 |
HbAutoTest::mouseClick(mMainWindow, mView, internetDestination, waitTime);
|
|
487 |
QTest::qWait(500);
|
|
488 |
|
|
489 |
// Activate context menu
|
|
490 |
HbAutoTest::mouseClick(mMainWindow, mView, internetFirstAp, 700);
|
|
491 |
QTest::qWait(50);
|
|
492 |
|
|
493 |
// Select move
|
|
494 |
HbAutoTest::mouseClick(mMainWindow, mView, internetFirstApMove, waitTime);
|
|
495 |
QTest::qWait(300);
|
|
496 |
|
|
497 |
// Select destination
|
|
498 |
HbAutoTest::mouseClick(mMainWindow, mView, destDialogNewDest, waitTime);
|
|
499 |
QTest::qWait(300);
|
|
500 |
|
|
501 |
// Select ok
|
|
502 |
HbAutoTest::mouseClick(mMainWindow, mView, destDialogOk, waitTime);
|
|
503 |
QTest::qWait(2000);
|
|
504 |
|
|
505 |
// Back to destination view
|
|
506 |
subClickWidget(navigationButton);
|
|
507 |
QTest::qWait(500);
|
|
508 |
|
|
509 |
// Open context menu
|
|
510 |
HbAutoTest::mouseClick(mMainWindow, mView, addDestination, 700);
|
|
511 |
QTest::qWait(50);
|
|
512 |
|
|
513 |
// Click OK -> Error note
|
|
514 |
HbAutoTest::mouseClick(mMainWindow, mView, newDestinationDelete, waitTime);
|
|
515 |
QTest::qWait(300);
|
|
516 |
|
|
517 |
// Click OK -> error note shown
|
|
518 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
|
|
519 |
QTest::qWait(1000);
|
|
520 |
|
|
521 |
// TODO: remove
|
|
522 |
subClickWidget(navigationButton);
|
|
523 |
QTest::qWait(500);
|
|
524 |
}
|
|
525 |
|
|
526 |
void TestCpDestinationPlugin::tcOpenDestinations()
|
|
527 |
{
|
|
528 |
// Open uncategorised aps
|
|
529 |
HbAutoTest::mouseClick(mMainWindow, mView, secondDestination, waitTime);
|
|
530 |
QTest::qWait(500);
|
|
531 |
|
|
532 |
// Back to destination view
|
|
533 |
subClickWidget(navigationButton);
|
|
534 |
QTest::qWait(500);
|
|
535 |
|
|
536 |
// Open uncategorised aps
|
|
537 |
HbAutoTest::mouseClick(mMainWindow, mView, thirdDestination, waitTime);
|
|
538 |
QTest::qWait(500);
|
|
539 |
|
|
540 |
// Back to destination view
|
|
541 |
subClickWidget(navigationButton);
|
|
542 |
QTest::qWait(500);
|
|
543 |
|
|
544 |
// Open uncategorised aps
|
|
545 |
HbAutoTest::mouseClick(mMainWindow, mView, fourthDestination, waitTime);
|
|
546 |
QTest::qWait(500);
|
|
547 |
|
|
548 |
// Back to destination view
|
|
549 |
subClickWidget(navigationButton);
|
|
550 |
QTest::qWait(500);
|
|
551 |
|
|
552 |
// Activate context menu
|
|
553 |
HbAutoTest::mouseClick(mMainWindow, mView, uncatAp, 700);
|
|
554 |
QTest::qWait(50);
|
|
555 |
|
|
556 |
// TODO: remove
|
|
557 |
subClickWidget(navigationButton);
|
|
558 |
QTest::qWait(500);
|
|
559 |
}
|
|
560 |
|
|
561 |
void TestCpDestinationPlugin::tcDeleteUncat()
|
|
562 |
{
|
|
563 |
// Open uncategorised aps
|
|
564 |
HbAutoTest::mouseClick(mMainWindow, mView, uncatDestination, waitTime);
|
|
565 |
QTest::qWait(500);
|
|
566 |
|
|
567 |
// Activate context menu
|
|
568 |
HbAutoTest::mouseClick(mMainWindow, mView, uncatAp, 700);
|
|
569 |
QTest::qWait(50);
|
|
570 |
|
|
571 |
// Select move
|
|
572 |
HbAutoTest::mouseClick(mMainWindow, mView, uncatMenuDelete, waitTime);
|
|
573 |
QTest::qWait(500);
|
|
574 |
|
|
575 |
// Select ok
|
|
576 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
|
|
577 |
QTest::qWait(2000);
|
|
578 |
|
|
579 |
// Back to destination view
|
|
580 |
subClickWidget(navigationButton);
|
|
581 |
QTest::qWait(500);
|
|
582 |
}
|
|
583 |
|
|
584 |
void TestCpDestinationPlugin::tcMoveProtected()
|
|
585 |
{
|
|
586 |
// Open Internet destination
|
|
587 |
HbAutoTest::mouseClick(mMainWindow, mView, internetDestination, waitTime);
|
|
588 |
QTest::qWait(500);
|
|
589 |
|
|
590 |
// Activate context menu
|
|
591 |
HbAutoTest::mouseClick(mMainWindow, mView, internetFirstAp, 700);
|
|
592 |
QTest::qWait(50);
|
|
593 |
|
|
594 |
// Select move
|
|
595 |
HbAutoTest::mouseClick(mMainWindow, mView, internetFirstApMove, waitTime);
|
|
596 |
QTest::qWait(300);
|
|
597 |
|
|
598 |
// Select destination
|
|
599 |
HbAutoTest::mouseClick(mMainWindow, mView, destDialogSecond, waitTime);
|
|
600 |
QTest::qWait(300);
|
|
601 |
|
|
602 |
// Select ok
|
|
603 |
HbAutoTest::mouseClick(mMainWindow, mView, destDialogOk, waitTime);
|
|
604 |
QTest::qWait(2000);
|
|
605 |
|
|
606 |
HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
|
|
607 |
QTest::qWait(2000);
|
|
608 |
|
|
609 |
// Back to destination view
|
|
610 |
subClickWidget(navigationButton);
|
|
611 |
QTest::qWait(500);
|
|
612 |
}
|
|
613 |
|
|
614 |
// -----------------------------------------------------------------------------
|
|
615 |
// SUB TEST CASES
|
|
616 |
// -----------------------------------------------------------------------------
|
|
617 |
|
|
618 |
void TestCpDestinationPlugin::subCreateSettingsView()
|
|
619 |
{
|
|
620 |
// Create settings view
|
|
621 |
HbView *view = new HbView();
|
|
622 |
CpItemDataHelper *itemDataHelper = new CpItemDataHelper();
|
|
623 |
itemDataHelper->setParent(view);
|
|
624 |
HbDataForm *form = new HbDataForm();
|
|
625 |
HbDataFormModel *model = new HbDataFormModel;
|
|
626 |
CpPluginUtility::addCpItemPrototype(form);
|
|
627 |
QList<CpSettingFormItemData *> list = mPlugin->createSettingFormItemData(*itemDataHelper);
|
|
628 |
HbDataFormModelItem *modelItem = NULL;
|
|
629 |
modelItem = list[0];
|
|
630 |
model->appendDataFormItem(modelItem);
|
|
631 |
form->setModel(model);
|
|
632 |
model->setParent(form);
|
|
633 |
view->setWidget(form);
|
|
634 |
itemDataHelper->bindToForm(form);
|
|
635 |
|
|
636 |
// Display the view
|
|
637 |
// TODO: connect aboutToClose() signal
|
|
638 |
mMainWindow->addView(view);
|
|
639 |
mMainWindow->setCurrentView(view);
|
|
640 |
|
|
641 |
mView = view;
|
|
642 |
}
|
|
643 |
|
|
644 |
void TestCpDestinationPlugin::subClickWidget(const QString &name)
|
|
645 |
{
|
|
646 |
QList<QGraphicsItem *> itemList = mMainWindow->scene()->items();
|
|
647 |
|
|
648 |
QGraphicsItem *target = 0;
|
|
649 |
foreach (QGraphicsItem* item, itemList) {
|
|
650 |
if (item->isWidget()) {
|
|
651 |
QString widgetClassName(static_cast<QGraphicsWidget*>(item)->metaObject()->className());
|
|
652 |
qDebug() << widgetClassName;
|
|
653 |
|
|
654 |
if (widgetClassName == name) {
|
|
655 |
target = item;
|
|
656 |
//break;
|
|
657 |
}
|
|
658 |
}
|
|
659 |
}
|
|
660 |
|
|
661 |
Q_ASSERT(target);
|
|
662 |
HbAutoTest::mouseClick(mMainWindow, static_cast<HbWidget *>(target));
|
|
663 |
}
|