143
144
mApprover->acceptCall();
145
146
// wait until the call properties are changed
146
QTRY_COMPARE(handlerCallPropertiesSpy.count(), 1);
147
QString objectPath = handlerCallPropertiesSpy.first()[0].toString();
148
QVariantMap propsFromSignal = handlerCallPropertiesSpy.first()[1].toMap();
147
QTRY_VERIFY(handlerCallPropertiesSpy.count() > 0);
148
QString objectPath = handlerCallPropertiesSpy.last()[0].toString();
149
QVariantMap propsFromSignal = handlerCallPropertiesSpy.last()[1].toMap();
149
150
QVERIFY(!propsFromSignal.isEmpty());
150
151
QDateTime activeTimestampFromSignal;
151
152
QDateTime timestampFromSignal;
181
182
HandlerController::instance()->hangUpCall(objectPath);
185
void HandlerTest::testConferenceCall()
187
QString callerId1("55555555");
188
QString callerId2("66666666");
189
QString callerId3("77777777");
191
QVariantMap properties;
192
properties["Caller"] = callerId1;
193
properties["State"] = "incoming";
195
QSignalSpy approverCallSpy(mApprover, SIGNAL(newCall()));
196
QString call1 = MockController::instance()->placeCall(properties);
198
// wait for the channel to hit the approver
199
QTRY_COMPARE(approverCallSpy.count(), 1);
200
mApprover->acceptCall();
201
approverCallSpy.clear();
202
waitForCallActive(callerId1);
204
// make a second call
205
properties["Caller"] = callerId2;
206
QString call2 = MockController::instance()->placeCall(properties);
207
// wait for the channel to hit the approver
208
QTRY_COMPARE(approverCallSpy.count(), 1);
209
mApprover->acceptCall();
210
approverCallSpy.clear();
211
waitForCallActive(callerId2);
213
// now create the conf call
214
QSignalSpy conferenceCreatedSpy(MockController::instance(), SIGNAL(conferenceCreated(QString)));
215
HandlerController::instance()->createConferenceCall(QStringList() << call1 << call2);
216
QTRY_COMPARE(conferenceCreatedSpy.count(), 1);
217
QString conferenceObjectPath = conferenceCreatedSpy.first().first().toString();
219
// now place a third call and try to merge it
220
properties["Caller"] = callerId3;
221
QString call3 = MockController::instance()->placeCall(properties);
222
QTRY_COMPARE(approverCallSpy.count(), 1);
223
mApprover->acceptCall();
224
approverCallSpy.clear();
225
waitForCallActive(callerId3);
227
// merge that call on the conference
228
QSignalSpy channelMergedSpy(MockController::instance(), SIGNAL(channelMerged(QString)));
229
HandlerController::instance()->mergeCall(conferenceObjectPath, call3);
230
QTRY_COMPARE(channelMergedSpy.count(), 1);
231
QCOMPARE(channelMergedSpy.first().first().toString(), call3);
233
// now try to split one of the channels
234
QSignalSpy channelSplittedSpy(MockController::instance(), SIGNAL(channelSplitted(QString)));
235
HandlerController::instance()->splitCall(call2);
236
QTRY_COMPARE(channelSplittedSpy.count(), 1);
237
QCOMPARE(channelSplittedSpy.first().first().toString(), call2);
239
// now hangup the conference and the individual channels
240
HandlerController::instance()->hangUpCall(conferenceObjectPath);
241
HandlerController::instance()->hangUpCall(call1);
242
HandlerController::instance()->hangUpCall(call2);
243
HandlerController::instance()->hangUpCall(call3);
184
246
void HandlerTest::testSendMessage()
186
248
QString recipient("22222222");