diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2012-01-25 18:11:07 +0100 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2012-01-25 18:11:07 +0100 |
commit | 39cf870292e40bd72a16fc10b20135e294d4e269 (patch) | |
tree | 7d4114d3446297cc9a87a658b5540986f716fa0e | |
parent | 1baaf2880f44fea4519f323e3da425318af6c688 (diff) | |
download | libayatana-indicator-39cf870292e40bd72a16fc10b20135e294d4e269.tar.gz libayatana-indicator-39cf870292e40bd72a16fc10b20135e294d4e269.tar.bz2 libayatana-indicator-39cf870292e40bd72a16fc10b20135e294d4e269.zip |
Tests: update dummy signaler to work with real IndicatorObjectEntry
This fixes a crash due to the parent/unparent.
-rw-r--r-- | tests/dummy-indicator-signaler.c | 17 | ||||
-rw-r--r-- | tests/test-loader.c | 23 |
2 files changed, 28 insertions, 12 deletions
diff --git a/tests/dummy-indicator-signaler.c b/tests/dummy-indicator-signaler.c index c7a5c1f..9908d3d 100644 --- a/tests/dummy-indicator-signaler.c +++ b/tests/dummy-indicator-signaler.c @@ -110,9 +110,20 @@ idle_signal (gpointer data) { DummyIndicatorSignaler * self = DUMMY_INDICATOR_SIGNALER(data); - 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); - g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED_ID, 0, GUINT_TO_POINTER(5), 0, 1, TRUE); + IndicatorObjectEntry *added_entry, *removed_entry, *moved_entry; + IndicatorObjectEntry *entries = g_new0(IndicatorObjectEntry, 3); + + added_entry = &entries[0]; + moved_entry = &entries[1]; + removed_entry = &entries[2]; + + added_entry->name_hint = "added"; + moved_entry->name_hint = "moved"; + removed_entry->name_hint = "removed"; + + g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID, 0, added_entry); + g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED_ID, 0, moved_entry, 0, 1); + g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID, 0, removed_entry); return FALSE; /* Don't queue again */ } diff --git a/tests/test-loader.c b/tests/test-loader.c index b567733..2140294 100644 --- a/tests/test-loader.c +++ b/tests/test-loader.c @@ -100,8 +100,8 @@ void destroy_cb (gpointer data, GObject * object); void entry_change_cb (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer data) { - gpointer * valuestore = (gpointer *)data; - *valuestore = entry; + IndicatorObjectEntry *other_entry = data; + other_entry->name_hint = entry->name_hint; return; } @@ -117,11 +117,16 @@ 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, moved_value = NULL; + IndicatorObjectEntry *added_entry, *moved_entry, *removed_entry; + IndicatorObjectEntry entries[3]; - 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); - g_signal_connect(G_OBJECT(object), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED, G_CALLBACK(entry_move_cb), &moved_value); + added_entry = &entries[0]; + moved_entry = &entries[1]; + removed_entry = &entries[2]; + + g_signal_connect_after(G_OBJECT(object), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, G_CALLBACK(entry_change_cb), added_entry); + g_signal_connect_after(G_OBJECT(object), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED, G_CALLBACK(entry_move_cb), moved_entry); + g_signal_connect_after(G_OBJECT(object), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, G_CALLBACK(entry_change_cb), removed_entry); GList * list = indicator_object_get_entries(object); g_assert(list != NULL); @@ -131,9 +136,9 @@ test_loader_filename_dummy_signaler (void) g_main_context_iteration(NULL, TRUE); } - g_assert(GPOINTER_TO_UINT(added_value) == 5); - g_assert(GPOINTER_TO_UINT(removed_value) == 5); - g_assert(GPOINTER_TO_UINT(moved_value) == 5); + g_assert(g_strcmp0(added_entry->name_hint, "added") == 0); + g_assert(g_strcmp0(removed_entry->name_hint, "removed") == 0); + g_assert(g_strcmp0(moved_entry->name_hint, "moved") == 0); g_object_unref(object); |