|
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: Unit tests for PhoneBubbleWrapper. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <QtTest/QtTest> |
|
19 #include <QtGui> |
|
20 #include <hbapplication.h> |
|
21 #include <QSignalSpy> |
|
22 #include <hbmainwindow.h> |
|
23 //#include <hbglobal_p.h> |
|
24 #include "phonebubblewrapper.h" |
|
25 #include "bubblemanagerif.h" |
|
26 #include "pevirtualengine.h" |
|
27 |
|
28 class TestPhoneBubbleWrapper : public QObject, public BubbleManagerIF |
|
29 { |
|
30 Q_OBJECT |
|
31 public: |
|
32 TestPhoneBubbleWrapper(); |
|
33 virtual ~TestPhoneBubbleWrapper(); |
|
34 QString sayTestPhoneBubbleWrapper (); |
|
35 |
|
36 // From BubbleManagerIF |
|
37 void startChanges () { m_startChangesCalled=true; }; |
|
38 void endChanges () { m_endChangesCalled=true; }; |
|
39 int createCallHeader () { return 5; }; |
|
40 void removeCallHeader (int bubbleId) { m_removeCallHeaderCalled=true; m_int=bubbleId; }; |
|
41 void setState (int bubbleId, PhoneCallState state) { m_int=bubbleId; m_bubbleState=state; }; |
|
42 void setLabel ( |
|
43 int bubbleId, |
|
44 const QString& text, |
|
45 Qt::TextElideMode clipDirection) { m_int=bubbleId; m_string=text; m_elideMode=clipDirection; }; |
|
46 void setCli (int bubbleId, |
|
47 const QString& cliText, |
|
48 Qt::TextElideMode clipDirection) { m_int=bubbleId; m_string=cliText; m_elideMode=clipDirection; }; |
|
49 void updateCLI ( |
|
50 int bubbleId, |
|
51 const QString& cliText, |
|
52 Qt::TextElideMode clipDirection) {}; |
|
53 void setSecondaryCli ( |
|
54 int bubbleId, |
|
55 const QString& cliText, |
|
56 Qt::TextElideMode clipDirection = Qt::ElideLeft) { m_int=bubbleId; m_string=cliText; m_elideMode=clipDirection; }; |
|
57 void setCallTime (int bubbleId, const QString& callTime) {}; |
|
58 void updateCallTime (int bubbleId, const QString& callTime) {}; |
|
59 void setCallObjectImage (int bubbleId, const QString &fileName) {}; |
|
60 void setCallObjectFromTheme (int bubbleId) {}; |
|
61 void setCallObjectText (int bubbleId, const QString &text) {}; |
|
62 void setCallFlags (int bubbleId, int flags) {}; |
|
63 void setCallFlag (int bubbleId, PhoneCallFlags flag, bool set) { m_setCallFlagCalled=true; m_int=bubbleId; m_callFlags=flag; m_set=set; }; |
|
64 void setNumberType (int bubbleId, PhoneNumberType type) {}; |
|
65 void updateCallHeaderText( |
|
66 int bubbleId, |
|
67 const QString &longText, |
|
68 const QString &shortText, |
|
69 Qt::TextElideMode clipDirection) {}; |
|
70 void setPhoneMuted (bool muted) {}; |
|
71 int createConference (int bubble1, int bubble2) { return 1; }; |
|
72 void removeConference () {}; |
|
73 void addRowToConference (int bubbleId) {}; |
|
74 void removeRowFromConference (int bubbleId) {}; |
|
75 int conferenceRowCount () const { return 2; }; |
|
76 void setSelectionInConference (int rowNumber) {}; |
|
77 void setSelectionIdInConference (int bubbleId) {}; |
|
78 int selectionInConference () const { return 0; }; |
|
79 int selectionIdInConference () const { return 0; }; |
|
80 void moveHighlightOneUpInConference () {}; |
|
81 void moveHighlightOneDownInConference () {}; |
|
82 void setExpandedConferenceCallHeader (bool expanded) {}; |
|
83 bool isConferenceExpanded () const { return false; }; |
|
84 int shownHeaderCount () const { return 1; }; |
|
85 void setParticipantListCli (int aBubbleId, ParticipantListCli aParticipantCli) {}; |
|
86 void addAction (int bubble, HbAction *action) {}; |
|
87 void clearActions (int bubble) {}; |
|
88 QGraphicsWidget* graphicsWidgetForAction (HbAction *action) const { return 0;}; |
|
89 void addParticipantListAction (HbAction *action) {}; |
|
90 void clearParticipantListActions () {}; |
|
91 int expandedBubble() const { return 0; }; |
|
92 void setExpandAction(int bubbleId, HbAction* action) {}; |
|
93 void setBubbleSelectionDisabled(bool b) {}; |
|
94 |
|
95 public slots: |
|
96 void initTestCase (); |
|
97 void cleanupTestCase (); |
|
98 void init (); |
|
99 void cleanup (); |
|
100 |
|
101 private slots: |
|
102 void testBubbleManager (); |
|
103 void testSetLabel (); |
|
104 void testSetCli (); |
|
105 void testSetSecondaryCli (); |
|
106 void testSetCallType (); |
|
107 void testCreateCallHeader (); |
|
108 void testRemoveCallHeader (); |
|
109 void testSetState (); |
|
110 void testBubbleId (); |
|
111 void testSetDivert(); |
|
112 void testSetCiphering(); |
|
113 void testActiveCallCount(); |
|
114 void testCallStates (); |
|
115 void testBubbles (); |
|
116 void testSetConferenceCallId (); |
|
117 void testRemoveConferenceCallId (); |
|
118 void testCreateConferenceBubble (); |
|
119 void testRemoveCallFromConference (); |
|
120 void testRemoveConferenceBubble (); |
|
121 void testCallIdByBubbleId (); |
|
122 void testAddToConferenceBubble(); |
|
123 void testSetServiceId(); |
|
124 |
|
125 private: |
|
126 PhoneBubbleWrapper *m_wrapper; // class under test |
|
127 QString m_string; |
|
128 int m_int; |
|
129 Qt::TextElideMode m_elideMode; |
|
130 bool m_startChangesCalled; |
|
131 bool m_endChangesCalled; |
|
132 bool m_removeCallHeaderCalled; |
|
133 bool m_setCallFlagCalled; |
|
134 bool m_set; |
|
135 PhoneCallState m_bubbleState; |
|
136 PhoneCallFlags m_callFlags; |
|
137 }; |
|
138 |
|
139 TestPhoneBubbleWrapper::TestPhoneBubbleWrapper () |
|
140 { |
|
141 } |
|
142 |
|
143 TestPhoneBubbleWrapper::~TestPhoneBubbleWrapper () |
|
144 { |
|
145 } |
|
146 |
|
147 void TestPhoneBubbleWrapper::initTestCase () |
|
148 { |
|
149 |
|
150 } |
|
151 |
|
152 void TestPhoneBubbleWrapper::cleanupTestCase () |
|
153 { |
|
154 // delete m_wrapper; |
|
155 |
|
156 } |
|
157 |
|
158 void TestPhoneBubbleWrapper::init () |
|
159 { |
|
160 m_wrapper = new PhoneBubbleWrapper (*this); |
|
161 m_string = ""; |
|
162 m_int = -1; |
|
163 m_elideMode = Qt::ElideNone; |
|
164 m_startChangesCalled = false; |
|
165 m_endChangesCalled = false; |
|
166 m_removeCallHeaderCalled = false; |
|
167 m_setCallFlagCalled = false; |
|
168 m_set = false; |
|
169 m_callFlags = BubbleManagerIF::Normal; |
|
170 } |
|
171 |
|
172 void TestPhoneBubbleWrapper::cleanup () |
|
173 { |
|
174 delete m_wrapper; |
|
175 m_wrapper = 0; |
|
176 } |
|
177 |
|
178 QString TestPhoneBubbleWrapper::sayTestPhoneBubbleWrapper () |
|
179 { |
|
180 QString say ("TestPhoneBubbleWrapper"); |
|
181 return say; |
|
182 } |
|
183 |
|
184 void TestPhoneBubbleWrapper::testBubbleManager () |
|
185 { |
|
186 TestPhoneBubbleWrapper &fetched = reinterpret_cast<TestPhoneBubbleWrapper&>(m_wrapper-> bubbleManager ()); |
|
187 |
|
188 // Comparing two references not possible so we circumvent it this way |
|
189 // to be sure we are dealing with same object. |
|
190 // fetched should be this object so calling sayTestPhoneBubbleWrapper should |
|
191 // return a QString - if it's not this object it should simply crash. |
|
192 QCOMPARE (fetched.sayTestPhoneBubbleWrapper (), sayTestPhoneBubbleWrapper () ); |
|
193 } |
|
194 |
|
195 void TestPhoneBubbleWrapper::testSetLabel () |
|
196 { |
|
197 _LIT (KTestText, "Test Name"); |
|
198 m_wrapper->setLabel (2, KTestText); |
|
199 QCOMPARE (m_int, 2); |
|
200 QCOMPARE (m_string, QString ("Test Name")); |
|
201 QCOMPARE (m_elideMode, Qt::ElideRight); |
|
202 } |
|
203 |
|
204 void TestPhoneBubbleWrapper::testSetCli () |
|
205 { |
|
206 _LIT (KTestText, "Test Name"); |
|
207 m_wrapper->setCli (3, KTestText); |
|
208 QCOMPARE (m_int, 3); |
|
209 QCOMPARE (m_string, QString ("Test Name")); |
|
210 QCOMPARE (m_elideMode, Qt::ElideRight); |
|
211 } |
|
212 |
|
213 void TestPhoneBubbleWrapper::testSetSecondaryCli () |
|
214 { |
|
215 _LIT (KTestText, "Test Name"); |
|
216 m_wrapper->setSecondaryCli (4, KTestText); |
|
217 QCOMPARE (m_int, 4); |
|
218 QCOMPARE (m_string, QString ("Test Name")); |
|
219 QCOMPARE (m_elideMode, Qt::ElideLeft); |
|
220 } |
|
221 |
|
222 void TestPhoneBubbleWrapper::testSetCallType () |
|
223 { |
|
224 m_wrapper->setCallType(0, EPECallTypeVideo); |
|
225 m_wrapper->setCallType(0, EPECallTypeVoIP); |
|
226 m_wrapper->setCallType(0, 100); |
|
227 |
|
228 m_wrapper->setCallType(1, EPECallTypeCSVoice); |
|
229 |
|
230 QVERIFY(m_setCallFlagCalled); |
|
231 QCOMPARE(m_int, 1); |
|
232 QCOMPARE(m_callFlags, BubbleManagerIF::Normal); |
|
233 } |
|
234 |
|
235 void TestPhoneBubbleWrapper::testCreateCallHeader () |
|
236 { |
|
237 QCOMPARE (m_wrapper->createCallHeader (1), 5); |
|
238 QCOMPARE (m_wrapper->createCallHeader (1), 5); |
|
239 m_wrapper->removeCallHeader(1); |
|
240 } |
|
241 |
|
242 void TestPhoneBubbleWrapper::testRemoveCallHeader () |
|
243 { |
|
244 m_wrapper->removeCallHeader (3); |
|
245 QVERIFY (m_startChangesCalled == false); |
|
246 QVERIFY (m_removeCallHeaderCalled == false); |
|
247 QVERIFY (m_endChangesCalled == false); |
|
248 |
|
249 m_wrapper->createCallHeader (2); |
|
250 m_wrapper->removeCallHeader (2); |
|
251 |
|
252 QVERIFY (m_removeCallHeaderCalled == true); |
|
253 QCOMPARE (m_int, 5); |
|
254 } |
|
255 |
|
256 void TestPhoneBubbleWrapper::testSetState () |
|
257 { |
|
258 m_wrapper->setState (0, 1, EPEStateIdle); |
|
259 QCOMPARE(m_int, 1); |
|
260 QCOMPARE(m_bubbleState, BubbleManagerIF::Disconnected); |
|
261 QCOMPARE(m_wrapper->callId (EPEStateIdle), 0); |
|
262 |
|
263 m_wrapper->setState (0, 2, EPEStateDialing); |
|
264 QCOMPARE(m_int, 2); |
|
265 QCOMPARE(m_bubbleState, BubbleManagerIF::Outgoing); |
|
266 QCOMPARE(m_wrapper->callId (EPEStateDialing), 0); |
|
267 |
|
268 m_wrapper->setState (0, 3, EPEStateRinging); |
|
269 QCOMPARE(m_int, 3); |
|
270 QCOMPARE(m_bubbleState, BubbleManagerIF::Incoming); |
|
271 QCOMPARE(m_wrapper->callId (EPEStateRinging), 0); |
|
272 |
|
273 m_wrapper->setState (0, 4, EPEStateConnecting); |
|
274 QCOMPARE(m_int, 4); |
|
275 QCOMPARE(m_bubbleState, BubbleManagerIF::Alerting); |
|
276 QCOMPARE(m_wrapper->callId (EPEStateConnecting), 0); |
|
277 |
|
278 m_wrapper->setState (0, 5, EPEStateConnected); |
|
279 QCOMPARE(m_int, 5); |
|
280 QCOMPARE(m_bubbleState, BubbleManagerIF::Active); |
|
281 QCOMPARE(m_wrapper->callId (EPEStateConnected), 0); |
|
282 |
|
283 m_wrapper->setState (0, 6, EPEStateHeld); |
|
284 QCOMPARE(m_int, 6); |
|
285 QCOMPARE(m_bubbleState, BubbleManagerIF::OnHold); |
|
286 QCOMPARE(m_wrapper->callId (EPEStateHeld), 0); |
|
287 |
|
288 m_wrapper->setState (0, 7, EPEStateDisconnecting); |
|
289 QCOMPARE(m_int, 7); |
|
290 QCOMPARE(m_bubbleState, BubbleManagerIF::Disconnected); |
|
291 QCOMPARE(m_wrapper->callId (EPEStateDisconnecting), 0); |
|
292 |
|
293 m_wrapper->setState (0, 8, EPEStateConferenceIdle); |
|
294 QCOMPARE(m_int, 8); |
|
295 QCOMPARE(m_bubbleState, BubbleManagerIF::Disconnected); |
|
296 QCOMPARE(m_wrapper->callId (EPEStateConferenceIdle), 0); |
|
297 |
|
298 m_wrapper->setState (0, 9, EPEStateConnectedConference); |
|
299 QCOMPARE(m_int, 9); |
|
300 QCOMPARE(m_bubbleState, BubbleManagerIF::Active); |
|
301 QCOMPARE(m_wrapper->callId (EPEStateConnectedConference), 0); |
|
302 |
|
303 m_wrapper->setState (0, 10, EPEStateHeldConference); |
|
304 QCOMPARE(m_int, 10); |
|
305 QCOMPARE(m_bubbleState, BubbleManagerIF::OnHold); |
|
306 QCOMPARE(m_wrapper->callId (EPEStateHeldConference), 0); |
|
307 |
|
308 m_wrapper->setState (0, 11, EPEStateUnknown); |
|
309 QCOMPARE(m_int, 11); |
|
310 QCOMPARE(m_bubbleState, BubbleManagerIF::None); |
|
311 QCOMPARE(m_wrapper->callId (EPEStateUnknown), 0); |
|
312 |
|
313 m_wrapper->createCallHeader (0); |
|
314 int bubble = m_wrapper->createCallHeader (1); |
|
315 m_wrapper->setState (1, bubble, EPEStateRinging); |
|
316 QCOMPARE (m_int, bubble); |
|
317 QCOMPARE (m_bubbleState, BubbleManagerIF::Waiting); |
|
318 QCOMPARE (m_wrapper->callId (EPEStateRinging), 1); |
|
319 m_wrapper->removeCallHeader (1); |
|
320 m_wrapper->removeCallHeader (0); |
|
321 |
|
322 m_wrapper->setState (0, 11, 100); |
|
323 } |
|
324 |
|
325 void TestPhoneBubbleWrapper::testBubbleId () |
|
326 { |
|
327 QCOMPARE (m_wrapper->bubbleId (0), -1); |
|
328 int bubble = m_wrapper->createCallHeader (0); |
|
329 QCOMPARE (m_wrapper->bubbleId (0), bubble); |
|
330 m_wrapper->removeCallHeader (0); |
|
331 QCOMPARE (m_wrapper->bubbleId (0), -1); |
|
332 } |
|
333 |
|
334 void TestPhoneBubbleWrapper::testSetDivert () |
|
335 { |
|
336 m_wrapper->setDivert (2, false); |
|
337 QVERIFY (m_setCallFlagCalled == false); |
|
338 QCOMPARE (m_int, -1); |
|
339 QCOMPARE (m_callFlags, (int)BubbleManagerIF::None); |
|
340 QVERIFY (m_set == false); |
|
341 |
|
342 m_wrapper->setDivert (1, true); |
|
343 QVERIFY (m_setCallFlagCalled == true); |
|
344 QCOMPARE (m_int, 1); |
|
345 QCOMPARE (m_callFlags, BubbleManagerIF::Diverted); |
|
346 QVERIFY (m_set == true); |
|
347 } |
|
348 |
|
349 void TestPhoneBubbleWrapper::testSetCiphering() |
|
350 { |
|
351 m_wrapper->setCiphering(2, false, false); |
|
352 QVERIFY(m_setCallFlagCalled == true); |
|
353 QCOMPARE(m_callFlags, (int)BubbleManagerIF::NoCiphering); |
|
354 QVERIFY(m_int == 2); |
|
355 QVERIFY(m_set == false); |
|
356 |
|
357 m_wrapper->setCiphering(2, true, true); |
|
358 QVERIFY(m_setCallFlagCalled == true); |
|
359 QCOMPARE(m_callFlags, (int)BubbleManagerIF::NoCiphering); |
|
360 QVERIFY(m_int == 2); |
|
361 QVERIFY(m_set == false); |
|
362 |
|
363 m_wrapper->setCiphering(2, true, false); |
|
364 QVERIFY(m_setCallFlagCalled == true); |
|
365 QCOMPARE(m_callFlags, (int)BubbleManagerIF::NoCiphering); |
|
366 QVERIFY(m_int == 2); |
|
367 QVERIFY(m_set == true); |
|
368 } |
|
369 |
|
370 void TestPhoneBubbleWrapper::testActiveCallCount () |
|
371 { |
|
372 QCOMPARE (m_wrapper->activeCallCount(), 0); |
|
373 int bubble = m_wrapper->createCallHeader (0); |
|
374 m_wrapper->setState(0,bubble,EPEStateConnected); |
|
375 QCOMPARE (m_wrapper->activeCallCount(), 1); |
|
376 m_wrapper->removeCallHeader (0); |
|
377 QCOMPARE (m_wrapper->activeCallCount(), 0); |
|
378 } |
|
379 |
|
380 void TestPhoneBubbleWrapper::testCallStates () |
|
381 { |
|
382 QCOMPARE( 0, m_wrapper->callStates().size() ); |
|
383 |
|
384 m_wrapper->createCallHeader (0); |
|
385 m_wrapper->createCallHeader (1); |
|
386 |
|
387 |
|
388 m_wrapper->updateCallState(0, 2); |
|
389 m_wrapper->updateCallState(1, 3); |
|
390 m_wrapper->updateCallState(2, 4); |
|
391 |
|
392 QCOMPARE( 2, m_wrapper->callStates().size() ); |
|
393 |
|
394 m_wrapper->createCallHeader (2); |
|
395 QCOMPARE( 3, m_wrapper->callStates().size() ); |
|
396 |
|
397 m_wrapper->setConferenceCallId(0); |
|
398 m_wrapper->setConferenceCallId(1); |
|
399 m_wrapper->updateCallState(8, 5); |
|
400 |
|
401 QCOMPARE( 1, m_wrapper->callStates().size() ); |
|
402 |
|
403 } |
|
404 |
|
405 void TestPhoneBubbleWrapper::testBubbles () |
|
406 { |
|
407 QCOMPARE( 0, m_wrapper->bubbles().size() ); |
|
408 |
|
409 m_wrapper->createCallHeader (0); |
|
410 m_wrapper->createCallHeader (1); |
|
411 m_wrapper->createCallHeader (3); |
|
412 |
|
413 QCOMPARE( 3, m_wrapper->bubbles().size() ); |
|
414 |
|
415 m_wrapper->setConferenceCallId(0); |
|
416 |
|
417 QCOMPARE( 2, m_wrapper->bubbles().size() ); |
|
418 } |
|
419 |
|
420 void TestPhoneBubbleWrapper::testSetConferenceCallId () |
|
421 { |
|
422 m_wrapper->setConferenceCallId(0); |
|
423 m_wrapper->setConferenceCallId(1); |
|
424 |
|
425 QCOMPARE( 2, m_wrapper->conferenceCallList().size() ); |
|
426 |
|
427 //set same call id |
|
428 m_wrapper->setConferenceCallId(1); |
|
429 QCOMPARE( 2, m_wrapper->conferenceCallList().size() ); |
|
430 |
|
431 QCOMPARE( true, m_wrapper->conferenceCallId(0) ); |
|
432 QCOMPARE( false, m_wrapper->conferenceCallId(3) ); |
|
433 } |
|
434 |
|
435 void TestPhoneBubbleWrapper::testRemoveConferenceCallId () |
|
436 { |
|
437 m_wrapper->setConferenceCallId(0); |
|
438 m_wrapper->setConferenceCallId(1); |
|
439 |
|
440 QCOMPARE( 2, m_wrapper->conferenceCallList().size() ); |
|
441 m_wrapper->removeConferenceCallId(3); |
|
442 QCOMPARE( 2, m_wrapper->conferenceCallList().size() ); |
|
443 m_wrapper->removeConferenceCallId(1); |
|
444 QCOMPARE( 1, m_wrapper->conferenceCallList().size() ); |
|
445 QCOMPARE( true, m_wrapper->conferenceCallId(0) ); |
|
446 QCOMPARE( false, m_wrapper->conferenceCallId(1) ); |
|
447 m_wrapper->removeConferenceCallId(0); |
|
448 QCOMPARE( 0, m_wrapper->conferenceCallList().size() ); |
|
449 } |
|
450 |
|
451 void TestPhoneBubbleWrapper::testCreateConferenceBubble () |
|
452 { |
|
453 m_wrapper->createConferenceBubble(8,EPEStateConnectedConference,_L("conference"),_L("conference")); |
|
454 QVERIFY( 0 == m_wrapper->conferenceCallList().size() ); |
|
455 |
|
456 m_wrapper->createCallHeader(0); |
|
457 m_wrapper->createCallHeader(1); |
|
458 |
|
459 m_wrapper->createConferenceBubble(0,EPEStateConnectedConference,_L("conference"),_L("conference")); |
|
460 |
|
461 QVERIFY( 2 == m_wrapper->conferenceCallList().size() ); |
|
462 |
|
463 } |
|
464 |
|
465 void TestPhoneBubbleWrapper::testRemoveCallFromConference () |
|
466 { |
|
467 m_wrapper->createCallHeader(0); |
|
468 m_wrapper->createCallHeader(1); |
|
469 |
|
470 m_wrapper->createConferenceBubble(0,EPEStateConnectedConference,_L("conference"),_L("conference")); |
|
471 |
|
472 m_wrapper->removeCallFromConference(0); |
|
473 |
|
474 QVERIFY( 1 == m_wrapper->conferenceCallList().size() ); |
|
475 |
|
476 m_wrapper->removeConferenceCallId(1); |
|
477 |
|
478 QVERIFY( 0 == m_wrapper->conferenceCallList().size() ); |
|
479 } |
|
480 |
|
481 void TestPhoneBubbleWrapper::testRemoveConferenceBubble () |
|
482 { |
|
483 m_wrapper->createCallHeader(0); |
|
484 m_wrapper->createCallHeader(1); |
|
485 |
|
486 m_wrapper->createConferenceBubble(0,EPEStateConnectedConference,_L("conference"),_L("conference")); |
|
487 m_wrapper->removeConferenceBubble(); |
|
488 |
|
489 QVERIFY( 0 == m_wrapper->conferenceCallList().size() ); |
|
490 } |
|
491 |
|
492 void TestPhoneBubbleWrapper::testAddToConferenceBubble () |
|
493 { |
|
494 m_wrapper->addToConferenceBubble(); |
|
495 |
|
496 int bubbleId = m_wrapper->createCallHeader(0); |
|
497 m_wrapper->setState(0, bubbleId, EPEStateRinging); |
|
498 int bubbleId2 = m_wrapper->createCallHeader(1); |
|
499 m_wrapper->setState(1, bubbleId2, EPEStateConnected); |
|
500 int bubbleId3 = m_wrapper->createCallHeader(2); |
|
501 m_wrapper->setState(2, bubbleId3, EPEStateHeld); |
|
502 |
|
503 m_wrapper->createConferenceBubble(8,EPEStateConnectedConference,_L("conference"),_L("conference")); |
|
504 |
|
505 m_wrapper->addToConferenceBubble(); |
|
506 |
|
507 QCOMPARE( 3, m_wrapper->conferenceCallList().size() ); |
|
508 |
|
509 m_wrapper->removeCallFromConference(0); |
|
510 QCOMPARE( 2, m_wrapper->conferenceCallList().size() ); |
|
511 |
|
512 int bubbleId4 = m_wrapper->createCallHeader(3); |
|
513 m_wrapper->setState(3, bubbleId4, EPEStateHeld); |
|
514 |
|
515 m_wrapper->addToConferenceBubble(); |
|
516 QCOMPARE( 3, m_wrapper->conferenceCallList().size() ); |
|
517 |
|
518 m_wrapper->removeCallFromConference(0); |
|
519 m_wrapper->removeCallHeader(0); |
|
520 QCOMPARE( 3, m_wrapper->conferenceCallList().size() ); |
|
521 |
|
522 m_wrapper->removeCallFromConference(1); |
|
523 m_wrapper->removeCallHeader(1); |
|
524 m_wrapper->removeCallFromConference(2); |
|
525 m_wrapper->removeCallHeader(2); |
|
526 m_wrapper->removeCallFromConference(3); |
|
527 m_wrapper->removeCallHeader(3); |
|
528 |
|
529 QCOMPARE( 0, m_wrapper->conferenceCallList().size() ); |
|
530 } |
|
531 |
|
532 void TestPhoneBubbleWrapper::testCallIdByBubbleId () |
|
533 { |
|
534 int callId = 1; |
|
535 int bubbleId = m_wrapper->createCallHeader(callId); |
|
536 |
|
537 QVERIFY( callId == m_wrapper->callIdByBubbleId(bubbleId) ); |
|
538 } |
|
539 |
|
540 void TestPhoneBubbleWrapper::testSetServiceId() |
|
541 { |
|
542 int serviceId(1); |
|
543 int callId(2); |
|
544 int callId2(3); |
|
545 |
|
546 m_wrapper->setServiceId(callId, serviceId); |
|
547 |
|
548 QVERIFY(serviceId == m_wrapper->serviceIdByCallId(callId)); |
|
549 QVERIFY(-1 == m_wrapper->serviceIdByCallId(callId2)); |
|
550 QVERIFY(1 == m_wrapper->serviceIds().keys().count()); |
|
551 |
|
552 } |
|
553 |
|
554 QTEST_MAIN(TestPhoneBubbleWrapper) |
|
555 #include "unit_tests.moc" |