summaryrefslogtreecommitdiff
path: root/test/call.c
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2016-12-07 21:30:04 +0100
committerAlfred E. Heggestad <alfred.heggestad@gmail.com>2016-12-07 21:30:04 +0100
commit5b7bb10e612704862dd72fa337f29bd48d34cac5 (patch)
tree393fcaa08f29ab238e7b5b0634b9a3b146aeb88d /test/call.c
parent618120a71690ea84ec05e4ae1473a2df6f78dd99 (diff)
test: added testcase for call with video
Diffstat (limited to 'test/call.c')
-rw-r--r--test/call.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/test/call.c b/test/call.c
index 75d8c9f..4744b8a 100644
--- a/test/call.c
+++ b/test/call.c
@@ -123,8 +123,8 @@ static void event_handler(struct ua *ua, enum ua_event ev,
int err = 0;
(void)prm;
-#if 0
- re_printf("[ %s ] event: %s (%s)\n",
+#if 1
+ info("test: [ %s ] event: %s (%s)\n",
ua_aor(ua), uag_event_str(ev), prm);
#endif
@@ -663,3 +663,50 @@ int test_call_dtmf(void)
return err;
}
+
+
+int test_call_video(void)
+{
+ struct fixture fix, *f = &fix;
+ struct vidsrc *vidsrc = NULL;
+ struct vidisp *vidisp = NULL;
+ int err = 0;
+
+ conf_config()->video.fps = 100;
+
+ fixture_init(f);
+
+ /* to enable video, we need one vidsrc and vidcodec */
+ mock_vidcodec_register();
+ err = mock_vidsrc_register(&vidsrc);
+ TEST_ERR(err);
+ err = mock_vidisp_register(&vidisp);
+ TEST_ERR(err);
+
+ f->behaviour = BEHAVIOUR_ANSWER;
+ f->estab_action = ACTION_NOTHING;
+
+ /* Make a call from A to B */
+ err = ua_connect(f->a.ua, 0, NULL, f->buri, NULL, VIDMODE_ON);
+ TEST_ERR(err);
+
+ /* run main-loop with timeout, wait for events */
+ err = re_main_timeout(10000);
+ TEST_ERR(err);
+ TEST_ERR(fix.err);
+
+ /* verify that video was enabled for this call */
+ ASSERT_EQ(1, fix.a.n_established);
+ ASSERT_EQ(1, fix.b.n_established);
+
+ ASSERT_TRUE(call_has_video(ua_call(f->a.ua)));
+ ASSERT_TRUE(call_has_video(ua_call(f->b.ua)));
+
+ out:
+ fixture_close(f);
+ mem_deref(vidisp);
+ mem_deref(vidsrc);
+ mock_vidcodec_unregister();
+
+ return err;
+}