53
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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_psuiclinotehandler.h"
|
|
19 |
#include "psuiclinotehandler.h"
|
|
20 |
#include "psetcliwrapper.h"
|
|
21 |
#include "psuinotes.h"
|
|
22 |
#include "psuiutils.h"
|
|
23 |
#include "qtestmains60.h"
|
|
24 |
#include <smcmockclassincludes.h>
|
|
25 |
|
|
26 |
class CPsetContainer
|
|
27 |
{
|
|
28 |
public:
|
|
29 |
CPsetContainer(){};
|
|
30 |
~CPsetContainer(){};
|
|
31 |
};
|
|
32 |
|
|
33 |
/*!
|
|
34 |
UT_psuiclinotehandler::UT_psuiclinotehandler
|
|
35 |
*/
|
|
36 |
UT_psuiclinotehandler::UT_psuiclinotehandler()
|
|
37 |
{
|
|
38 |
|
|
39 |
}
|
|
40 |
|
|
41 |
/*!
|
|
42 |
UT_psuiclinotehandler::~UT_psuiclinotehandler
|
|
43 |
*/
|
|
44 |
UT_psuiclinotehandler::~UT_psuiclinotehandler()
|
|
45 |
{
|
|
46 |
|
|
47 |
}
|
|
48 |
|
|
49 |
/*!
|
|
50 |
UT_psuiclinotehandler::init
|
|
51 |
*/
|
|
52 |
void UT_psuiclinotehandler::init()
|
|
53 |
{
|
|
54 |
initialize();
|
|
55 |
m_psetContainer = new CPsetContainer();
|
|
56 |
m_mockCliWrapper = new PSetCliWrapper(*m_psetContainer,this);
|
|
57 |
m_cliHandler = new PsUiCliNoteHandler(*m_mockCliWrapper);
|
|
58 |
}
|
|
59 |
|
|
60 |
/*!
|
|
61 |
UT_psuiclinotehandler::cleanup
|
|
62 |
*/
|
|
63 |
void UT_psuiclinotehandler::cleanup()
|
|
64 |
{
|
|
65 |
delete m_cliHandler;
|
|
66 |
delete m_mockCliWrapper;
|
|
67 |
delete m_psetContainer;
|
|
68 |
reset();
|
|
69 |
}
|
|
70 |
|
|
71 |
/*!
|
|
72 |
UT_psuiclinotehandler::t_memleak
|
|
73 |
*/
|
|
74 |
void UT_psuiclinotehandler::t_memleak()
|
|
75 |
{
|
|
76 |
|
|
77 |
}
|
|
78 |
|
|
79 |
/*!
|
|
80 |
UT_psuiclinotehandler::t_construction
|
|
81 |
*/
|
|
82 |
void UT_psuiclinotehandler::t_construction()
|
|
83 |
{
|
|
84 |
EXPECT(QObject,connect).times(4);
|
|
85 |
CPsetContainer psetContainer;
|
|
86 |
PSetCliWrapper *mockCliWrapper = new PSetCliWrapper(psetContainer,this);
|
|
87 |
PsUiCliNoteHandler *cliHandler = new PsUiCliNoteHandler(*mockCliWrapper);
|
|
88 |
delete cliHandler;
|
|
89 |
delete mockCliWrapper;
|
|
90 |
QVERIFY(verify());
|
|
91 |
}
|
|
92 |
|
|
93 |
void UT_psuiclinotehandler::t_handleCliRequesting()
|
|
94 |
{
|
|
95 |
EXPECT(PsUiNotes,showGlobalProgressNote);
|
|
96 |
bool ongoing = true;
|
|
97 |
bool interrupted = false;
|
|
98 |
m_cliHandler->handleCliRequesting(ongoing,interrupted);
|
|
99 |
QVERIFY(verify());
|
|
100 |
|
|
101 |
EXPECT(PsUiNotes,cancelNote).times(2);
|
|
102 |
ongoing = false;
|
|
103 |
interrupted = true;
|
|
104 |
m_cliHandler->handleCliRequesting(ongoing,interrupted);
|
|
105 |
QVERIFY(verify());
|
|
106 |
|
|
107 |
EXPECT(PsUiNotes,cancelNote);
|
|
108 |
ongoing = false;
|
|
109 |
interrupted = false;
|
|
110 |
m_cliHandler->handleCliRequesting(ongoing,interrupted);
|
|
111 |
QVERIFY(verify());
|
|
112 |
}
|
|
113 |
|
|
114 |
void UT_psuiclinotehandler::t_cliInformation()
|
|
115 |
{
|
|
116 |
EXPECT(PsUiNotes,cancelNote);
|
|
117 |
|
|
118 |
EXPECT(PsUiNotes,showGlobalNotificationDialog).with(
|
|
119 |
QString("txt_phone_dpopinfo_my_caller_id_not_sent_on_calling"));
|
|
120 |
m_cliHandler->cliInformation(ClirOn);
|
|
121 |
QVERIFY(verify());
|
|
122 |
|
|
123 |
EXPECT(PsUiNotes,showGlobalNotificationDialog).with(
|
|
124 |
QString("txt_phone_dpopinfo_my_caller_id_sent_on_calling"));
|
|
125 |
m_cliHandler->cliInformation(ClirOff);
|
|
126 |
QVERIFY(verify());
|
|
127 |
|
|
128 |
EXPECT(PsUiNotes,showGlobalNotificationDialog).with(
|
|
129 |
QString("txt_phone_dpopinfo_number_of_caller_is_shown"));
|
|
130 |
m_cliHandler->cliInformation(ClipOn);
|
|
131 |
QVERIFY(verify());
|
|
132 |
|
|
133 |
EXPECT(PsUiNotes,showGlobalNotificationDialog).with(
|
|
134 |
QString("txt_phone_dpopinfo_number_of_caller_is_not_shown"));
|
|
135 |
m_cliHandler->cliInformation(ClipOff);
|
|
136 |
QVERIFY(verify());
|
|
137 |
|
|
138 |
EXPECT(PsUiNotes,showGlobalNotificationDialog).with(
|
|
139 |
QString("txt_phone_dpopinfo_my_caller_id_not_sent_on_answer"));
|
|
140 |
m_cliHandler->cliInformation(ColrOn);
|
|
141 |
QVERIFY(verify());
|
|
142 |
|
|
143 |
EXPECT(PsUiNotes,showGlobalNotificationDialog).with(
|
|
144 |
QString("txt_phone_dpopinfo_my_caller_id_sent_on_answering"));
|
|
145 |
m_cliHandler->cliInformation(ColrOff);
|
|
146 |
QVERIFY(verify());
|
|
147 |
|
|
148 |
EXPECT(PsUiNotes,showGlobalNotificationDialog).with(
|
|
149 |
QString("txt_phone_dpopinfo_answering_number_is_shown"));
|
|
150 |
m_cliHandler->cliInformation(ColpOn);
|
|
151 |
QVERIFY(verify());
|
|
152 |
|
|
153 |
EXPECT(PsUiNotes,showGlobalNotificationDialog).with(
|
|
154 |
QString("txt_phone_dpopinfo_answering_number_is_not_shown"));
|
|
155 |
m_cliHandler->cliInformation(ColpOff);
|
|
156 |
QVERIFY(verify());
|
|
157 |
|
|
158 |
EXPECT(PsUiNotes,showGlobalNotificationDialog).with(
|
|
159 |
QString("txt_phone_info_result_unknown")).times(2);
|
|
160 |
m_cliHandler->cliInformation(CliUnknown);
|
|
161 |
m_cliHandler->cliInformation((PsCallLineIdentity)100);
|
|
162 |
QVERIFY(verify());
|
|
163 |
}
|
|
164 |
|
|
165 |
void UT_psuiclinotehandler::t_handleCliError()
|
|
166 |
{
|
|
167 |
EXPECT(PsUiNotes,cancelNote);
|
|
168 |
EXPECT(PsUiNotes,showGlobalErrorNote);
|
|
169 |
int error = -1;
|
|
170 |
m_cliHandler->handleCliError(error);
|
|
171 |
|
|
172 |
QVERIFY(verify());
|
|
173 |
}
|
|
174 |
|
|
175 |
void UT_psuiclinotehandler::t_handleCnapStatus()
|
|
176 |
{
|
|
177 |
EXPECT(PsUiNotes,instance);
|
|
178 |
|
|
179 |
EXPECT(PsUiNotes,showGlobalNotificationDialog).with(
|
|
180 |
QString("txt_phone_dpopinfo_name_of_caller_is_shown")).times(2);
|
|
181 |
m_cliHandler->handleCnapStatus(PsUiUtils::ServiceActivePermanent);
|
|
182 |
m_cliHandler->handleCnapStatus(PsUiUtils::ServiceActiveDefaultAllowed);
|
|
183 |
QVERIFY(verify());
|
|
184 |
|
|
185 |
EXPECT(PsUiNotes,showGlobalNotificationDialog).with(
|
|
186 |
QString("txt_phone_dpopinfo_name_of_caller_is_not_shown")).times(2);
|
|
187 |
m_cliHandler->handleCnapStatus(PsUiUtils::ServiceActiveDefaultRestricted);
|
|
188 |
m_cliHandler->handleCnapStatus(PsUiUtils::ServiceNotProvisioned);
|
|
189 |
QVERIFY(verify());
|
|
190 |
|
|
191 |
EXPECT(PsUiNotes,showGlobalNotificationDialog).with(
|
|
192 |
QString("txt_phone_info_request_not_completed"));
|
|
193 |
m_cliHandler->handleCnapStatus(PsUiUtils::ServiceUnknown);
|
|
194 |
QVERIFY(verify());
|
|
195 |
}
|
|
196 |
|
|
197 |
QTEST_MAIN_S60(UT_psuiclinotehandler)
|