author | William Roberts <williamr@symbian.org> |
Thu, 22 Jul 2010 16:33:21 +0100 | |
branch | GCC_SURGE |
changeset 51 | f39ed5e045e0 |
parent 30 | ebdbd102c78a |
parent 45 | 6b911d05207e |
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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include "ut_callsplugingroup.h" |
|
19 |
#include "cpcallsplugingroup.h" |
|
20 |
#include "cpitemdatahelper.h" |
|
21 |
#include "qtestmains60.h" |
|
22 |
// mocked dependencies for the class under test |
|
23 |
#include "psetwrapper.h" |
|
24 |
#include "sssettingswrapper.h" |
|
25 |
#include "cpplugincommon.h" |
|
26 |
#include "cpphonenotes.h" |
|
27 |
||
28 |
/*! |
|
29 |
Dummy CPsetContainer class |
|
30 |
*/ |
|
31 |
class CPsetContainer |
|
32 |
{ |
|
33 |
public: |
|
34 |
CPsetContainer(){}; |
|
35 |
~CPsetContainer(){}; |
|
36 |
}; |
|
37 |
||
38 |
/*! |
|
39 |
UT_CpCallsPluginGroup::UT_CpCallsPluginGroup |
|
40 |
*/ |
|
41 |
UT_CpCallsPluginGroup::UT_CpCallsPluginGroup() |
|
42 |
: m_callspluginGroup(NULL) |
|
43 |
{ |
|
44 |
||
45 |
} |
|
46 |
||
47 |
/*! |
|
48 |
UT_CpCallsPluginGroup::~UT_CpCallsPluginGroup |
|
49 |
*/ |
|
50 |
UT_CpCallsPluginGroup::~UT_CpCallsPluginGroup() |
|
51 |
{ |
|
52 |
delete m_callspluginGroup; |
|
53 |
} |
|
54 |
||
55 |
/*! |
|
56 |
UT_CpCallsPluginGroup::init |
|
57 |
*/ |
|
58 |
void UT_CpCallsPluginGroup::init() |
|
59 |
{ |
|
60 |
initialize(); |
|
61 |
||
62 |
CpItemDataHelper itemDataHelper; |
|
63 |
CPsetContainer cont; |
|
64 |
PSetCallWaitingWrapper waitingWrapper(cont); |
|
65 |
||
66 |
EXPECT(PSetWrapper::callWaitingWrapper).returns(&waitingWrapper); |
|
67 |
||
68 |
static bool b=0;//CenrepKeyValueOff; |
|
69 |
if (b==0) { |
|
70 |
b=1;//CenrepKeyValueOn |
|
71 |
} else { |
|
72 |
b=0; |
|
73 |
} |
|
74 |
EXPECT(CpSettingsWrapper::showCallDuration).returns(b); |
|
75 |
||
76 |
static int i=0;//No Errors |
|
77 |
if (i==0) { |
|
78 |
i=1;//Error |
|
79 |
} else { |
|
80 |
i=0; |
|
81 |
} |
|
82 |
EXPECT(SsSettingsWrapper::get).returns(i); |
|
83 |
||
84 |
EXPECT(CpSettingsWrapper::readSoftRejectText); |
|
85 |
||
86 |
if (qstrcmp(QTest::currentTestFunction(), |
|
87 |
"t_handleCallWaitingGetStatusDistinguishEnabled") == 0) { |
|
88 |
EXPECT( |
|
89 |
CpSettingsWrapper::isFeatureCallWaitingDistiquishNotProvisionedEnabled) |
|
90 |
.returns(true); |
|
91 |
} |
|
92 |
||
93 |
m_callspluginGroup = new CpCallsPluginGroup(itemDataHelper); |
|
94 |
QVERIFY(verify()); |
|
95 |
} |
|
96 |
||
97 |
/*! |
|
98 |
UT_CpCallsPluginGroup::t_showCallDurationStateChanged |
|
99 |
*/ |
|
100 |
void UT_CpCallsPluginGroup::t_showCallDurationStateChanged() |
|
101 |
{ |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
102 |
bool bOngoing=true; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
103 |
bool bDuration=true; |
37 | 104 |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
105 |
EXPECT(CpSettingsWrapper::isOngoingCall).returns(bOngoing); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
106 |
EXPECT(CpSettingsWrapper::showCallDuration).returns(bDuration); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
107 |
EXPECT(CpPhoneNotes::showGlobalNote); |
37 | 108 |
m_callspluginGroup->showCallDurationStateChanged(); |
109 |
||
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
110 |
bDuration = false; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
111 |
EXPECT(CpSettingsWrapper::isOngoingCall).returns(bOngoing); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
112 |
EXPECT(CpSettingsWrapper::showCallDuration).returns(bDuration); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
113 |
m_callspluginGroup->showCallDurationStateChanged(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
114 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
115 |
bOngoing = false; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
116 |
EXPECT(CpSettingsWrapper::isOngoingCall).returns(bOngoing); |
37 | 117 |
m_callspluginGroup->showCallDurationStateChanged(); |
118 |
||
119 |
QVERIFY(verify()); |
|
120 |
} |
|
121 |
||
122 |
/*! |
|
123 |
UT_CpCallsPluginGroup::t_callWaitingCurrentIndexChanged |
|
124 |
*/ |
|
125 |
void UT_CpCallsPluginGroup::t_callWaitingCurrentIndexChanged() |
|
126 |
{ |
|
127 |
QList<unsigned char> basicServiceGroupIds; |
|
128 |
||
129 |
// check status case |
|
130 |
EXPECT(PSetCallWaitingWrapper::getCallWaitingStatus); |
|
131 |
m_callspluginGroup->callWaitingCurrentIndexChanged(); |
|
132 |
||
133 |
// active case |
|
134 |
m_callspluginGroup->handleCallWaitingGetStatus( |
|
135 |
PSetCallWaitingWrapper::StatusActive, basicServiceGroupIds); |
|
136 |
EXPECT(PSetCallWaitingWrapper::setCallWaiting); |
|
137 |
m_callspluginGroup->callWaitingCurrentIndexChanged(); |
|
138 |
||
139 |
// deactive case |
|
140 |
m_callspluginGroup->handleCallWaitingGetStatus( |
|
141 |
PSetCallWaitingWrapper::StatusDisabled, basicServiceGroupIds); |
|
142 |
EXPECT(PSetCallWaitingWrapper::setCallWaiting); |
|
143 |
m_callspluginGroup->callWaitingCurrentIndexChanged(); |
|
144 |
||
145 |
QVERIFY(verify()); |
|
146 |
} |
|
147 |
||
148 |
/*! |
|
149 |
UT_CpCallsPluginGroup::t_cliCurrentIndexChanged |
|
150 |
*/ |
|
151 |
void UT_CpCallsPluginGroup::t_cliCurrentIndexChanged() |
|
152 |
{ |
|
153 |
EXPECT(SsSettingsWrapper::set); |
|
154 |
m_callspluginGroup->cliCurrentIndexChanged(1); |
|
155 |
||
156 |
QVERIFY(verify()); |
|
157 |
reset(); |
|
158 |
||
159 |
//Do nothing, index is out of range |
|
160 |
EXPECT(PSetCallWaitingWrapper::setCallWaiting).times(0); |
|
161 |
m_callspluginGroup->cliCurrentIndexChanged(-1); |
|
162 |
||
163 |
QVERIFY(verify()); |
|
164 |
} |
|
165 |
||
166 |
/*! |
|
167 |
UT_CpCallsPluginGroup::t_handleCallWaitingChanged |
|
168 |
*/ |
|
169 |
void UT_CpCallsPluginGroup::t_handleCallWaitingChanged() |
|
170 |
{ |
|
171 |
EXPECT(CpPhoneNotes::cancelNote); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
172 |
EXPECT(CpPhoneNotes::showNotificationDialog); |
37 | 173 |
m_callspluginGroup->handleCallWaitingChanged( |
174 |
PSetCallWaitingWrapper::ActivateCallWaiting , 0); |
|
175 |
||
176 |
EXPECT(CpPhoneNotes::cancelNote); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
177 |
EXPECT(CpPhoneNotes::showNotificationDialog); |
37 | 178 |
m_callspluginGroup->handleCallWaitingChanged( |
179 |
PSetCallWaitingWrapper::DeactivateCallWaiting, 0); |
|
180 |
||
181 |
EXPECT(CpPhoneNotes::cancelNote); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
182 |
EXPECT(CpPhoneNotes::showNotificationDialog); |
37 | 183 |
m_callspluginGroup->handleCallWaitingChanged( |
184 |
PSetCallWaitingWrapper::CheckCallWaitingStatus, 0); |
|
185 |
||
186 |
EXPECT(CpPhoneNotes::cancelNote); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
187 |
EXPECT(CpPhoneNotes::showNotificationDialog); |
37 | 188 |
m_callspluginGroup->handleCallWaitingChanged( |
189 |
PSetCallWaitingWrapper::DeactivateCallWaiting , -1); |
|
190 |
||
191 |
QVERIFY(verify()); |
|
192 |
} |
|
193 |
||
194 |
/*! |
|
195 |
UT_CpCallsPluginGroup::t_handleCallWaitingRequesting |
|
196 |
*/ |
|
197 |
void UT_CpCallsPluginGroup::t_handleCallWaitingRequesting() |
|
198 |
{ |
|
199 |
EXPECT(CpPhoneNotes::cancelNote); |
|
200 |
m_callspluginGroup->handleCallWaitingRequesting( false, true ); |
|
201 |
||
202 |
EXPECT(CpPhoneNotes::showGlobalProgressNote); |
|
203 |
m_callspluginGroup->handleCallWaitingRequesting( true, false ); |
|
204 |
||
205 |
EXPECT(CpPhoneNotes::cancelNote); |
|
206 |
EXPECT(CpPhoneNotes::showGlobalProgressNote); |
|
207 |
// m_callspluginGroup->handleCallWaitingRequesting( true, true ); |
|
208 |
||
209 |
// QVERIFY(verify()); |
|
210 |
reset(); |
|
211 |
||
212 |
EXPECT(CpPhoneNotes::cancelNote).times(0); |
|
213 |
EXPECT(CpPhoneNotes::showGlobalProgressNote).times(0); |
|
214 |
m_callspluginGroup->handleCallWaitingRequesting( false, false ); |
|
215 |
||
216 |
QVERIFY(verify()); |
|
217 |
} |
|
218 |
||
219 |
/*! |
|
220 |
UT_CpCallsPluginGroup::t_handleCallWaitingError |
|
221 |
*/ |
|
222 |
void UT_CpCallsPluginGroup::t_handleCallWaitingError() |
|
223 |
{ |
|
224 |
EXPECT(CpPhoneNotes::cancelNote); |
|
225 |
EXPECT(CpPhoneNotes::showGlobalErrorNote); |
|
226 |
m_callspluginGroup->handleCallWaitingError( -1 ); |
|
227 |
||
228 |
QVERIFY(verify()); |
|
229 |
} |
|
230 |
||
231 |
/*! |
|
232 |
UT_CpCallsPluginGroup::t_softRejectTextChanged |
|
233 |
*/ |
|
234 |
void UT_CpCallsPluginGroup::t_softRejectTextChanged() |
|
235 |
{ |
|
236 |
int iRet=0; |
|
237 |
EXPECT(CpSettingsWrapper::writeSoftRejectText).returns(iRet); |
|
238 |
m_callspluginGroup->softRejectTextChanged(); |
|
239 |
||
240 |
QVERIFY(verify()); |
|
241 |
} |
|
242 |
||
243 |
/*! |
|
244 |
UT_CpCallsPluginGroup::t_handleCallWaitingGetStatus |
|
245 |
*/ |
|
246 |
void UT_CpCallsPluginGroup::t_handleCallWaitingGetStatus() |
|
247 |
{ |
|
248 |
QList<unsigned char> basicServiceGroupIds; |
|
249 |
||
250 |
EXPECT(CpPhoneNotes::cancelNote); |
|
251 |
m_callspluginGroup->handleCallWaitingGetStatus( |
|
252 |
PSetCallWaitingWrapper::StatusNotProvisioned, basicServiceGroupIds); |
|
253 |
||
254 |
EXPECT(CpPhoneNotes::cancelNote); |
|
255 |
m_callspluginGroup->handleCallWaitingGetStatus( |
|
256 |
PSetCallWaitingWrapper::StatusActive, basicServiceGroupIds); |
|
257 |
QVERIFY(verify()); |
|
258 |
} |
|
259 |
||
260 |
/*! |
|
261 |
UT_CpCallsPluginGroup::t_handleCallWaitingGetStatusDistinguishEnabled |
|
262 |
*/ |
|
263 |
void UT_CpCallsPluginGroup::t_handleCallWaitingGetStatusDistinguishEnabled() |
|
264 |
{ |
|
265 |
QList<unsigned char> basicServiceGroupIds; |
|
266 |
||
267 |
EXPECT(CpPhoneNotes::cancelNote); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
268 |
EXPECT(CpPhoneNotes::showNotificationDialog); |
37 | 269 |
m_callspluginGroup->handleCallWaitingGetStatus( |
270 |
PSetCallWaitingWrapper::StatusNotProvisioned, basicServiceGroupIds); |
|
271 |
||
272 |
QVERIFY(verify()); |
|
273 |
} |
|
274 |
||
275 |
/*! |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
276 |
UT_CpCallsPluginGroup::t_ownVideoInReceivedCallStateChanged |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
277 |
*/ |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
278 |
void UT_CpCallsPluginGroup::t_ownVideoInReceivedCallStateChanged() |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
279 |
{ |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
280 |
EXPECT(CpSettingsWrapper::writeVtVideoSending).times(3); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
281 |
m_callspluginGroup->ownVideoInReceivedCallStateChanged(0); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
282 |
m_callspluginGroup->ownVideoInReceivedCallStateChanged(1); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
283 |
m_callspluginGroup->ownVideoInReceivedCallStateChanged(2); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
284 |
m_callspluginGroup->ownVideoInReceivedCallStateChanged(-1); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
285 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
286 |
QVERIFY(verify()); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
287 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
288 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
289 |
/*! |
37 | 290 |
UT_CpCallsPluginGroup::cleanup |
291 |
*/ |
|
292 |
void UT_CpCallsPluginGroup::cleanup() |
|
293 |
{ |
|
294 |
reset(); |
|
295 |
||
296 |
delete m_callspluginGroup; |
|
297 |
m_callspluginGroup = NULL; |
|
298 |
} |
|
299 |
||
300 |
/*! |
|
301 |
UT_CpCallsPluginGroup::t_memleak |
|
302 |
*/ |
|
303 |
void UT_CpCallsPluginGroup::t_memleak() |
|
304 |
{ |
|
305 |
||
306 |
} |
|
307 |
||
308 |
QTEST_MAIN_S60(UT_CpCallsPluginGroup) |