diff options
author | Linus Svensson <linusp.svensson@gmail.com> | 2014-10-11 19:28:21 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-10-14 10:31:27 +0200 |
commit | bf8e36a7685a34a878276b5b463645dffebfdba7 (patch) | |
tree | 5fb06949c4da8a20484700643c49a1a8a98d75fc | |
parent | c8b512d2f0a468eba940bede3c7d9ce485a2176a (diff) |
tests: Add a test for removing a bus watch
https://bugzilla.gnome.org/show_bug.cgi?id=735195
-rw-r--r-- | tests/check/gst/gstbus.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/check/gst/gstbus.c b/tests/check/gst/gstbus.c index f7bed4600c..60c699895d 100644 --- a/tests/check/gst/gstbus.c +++ b/tests/check/gst/gstbus.c @@ -286,6 +286,31 @@ GST_START_TEST (test_add_watch_with_custom_context) GST_END_TEST; +static gboolean +dummy_bus_func (GstBus * bus, GstMessage * msg, gpointer user_data) +{ + return TRUE; +} + +GST_START_TEST (test_remove_watch) +{ + test_bus = gst_bus_new (); + + /* removing a non-existing watch should fail */ + fail_if (gst_bus_remove_watch (test_bus)); + + gst_bus_add_watch (test_bus, dummy_bus_func, NULL); + + fail_unless (gst_bus_remove_watch (test_bus)); + + /* now it should fail to remove the watch again */ + fail_if (gst_bus_remove_watch (test_bus)); + + gst_object_unref (test_bus); +} + +GST_END_TEST; + static gint messages_seen; static void @@ -718,6 +743,7 @@ gst_bus_suite (void) tcase_add_test (tc_chain, test_watch_with_poll); tcase_add_test (tc_chain, test_watch_with_custom_context); tcase_add_test (tc_chain, test_add_watch_with_custom_context); + tcase_add_test (tc_chain, test_remove_watch); tcase_add_test (tc_chain, test_timed_pop); tcase_add_test (tc_chain, test_timed_pop_thread); tcase_add_test (tc_chain, test_timed_pop_filtered); |