diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dummy-indicator-signaler.c | 4 | ||||
-rw-r--r-- | tests/test-loader.c | 37 |
2 files changed, 39 insertions, 2 deletions
diff --git a/tests/dummy-indicator-signaler.c b/tests/dummy-indicator-signaler.c index b88cea9..0444110 100644 --- a/tests/dummy-indicator-signaler.c +++ b/tests/dummy-indicator-signaler.c @@ -79,8 +79,8 @@ idle_signal (gpointer data) { DummyIndicatorSignaler * self = DUMMY_INDICATOR_SIGNALER(data); - g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID, 0, (gpointer)5, TRUE); - g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID, 0, (gpointer)5, TRUE); + g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID, 0, GUINT_TO_POINTER(5), TRUE); + g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID, 0, GUINT_TO_POINTER(5), TRUE); return FALSE; /* Don't queue again */ } diff --git a/tests/test-loader.c b/tests/test-loader.c index 263e54f..485a951 100644 --- a/tests/test-loader.c +++ b/tests/test-loader.c @@ -4,6 +4,42 @@ void destroy_cb (gpointer data, GObject * object); void +entry_change_cb (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer data) +{ + gpointer * valuestore = (gpointer *)data; + *valuestore = entry; + return; +} + +void +test_loader_filename_dummy_signaler (void) +{ + IndicatorObject * object = indicator_object_new_from_file(BUILD_DIR "/.libs/libdummy-indicator-signaler.so"); + g_assert(object != NULL); + + gpointer added_value = NULL, removed_value = NULL; + + g_signal_connect(G_OBJECT(object), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, G_CALLBACK(entry_change_cb), &added_value); + g_signal_connect(G_OBJECT(object), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, G_CALLBACK(entry_change_cb), &removed_value); + + GList * list = indicator_object_get_entries(object); + g_assert(list != NULL); + g_list_free(list); + + while (g_main_context_pending(NULL)) { + g_main_context_iteration(NULL, TRUE); + } + + g_assert(GPOINTER_TO_UINT(added_value) == 5); + g_assert(GPOINTER_TO_UINT(removed_value) == 5); + + g_object_unref(object); + + return; +} + + +void test_loader_filename_dummy_simple_accessors (void) { IndicatorObject * object = indicator_object_new_from_file(BUILD_DIR "/.libs/libdummy-indicator-simple.so"); @@ -89,6 +125,7 @@ test_loader_creation_deletion_suite (void) g_test_add_func ("/libindicator/loader/dummy/blank_load", test_loader_filename_dummy_null); g_test_add_func ("/libindicator/loader/dummy/simple_load", test_loader_filename_dummy_simple); g_test_add_func ("/libindicator/loader/dummy/simple_accessors", test_loader_filename_dummy_simple_accessors); + g_test_add_func ("/libindicator/loader/dummy/signaler", test_loader_filename_dummy_signaler); return; } |