aboutsummaryrefslogtreecommitdiff
path: root/tests/test-desktop-shortcuts.c
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2020-08-08 10:05:24 +0200
committerRobert Tari <robert@tari.in>2020-08-08 10:05:24 +0200
commit7ceee62eb53671e2dd5211ca693e47877b55f2dd (patch)
treeaa576074b553be2a26e7027f5ab661840ede0671 /tests/test-desktop-shortcuts.c
parenta5b13749745f729216c42697d7dea961fa6c7f99 (diff)
downloadlibayatana-indicator-7ceee62eb53671e2dd5211ca693e47877b55f2dd.tar.gz
libayatana-indicator-7ceee62eb53671e2dd5211ca693e47877b55f2dd.tar.bz2
libayatana-indicator-7ceee62eb53671e2dd5211ca693e47877b55f2dd.zip
Fix tests and deprecations (fixes #1)
Diffstat (limited to 'tests/test-desktop-shortcuts.c')
-rw-r--r--tests/test-desktop-shortcuts.c126
1 files changed, 63 insertions, 63 deletions
diff --git a/tests/test-desktop-shortcuts.c b/tests/test-desktop-shortcuts.c
index 4f20d3e..59084dd 100644
--- a/tests/test-desktop-shortcuts.c
+++ b/tests/test-desktop-shortcuts.c
@@ -1,5 +1,5 @@
/*
-Test for libindicator
+Test for libayatana-indicator
Copyright 2009 Canonical Ltd.
@@ -21,7 +21,7 @@ License along with this library. If not, see
*/
#include <gtk/gtk.h>
-#include "libindicator/indicator-desktop-shortcuts.h"
+#include "libayatana-indicator/indicator-desktop-shortcuts.h"
/* Basic object creation and destruction. Stop big
f*** ups here. */
@@ -29,14 +29,14 @@ void
test_desktop_shortcuts_creation (void)
{
- IndicatorDesktopShortcuts * ids = indicator_desktop_shortcuts_new(SRCDIR "/test-well-formed.desktop", "France");
- g_assert(ids != NULL);
+ IndicatorDesktopShortcuts * ids = indicator_desktop_shortcuts_new(SRCDIR "/test-well-formed.desktop", "France");
+ g_assert(ids != NULL);
- g_object_add_weak_pointer(G_OBJECT(ids), (gpointer *)&ids);
- g_object_unref(G_OBJECT(ids));
+ g_object_add_weak_pointer(G_OBJECT(ids), (gpointer *)&ids);
+ g_object_unref(G_OBJECT(ids));
- g_assert(ids == NULL);
- return;
+ g_assert(ids == NULL);
+ return;
}
/* Tests that the NotShowIn the desktop group is watched
@@ -45,116 +45,116 @@ void
test_desktop_shortcuts_globalnoshow (void)
{
- IndicatorDesktopShortcuts * ids = indicator_desktop_shortcuts_new(SRCDIR "/test-well-formed.desktop", "Germany");
- g_assert(ids != NULL);
+ IndicatorDesktopShortcuts * ids = indicator_desktop_shortcuts_new(SRCDIR "/test-well-formed.desktop", "Germany");
+ g_assert(ids != NULL);
- const gchar ** nicks = indicator_desktop_shortcuts_get_nicks(ids);
- g_assert(nicks[0] == NULL);
+ const gchar ** nicks = indicator_desktop_shortcuts_get_nicks(ids);
+ g_assert(nicks[0] == NULL);
- g_object_unref(ids);
+ g_object_unref(ids);
- return;
+ 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);
+ 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);
+ 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);
+ 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_assert(nicks_contains(nicks, "bob"));
+ g_assert(nicks_contains(nicks, "alvin"));
+ g_assert(!nicks_contains(nicks, "jim"));
- g_object_unref(ids);
+ g_object_unref(ids);
- return;
+ return;
}
/* Nick names -- checks to see they all have names */
void
test_desktop_shortcuts_nicknames (void)
{
- IndicatorDesktopShortcuts * ids = indicator_desktop_shortcuts_new(SRCDIR "/test-well-formed.desktop", "France");
- g_assert(ids != NULL);
+ 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);
- gint i = 0;
- while (nicks[i] != NULL) {
- gchar * expectedstr = g_strdup_printf("%s's shortcut", nicks[i]);
- gchar * name = indicator_desktop_shortcuts_nick_get_name(ids, nicks[i]);
- g_assert(name != NULL);
+ const gchar ** nicks = indicator_desktop_shortcuts_get_nicks(ids);
+ gint i = 0;
+ while (nicks[i] != NULL) {
+ gchar * expectedstr = g_strdup_printf("%s's shortcut", nicks[i]);
+ gchar * name = indicator_desktop_shortcuts_nick_get_name(ids, nicks[i]);
+ g_assert(name != NULL);
- gboolean same = (g_strcmp0(expectedstr, name) == 0);
+ gboolean same = (g_strcmp0(expectedstr, name) == 0);
- g_free(name);
- g_free(expectedstr);
+ g_free(name);
+ g_free(expectedstr);
- g_assert(same);
+ g_assert(same);
- i++;
- }
+ i++;
+ }
- g_object_unref(ids);
+ g_object_unref(ids);
- return;
+ return;
}
/* Try executing a shortcut which will touch a file */
void
test_desktop_shortcuts_launch (void)
{
- return;
- IndicatorDesktopShortcuts * ids = indicator_desktop_shortcuts_new(SRCDIR "/test-well-formed.desktop", "TouchTest");
- g_assert(ids != NULL);
+ return;
+ IndicatorDesktopShortcuts * ids = indicator_desktop_shortcuts_new(SRCDIR "/test-well-formed.desktop", "TouchTest");
+ g_assert(ids != NULL);
- const gchar ** nicks = indicator_desktop_shortcuts_get_nicks(ids);
- g_assert(nicks_contains(nicks, "touch"));
+ const gchar ** nicks = indicator_desktop_shortcuts_get_nicks(ids);
+ g_assert(nicks_contains(nicks, "touch"));
- g_assert(indicator_desktop_shortcuts_nick_exec_with_context(ids, "touch", NULL));
- g_usleep(100000);
- g_assert(g_file_test(BUILD_DIR "/test-desktop-shortcuts-touch-test", G_FILE_TEST_EXISTS));
+ g_assert(indicator_desktop_shortcuts_nick_exec_with_context(ids, "touch", NULL));
+ g_usleep(100000);
+ g_assert(g_file_test(BUILD_DIR "/test-desktop-shortcuts-touch-test", G_FILE_TEST_EXISTS));
- g_object_unref(ids);
+ g_object_unref(ids);
- return;
+ return;
}
/* Build our test suite */
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/nicknames", test_desktop_shortcuts_nicknames);
- g_test_add_func ("/libindicator/desktopshortcuts/launch", test_desktop_shortcuts_launch);
+ g_test_add_func ("/libayatana-indicator/desktopshortcuts/creation", test_desktop_shortcuts_creation);
+ g_test_add_func ("/libayatana-indicator/desktopshortcuts/globalnosho", test_desktop_shortcuts_globalnoshow);
+ g_test_add_func ("/libayatana-indicator/desktopshortcuts/nicknames", test_desktop_shortcuts_nicknames);
+ g_test_add_func ("/libayatana-indicator/desktopshortcuts/launch", test_desktop_shortcuts_launch);
- return;
+ return;
}
int
main (int argc, char ** argv)
{
- g_test_init (&argc, &argv, NULL);
- gtk_init(&argc, &argv);
+ g_test_init (&argc, &argv, NULL);
+ gtk_init(&argc, &argv);
- test_desktop_shortcuts_suite();
+ test_desktop_shortcuts_suite();
- g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL);
+ g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL);
- return g_test_run();
+ return g_test_run();
}