author | hgs |
Mon, 04 Oct 2010 16:06:10 +0300 | |
changeset 76 | cfea66083b62 |
parent 60 | 1eef62f5c541 |
child 78 | baacf668fe89 |
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" |
|
50 | 26 |
#include <psuinotes.h> |
37 | 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 |
||
60 | 66 |
EXPECT(PSetWrapper, callWaitingWrapper).returns(&waitingWrapper); |
37 | 67 |
|
68 |
static bool b=0;//CenrepKeyValueOff; |
|
69 |
if (b==0) { |
|
70 |
b=1;//CenrepKeyValueOn |
|
71 |
} else { |
|
72 |
b=0; |
|
73 |
} |
|
76 | 74 |
EXPECT(SettingsWrapper, showCallDuration).returns(b); |
37 | 75 |
|
76 |
static int i=0;//No Errors |
|
77 |
if (i==0) { |
|
78 |
i=1;//Error |
|
79 |
} else { |
|
80 |
i=0; |
|
81 |
} |
|
60 | 82 |
EXPECT(SsSettingsWrapper, get).returns(i); |
37 | 83 |
|
76 | 84 |
EXPECT(SettingsWrapper, readSoftRejectText); |
37 | 85 |
|
86 |
if (qstrcmp(QTest::currentTestFunction(), |
|
87 |
"t_handleCallWaitingGetStatusDistinguishEnabled") == 0) { |
|
76 | 88 |
EXPECT(SettingsWrapper, isFeatureCallWaitingDistiquishNotProvisionedEnabled) |
37 | 89 |
.returns(true); |
90 |
} |
|
91 |
||
92 |
m_callspluginGroup = new CpCallsPluginGroup(itemDataHelper); |
|
93 |
QVERIFY(verify()); |
|
94 |
} |
|
95 |
||
96 |
/*! |
|
97 |
UT_CpCallsPluginGroup::t_showCallDurationStateChanged |
|
98 |
*/ |
|
99 |
void UT_CpCallsPluginGroup::t_showCallDurationStateChanged() |
|
100 |
{ |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
101 |
bool bOngoing=true; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
102 |
bool bDuration=true; |
37 | 103 |
|
76 | 104 |
EXPECT(SettingsWrapper, isOngoingCall).returns(bOngoing); |
105 |
EXPECT(SettingsWrapper, showCallDuration).returns(bDuration); |
|
60 | 106 |
EXPECT(PsUiNotes, showGlobalNote); |
37 | 107 |
m_callspluginGroup->showCallDurationStateChanged(); |
108 |
||
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
109 |
bDuration = false; |
76 | 110 |
EXPECT(SettingsWrapper, isOngoingCall).returns(bOngoing); |
111 |
EXPECT(SettingsWrapper, showCallDuration).returns(bDuration); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
112 |
m_callspluginGroup->showCallDurationStateChanged(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
113 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
114 |
bOngoing = false; |
76 | 115 |
EXPECT(SettingsWrapper, isOngoingCall).returns(bOngoing); |
37 | 116 |
m_callspluginGroup->showCallDurationStateChanged(); |
117 |
||
118 |
QVERIFY(verify()); |
|
119 |
} |
|
120 |
||
121 |
/*! |
|
122 |
UT_CpCallsPluginGroup::t_callWaitingCurrentIndexChanged |
|
123 |
*/ |
|
124 |
void UT_CpCallsPluginGroup::t_callWaitingCurrentIndexChanged() |
|
125 |
{ |
|
126 |
QList<unsigned char> basicServiceGroupIds; |
|
127 |
||
128 |
// check status case |
|
60 | 129 |
EXPECT(PSetCallWaitingWrapper, getCallWaitingStatus); |
37 | 130 |
m_callspluginGroup->callWaitingCurrentIndexChanged(); |
131 |
||
132 |
// active case |
|
133 |
m_callspluginGroup->handleCallWaitingGetStatus( |
|
134 |
PSetCallWaitingWrapper::StatusActive, basicServiceGroupIds); |
|
60 | 135 |
EXPECT(PSetCallWaitingWrapper, setCallWaiting); |
37 | 136 |
m_callspluginGroup->callWaitingCurrentIndexChanged(); |
137 |
||
138 |
// deactive case |
|
139 |
m_callspluginGroup->handleCallWaitingGetStatus( |
|
140 |
PSetCallWaitingWrapper::StatusDisabled, basicServiceGroupIds); |
|
60 | 141 |
EXPECT(PSetCallWaitingWrapper, setCallWaiting); |
37 | 142 |
m_callspluginGroup->callWaitingCurrentIndexChanged(); |
143 |
||
144 |
QVERIFY(verify()); |
|
145 |
} |
|
146 |
||
147 |
/*! |
|
148 |
UT_CpCallsPluginGroup::t_cliCurrentIndexChanged |
|
149 |
*/ |
|
150 |
void UT_CpCallsPluginGroup::t_cliCurrentIndexChanged() |
|
151 |
{ |
|
60 | 152 |
EXPECT(SsSettingsWrapper, set); |
37 | 153 |
m_callspluginGroup->cliCurrentIndexChanged(1); |
154 |
||
155 |
QVERIFY(verify()); |
|
156 |
reset(); |
|
157 |
||
158 |
//Do nothing, index is out of range |
|
60 | 159 |
EXPECT(PSetCallWaitingWrapper, setCallWaiting).times(0); |
37 | 160 |
m_callspluginGroup->cliCurrentIndexChanged(-1); |
161 |
||
162 |
QVERIFY(verify()); |
|
163 |
} |
|
164 |
||
165 |
/*! |
|
166 |
UT_CpCallsPluginGroup::t_handleCallWaitingChanged |
|
167 |
*/ |
|
168 |
void UT_CpCallsPluginGroup::t_handleCallWaitingChanged() |
|
169 |
{ |
|
60 | 170 |
EXPECT(PsUiNotes, cancelNote); |
171 |
EXPECT(PsUiNotes, showNotificationDialog); |
|
37 | 172 |
m_callspluginGroup->handleCallWaitingChanged( |
173 |
PSetCallWaitingWrapper::ActivateCallWaiting , 0); |
|
174 |
||
60 | 175 |
EXPECT(PsUiNotes, cancelNote); |
176 |
EXPECT(PsUiNotes, showNotificationDialog); |
|
37 | 177 |
m_callspluginGroup->handleCallWaitingChanged( |
178 |
PSetCallWaitingWrapper::DeactivateCallWaiting, 0); |
|
179 |
||
60 | 180 |
EXPECT(PsUiNotes, cancelNote); |
181 |
EXPECT(PsUiNotes, showNotificationDialog); |
|
37 | 182 |
m_callspluginGroup->handleCallWaitingChanged( |
183 |
PSetCallWaitingWrapper::CheckCallWaitingStatus, 0); |
|
184 |
||
60 | 185 |
EXPECT(PsUiNotes, cancelNote); |
186 |
EXPECT(PsUiNotes, showNotificationDialog); |
|
37 | 187 |
m_callspluginGroup->handleCallWaitingChanged( |
188 |
PSetCallWaitingWrapper::DeactivateCallWaiting , -1); |
|
189 |
||
190 |
QVERIFY(verify()); |
|
191 |
} |
|
192 |
||
193 |
/*! |
|
194 |
UT_CpCallsPluginGroup::t_handleCallWaitingRequesting |
|
195 |
*/ |
|
196 |
void UT_CpCallsPluginGroup::t_handleCallWaitingRequesting() |
|
197 |
{ |
|
60 | 198 |
EXPECT(PsUiNotes, cancelNote); |
37 | 199 |
m_callspluginGroup->handleCallWaitingRequesting( false, true ); |
200 |
||
60 | 201 |
EXPECT(PsUiNotes, showGlobalProgressNote); |
37 | 202 |
m_callspluginGroup->handleCallWaitingRequesting( true, false ); |
203 |
||
60 | 204 |
EXPECT(PsUiNotes, cancelNote); |
205 |
EXPECT(PsUiNotes, showGlobalProgressNote); |
|
37 | 206 |
// m_callspluginGroup->handleCallWaitingRequesting( true, true ); |
207 |
||
208 |
// QVERIFY(verify()); |
|
209 |
reset(); |
|
210 |
||
60 | 211 |
EXPECT(PsUiNotes, cancelNote).times(0); |
212 |
EXPECT(PsUiNotes, showGlobalProgressNote).times(0); |
|
37 | 213 |
m_callspluginGroup->handleCallWaitingRequesting( false, false ); |
214 |
||
215 |
QVERIFY(verify()); |
|
216 |
} |
|
217 |
||
218 |
/*! |
|
219 |
UT_CpCallsPluginGroup::t_handleCallWaitingError |
|
220 |
*/ |
|
221 |
void UT_CpCallsPluginGroup::t_handleCallWaitingError() |
|
222 |
{ |
|
60 | 223 |
EXPECT(PsUiNotes, cancelNote); |
224 |
EXPECT(PsUiNotes, showGlobalErrorNote); |
|
37 | 225 |
m_callspluginGroup->handleCallWaitingError( -1 ); |
226 |
||
227 |
QVERIFY(verify()); |
|
228 |
} |
|
229 |
||
230 |
/*! |
|
231 |
UT_CpCallsPluginGroup::t_softRejectTextChanged |
|
232 |
*/ |
|
233 |
void UT_CpCallsPluginGroup::t_softRejectTextChanged() |
|
234 |
{ |
|
235 |
int iRet=0; |
|
76 | 236 |
EXPECT(SettingsWrapper, writeSoftRejectText).returns(iRet); |
37 | 237 |
m_callspluginGroup->softRejectTextChanged(); |
238 |
||
239 |
QVERIFY(verify()); |
|
240 |
} |
|
241 |
||
242 |
/*! |
|
243 |
UT_CpCallsPluginGroup::t_handleCallWaitingGetStatus |
|
244 |
*/ |
|
245 |
void UT_CpCallsPluginGroup::t_handleCallWaitingGetStatus() |
|
246 |
{ |
|
247 |
QList<unsigned char> basicServiceGroupIds; |
|
248 |
||
60 | 249 |
EXPECT(PsUiNotes, cancelNote); |
37 | 250 |
m_callspluginGroup->handleCallWaitingGetStatus( |
251 |
PSetCallWaitingWrapper::StatusNotProvisioned, basicServiceGroupIds); |
|
252 |
||
60 | 253 |
EXPECT(PsUiNotes, cancelNote); |
37 | 254 |
m_callspluginGroup->handleCallWaitingGetStatus( |
255 |
PSetCallWaitingWrapper::StatusActive, basicServiceGroupIds); |
|
256 |
QVERIFY(verify()); |
|
257 |
} |
|
258 |
||
259 |
/*! |
|
260 |
UT_CpCallsPluginGroup::t_handleCallWaitingGetStatusDistinguishEnabled |
|
261 |
*/ |
|
262 |
void UT_CpCallsPluginGroup::t_handleCallWaitingGetStatusDistinguishEnabled() |
|
263 |
{ |
|
264 |
QList<unsigned char> basicServiceGroupIds; |
|
265 |
||
60 | 266 |
EXPECT(PsUiNotes, cancelNote); |
267 |
EXPECT(PsUiNotes, showNotificationDialog); |
|
37 | 268 |
m_callspluginGroup->handleCallWaitingGetStatus( |
269 |
PSetCallWaitingWrapper::StatusNotProvisioned, basicServiceGroupIds); |
|
270 |
||
271 |
QVERIFY(verify()); |
|
272 |
} |
|
273 |
||
274 |
/*! |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
275 |
UT_CpCallsPluginGroup::t_ownVideoInReceivedCallStateChanged |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
276 |
*/ |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
277 |
void UT_CpCallsPluginGroup::t_ownVideoInReceivedCallStateChanged() |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
278 |
{ |
76 | 279 |
EXPECT(SettingsWrapper, writeVtVideoSending).times(3); |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
280 |
m_callspluginGroup->ownVideoInReceivedCallStateChanged(0); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
281 |
m_callspluginGroup->ownVideoInReceivedCallStateChanged(1); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
282 |
m_callspluginGroup->ownVideoInReceivedCallStateChanged(2); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
283 |
m_callspluginGroup->ownVideoInReceivedCallStateChanged(-1); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
284 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
285 |
QVERIFY(verify()); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
286 |
} |
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 |
/*! |
37 | 289 |
UT_CpCallsPluginGroup::cleanup |
290 |
*/ |
|
291 |
void UT_CpCallsPluginGroup::cleanup() |
|
292 |
{ |
|
293 |
reset(); |
|
294 |
||
295 |
delete m_callspluginGroup; |
|
296 |
m_callspluginGroup = NULL; |
|
297 |
} |
|
298 |
||
299 |
/*! |
|
300 |
UT_CpCallsPluginGroup::t_memleak |
|
301 |
*/ |
|
302 |
void UT_CpCallsPluginGroup::t_memleak() |
|
303 |
{ |
|
304 |
||
305 |
} |
|
306 |
||
307 |
QTEST_MAIN_S60(UT_CpCallsPluginGroup) |