diff options
author | Ted Gould <ted@gould.cx> | 2010-02-16 21:23:59 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-02-16 21:23:59 -0600 |
commit | b6b2a65e651701650c2dbd6b99b5c44ec2dfb534 (patch) | |
tree | bcd3027446cbfb8dc103938d908fca68a4e8935e | |
parent | edaa80e3a3fe85b11cb193179e7e7f5b1e9d310a (diff) | |
download | libayatana-indicator-b6b2a65e651701650c2dbd6b99b5c44ec2dfb534.tar.gz libayatana-indicator-b6b2a65e651701650c2dbd6b99b5c44ec2dfb534.tar.bz2 libayatana-indicator-b6b2a65e651701650c2dbd6b99b5c44ec2dfb534.zip |
Adding in local filter test functions.
-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; } |