diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-desktop-shortcuts.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test-desktop-shortcuts.c b/tests/test-desktop-shortcuts.c index 621721b..6dab100 100644 --- a/tests/test-desktop-shortcuts.c +++ b/tests/test-desktop-shortcuts.c @@ -1,6 +1,8 @@ #include <gtk/gtk.h> #include "libindicator/indicator-desktop-shortcuts.h" +/* Basic object creation and destruction. Stop big + f*** ups here. */ void test_desktop_shortcuts_creation (void) { @@ -15,6 +17,8 @@ test_desktop_shortcuts_creation (void) return; } +/* Tests that the NotShowIn the desktop group is watched + for */ void test_desktop_shortcuts_globalnoshow (void) { @@ -30,11 +34,40 @@ test_desktop_shortcuts_globalnoshow (void) return; } +gboolean +nicks_contains (const gchar ** nicks, const gchar * search) +{ + if (nicks[0] == NULL) + return FALSE; + if (g_strcmp0(nicks[0], search) == 0) + return TRUE; + return nicks_contains(&nicks[1], search); +} + +/* Checking that the local show OnlyIn works. */ +void +test_desktop_shortcuts_localfilter (void) +{ + IndicatorDesktopShortcuts * ids = indicator_desktop_shortcuts_new(SRCDIR "/test-well-formed.desktop", "France"); + g_assert(ids != NULL); + + const gchar ** nicks = indicator_desktop_shortcuts_get_nicks(ids); + + g_assert(nicks_contains(nicks, "bob")); + g_assert(nicks_contains(nicks, "alvin")); + g_assert(!nicks_contains(nicks, "jim")); + + g_object_unref(ids); + + return; +} + void test_desktop_shortcuts_suite (void) { g_test_add_func ("/libindicator/desktopshortcuts/creation", test_desktop_shortcuts_creation); g_test_add_func ("/libindicator/desktopshortcuts/globalnosho", test_desktop_shortcuts_globalnoshow); + g_test_add_func ("/libindicator/desktopshortcuts/localfilter", test_desktop_shortcuts_localfilter); return; } |