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 |
#include <hbapplication.h>
|
|
21 |
#include <hbtextitem.h>
|
|
22 |
#include <hbiconitem.h>
|
|
23 |
#include <bubblebutton.h>
|
|
24 |
#include <hbaction.h>
|
|
25 |
|
|
26 |
#include "bubbletest.h"
|
|
27 |
#include "bubbleutils.h"
|
|
28 |
#include "bubbleheader.h"
|
|
29 |
#include "bubbleconferenceheader.h"
|
|
30 |
|
|
31 |
class ut_BubbleUtils : public QObject
|
|
32 |
{
|
|
33 |
Q_OBJECT
|
|
34 |
|
|
35 |
private slots:
|
|
36 |
void initTestCase();
|
|
37 |
void cleanupTestCase();
|
|
38 |
|
|
39 |
void test_setCallHeaderTexts3Lines_incoming();
|
|
40 |
void test_setCallHeaderTexts3Lines_waiting();
|
|
41 |
void test_setCallHeaderTexts3Lines_active();
|
|
42 |
void test_setCallHeaderTexts3Lines_disconnected();
|
|
43 |
void test_setCallHeaderTexts3Lines_outgoing();
|
|
44 |
void test_setCallHeaderTexts3Lines_alerting();
|
|
45 |
void test_setCallHeaderTexts3Lines_held();
|
|
46 |
void test_setCallHeaderTexts3Lines_alerttodisconnected();
|
|
47 |
|
|
48 |
void test_setCallHeaderTexts2Lines_waiting();
|
|
49 |
void test_setCallHeaderTexts2Lines_alerttodisconnected();
|
|
50 |
void test_setCallHeaderTexts2Lines_active();
|
|
51 |
void test_setCallHeaderTexts2Lines_held();
|
|
52 |
void test_setCallHeaderTexts2Lines_disconnected();
|
|
53 |
void test_setCallHeaderTexts2Lines_outgoing();
|
|
54 |
|
|
55 |
void test_compareHeaders();
|
|
56 |
|
|
57 |
void test_setButtonStyleForAction();
|
|
58 |
|
|
59 |
void test_voiceCallStatusIcon();
|
|
60 |
void test_videoCallStatusIcon();
|
|
61 |
void test_voipCallStatusIcon();
|
|
62 |
|
|
63 |
void test_numberTypeIcon();
|
|
64 |
|
|
65 |
void test_cipheringIcon();
|
|
66 |
|
|
67 |
private:
|
|
68 |
};
|
|
69 |
|
|
70 |
void ut_BubbleUtils::initTestCase()
|
|
71 |
{
|
|
72 |
}
|
|
73 |
|
|
74 |
void ut_BubbleUtils::cleanupTestCase()
|
|
75 |
{
|
|
76 |
}
|
|
77 |
|
|
78 |
void ut_BubbleUtils::test_setCallHeaderTexts3Lines_incoming()
|
|
79 |
{
|
|
80 |
// incoming call
|
|
81 |
BubbleHeader header;
|
|
82 |
HbTextItem text1;
|
|
83 |
HbTextItem text2;
|
|
84 |
HbTextItem text3;
|
|
85 |
int cliLine;
|
|
86 |
int timerLine;
|
|
87 |
|
|
88 |
header.setCallState( BubbleManager::Incoming );
|
|
89 |
header.setCli( "john", Qt::ElideRight );
|
|
90 |
header.setText( "calling", Qt::ElideRight );
|
|
91 |
|
|
92 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
93 |
|
|
94 |
QVERIFY( text1.text() == "john" );
|
|
95 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
96 |
QVERIFY( text2.text() == "calling" );
|
|
97 |
QVERIFY( text2.elideMode() == Qt::ElideRight );
|
|
98 |
QVERIFY( text3.text() == "" );
|
|
99 |
|
|
100 |
// add secondary cli
|
|
101 |
header.setSecondaryCli( "12345", Qt::ElideLeft );
|
|
102 |
|
|
103 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
104 |
|
|
105 |
QVERIFY( text1.text() == "john" );
|
|
106 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
107 |
QVERIFY( text2.text() == "12345" );
|
|
108 |
QVERIFY( text2.elideMode() == Qt::ElideLeft );
|
|
109 |
QVERIFY( text3.text() == "calling" );
|
|
110 |
}
|
|
111 |
|
|
112 |
void ut_BubbleUtils::test_setCallHeaderTexts3Lines_waiting()
|
|
113 |
{
|
|
114 |
// incoming call
|
|
115 |
BubbleHeader header;
|
|
116 |
HbTextItem text1;
|
|
117 |
HbTextItem text2;
|
|
118 |
HbTextItem text3;
|
|
119 |
int cliLine;
|
|
120 |
int timerLine;
|
|
121 |
|
|
122 |
header.setCallState( BubbleManager::Waiting );
|
|
123 |
header.setCli( "john", Qt::ElideRight );
|
|
124 |
header.setText( "waiting", Qt::ElideRight );
|
|
125 |
|
|
126 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
127 |
|
|
128 |
QVERIFY( text1.text() == "john" );
|
|
129 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
130 |
QVERIFY( text2.text() == "waiting" );
|
|
131 |
QVERIFY( text2.elideMode() == Qt::ElideRight );
|
|
132 |
QVERIFY( text3.text() == "" );
|
|
133 |
|
|
134 |
// add secondary cli
|
|
135 |
header.setSecondaryCli( "12345", Qt::ElideLeft );
|
|
136 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
137 |
|
|
138 |
QVERIFY( text1.text() == "john" );
|
|
139 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
140 |
QVERIFY( text2.text() == "12345" );
|
|
141 |
QVERIFY( text2.elideMode() == Qt::ElideLeft );
|
|
142 |
QVERIFY( text3.text() == "waiting" );
|
|
143 |
}
|
|
144 |
|
|
145 |
void ut_BubbleUtils::test_setCallHeaderTexts3Lines_active()
|
|
146 |
{
|
|
147 |
// active call
|
|
148 |
BubbleHeader header;
|
|
149 |
HbTextItem text1;
|
|
150 |
HbTextItem text2;
|
|
151 |
HbTextItem text3;
|
|
152 |
int cliLine;
|
|
153 |
int timerLine;
|
|
154 |
|
|
155 |
header.setCallState( BubbleManager::Active );
|
|
156 |
header.setCli( "john", Qt::ElideRight );
|
|
157 |
header.setText( "", Qt::ElideRight );
|
|
158 |
|
|
159 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
160 |
|
|
161 |
QVERIFY( text1.text() == "john" );
|
|
162 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
163 |
QVERIFY( text2.text() == "" );
|
|
164 |
QVERIFY( text3.text() == "" );
|
|
165 |
|
|
166 |
// add timer
|
|
167 |
header.setTimerCost( "00:00" );
|
|
168 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
169 |
QVERIFY( text1.text()== "john" );
|
|
170 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
171 |
QVERIFY( text2.text() == "00:00" );
|
|
172 |
QVERIFY( text2.elideMode() == Qt::ElideRight );
|
|
173 |
QVERIFY( text3.text() == "" );
|
|
174 |
header.setTimerCost( "" );
|
|
175 |
|
|
176 |
// add secondary cli
|
|
177 |
header.setSecondaryCli( "12345", Qt::ElideLeft );
|
|
178 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
179 |
|
|
180 |
QVERIFY( text1.text() == "john" );
|
|
181 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
182 |
QVERIFY( text2.text() == "12345" );
|
|
183 |
QVERIFY( text2.elideMode() == Qt::ElideLeft );
|
|
184 |
QVERIFY( text3.text() == "" );
|
|
185 |
|
|
186 |
// add timer
|
|
187 |
header.setTimerCost( "00:00" );
|
|
188 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
189 |
QVERIFY( text1.text()== "john" );
|
|
190 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
191 |
QVERIFY( text2.text() == "12345" );
|
|
192 |
QVERIFY( text2.elideMode() == Qt::ElideLeft );
|
|
193 |
QVERIFY( text3.text() == "00:00" );
|
|
194 |
QVERIFY( text3.elideMode() == Qt::ElideRight );
|
|
195 |
}
|
|
196 |
|
|
197 |
void ut_BubbleUtils::test_setCallHeaderTexts3Lines_disconnected()
|
|
198 |
{
|
|
199 |
// disconnected call
|
|
200 |
BubbleHeader header;
|
|
201 |
HbTextItem text1;
|
|
202 |
HbTextItem text2;
|
|
203 |
HbTextItem text3;
|
|
204 |
int cliLine;
|
|
205 |
int timerLine;
|
|
206 |
|
|
207 |
header.setCallState( BubbleManager::Disconnected );
|
|
208 |
header.setCli( "john", Qt::ElideRight );
|
|
209 |
header.setText( "discon", Qt::ElideRight );
|
|
210 |
header.setTimerCost( "00:00" );
|
|
211 |
|
|
212 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
213 |
QVERIFY( text1.text() == "john" );
|
|
214 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
215 |
QVERIFY( text2.text() == "discon" );
|
|
216 |
QVERIFY( text2.elideMode() == Qt::ElideRight );
|
|
217 |
QVERIFY( text3.text() == "" );
|
|
218 |
|
|
219 |
// add secondary cli
|
|
220 |
header.setSecondaryCli( "12345", Qt::ElideLeft );
|
|
221 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
222 |
|
|
223 |
QVERIFY( text1.text() == "john" );
|
|
224 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
225 |
QVERIFY( text2.text() == "12345" );
|
|
226 |
QVERIFY( text2.elideMode() == Qt::ElideLeft );
|
|
227 |
QVERIFY( text3.text() == "discon" );
|
|
228 |
QVERIFY( text3.elideMode() == Qt::ElideRight );
|
|
229 |
}
|
|
230 |
|
|
231 |
void ut_BubbleUtils::test_setCallHeaderTexts3Lines_outgoing()
|
|
232 |
{
|
|
233 |
// outgoing call
|
|
234 |
BubbleHeader header;
|
|
235 |
HbTextItem text1;
|
|
236 |
HbTextItem text2;
|
|
237 |
HbTextItem text3;
|
|
238 |
int cliLine;
|
|
239 |
int timerLine;
|
|
240 |
|
|
241 |
header.setCallState( BubbleManager::Outgoing );
|
|
242 |
header.setCli( "john", Qt::ElideRight );
|
|
243 |
header.setText( "calling", Qt::ElideRight );
|
|
244 |
|
|
245 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
246 |
|
|
247 |
QVERIFY( text1.text() == "calling" );
|
|
248 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
249 |
QVERIFY( text2.text() == "john" );
|
|
250 |
QVERIFY( text2.elideMode() == Qt::ElideRight );
|
|
251 |
QVERIFY( text3.text() == "" );
|
|
252 |
|
|
253 |
// add secondary cli
|
|
254 |
header.setSecondaryCli( "12345", Qt::ElideLeft );
|
|
255 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
256 |
|
|
257 |
QVERIFY( text1.text() == "calling" );
|
|
258 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
259 |
QVERIFY( text2.text() == "john" );
|
|
260 |
QVERIFY( text2.elideMode() == Qt::ElideRight );
|
|
261 |
QVERIFY( text3.text() == "12345" );
|
|
262 |
QVERIFY( text3.elideMode() == Qt::ElideLeft );
|
|
263 |
}
|
|
264 |
|
|
265 |
void ut_BubbleUtils::test_setCallHeaderTexts3Lines_alerting()
|
|
266 |
{
|
|
267 |
// alerting call
|
|
268 |
BubbleHeader header;
|
|
269 |
HbTextItem text1;
|
|
270 |
HbTextItem text2;
|
|
271 |
HbTextItem text3;
|
|
272 |
int cliLine;
|
|
273 |
int timerLine;
|
|
274 |
|
|
275 |
header.setCallState( BubbleManager::Alerting );
|
|
276 |
header.setCli( "john", Qt::ElideRight );
|
|
277 |
header.setText( "calling", Qt::ElideRight );
|
|
278 |
|
|
279 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
280 |
|
|
281 |
QVERIFY( text1.text() == "john" );
|
|
282 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
283 |
QVERIFY( text2.text() == "" );
|
|
284 |
QVERIFY( text3.text() == "" );
|
|
285 |
|
|
286 |
// add secondary cli
|
|
287 |
header.setSecondaryCli( "12345", Qt::ElideLeft );
|
|
288 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
289 |
|
|
290 |
QVERIFY( text1.text() == "john" );
|
|
291 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
292 |
QVERIFY( text2.text() == "12345" );
|
|
293 |
QVERIFY( text2.elideMode() == Qt::ElideLeft );
|
|
294 |
QVERIFY( text3.text() == "" );
|
|
295 |
}
|
|
296 |
|
|
297 |
void ut_BubbleUtils::test_setCallHeaderTexts3Lines_held()
|
|
298 |
{
|
|
299 |
// held
|
|
300 |
BubbleHeader header;
|
|
301 |
HbTextItem text1;
|
|
302 |
HbTextItem text2;
|
|
303 |
HbTextItem text3;
|
|
304 |
int cliLine;
|
|
305 |
int timerLine;
|
|
306 |
|
|
307 |
header.setCallState( BubbleManager::OnHold );
|
|
308 |
header.setCli( "john", Qt::ElideRight );
|
|
309 |
header.setText( "on hold", Qt::ElideRight );
|
|
310 |
header.setTimerCost( "00:00" );
|
|
311 |
|
|
312 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
313 |
|
|
314 |
QVERIFY( text1.text() == "john" );
|
|
315 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
316 |
QVERIFY( text2.text() == "on hold" );
|
|
317 |
QVERIFY( text2.elideMode() == Qt::ElideRight );
|
|
318 |
QVERIFY( text3.text() == "" );
|
|
319 |
|
|
320 |
// add secondary cli
|
|
321 |
header.setSecondaryCli( "12345", Qt::ElideLeft );
|
|
322 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
323 |
|
|
324 |
QVERIFY( text1.text() == "john" );
|
|
325 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
326 |
QVERIFY( text2.text() == "12345" );
|
|
327 |
QVERIFY( text2.elideMode() == Qt::ElideLeft );
|
|
328 |
QVERIFY( text3.text() == "on hold" );
|
|
329 |
QVERIFY( text3.elideMode() == Qt::ElideRight );
|
|
330 |
}
|
|
331 |
|
|
332 |
void ut_BubbleUtils::test_setCallHeaderTexts3Lines_alerttodisconnected()
|
|
333 |
{
|
|
334 |
// incoming call
|
|
335 |
BubbleHeader header;
|
|
336 |
HbTextItem text1;
|
|
337 |
HbTextItem text2;
|
|
338 |
HbTextItem text3;
|
|
339 |
int cliLine;
|
|
340 |
int timerLine;
|
|
341 |
|
|
342 |
header.setCallState( BubbleManager::Incoming );
|
|
343 |
header.setCallState( BubbleManager::AlertToDisconnected );
|
|
344 |
header.setCli( "john", Qt::ElideRight );
|
|
345 |
header.setText( "disconnected", Qt::ElideRight );
|
|
346 |
|
|
347 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
348 |
|
|
349 |
QVERIFY( text1.text() == "john" );
|
|
350 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
351 |
QVERIFY( text2.text() == "disconnected" );
|
|
352 |
QVERIFY( text2.elideMode() == Qt::ElideRight );
|
|
353 |
QVERIFY( text3.text() == "" );
|
|
354 |
|
|
355 |
// add secondary cli
|
|
356 |
header.setSecondaryCli( "12345", Qt::ElideLeft );
|
|
357 |
BubbleUtils::setCallHeaderTexts3Lines(header, text1, text2, text3, cliLine, timerLine);
|
|
358 |
|
|
359 |
QVERIFY( text1.text() == "john" );
|
|
360 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
361 |
QVERIFY( text2.text() == "12345" );
|
|
362 |
QVERIFY( text2.elideMode() == Qt::ElideLeft );
|
|
363 |
QVERIFY( text3.text() == "disconnected" );
|
|
364 |
}
|
|
365 |
|
|
366 |
void ut_BubbleUtils::test_setCallHeaderTexts2Lines_waiting()
|
|
367 |
{
|
|
368 |
// waiting call
|
|
369 |
BubbleHeader header;
|
|
370 |
HbTextItem text1;
|
|
371 |
HbTextItem text2;
|
|
372 |
int cliLine;
|
|
373 |
int timerLine;
|
|
374 |
|
|
375 |
header.setCallState( BubbleManager::Waiting );
|
|
376 |
header.setCli( "john", Qt::ElideRight );
|
|
377 |
header.setText( "waiting", Qt::ElideRight );
|
|
378 |
|
|
379 |
BubbleUtils::setCallHeaderTexts2Lines(header, text1, text2, cliLine, timerLine);
|
|
380 |
|
|
381 |
QVERIFY( text1.text() == "john" );
|
|
382 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
383 |
QVERIFY( text2.text() == "waiting" );
|
|
384 |
QVERIFY( text2.elideMode() == Qt::ElideRight );
|
|
385 |
|
|
386 |
// add secondary cli
|
|
387 |
header.setSecondaryCli("12345",Qt::ElideLeft);
|
|
388 |
BubbleUtils::setCallHeaderTexts2Lines(header, text1, text2, cliLine, timerLine);
|
|
389 |
QVERIFY( text1.text() == "john" );
|
|
390 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
391 |
QVERIFY( text2.text() == "waiting" );
|
|
392 |
QVERIFY( text2.elideMode() == Qt::ElideRight );
|
|
393 |
}
|
|
394 |
|
|
395 |
void ut_BubbleUtils::test_setCallHeaderTexts2Lines_alerttodisconnected()
|
|
396 |
{
|
|
397 |
// waiting call
|
|
398 |
BubbleHeader header;
|
|
399 |
HbTextItem text1;
|
|
400 |
HbTextItem text2;
|
|
401 |
int cliLine;
|
|
402 |
int timerLine;
|
|
403 |
|
|
404 |
header.setCallState( BubbleManager::AlertToDisconnected );
|
|
405 |
header.setCli( "john", Qt::ElideRight );
|
|
406 |
header.setText( "disconnected", Qt::ElideRight );
|
|
407 |
|
|
408 |
BubbleUtils::setCallHeaderTexts2Lines(header, text1, text2, cliLine, timerLine);
|
|
409 |
|
|
410 |
QVERIFY( text1.text() == "john" );
|
|
411 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
412 |
QVERIFY( text2.text() == "disconnected" );
|
|
413 |
QVERIFY( text2.elideMode() == Qt::ElideRight );
|
|
414 |
|
|
415 |
// add secondary cli
|
|
416 |
header.setSecondaryCli("12345",Qt::ElideLeft);
|
|
417 |
BubbleUtils::setCallHeaderTexts2Lines(header, text1, text2, cliLine, timerLine);
|
|
418 |
QVERIFY( text1.text() == "john" );
|
|
419 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
420 |
QVERIFY( text2.text() == "disconnected" );
|
|
421 |
QVERIFY( text2.elideMode() == Qt::ElideRight );
|
|
422 |
}
|
|
423 |
|
|
424 |
void ut_BubbleUtils::test_setCallHeaderTexts2Lines_active()
|
|
425 |
{
|
|
426 |
// active call
|
|
427 |
BubbleHeader header;
|
|
428 |
HbTextItem text1;
|
|
429 |
HbTextItem text2;
|
|
430 |
int cliLine;
|
|
431 |
int timerLine;
|
|
432 |
|
|
433 |
header.setCallState( BubbleManager::Active );
|
|
434 |
header.setCli( "john", Qt::ElideRight );
|
|
435 |
header.setText( "", Qt::ElideRight );
|
|
436 |
|
|
437 |
BubbleUtils::setCallHeaderTexts2Lines(header, text1, text2, cliLine, timerLine);
|
|
438 |
|
|
439 |
QVERIFY( text1.text() == "john" );
|
|
440 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
441 |
QVERIFY( text2.text() == "" );
|
|
442 |
|
|
443 |
// add timer
|
|
444 |
header.setTimerCost( "00:00" );
|
|
445 |
BubbleUtils::setCallHeaderTexts2Lines(header, text1, text2, cliLine, timerLine);
|
|
446 |
QVERIFY( text1.text() == "john" );
|
|
447 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
448 |
QVERIFY( text2.text() == "00:00" );
|
|
449 |
QVERIFY( text2.elideMode() == Qt::ElideRight );
|
|
450 |
}
|
|
451 |
|
|
452 |
void ut_BubbleUtils::test_setCallHeaderTexts2Lines_held()
|
|
453 |
{
|
|
454 |
// held
|
|
455 |
BubbleHeader header;
|
|
456 |
HbTextItem text1;
|
|
457 |
HbTextItem text2;
|
|
458 |
int cliLine;
|
|
459 |
int timerLine;
|
|
460 |
|
|
461 |
header.setCallState( BubbleManager::OnHold );
|
|
462 |
header.setCli( "john", Qt::ElideRight );
|
|
463 |
header.setText( "on hold", Qt::ElideRight );
|
|
464 |
header.setTimerCost( "00:00" );
|
|
465 |
|
|
466 |
BubbleUtils::setCallHeaderTexts2Lines(header, text1, text2, cliLine, timerLine);
|
|
467 |
|
|
468 |
QVERIFY( text1.text() == "john" );
|
|
469 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
470 |
QVERIFY( text2.text() == "on hold" );
|
|
471 |
QVERIFY( text2.elideMode() == Qt::ElideRight );
|
|
472 |
}
|
|
473 |
|
|
474 |
void ut_BubbleUtils::test_setCallHeaderTexts2Lines_disconnected()
|
|
475 |
{
|
|
476 |
// disconnected call
|
|
477 |
BubbleHeader header;
|
|
478 |
HbTextItem text1;
|
|
479 |
HbTextItem text2;
|
|
480 |
int cliLine;
|
|
481 |
int timerLine;
|
|
482 |
|
|
483 |
header.setCallState( BubbleManager::Disconnected );
|
|
484 |
header.setCli( "john", Qt::ElideRight );
|
|
485 |
header.setText( "discon", Qt::ElideRight );
|
|
486 |
header.setTimerCost( "00:00" );
|
|
487 |
|
|
488 |
BubbleUtils::setCallHeaderTexts2Lines(header, text1, text2, cliLine, timerLine);
|
|
489 |
QVERIFY( text1.text() == "john" );
|
|
490 |
QVERIFY( text1.elideMode() == Qt::ElideRight );
|
|
491 |
QVERIFY( text2.text() == "discon" );
|
|
492 |
QVERIFY( text2.elideMode() == Qt::ElideRight );
|
|
493 |
}
|
|
494 |
|
|
495 |
void ut_BubbleUtils::test_setCallHeaderTexts2Lines_outgoing()
|
|
496 |
{
|
|
497 |
// outgoing
|
|
498 |
BubbleHeader header;
|
|
499 |
HbTextItem text1;
|
|
500 |
HbTextItem text2;
|
|
501 |
int cliLine;
|
|
502 |
int timerLine;
|
|
503 |
|
|
504 |
header.setCallState(BubbleManager::Outgoing);
|
|
505 |
header.setCli("john", Qt::ElideRight);
|
|
506 |
header.setText("calling", Qt::ElideRight);
|
|
507 |
header.setTimerCost("00:00");
|
|
508 |
|
|
509 |
BubbleUtils::setCallHeaderTexts2Lines(header, text1, text2, cliLine, timerLine);
|
|
510 |
QCOMPARE(text1.text(), QString("calling"));
|
|
511 |
QCOMPARE(text1.elideMode(), Qt::ElideRight);
|
|
512 |
QCOMPARE(text2.text(), QString("john"));
|
|
513 |
QCOMPARE(text2.elideMode(), Qt::ElideRight);
|
|
514 |
}
|
|
515 |
|
|
516 |
void ut_BubbleUtils::test_compareHeaders()
|
|
517 |
{
|
|
518 |
BubbleHeader header1;
|
|
519 |
BubbleHeader header2;
|
|
520 |
BubbleConferenceHeader headerC;
|
|
521 |
|
|
522 |
header1.setCallState(BubbleManagerIF::Active);
|
|
523 |
header2.setCallState(BubbleManagerIF::Waiting);
|
|
524 |
QVERIFY( BubbleUtils::compareHeaders(&header1,&header2) == false );
|
|
525 |
|
|
526 |
header1.setCallState(BubbleManagerIF::Active);
|
|
527 |
header2.setCallState(BubbleManagerIF::OnHold);
|
|
528 |
QVERIFY( BubbleUtils::compareHeaders(&header1,&header2) == true );
|
|
529 |
|
|
530 |
headerC.setCallState(BubbleManagerIF::Active);
|
|
531 |
header1.setCallState(BubbleManagerIF::OnHold);
|
|
532 |
|
|
533 |
QVERIFY( BubbleUtils::compareHeaders(&headerC,&header1) == false );
|
|
534 |
}
|
|
535 |
|
|
536 |
void ut_BubbleUtils::test_setButtonStyleForAction()
|
|
537 |
{
|
|
538 |
BubbleButton button;
|
|
539 |
HbAction action;
|
|
540 |
|
|
541 |
action.setSoftKeyRole(QAction::NoSoftKey);
|
|
542 |
BubbleUtils::setButtonStyleForAction(button,action);
|
|
543 |
QVERIFY(button.buttonType()==BubbleButton::DefaultButton);
|
|
544 |
|
|
545 |
action.setSoftKeyRole(QAction::PositiveSoftKey);
|
|
546 |
BubbleUtils::setButtonStyleForAction(button,action);
|
|
547 |
QVERIFY(button.buttonType()==BubbleButton::GreenButton);
|
|
548 |
|
|
549 |
action.setSoftKeyRole(QAction::NegativeSoftKey);
|
|
550 |
BubbleUtils::setButtonStyleForAction(button,action);
|
|
551 |
QVERIFY(button.buttonType()==BubbleButton::RedButton);
|
|
552 |
}
|
|
553 |
|
|
554 |
void ut_BubbleUtils::test_voiceCallStatusIcon()
|
|
555 |
{
|
|
556 |
HbIconItem icon;
|
|
557 |
icon.hide();
|
|
558 |
|
|
559 |
// test different voice call states
|
|
560 |
|
|
561 |
BubbleUtils::setCallStatusIcon(
|
|
562 |
BubbleManagerIF::Incoming, BubbleManagerIF::Normal, icon);
|
|
563 |
QVERIFY(icon.iconName()=="voice_call_waiting_anim");
|
|
564 |
QVERIFY(icon.isVisible()==true);
|
|
565 |
|
|
566 |
BubbleUtils::setCallStatusIcon(
|
|
567 |
BubbleManagerIF::Waiting, BubbleManagerIF::Normal, icon);
|
|
568 |
QVERIFY(icon.iconName()=="voice_call_waiting_anim");
|
|
569 |
|
|
570 |
BubbleUtils::setCallStatusIcon(
|
|
571 |
BubbleManagerIF::Alerting, BubbleManagerIF::Normal, icon);
|
|
572 |
QVERIFY(icon.iconName()=="voice_call_waiting_anim");
|
|
573 |
|
|
574 |
BubbleUtils::setCallStatusIcon(
|
|
575 |
BubbleManagerIF::Active, BubbleManagerIF::Normal, icon);
|
|
576 |
QVERIFY(icon.iconName()=="qtg_large_active_call");
|
|
577 |
|
|
578 |
BubbleUtils::setCallStatusIcon(
|
|
579 |
BubbleManagerIF::Outgoing, BubbleManagerIF::Normal, icon);
|
|
580 |
QVERIFY(icon.iconName()=="qtg_large_active_call");
|
|
581 |
|
|
582 |
BubbleUtils::setCallStatusIcon(
|
|
583 |
BubbleManagerIF::OnHold, BubbleManagerIF::Normal, icon);
|
|
584 |
QVERIFY(icon.iconName()=="qtg_large_waiting_call");
|
|
585 |
|
|
586 |
BubbleUtils::setCallStatusIcon(
|
|
587 |
BubbleManagerIF::Disconnected, BubbleManagerIF::Normal, icon);
|
|
588 |
QVERIFY(icon.iconName()=="qtg_large_end_call");
|
|
589 |
|
|
590 |
BubbleUtils::setCallStatusIcon(
|
|
591 |
BubbleManagerIF::AlertToDisconnected, BubbleManagerIF::Normal, icon);
|
|
592 |
QVERIFY(icon.iconName()=="qtg_large_end_call");
|
|
593 |
|
|
594 |
icon.hide();
|
|
595 |
BubbleUtils::setCallStatusIcon(
|
|
596 |
BubbleManagerIF::None, BubbleManagerIF::Normal, icon);
|
|
597 |
QVERIFY(icon.iconName()=="");
|
|
598 |
QVERIFY(icon.isVisible()==false);
|
|
599 |
}
|
|
600 |
|
|
601 |
void ut_BubbleUtils::test_videoCallStatusIcon()
|
|
602 |
{
|
|
603 |
HbIconItem icon;
|
|
604 |
icon.hide();
|
|
605 |
|
|
606 |
// test different voice call states
|
|
607 |
|
|
608 |
BubbleUtils::setCallStatusIcon(
|
|
609 |
BubbleManagerIF::Incoming, BubbleManagerIF::Video, icon);
|
|
610 |
QVERIFY(icon.iconName()=="video_call_waiting_anim");
|
|
611 |
QVERIFY(icon.isVisible()==true);
|
|
612 |
|
|
613 |
BubbleUtils::setCallStatusIcon(
|
|
614 |
BubbleManagerIF::Waiting, BubbleManagerIF::Video, icon);
|
|
615 |
QVERIFY(icon.iconName()=="video_call_waiting_anim");
|
|
616 |
|
|
617 |
BubbleUtils::setCallStatusIcon(
|
|
618 |
BubbleManagerIF::Alerting, BubbleManagerIF::Video, icon);
|
|
619 |
QVERIFY(icon.iconName()=="video_call_waiting_anim");
|
|
620 |
|
|
621 |
BubbleUtils::setCallStatusIcon(
|
|
622 |
BubbleManagerIF::Active, BubbleManagerIF::Video, icon);
|
|
623 |
QVERIFY(icon.iconName()=="qtg_large_video_call_active");
|
|
624 |
|
|
625 |
BubbleUtils::setCallStatusIcon(
|
|
626 |
BubbleManagerIF::Outgoing, BubbleManagerIF::Video, icon);
|
|
627 |
QVERIFY(icon.iconName()=="qtg_large_video_call_active");
|
|
628 |
|
|
629 |
BubbleUtils::setCallStatusIcon(
|
|
630 |
BubbleManagerIF::OnHold, BubbleManagerIF::Video, icon);
|
|
631 |
QVERIFY(icon.iconName()=="qtg_large_video_call_waiting");
|
|
632 |
|
|
633 |
BubbleUtils::setCallStatusIcon(
|
|
634 |
BubbleManagerIF::Disconnected, BubbleManagerIF::Video, icon);
|
|
635 |
QVERIFY(icon.iconName()=="qtg_large_end_call");
|
|
636 |
|
|
637 |
BubbleUtils::setCallStatusIcon(
|
|
638 |
BubbleManagerIF::AlertToDisconnected, BubbleManagerIF::Video, icon);
|
|
639 |
QVERIFY(icon.iconName()=="qtg_large_end_call");
|
|
640 |
|
|
641 |
icon.hide();
|
|
642 |
BubbleUtils::setCallStatusIcon(
|
|
643 |
BubbleManagerIF::None, BubbleManagerIF::Video, icon);
|
|
644 |
QVERIFY(icon.iconName()=="");
|
|
645 |
QVERIFY(icon.isVisible()==false);
|
|
646 |
}
|
|
647 |
|
|
648 |
void ut_BubbleUtils::test_voipCallStatusIcon()
|
|
649 |
{
|
|
650 |
HbIconItem icon;
|
|
651 |
icon.hide();
|
|
652 |
|
|
653 |
// test different voice call states
|
|
654 |
|
|
655 |
BubbleUtils::setCallStatusIcon(
|
|
656 |
BubbleManagerIF::Incoming, BubbleManagerIF::VoIPCall, icon);
|
|
657 |
QVERIFY(icon.iconName()=="voip_call_waiting_anim");
|
|
658 |
QVERIFY(icon.isVisible()==true);
|
|
659 |
|
|
660 |
BubbleUtils::setCallStatusIcon(
|
|
661 |
BubbleManagerIF::Waiting, BubbleManagerIF::VoIPCall, icon);
|
|
662 |
QVERIFY(icon.iconName()=="voip_call_waiting_anim");
|
|
663 |
|
|
664 |
BubbleUtils::setCallStatusIcon(
|
|
665 |
BubbleManagerIF::Alerting, BubbleManagerIF::VoIPCall, icon);
|
|
666 |
QVERIFY(icon.iconName()=="voip_call_waiting_anim");
|
|
667 |
|
|
668 |
BubbleUtils::setCallStatusIcon(
|
|
669 |
BubbleManagerIF::Active, BubbleManagerIF::VoIPCall, icon);
|
|
670 |
QVERIFY(icon.iconName()=="qtg_large_voip_call_active");
|
|
671 |
|
|
672 |
BubbleUtils::setCallStatusIcon(
|
|
673 |
BubbleManagerIF::Outgoing, BubbleManagerIF::VoIPCall, icon);
|
|
674 |
QVERIFY(icon.iconName()=="qtg_large_voip_call_active");
|
|
675 |
|
|
676 |
BubbleUtils::setCallStatusIcon(
|
|
677 |
BubbleManagerIF::OnHold, BubbleManagerIF::VoIPCall, icon);
|
|
678 |
QVERIFY(icon.iconName()=="qtg_large_voip_call_waiting");
|
|
679 |
|
|
680 |
BubbleUtils::setCallStatusIcon(
|
|
681 |
BubbleManagerIF::Disconnected, BubbleManagerIF::VoIPCall, icon);
|
|
682 |
QVERIFY(icon.iconName()=="qtg_large_end_call");
|
|
683 |
|
|
684 |
BubbleUtils::setCallStatusIcon(
|
|
685 |
BubbleManagerIF::AlertToDisconnected, BubbleManagerIF::VoIPCall, icon);
|
|
686 |
QVERIFY(icon.iconName()=="qtg_large_end_call");
|
|
687 |
|
|
688 |
icon.hide();
|
|
689 |
BubbleUtils::setCallStatusIcon(
|
|
690 |
BubbleManagerIF::None, BubbleManagerIF::VoIPCall, icon);
|
|
691 |
QVERIFY(icon.iconName()=="");
|
|
692 |
QVERIFY(icon.isVisible()==false);
|
|
693 |
}
|
|
694 |
|
|
695 |
void ut_BubbleUtils::test_numberTypeIcon()
|
|
696 |
{
|
|
697 |
HbIconItem icon;
|
|
698 |
icon.hide();
|
|
699 |
|
|
700 |
BubbleUtils::setNumberTypeIcon(
|
|
701 |
BubbleManagerIF::Incoming, BubbleManagerIF::Diverted, icon);
|
|
702 |
QVERIFY(icon.iconName()==":/qtg_mono_call_diverted.svg");
|
|
703 |
QVERIFY(icon.isVisible()==true);
|
|
704 |
|
|
705 |
BubbleUtils::setNumberTypeIcon(
|
|
706 |
BubbleManagerIF::Waiting, BubbleManagerIF::Diverted, icon);
|
|
707 |
QVERIFY(icon.iconName()==":/qtg_mono_call_diverted.svg");
|
|
708 |
QVERIFY(icon.isVisible()==true);
|
|
709 |
|
|
710 |
BubbleUtils::setNumberTypeIcon(
|
|
711 |
BubbleManagerIF::Incoming, BubbleManagerIF::Normal, icon);
|
|
712 |
QVERIFY(icon.iconName()=="");
|
|
713 |
QVERIFY(icon.isVisible()==false);
|
|
714 |
}
|
|
715 |
|
|
716 |
void ut_BubbleUtils::test_cipheringIcon()
|
|
717 |
{
|
|
718 |
HbIconItem icon;
|
|
719 |
icon.hide();
|
|
720 |
|
|
721 |
BubbleUtils::setCipheringIcon(
|
|
722 |
BubbleManagerIF::Incoming, BubbleManagerIF::NoCiphering, icon);
|
|
723 |
QVERIFY(icon.iconName()=="qtg_mono_ciphering_off");
|
|
724 |
QVERIFY(icon.isVisible()==true);
|
|
725 |
|
|
726 |
BubbleUtils::setCipheringIcon(
|
|
727 |
BubbleManagerIF::Incoming, BubbleManagerIF::Normal, icon);
|
|
728 |
QVERIFY(icon.iconName()=="");
|
|
729 |
QVERIFY(icon.isVisible()==false);
|
|
730 |
}
|
|
731 |
|
|
732 |
BUBBLE_TEST_MAIN(ut_BubbleUtils)
|
|
733 |
#include "ut_bubbleutils.moc"
|