aboutsummaryrefslogtreecommitdiff
path: root/tests/test-loader.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-01-23 08:55:12 -0600
committerCharles Kerr <charles.kerr@canonical.com>2012-01-23 08:55:12 -0600
commit95daf102dac37a69686f8a86bf7fe47cd442c7d6 (patch)
tree3891a7075873c6eeb320fe0c8a572ca14655f5af /tests/test-loader.c
parent4f4190f71f8495e5bcf6779d73157931572e42ac (diff)
parent1cf6a9761db8beefc8d2a73c2cf9903264424c66 (diff)
downloadlibayatana-indicator-95daf102dac37a69686f8a86bf7fe47cd442c7d6.tar.gz
libayatana-indicator-95daf102dac37a69686f8a86bf7fe47cd442c7d6.tar.bz2
libayatana-indicator-95daf102dac37a69686f8a86bf7fe47cd442c7d6.zip
"bzr merge lp:indicator" + conflict resolution in tests suite
Diffstat (limited to 'tests/test-loader.c')
-rw-r--r--tests/test-loader.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/tests/test-loader.c b/tests/test-loader.c
index 51ea6f3..0ea3224 100644
--- a/tests/test-loader.c
+++ b/tests/test-loader.c
@@ -23,6 +23,78 @@ License along with this library. If not, see
#include <gtk/gtk.h>
#include "libindicator/indicator-object.h"
+#include "dummy-indicator-entry-func.h"
+
+void
+entry_func_swap (IndicatorObject * io)
+{
+ static void (*saved_func) (IndicatorObject * io, IndicatorObjectEntry * entry, guint windowid, guint timestamp) = NULL;
+ IndicatorObjectClass * klass = INDICATOR_OBJECT_GET_CLASS(io);
+
+ if (saved_func == NULL) {
+ saved_func = klass->entry_activate_window;
+ }
+
+ if (klass->entry_activate_window == NULL) {
+ klass->entry_activate_window = saved_func;
+ } else {
+ klass->entry_activate_window = NULL;
+ }
+
+ return;
+}
+
+void
+test_loader_entry_func_window (void)
+{
+ IndicatorObject * object = indicator_object_new_from_file(BUILD_DIR "/.libs/libdummy-indicator-entry-func.so");
+ g_assert(object != NULL);
+
+ DummyIndicatorEntryFunc * entryfunc = (DummyIndicatorEntryFunc *)(object);
+
+ entryfunc->entry_activate_called = FALSE;
+ entryfunc->entry_activate_window_called = FALSE;
+ entryfunc->entry_close_called = FALSE;
+
+ entry_func_swap(object);
+ indicator_object_entry_activate_window(object, NULL, 0, 0);
+ g_assert(entryfunc->entry_activate_called);
+
+ entry_func_swap(object);
+ indicator_object_entry_activate_window(object, NULL, 0, 0);
+ g_assert(entryfunc->entry_activate_window_called);
+
+ g_object_unref(object);
+
+ return;
+}
+
+void
+test_loader_entry_funcs (void)
+{
+ IndicatorObject * object = indicator_object_new_from_file(BUILD_DIR "/.libs/libdummy-indicator-entry-func.so");
+ g_assert(object != NULL);
+
+ DummyIndicatorEntryFunc * entryfunc = (DummyIndicatorEntryFunc *)(object);
+
+ entryfunc->entry_activate_called = FALSE;
+ entryfunc->entry_activate_window_called = FALSE;
+ entryfunc->entry_close_called = FALSE;
+
+ indicator_object_entry_activate(object, NULL, 0);
+ g_assert(entryfunc->entry_activate_called);
+
+ indicator_object_entry_activate_window(object, NULL, 0, 0);
+ g_assert(entryfunc->entry_activate_window_called);
+
+ indicator_object_entry_close(object, NULL, 0);
+ g_assert(entryfunc->entry_close_called);
+
+ g_object_unref(object);
+
+ return;
+}
+
void destroy_cb (gpointer data, GObject * object);
void
@@ -263,6 +335,8 @@ test_loader_creation_deletion_suite (void)
g_test_add_func ("/libindicator/loader/dummy/simple_accessors", test_loader_filename_dummy_simple_accessors);
g_test_add_func ("/libindicator/loader/dummy/simple_location", test_loader_filename_dummy_simple_location);
g_test_add_func ("/libindicator/loader/dummy/signaler", test_loader_filename_dummy_signaler);
+ g_test_add_func ("/libindicator/loader/dummy/entry_funcs", test_loader_entry_funcs);
+ g_test_add_func ("/libindicator/loader/dummy/entry_func_window", test_loader_entry_func_window);
g_test_add_func ("/libindicator/loader/dummy/visible", test_loader_filename_dummy_visible);
return;