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