aboutsummaryrefslogtreecommitdiff
path: root/tests/test-loader.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-11-05 09:13:41 -0600
committerTed Gould <ted@canonical.com>2009-11-05 09:13:41 -0600
commitdb9e8f49d8136dfbec1539812d7cf76d90b9bc69 (patch)
treed0abd50fd186a0652b3b319e0c51f073b00e4dd7 /tests/test-loader.c
parentc547687a407d935654aa71f7afa1e4392e50d5c5 (diff)
parent34f914c264d268efff97142ba1ea7f2c3eab0493 (diff)
downloadlibayatana-indicator-db9e8f49d8136dfbec1539812d7cf76d90b9bc69.tar.gz
libayatana-indicator-db9e8f49d8136dfbec1539812d7cf76d90b9bc69.tar.bz2
libayatana-indicator-db9e8f49d8136dfbec1539812d7cf76d90b9bc69.zip
Changing the indicator-object API to support indicators that have multiple entries, and are dynamic.
Diffstat (limited to 'tests/test-loader.c')
-rw-r--r--tests/test-loader.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/tests/test-loader.c b/tests/test-loader.c
index 4b2b096..485a951 100644
--- a/tests/test-loader.c
+++ b/tests/test-loader.c
@@ -4,14 +4,48 @@
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");
g_assert(object != NULL);
- g_assert(indicator_object_get_label(object) != NULL);
- g_assert(indicator_object_get_menu(object) != NULL);
- g_assert(indicator_object_get_icon(object) != NULL);
+ g_assert(indicator_object_get_entries(object) != NULL);
g_object_unref(object);
@@ -45,7 +79,9 @@ void
test_loader_filename_dummy_null (void)
{
IndicatorObject * object = indicator_object_new_from_file(BUILD_DIR "/.libs/libdummy-indicator-null.so");
- g_assert(object == NULL);
+ g_assert(object != NULL);
+ g_assert(indicator_object_get_entries(object) == NULL);
+ g_object_unref(G_OBJECT(object));
return;
}
@@ -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;
}