From 89ad8bda233cb69608570471a18bc3c42d28db28 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 21 Nov 2011 01:40:51 -0500 Subject: [PATCH] Improve mainloop test coverage slightly --- glib/tests/mainloop.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c index de780b7..2151a27 100644 --- a/glib/tests/mainloop.c +++ b/glib/tests/mainloop.c @@ -21,6 +21,14 @@ */ #include +#include +#include +#include + +static gboolean cb (gpointer data) +{ + return FALSE; +} static void test_maincontext_basic (void) @@ -29,6 +37,7 @@ test_maincontext_basic (void) GSource *source; GSourceFuncs funcs; guint id; + gpointer data = &funcs; ctx = g_main_context_new (); @@ -58,6 +67,15 @@ test_maincontext_basic (void) g_assert (g_source_get_priority (source) == G_PRIORITY_HIGH); g_main_context_unref (ctx); + + ctx = g_main_context_default (); + source = g_source_new (&funcs, sizeof (GSource)); + g_source_set_funcs (source, &funcs); + g_source_set_callback (source, cb, data, NULL); + id = g_source_attach (source, ctx); + g_source_set_name_by_id (id, "e"); + g_assert_cmpstr (g_source_get_name (source), ==, "e"); + g_assert (g_source_remove_by_funcs_user_data (&funcs, data)); } static void -- 2.7.4