diff options
author | Ted Gould <ted@gould.cx> | 2012-01-16 03:59:29 +0100 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2012-01-16 03:59:29 +0100 |
commit | 6a0f41aaa53cb79e03520a8214cc2c9305821496 (patch) | |
tree | 42ca4612dbc583426b4e476fa054979829c93495 /tests | |
parent | f898563b6eaff8a00dd0cc2f7adabed16b80b698 (diff) | |
download | libayatana-indicator-6a0f41aaa53cb79e03520a8214cc2c9305821496.tar.gz libayatana-indicator-6a0f41aaa53cb79e03520a8214cc2c9305821496.tar.bz2 libayatana-indicator-6a0f41aaa53cb79e03520a8214cc2c9305821496.zip |
Moving the function into the tester to making linking simpler
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dummy-indicator-entry-func.c | 14 | ||||
-rw-r--r-- | tests/dummy-indicator-entry-func.h | 2 | ||||
-rw-r--r-- | tests/test-loader.c | 23 |
3 files changed, 21 insertions, 18 deletions
diff --git a/tests/dummy-indicator-entry-func.c b/tests/dummy-indicator-entry-func.c index ac330aa..96e5ad0 100644 --- a/tests/dummy-indicator-entry-func.c +++ b/tests/dummy-indicator-entry-func.c @@ -128,17 +128,3 @@ dummy_indicator_entry_func_finalize (GObject *object) G_OBJECT_CLASS (dummy_indicator_entry_func_parent_class)->finalize (object); return; } - -void -dummy_indicator_entry_func_support_window(DummyIndicatorEntryFunc * ind, gboolean different) -{ - DummyIndicatorEntryFuncClass * entry_class = DUMMY_INDICATOR_ENTRY_FUNC_GET_CLASS(ind); - - if (different) { - entry_class->parent_class.entry_activate_window = entry_activate_window; - } else { - entry_class->parent_class.entry_activate_window = NULL; - } - - return; -} diff --git a/tests/dummy-indicator-entry-func.h b/tests/dummy-indicator-entry-func.h index d22abed..f5c8264 100644 --- a/tests/dummy-indicator-entry-func.h +++ b/tests/dummy-indicator-entry-func.h @@ -53,6 +53,4 @@ struct _DummyIndicatorEntryFunc { gboolean entry_close_called; }; -void dummy_indicator_entry_func_support_window(DummyIndicatorEntryFunc * ind, gboolean different); - #endif /* __DUMMY_INDICATOR_ENTRY_FUNC__ */ diff --git a/tests/test-loader.c b/tests/test-loader.c index 48537c0..2e9cf55 100644 --- a/tests/test-loader.c +++ b/tests/test-loader.c @@ -26,6 +26,25 @@ License along with this library. If not, see #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"); @@ -37,11 +56,11 @@ test_loader_entry_func_window (void) entryfunc->entry_activate_window_called = FALSE; entryfunc->entry_close_called = FALSE; - dummy_indicator_entry_func_support_window(entryfunc, FALSE); + entry_func_swap(object); indicator_object_entry_activate_window(object, NULL, 0, 0); g_assert(entryfunc->entry_activate_called); - dummy_indicator_entry_func_support_window(entryfunc, TRUE); + entry_func_swap(object); indicator_object_entry_activate_window(object, NULL, 0, 0); g_assert(entryfunc->entry_activate_window_called); |