author | William Roberts <williamr@symbian.org> |
Thu, 22 Jul 2010 16:33:21 +0100 | |
branch | GCC_SURGE |
changeset 51 | f39ed5e045e0 |
parent 27 | 2f8f8080a020 |
parent 46 | bc5a64e5bc3c |
permissions | -rw-r--r-- |
37 | 1 |
/*! |
2 |
* Copyright (c) 2009 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 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include <QtGui> |
|
19 |
#include <QtTest/QtTest> |
|
20 |
||
21 |
#include <hbapplication.h> |
|
22 |
#include <hbmainwindow.h> |
|
23 |
#include <hbaction.h> |
|
24 |
#include <hbtoolbar.h> |
|
25 |
#include <hbview.h> |
|
26 |
||
27 |
#include "bubbletest.h" |
|
28 |
#include "bubblemanager2.h" |
|
29 |
||
30 |
const int WAIT_TIME = 200; |
|
31 |
||
32 |
class mt_BubbleManager2 : public QObject |
|
33 |
{ |
|
34 |
Q_OBJECT |
|
35 |
||
36 |
private slots: |
|
37 |
void initTestCase(); |
|
38 |
void cleanupTestCase(); |
|
39 |
||
40 |
void testBasicMtCall(); |
|
41 |
void testBasicMoCall(); |
|
42 |
void testWaitingCall(); |
|
43 |
void testConferenceCall(); |
|
44 |
void testEmergencyCall(); |
|
45 |
||
46 |
private: |
|
47 |
void mouseClickWidget(const QString& name); |
|
48 |
void mouseClickWidgetAction(const QString& name, HbAction* action); |
|
49 |
QGraphicsWidget* getWidgetByName(const QString& name); |
|
50 |
||
51 |
private: |
|
52 |
HbMainWindow* mainWindow; |
|
53 |
BubbleManager* bubbleManager; // widget under test |
|
54 |
HbAction* toolbarAction; |
|
55 |
HbView* view; // not owned |
|
56 |
}; |
|
57 |
||
58 |
void mt_BubbleManager2::initTestCase() |
|
59 |
{ |
|
60 |
mainWindow = new HbMainWindow; |
|
61 |
||
62 |
bubbleManager = new BubbleManager(); |
|
63 |
||
64 |
view = mainWindow->addView( bubbleManager ); |
|
65 |
||
66 |
HbToolBar *toolBar = new HbToolBar(); |
|
67 |
toolbarAction = new HbAction(this); |
|
68 |
toolBar->addAction( toolbarAction ); |
|
69 |
toolBar->addAction( toolbarAction ); |
|
70 |
//toolBar->setOrientation(mainWindow->orientation()); |
|
71 |
mainWindow->currentView()->setToolBar(toolBar); |
|
72 |
||
73 |
mainWindow->show(); |
|
74 |
} |
|
75 |
||
76 |
void mt_BubbleManager2::cleanupTestCase() |
|
77 |
{ |
|
78 |
delete mainWindow; |
|
79 |
delete toolbarAction; |
|
80 |
} |
|
81 |
||
82 |
void mt_BubbleManager2::testBasicMtCall() |
|
83 |
{ |
|
84 |
view->setTitle( "Basic MT call" ); |
|
85 |
bubbleManager->startChanges(); |
|
86 |
int bubbleId = bubbleManager->createCallHeader(); |
|
87 |
QVERIFY( bubbleId == 0 ); |
|
88 |
bubbleManager->setState( bubbleId, BubbleManager::Incoming ); |
|
89 |
bubbleManager->setCli( bubbleId, "John Doe", Qt::ElideRight ); |
|
90 |
bubbleManager->setSecondaryCli( bubbleId, "0407284096" ); |
|
91 |
bubbleManager->setNumberType( bubbleId, BubbleManager::Mobile ); |
|
92 |
bubbleManager->setCallFlags( bubbleId, BubbleManager::Diverted ); |
|
93 |
bubbleManager->setCallFlag( bubbleId, BubbleManager::NoCiphering, true ); |
|
94 |
bubbleManager->setLabel( bubbleId,"calling"); |
|
95 |
bubbleManager->setCallObjectFromTheme(bubbleId); |
|
96 |
HbAction action1("Answer", this); |
|
97 |
action1.setSoftKeyRole(QAction::PositiveSoftKey); |
|
98 |
bubbleManager->addAction( bubbleId, &action1 ); |
|
99 |
HbAction action2("Reject", this); |
|
100 |
action2.setSoftKeyRole(QAction::NegativeSoftKey); |
|
101 |
bubbleManager->addAction( bubbleId, &action2 ); |
|
102 |
bubbleManager->endChanges(); |
|
103 |
||
104 |
QTest::qWait( WAIT_TIME ); |
|
105 |
mouseClickWidgetAction("eb:leftButton",&action1); |
|
106 |
mouseClickWidgetAction("eb:rightButton",&action2); |
|
107 |
QTest::qWait( WAIT_TIME ); |
|
108 |
||
109 |
bubbleManager->startChanges(); |
|
110 |
bubbleManager->setState( bubbleId, BubbleManager::Active ); |
|
111 |
bubbleManager->setLabel( bubbleId,""); |
|
112 |
bubbleManager->setCallTime( bubbleId, "00:00" ); |
|
113 |
bubbleManager->setCallFlag( bubbleId, BubbleManager::NoCiphering, false ); |
|
114 |
bubbleManager->clearActions(bubbleId); |
|
115 |
HbAction action3("Hold", this); |
|
116 |
bubbleManager->addAction( bubbleId, &action3 ); |
|
117 |
HbAction action4("End call", this); |
|
118 |
action4.setSoftKeyRole(QAction::NegativeSoftKey); |
|
119 |
bubbleManager->addAction( bubbleId, &action4 ); |
|
120 |
bubbleManager->endChanges(); |
|
121 |
||
122 |
QTest::qWait( WAIT_TIME ); |
|
123 |
bubbleManager->updateCallTime( bubbleId, "00:01" ); |
|
124 |
bubbleManager->updateCLI(bubbleId, "John Doe", Qt::ElideRight); |
|
125 |
QTest::qWait( WAIT_TIME ); |
|
126 |
bubbleManager->updateCallTime( bubbleId, "00:02" ); |
|
127 |
mouseClickWidgetAction("eb:leftButton",&action3); |
|
128 |
mouseClickWidgetAction("eb:rightButton",&action4); |
|
129 |
QTest::qWait( WAIT_TIME ); |
|
130 |
||
131 |
bubbleManager->startChanges(); |
|
132 |
bubbleManager->setState( bubbleId, BubbleManager::OnHold ); |
|
133 |
bubbleManager->setLabel( bubbleId,"on hold"); |
|
134 |
bubbleManager->endChanges(); |
|
135 |
QTest::qWait( WAIT_TIME ); |
|
136 |
||
137 |
bubbleManager->startChanges(); |
|
138 |
bubbleManager->setState( bubbleId, BubbleManager::Disconnected ); |
|
139 |
bubbleManager->setLabel( bubbleId,"disconnected"); |
|
140 |
bubbleManager->endChanges(); |
|
141 |
||
142 |
QTest::qWait( WAIT_TIME ); |
|
143 |
bubbleManager->startChanges(); |
|
144 |
bubbleManager->removeCallHeader( bubbleId ); |
|
145 |
bubbleManager->endChanges(); |
|
146 |
QTest::qWait( WAIT_TIME ); |
|
147 |
} |
|
148 |
||
149 |
void mt_BubbleManager2::testBasicMoCall() |
|
150 |
{ |
|
151 |
view->setTitle( "Basic M0 call" ); |
|
152 |
bubbleManager->startChanges(); |
|
153 |
int bubbleId = bubbleManager->createCallHeader(); |
|
154 |
QVERIFY( bubbleId == 0 ); |
|
155 |
bubbleManager->setState( bubbleId, BubbleManager::Outgoing ); |
|
156 |
bubbleManager->setCli( bubbleId, "Mary Poppins", Qt::ElideRight ); |
|
157 |
bubbleManager->setSecondaryCli( bubbleId, "0507284096" ); |
|
158 |
bubbleManager->setNumberType( bubbleId, BubbleManager::Mobile ); |
|
159 |
bubbleManager->setLabel( bubbleId,"Calling"); |
|
160 |
bubbleManager->setCallFlag( bubbleId, BubbleManager::NoCiphering, true ); |
|
161 |
bubbleManager->setCallObjectFromTheme(bubbleId); |
|
162 |
HbAction action1("End call", this); |
|
163 |
action1.setSoftKeyRole(QAction::NegativeSoftKey); |
|
164 |
bubbleManager->clearActions(bubbleId); |
|
165 |
bubbleManager->addAction( bubbleId, &action1 ); |
|
166 |
bubbleManager->endChanges(); |
|
167 |
||
168 |
QTest::qWait( WAIT_TIME ); |
|
169 |
mouseClickWidgetAction("eb:centerButton", &action1 ); |
|
170 |
QTest::qWait( WAIT_TIME ); |
|
171 |
||
172 |
bubbleManager->startChanges(); |
|
173 |
bubbleManager->setState( bubbleId, BubbleManager::Alerting ); |
|
174 |
bubbleManager->endChanges(); |
|
175 |
QTest::qWait( WAIT_TIME ); |
|
176 |
||
177 |
bubbleManager->startChanges(); |
|
178 |
bubbleManager->setState( bubbleId, BubbleManager::Active ); |
|
179 |
bubbleManager->setLabel( bubbleId,""); |
|
180 |
bubbleManager->setCallTime( bubbleId, "00:00" ); |
|
181 |
bubbleManager->setCallFlag( bubbleId, BubbleManager::NoCiphering, false); |
|
182 |
bubbleManager->clearActions(bubbleId); |
|
183 |
HbAction action2("Hold", this); |
|
184 |
bubbleManager->addAction( bubbleId, &action2 ); |
|
185 |
HbAction action3("End call", this); |
|
186 |
action3.setSoftKeyRole(QAction::NegativeSoftKey); |
|
187 |
bubbleManager->addAction( bubbleId, &action3 ); |
|
188 |
bubbleManager->endChanges(); |
|
189 |
||
190 |
QTest::qWait( WAIT_TIME ); |
|
191 |
bubbleManager->updateCallTime( bubbleId, "00:01" ); |
|
192 |
mouseClickWidgetAction("eb:leftButton",&action2); |
|
193 |
mouseClickWidgetAction("eb:rightButton",&action3); |
|
194 |
QTest::qWait( WAIT_TIME ); |
|
195 |
||
196 |
bubbleManager->setPhoneMuted(true); |
|
197 |
QTest::qWait( WAIT_TIME ); |
|
198 |
bubbleManager->setPhoneMuted(false); |
|
199 |
||
200 |
bubbleManager->startChanges(); |
|
201 |
bubbleManager->setState( bubbleId, BubbleManager::Disconnected ); |
|
202 |
bubbleManager->setLabel( bubbleId,"disconnected"); |
|
203 |
bubbleManager->endChanges(); |
|
204 |
||
205 |
QTest::qWait( WAIT_TIME ); |
|
206 |
bubbleManager->startChanges(); |
|
207 |
bubbleManager->removeCallHeader( bubbleId ); |
|
208 |
bubbleManager->endChanges(); |
|
209 |
QTest::qWait( WAIT_TIME ); |
|
210 |
} |
|
211 |
||
212 |
void mt_BubbleManager2::testWaitingCall() |
|
213 |
{ |
|
214 |
view->setTitle( "Waiting call" ); |
|
215 |
bubbleManager->startChanges(); |
|
216 |
int bubbleId1 = bubbleManager->createCallHeader(); |
|
217 |
QVERIFY( bubbleId1 == 0 ); |
|
218 |
bubbleManager->setState( bubbleId1, BubbleManager::Active ); |
|
219 |
bubbleManager->setCli( bubbleId1, "Mary Poppins", Qt::ElideRight ); |
|
220 |
bubbleManager->setSecondaryCli( bubbleId1, "0507284096" ); |
|
221 |
bubbleManager->setCallObjectFromTheme(bubbleId1); |
|
222 |
bubbleManager->setCallTime( bubbleId1, "00:00" ); |
|
223 |
bubbleManager->clearActions(bubbleId1); |
|
224 |
HbAction action1("Hold", this); |
|
225 |
bubbleManager->addAction( bubbleId1, &action1 ); |
|
226 |
HbAction action2("End call", this); |
|
227 |
action2.setSoftKeyRole(QAction::NegativeSoftKey); |
|
228 |
bubbleManager->addAction( bubbleId1, &action2 ); |
|
229 |
bubbleManager->endChanges(); |
|
230 |
||
231 |
QTest::qWait( WAIT_TIME ); |
|
232 |
||
233 |
// waiting call |
|
234 |
bubbleManager->startChanges(); |
|
235 |
int bubbleId2 = bubbleManager->createCallHeader(); |
|
236 |
QVERIFY( bubbleId2 == 1 ); |
|
237 |
bubbleManager->setState( bubbleId2, BubbleManager::Waiting ); |
|
238 |
bubbleManager->setCli( bubbleId2, "John Doe", Qt::ElideRight ); |
|
239 |
bubbleManager->setLabel( bubbleId2,"Waiting"); |
|
240 |
bubbleManager->setSecondaryCli( bubbleId2, "0501234567" ); |
|
241 |
bubbleManager->setCallObjectFromTheme(bubbleId2); |
|
242 |
bubbleManager->clearActions(bubbleId2); |
|
243 |
HbAction action3("Answer", this); |
|
244 |
action3.setSoftKeyRole(QAction::PositiveSoftKey); |
|
245 |
bubbleManager->addAction( bubbleId2, &action3 ); |
|
246 |
HbAction action4("Reject", this); |
|
247 |
action4.setSoftKeyRole(QAction::NegativeSoftKey); |
|
248 |
bubbleManager->addAction( bubbleId2, &action4 ); |
|
249 |
bubbleManager->endChanges(); |
|
250 |
||
251 |
QTest::qWait( WAIT_TIME ); |
|
252 |
mouseClickWidgetAction("eb:leftButton",&action3); |
|
253 |
mouseClickWidgetAction("eb:rightButton",&action4); |
|
254 |
bubbleManager->updateCallTime(bubbleId1,"00:01"); |
|
255 |
||
256 |
// two calls |
|
257 |
bubbleManager->startChanges(); |
|
258 |
bubbleManager->setState( bubbleId1, BubbleManager::OnHold ); |
|
259 |
bubbleManager->setLabel( bubbleId1,"On hold"); |
|
260 |
bubbleManager->setState( bubbleId2, BubbleManager::Active ); |
|
261 |
bubbleManager->setLabel( bubbleId2,""); |
|
262 |
bubbleManager->clearActions(bubbleId2); |
|
263 |
bubbleManager->addAction( bubbleId2, &action1 ); |
|
264 |
bubbleManager->addAction( bubbleId2, &action2 ); |
|
265 |
HbAction action5("Swap", this); |
|
266 |
bubbleManager->setExpandAction( bubbleId1, &action5 ); |
|
267 |
bubbleManager->setExpandAction( bubbleId2, &action5 ); |
|
268 |
bubbleManager->endChanges(); |
|
269 |
||
270 |
int expanded = bubbleManager->expandedBubble(); |
|
271 |
QVERIFY( expanded == bubbleId2 ); |
|
272 |
||
273 |
QTest::qWait( WAIT_TIME ); |
|
274 |
mouseClickWidgetAction("collapsedBubble",&action5); |
|
275 |
expanded = bubbleManager->expandedBubble(); |
|
276 |
QVERIFY( expanded == bubbleId1 ); |
|
277 |
||
278 |
QTest::qWait( WAIT_TIME ); |
|
279 |
bubbleManager->setBubbleSelectionDisabled(true); |
|
280 |
mouseClickWidget("collapsedBubble"); |
|
281 |
expanded = bubbleManager->expandedBubble(); |
|
282 |
QVERIFY( expanded == bubbleId1 ); |
|
283 |
bubbleManager->setBubbleSelectionDisabled(false); |
|
284 |
||
285 |
// waiting call (third call) |
|
286 |
bubbleManager->startChanges(); |
|
287 |
int bubbleId3 = bubbleManager->createCallHeader(); |
|
288 |
QVERIFY( bubbleId3 == 2 ); |
|
289 |
bubbleManager->setState( bubbleId3, BubbleManager::Waiting ); |
|
290 |
bubbleManager->setCli( bubbleId3, "Mary Poppins", Qt::ElideRight ); |
|
291 |
bubbleManager->setLabel( bubbleId3,"Waiting"); |
|
292 |
bubbleManager->setSecondaryCli( bubbleId3, "0501234567" ); |
|
293 |
bubbleManager->setCallObjectFromTheme(bubbleId3); |
|
294 |
bubbleManager->clearActions(bubbleId3); |
|
295 |
HbAction action6("Replace", this); |
|
296 |
bubbleManager->addAction( bubbleId3, &action6 ); |
|
297 |
bubbleManager->endChanges(); |
|
298 |
||
299 |
QTest::qWait( WAIT_TIME ); |
|
300 |
expanded = bubbleManager->expandedBubble(); |
|
301 |
QVERIFY( expanded == bubbleId3 ); |
|
302 |
||
303 |
// click top most bubble - bubble2 |
|
304 |
mouseClickWidgetAction("collapsedBubble2",&action5); |
|
305 |
expanded = bubbleManager->expandedBubble(); |
|
306 |
QVERIFY( expanded == bubbleId2 ); |
|
307 |
QTest::qWait( WAIT_TIME ); |
|
308 |
||
309 |
bubbleManager->startChanges(); |
|
310 |
bubbleManager->removeCallHeader( bubbleId3 ); |
|
311 |
bubbleManager->endChanges(); |
|
312 |
||
313 |
QTest::qWait( WAIT_TIME ); |
|
314 |
bubbleManager->startChanges(); |
|
315 |
bubbleManager->setState( bubbleId2, BubbleManager::Disconnected ); |
|
316 |
bubbleManager->setLabel( bubbleId2,"disconnected"); |
|
317 |
bubbleManager->endChanges(); |
|
318 |
||
319 |
QTest::qWait( WAIT_TIME ); |
|
320 |
bubbleManager->startChanges(); |
|
321 |
bubbleManager->removeCallHeader( bubbleId1 ); |
|
322 |
bubbleManager->removeCallHeader( bubbleId2 ); |
|
323 |
bubbleManager->endChanges(); |
|
324 |
} |
|
325 |
||
326 |
void mt_BubbleManager2::testConferenceCall() |
|
327 |
{ |
|
328 |
view->setTitle( "Test conference" ); |
|
329 |
bubbleManager->startChanges(); |
|
330 |
// held call |
|
331 |
int bubbleId1 = bubbleManager->createCallHeader(); |
|
332 |
bubbleManager->setState( bubbleId1, BubbleManager::OnHold ); |
|
333 |
bubbleManager->setCli( bubbleId1, "Mary Poppins", Qt::ElideRight ); |
|
334 |
bubbleManager->setSecondaryCli( bubbleId1, "0507284096" ); |
|
335 |
bubbleManager->setCallObjectFromTheme(bubbleId1); |
|
336 |
bubbleManager->setLabel( bubbleId1,"On hold"); |
|
337 |
bubbleManager->clearActions(bubbleId1); |
|
338 |
HbAction action1("Activate", this); |
|
339 |
bubbleManager->addAction( bubbleId1, &action1 ); |
|
340 |
HbAction action2("End call", this); |
|
341 |
action2.setSoftKeyRole(QAction::NegativeSoftKey); |
|
342 |
bubbleManager->addAction( bubbleId1, &action2 ); |
|
343 |
// active call |
|
344 |
int bubbleId2 = bubbleManager->createCallHeader(); |
|
345 |
bubbleManager->setState( bubbleId2, BubbleManager::Waiting ); |
|
346 |
bubbleManager->setCli( bubbleId2, "John Doe", Qt::ElideRight ); |
|
347 |
bubbleManager->setSecondaryCli( bubbleId2, "0501234567" ); |
|
348 |
bubbleManager->setCallObjectFromTheme(bubbleId2); |
|
349 |
bubbleManager->clearActions(bubbleId2); |
|
350 |
HbAction action3("Hold", this); |
|
351 |
bubbleManager->addAction( bubbleId2, &action3 ); |
|
352 |
HbAction action4("End call", this); |
|
353 |
action4.setSoftKeyRole(QAction::NegativeSoftKey); |
|
354 |
bubbleManager->addAction( bubbleId2, &action4 ); |
|
355 |
bubbleManager->endChanges(); |
|
356 |
QTest::qWait( WAIT_TIME ); |
|
357 |
||
358 |
bubbleManager->startChanges(); |
|
359 |
int bubbleIdC = bubbleManager->createConference(bubbleId1,bubbleId2); |
|
360 |
bubbleManager->setCli(bubbleIdC,"Conference call",Qt::ElideRight); |
|
361 |
bubbleManager->setExpandedConferenceCallHeader(true); |
|
362 |
bubbleManager->setState(bubbleIdC,BubbleManager::Active); |
|
363 |
bubbleManager->setState(bubbleId1,BubbleManager::Active); |
|
364 |
bubbleManager->setState(bubbleId2,BubbleManager::Active); |
|
365 |
bubbleManager->setCallTime(bubbleIdC,"00:00"); |
|
366 |
HbAction action5("End conference"); |
|
367 |
action5.setSoftKeyRole(QAction::NegativeSoftKey); |
|
368 |
bubbleManager->addAction(bubbleIdC,&action5); |
|
369 |
bubbleManager->clearParticipantListActions(); |
|
370 |
HbAction action6("Private"); |
|
371 |
bubbleManager->addParticipantListAction(&action6); |
|
372 |
HbAction action7("Drop"); |
|
373 |
bubbleManager->addParticipantListAction(&action7); |
|
374 |
bubbleManager->endChanges(); |
|
375 |
QTest::qWait( WAIT_TIME ); |
|
376 |
bubbleManager->updateCallTime(bubbleIdC,"00:01"); |
|
377 |
mouseClickWidgetAction("eb:centerButton",&action5); |
|
378 |
QVERIFY(bubbleManager->conferenceRowCount()==2); |
|
379 |
QVERIFY(bubbleManager->expandedBubble()==bubbleIdC); |
|
380 |
QTest::qWait( WAIT_TIME ); |
|
381 |
||
382 |
// add call to conference |
|
383 |
bubbleManager->startChanges(); |
|
384 |
int bubbleId3 = bubbleManager->createCallHeader(); |
|
385 |
bubbleManager->setState( bubbleId3, BubbleManager::Active ); |
|
386 |
bubbleManager->setCli( bubbleId3, "123457", Qt::ElideLeft ); |
|
387 |
bubbleManager->setCallObjectFromTheme(bubbleId3); |
|
388 |
bubbleManager->clearActions(bubbleId3); |
|
389 |
HbAction action8("Hold", this); |
|
390 |
bubbleManager->addAction( bubbleId3, &action8 ); |
|
391 |
HbAction action9("End call", this); |
|
392 |
action9.setSoftKeyRole(QAction::NegativeSoftKey); |
|
393 |
bubbleManager->addAction( bubbleId3, &action9 ); |
|
394 |
bubbleManager->setExpandedConferenceCallHeader(false); |
|
395 |
bubbleManager->setState(bubbleIdC,BubbleManager::OnHold); |
|
396 |
bubbleManager->setLabel(bubbleIdC,"On hold",Qt::ElideRight); |
|
397 |
bubbleManager->endChanges(); |
|
398 |
QTest::qWait( WAIT_TIME ); |
|
399 |
bubbleManager->startChanges(); |
|
400 |
bubbleManager->setExpandedConferenceCallHeader(true); |
|
401 |
bubbleManager->addRowToConference(bubbleId3); |
|
402 |
bubbleManager->setState(bubbleIdC,BubbleManager::Active); |
|
403 |
// to test two button layout |
|
404 |
bubbleManager->clearActions(bubbleIdC); |
|
405 |
bubbleManager->addAction(bubbleIdC,&action8); |
|
406 |
bubbleManager->addAction(bubbleIdC,&action5); |
|
407 |
bubbleManager->endChanges(); |
|
408 |
Q_ASSERT(bubbleManager->conferenceRowCount()==3); |
|
409 |
QTest::qWait( WAIT_TIME ); |
|
410 |
mouseClickWidgetAction("eb:leftButton",&action8); |
|
411 |
mouseClickWidgetAction("eb:rightButton",&action5); |
|
412 |
||
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
413 |
// click conference list |
37 | 414 |
QTest::mouseClick(mainWindow->viewport(),Qt::LeftButton,0,QPoint(100,100)); |
415 |
QTest::qWait( 2*WAIT_TIME ); |
|
416 |
||
417 |
// hold/unhold conference |
|
418 |
bubbleManager->startChanges(); |
|
419 |
bubbleManager->setState( bubbleIdC, BubbleManager::OnHold ); |
|
420 |
bubbleManager->setState( bubbleId1, BubbleManager::OnHold ); |
|
421 |
bubbleManager->setState( bubbleId2, BubbleManager::OnHold ); |
|
422 |
bubbleManager->setState( bubbleId3, BubbleManager::OnHold ); |
|
423 |
bubbleManager->endChanges(); |
|
424 |
QTest::qWait( 2*WAIT_TIME ); |
|
425 |
bubbleManager->startChanges(); |
|
426 |
bubbleManager->setState( bubbleIdC, BubbleManager::Active ); |
|
427 |
bubbleManager->setState( bubbleId1, BubbleManager::Active ); |
|
428 |
bubbleManager->setState( bubbleId2, BubbleManager::Active ); |
|
429 |
bubbleManager->setState( bubbleId3, BubbleManager::Active ); |
|
430 |
bubbleManager->endChanges(); |
|
431 |
||
432 |
// remove call from conference |
|
433 |
bubbleManager->startChanges(); |
|
434 |
bubbleManager->removeRowFromConference(bubbleId3); |
|
435 |
bubbleManager->removeCallHeader(bubbleId3); |
|
436 |
bubbleManager->endChanges(); |
|
437 |
Q_ASSERT(bubbleManager->conferenceRowCount()==2); |
|
438 |
QTest::qWait( WAIT_TIME ); |
|
439 |
||
440 |
// to be implemented API methods |
|
441 |
bubbleManager->startChanges(); |
|
442 |
bubbleManager->setSelectionInConference(0); |
|
443 |
bubbleManager->setSelectionIdInConference(bubbleId1); |
|
444 |
bubbleManager->selectionInConference(); |
|
445 |
bubbleManager->selectionIdInConference(); |
|
446 |
bubbleManager->moveHighlightOneUpInConference(); |
|
447 |
bubbleManager->moveHighlightOneDownInConference(); |
|
448 |
bubbleManager->setParticipantListCli(bubbleId1, |
|
449 |
BubbleManagerIF::ParticipantListCliText); |
|
450 |
bubbleManager->endChanges(); |
|
451 |
||
452 |
bubbleManager->startChanges(); |
|
453 |
bubbleManager->removeConference(); |
|
454 |
bubbleManager->endChanges(); |
|
455 |
QTest::qWait( WAIT_TIME ); |
|
456 |
||
457 |
bubbleManager->startChanges(); |
|
458 |
bubbleManager->removeCallHeader(bubbleId1); |
|
459 |
bubbleManager->removeCallHeader(bubbleId2); |
|
460 |
bubbleManager->endChanges(); |
|
461 |
} |
|
462 |
||
463 |
void mt_BubbleManager2::testEmergencyCall() |
|
464 |
{ |
|
465 |
view->setTitle( "Emergency call" ); |
|
466 |
bubbleManager->startChanges(); |
|
467 |
int bubbleId = bubbleManager->createCallHeader(); |
|
468 |
QVERIFY( bubbleId == 0 ); |
|
469 |
bubbleManager->setState( bubbleId, BubbleManager::Outgoing ); |
|
470 |
bubbleManager->setCli( bubbleId, "emergency call", Qt::ElideRight ); |
|
471 |
bubbleManager->setNumberType( bubbleId, BubbleManager::Mobile ); |
|
472 |
bubbleManager->setLabel( bubbleId,"Attempting"); |
|
473 |
HbAction action1("End call", this); |
|
474 |
action1.setSoftKeyRole(QAction::NegativeSoftKey); |
|
475 |
bubbleManager->clearActions(bubbleId); |
|
476 |
bubbleManager->addAction( bubbleId, &action1 ); |
|
477 |
bubbleManager->endChanges(); |
|
478 |
||
479 |
QTest::qWait( WAIT_TIME ); |
|
480 |
mouseClickWidgetAction("eb:centerButton",&action1); |
|
481 |
QTest::qWait( WAIT_TIME ); |
|
482 |
||
483 |
bubbleManager->startChanges(); |
|
484 |
bubbleManager->setCli( bubbleId, "Emergency call", Qt::ElideRight ); |
|
485 |
bubbleManager->setState( bubbleId, BubbleManager::Alerting ); |
|
486 |
bubbleManager->endChanges(); |
|
487 |
QTest::qWait( WAIT_TIME ); |
|
488 |
||
489 |
bubbleManager->startChanges(); |
|
490 |
bubbleManager->setState( bubbleId, BubbleManager::Active ); |
|
491 |
bubbleManager->setLabel( bubbleId,""); |
|
492 |
bubbleManager->setCallTime( bubbleId, "00:00" ); |
|
493 |
bubbleManager->endChanges(); |
|
494 |
QTest::qWait( WAIT_TIME ); |
|
495 |
||
496 |
bubbleManager->startChanges(); |
|
497 |
bubbleManager->setState( bubbleId, BubbleManager::Disconnected ); |
|
498 |
bubbleManager->setLabel( bubbleId,"disconnected"); |
|
499 |
bubbleManager->endChanges(); |
|
500 |
||
501 |
QTest::qWait( WAIT_TIME ); |
|
502 |
bubbleManager->startChanges(); |
|
503 |
bubbleManager->removeCallHeader( bubbleId ); |
|
504 |
bubbleManager->endChanges(); |
|
505 |
QTest::qWait( WAIT_TIME ); |
|
506 |
} |
|
507 |
||
508 |
void mt_BubbleManager2::mouseClickWidget( |
|
509 |
const QString& name ) |
|
510 |
{ |
|
511 |
QGraphicsWidget* widget = getWidgetByName(name); |
|
512 |
||
513 |
if ( widget ) { |
|
514 |
QPointF widgetPos = widget->scenePos() + |
|
515 |
widget->rect().center(); |
|
516 |
||
517 |
QPoint windowPos = mainWindow->mapFromScene( widgetPos ); |
|
518 |
||
519 |
QTest::mouseClick( mainWindow->viewport(), Qt::LeftButton, 0, windowPos ); |
|
520 |
QTest::qWait( WAIT_TIME ); |
|
521 |
} else { |
|
522 |
QFAIL( "Widget cannot be accessed!" ); |
|
523 |
} |
|
524 |
} |
|
525 |
||
526 |
void mt_BubbleManager2::mouseClickWidgetAction( |
|
527 |
const QString& name, |
|
528 |
HbAction* action ) |
|
529 |
{ |
|
530 |
QSignalSpy spy( action, SIGNAL( triggered() ) ); |
|
531 |
||
532 |
QGraphicsWidget* widget = getWidgetByName(name); |
|
533 |
||
534 |
if ( widget ) { |
|
535 |
QPointF widgetPos = widget->scenePos() + |
|
536 |
widget->rect().center(); |
|
537 |
||
538 |
QPoint windowPos = mainWindow->mapFromScene( widgetPos ); |
|
539 |
||
540 |
QTest::mouseClick( mainWindow->viewport(), Qt::LeftButton, 0, windowPos ); |
|
541 |
QTest::qWait( WAIT_TIME ); |
|
542 |
QVERIFY( spy.count() == 1 ); |
|
543 |
} else { |
|
544 |
QFAIL( "Widget cannot be accessed!" ); |
|
545 |
} |
|
546 |
} |
|
547 |
||
548 |
QGraphicsWidget* mt_BubbleManager2::getWidgetByName(const QString& name) |
|
549 |
{ |
|
550 |
Q_ASSERT(mainWindow!=0); |
|
551 |
||
552 |
QGraphicsWidget* widget = 0; |
|
553 |
||
554 |
QList<QGraphicsItem*> items = mainWindow->scene()->items(); |
|
555 |
foreach (QGraphicsItem* item, items) { |
|
556 |
if (item->isWidget()) { |
|
557 |
QGraphicsWidget *w = static_cast<QGraphicsWidget*>(item); |
|
558 |
if (w->objectName()==name) { |
|
559 |
widget = w; |
|
560 |
} |
|
561 |
} |
|
562 |
} |
|
563 |
||
564 |
return widget; |
|
565 |
} |
|
566 |
||
567 |
BUBBLE_TEST_MAIN(mt_BubbleManager2) |
|
568 |
#include "mt_bubblemanager2.moc" |
|
569 |