|
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 DialService. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <QtTest/QtTest> |
|
19 |
|
20 #include "xqcallinfo.h" |
|
21 #include <ccpdefs.h> |
|
22 |
|
23 extern bool GlobalEmptyCallList; |
|
24 extern bool GlobalTriggerSignal; |
|
25 |
|
26 class TestXQCallInfo : public QObject |
|
27 { |
|
28 Q_OBJECT |
|
29 public: |
|
30 TestXQCallInfo(); |
|
31 virtual ~TestXQCallInfo(); |
|
32 |
|
33 public slots: |
|
34 void initTestCase (); |
|
35 void cleanupTestCase (); |
|
36 |
|
37 private slots: |
|
38 void testGetCallInfo (); |
|
39 void testGetCallInfoEmptyCallInfo(); |
|
40 void testIsCallInState(); |
|
41 |
|
42 private: |
|
43 |
|
44 XQCallInfo *m_XQCallInfo; |
|
45 }; |
|
46 |
|
47 TestXQCallInfo::TestXQCallInfo(): |
|
48 m_XQCallInfo(0) |
|
49 { |
|
50 } |
|
51 |
|
52 TestXQCallInfo::~TestXQCallInfo () |
|
53 { |
|
54 } |
|
55 |
|
56 void TestXQCallInfo::initTestCase () |
|
57 { |
|
58 GlobalEmptyCallList=false; |
|
59 m_XQCallInfo = XQCallInfo::create(); |
|
60 } |
|
61 |
|
62 void TestXQCallInfo::cleanupTestCase () |
|
63 { |
|
64 delete m_XQCallInfo; |
|
65 } |
|
66 |
|
67 |
|
68 void TestXQCallInfo::testGetCallInfo() |
|
69 { |
|
70 QList<CallInfo> calls; |
|
71 CallInfo callInfo; |
|
72 m_XQCallInfo->getCalls(calls); |
|
73 callInfo = calls.first(); |
|
74 CallInfo callInfo2; |
|
75 callInfo2 = calls.last(); |
|
76 |
|
77 QCOMPARE(callInfo.callType(), CCPCall::ECallTypeCSVoice ); |
|
78 QCOMPARE(callInfo.callDirection(), CCPCall::EMobileOriginated); |
|
79 QCOMPARE(callInfo.callState(), CCPCall::EStateDialling); |
|
80 |
|
81 QCOMPARE(callInfo2.callType(), CCPCall::ECallTypeCSVoice ); |
|
82 QCOMPARE(callInfo2.callDirection(), CCPCall::EMobileTerminated); |
|
83 QCOMPARE(callInfo2.callState(), CCPCall::EStateConnected); |
|
84 } |
|
85 |
|
86 void TestXQCallInfo::testGetCallInfoEmptyCallInfo() |
|
87 { |
|
88 GlobalEmptyCallList=true; |
|
89 QList<CallInfo> calls; |
|
90 m_XQCallInfo->getCalls(calls); |
|
91 |
|
92 QCOMPARE(calls.count(), 0 ); |
|
93 } |
|
94 |
|
95 void TestXQCallInfo::testIsCallInState() |
|
96 { |
|
97 GlobalTriggerSignal=true; |
|
98 QSignalSpy spy( m_XQCallInfo, SIGNAL( callInformationChanged() ) ); |
|
99 |
|
100 GlobalEmptyCallList=false; |
|
101 bool value(false); |
|
102 const CCPCall::TCallState state(CCPCall::EStateConnected ); |
|
103 value = m_XQCallInfo->isCallInState(CCPCall::EStateConnected); |
|
104 |
|
105 QCOMPARE(value, true ); |
|
106 QCOMPARE( spy.count(), 1 ); |
|
107 } |
|
108 |
|
109 |
|
110 QTEST_MAIN(TestXQCallInfo) |
|
111 #include "unit_tests.moc" |