author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 23 Jun 2010 18:12:20 +0300 | |
changeset 45 | 6b911d05207e |
parent 37 | ba76fc04e6c2 |
child 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: Unit tests for Phone Services. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include <QtTest/QtTest> |
|
19 |
||
20 |
//#include <hbglobal_p.h> |
|
21 |
#include "phoneservices.h" |
|
22 |
#include "dialservice.h" |
|
23 |
#include "dtmfservice.h" |
|
24 |
||
25 |
bool m_dialServiceConstructed; |
|
26 |
bool m_dtmfServiceConstructed; |
|
27 |
MPECallControlIF* m_dialServiceCallPointer; |
|
28 |
MPECallSettersIF* m_dialServiceParameterPointer; |
|
29 |
MPECallControlIF* m_dtmfServiceCallPointer; |
|
30 |
MPECallSettersIF* m_dtmfServiceParameterPointer; |
|
31 |
||
32 |
class TestPhoneServices |
|
33 |
: |
|
34 |
public QObject, |
|
35 |
public MPECallControlIF, |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
36 |
public MPECallSettersIF |
37 | 37 |
{ |
38 |
Q_OBJECT |
|
39 |
public: |
|
40 |
TestPhoneServices(); |
|
41 |
virtual ~TestPhoneServices(); |
|
42 |
||
43 |
public slots: |
|
44 |
void initTestCase (); |
|
45 |
void cleanupTestCase (); |
|
46 |
void init (); |
|
47 |
void cleanup (); |
|
48 |
||
49 |
public: |
|
50 |
void SetKeyCode( const TChar& aKeyCode ); |
|
51 |
void SetPhoneNumber( const TPEPhoneNumber& aPhoneNumber ); |
|
52 |
void SetCallTypeCommand( const TPECallType& aCallType ); |
|
53 |
TInt HandleDialServiceCall( const TBool aClientCall = EFalse ); |
|
54 |
void HandlePlayDTMFL(); |
|
55 |
TInt HandleEndDTMF(); |
|
56 |
void SetContactId2( const TInt aContactId ); |
|
57 |
void SetServiceIdCommand( TUint32 aServiceId ); |
|
58 |
||
59 |
private slots: |
|
60 |
void testPhoneServiceStartup(); |
|
61 |
||
62 |
private: |
|
63 |
PhoneServices *m_phoneServices; // class under test |
|
64 |
bool m_setPhoneNumberCalled; |
|
65 |
bool m_setCallTypeCommandCalled; |
|
66 |
bool m_handleDialCallCalled; |
|
67 |
TPEPhoneNumber m_phoneNumber; |
|
68 |
TPECallType m_callType; |
|
69 |
bool m_clientCall; |
|
70 |
int m_contactId; |
|
71 |
bool m_setContactIdCalled; |
|
72 |
bool m_handleEndDTMFCalled; |
|
73 |
bool m_handlePlayDTMFLCalled; |
|
74 |
bool m_setKeyCodeCalled; |
|
75 |
ushort keyValue; |
|
76 |
}; |
|
77 |
||
78 |
DialService::DialService(MPECallControlIF &call, MPECallSettersIF ¶meters, QObject* parent) : |
|
79 |
XQServiceProvider(QLatin1String("com.nokia.symbian.ICallDial"), parent), m_call (call), m_parameters (parameters) |
|
80 |
{ |
|
81 |
m_dialServiceConstructed = true; |
|
82 |
m_dialServiceCallPointer = &call; |
|
83 |
m_dialServiceParameterPointer = ¶meters; |
|
84 |
} |
|
85 |
||
86 |
DialService::~DialService() |
|
87 |
{ |
|
88 |
} |
|
89 |
||
90 |
int DialService::dial(const QString& number) |
|
91 |
{ |
|
92 |
Q_UNUSED(number); |
|
93 |
return 0; |
|
94 |
} |
|
95 |
||
96 |
int DialService::dial(const QString& number, int contactId) |
|
97 |
{ |
|
98 |
Q_UNUSED(number); |
|
99 |
Q_UNUSED (contactId); |
|
100 |
return 0; |
|
101 |
} |
|
102 |
||
103 |
void DialService::dialVideo(const QString& number) |
|
104 |
{ |
|
105 |
Q_UNUSED(number); |
|
106 |
} |
|
107 |
||
108 |
void DialService::dialVideo(const QString& number, int contactId) |
|
109 |
{ |
|
110 |
Q_UNUSED(number); |
|
111 |
Q_UNUSED(contactId); |
|
112 |
} |
|
113 |
||
114 |
void DialService::dialVoip(const QString& address) |
|
115 |
{ |
|
116 |
Q_UNUSED(address); |
|
117 |
} |
|
118 |
||
119 |
void DialService::dialVoip(const QString& address, int contactId) |
|
120 |
{ |
|
121 |
Q_UNUSED(address); |
|
122 |
Q_UNUSED(contactId); |
|
123 |
} |
|
124 |
||
125 |
void DialService::dialVoipService(const QString& address, int serviceId) |
|
126 |
{ |
|
127 |
Q_UNUSED(address); |
|
128 |
Q_UNUSED(serviceId); |
|
129 |
} |
|
130 |
||
131 |
void DialService::dialVoipService( |
|
132 |
const QString& address, int serviceId, int contactId) |
|
133 |
{ |
|
134 |
Q_UNUSED(address); |
|
135 |
Q_UNUSED(serviceId); |
|
136 |
Q_UNUSED(contactId); |
|
137 |
} |
|
138 |
||
139 |
DTMFService::DTMFService(MPECallControlIF &call, MPECallSettersIF ¶meters, QObject* parent) : |
|
140 |
XQServiceProvider(QLatin1String("com.nokia.symbian.IDtmfPlay"), parent), m_call (call), m_parameters (parameters) |
|
141 |
{ |
|
142 |
m_dtmfServiceConstructed = true; |
|
143 |
m_dtmfServiceCallPointer = &call; |
|
144 |
m_dtmfServiceParameterPointer = ¶meters; |
|
145 |
} |
|
146 |
||
147 |
DTMFService::~DTMFService() |
|
148 |
{ |
|
149 |
} |
|
150 |
||
151 |
void DTMFService::playDTMFTone(const QChar& keyToPlay) |
|
152 |
{ |
|
153 |
Q_UNUSED(keyToPlay); |
|
154 |
} |
|
155 |
||
156 |
void DTMFService::stopDTMFPlay() |
|
157 |
{ |
|
158 |
} |
|
159 |
||
160 |
TestPhoneServices::TestPhoneServices () |
|
161 |
{ |
|
162 |
} |
|
163 |
||
164 |
TestPhoneServices::~TestPhoneServices () |
|
165 |
{ |
|
166 |
} |
|
167 |
||
168 |
void TestPhoneServices::initTestCase () |
|
169 |
{ |
|
170 |
} |
|
171 |
||
172 |
void TestPhoneServices::cleanupTestCase () |
|
173 |
{ |
|
174 |
} |
|
175 |
||
176 |
void TestPhoneServices::init () |
|
177 |
{ |
|
178 |
m_setPhoneNumberCalled = false; |
|
179 |
m_setCallTypeCommandCalled = false; |
|
180 |
m_handleDialCallCalled = false; |
|
181 |
m_clientCall = false; |
|
182 |
m_setContactIdCalled = false; |
|
183 |
m_contactId = -1; |
|
184 |
m_handleEndDTMFCalled = false; |
|
185 |
m_handlePlayDTMFLCalled = false; |
|
186 |
m_setKeyCodeCalled = false; |
|
187 |
keyValue = -1; |
|
188 |
m_dialServiceConstructed = false; |
|
189 |
m_dtmfServiceConstructed = false; |
|
190 |
||
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
191 |
m_phoneServices = new PhoneServices(*this, *this, this); |
37 | 192 |
|
193 |
QVERIFY(m_dialServiceConstructed == true); |
|
194 |
QVERIFY(m_dialServiceCallPointer == this); |
|
195 |
QVERIFY(m_dialServiceParameterPointer == this); |
|
196 |
||
197 |
QVERIFY(m_dtmfServiceConstructed == true); |
|
198 |
QVERIFY(m_dtmfServiceCallPointer == this); |
|
199 |
QVERIFY(m_dtmfServiceParameterPointer == this); |
|
200 |
} |
|
201 |
||
202 |
void TestPhoneServices::cleanup () |
|
203 |
{ |
|
204 |
delete m_phoneServices; |
|
205 |
} |
|
206 |
||
207 |
void TestPhoneServices::SetKeyCode( const TChar& aKeyCode ) |
|
208 |
{ |
|
209 |
m_setKeyCodeCalled = true; |
|
210 |
keyValue = aKeyCode; |
|
211 |
} |
|
212 |
||
213 |
void TestPhoneServices::SetPhoneNumber( const TPEPhoneNumber& aPhoneNumber ) |
|
214 |
{ |
|
215 |
m_setPhoneNumberCalled = true; |
|
216 |
m_phoneNumber = aPhoneNumber; |
|
217 |
} |
|
218 |
||
219 |
void TestPhoneServices::SetCallTypeCommand( const TPECallType& aCallType ) |
|
220 |
{ |
|
221 |
m_setCallTypeCommandCalled = true; |
|
222 |
m_callType = aCallType; |
|
223 |
} |
|
224 |
||
225 |
void TestPhoneServices::HandlePlayDTMFL() |
|
226 |
{ |
|
227 |
m_handlePlayDTMFLCalled = true; |
|
228 |
} |
|
229 |
||
230 |
TInt TestPhoneServices::HandleEndDTMF() |
|
231 |
{ |
|
232 |
m_handleEndDTMFCalled = true; |
|
233 |
return 0; |
|
234 |
} |
|
235 |
||
236 |
void TestPhoneServices::SetContactId2( const TInt aContactId ) |
|
237 |
{ |
|
238 |
m_setContactIdCalled = true; |
|
239 |
m_contactId = aContactId; |
|
240 |
} |
|
241 |
||
242 |
void TestPhoneServices::SetServiceIdCommand( TUint32 aServiceId ) |
|
243 |
{ |
|
244 |
Q_UNUSED(aServiceId) |
|
245 |
} |
|
246 |
||
247 |
TInt TestPhoneServices::HandleDialServiceCall( const TBool aClientCall ) |
|
248 |
{ |
|
249 |
m_handleDialCallCalled = true; |
|
250 |
m_clientCall = aClientCall; |
|
251 |
return KErrNone; |
|
252 |
} |
|
253 |
||
254 |
void TestPhoneServices::testPhoneServiceStartup() |
|
255 |
{ |
|
256 |
||
257 |
} |
|
258 |
||
259 |
QTEST_MAIN(TestPhoneServices) |
|
260 |
#include "unit_tests.moc" |