summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2013-11-15 14:44:33 -0500
committerRyan Lortie <desrt@desrt.ca>2014-05-08 16:19:55 -0400
commit880e8e8cb254e8c0c8a4bb62ebb606404818b52b (patch)
treed2980375396771d974c6f2869f10f7e3fb794df6
parent0b277192932f7612906186620a369f7445cd5f41 (diff)
tests: add tests for GDesktopAppInfo Implements=
https://bugzilla.gnome.org/show_bug.cgi?id=712391
-rw-r--r--gio/tests/apps.c7
-rw-r--r--gio/tests/desktop-app-info.c39
-rw-r--r--gio/tests/desktop-files/usr/applications/cheese.desktop1
-rw-r--r--gio/tests/desktop-files/usr/applications/eog.desktop1
-rw-r--r--gio/tests/desktop-files/usr/applications/gnome-contacts.desktop1
-rw-r--r--gio/tests/desktop-files/usr/applications/gnome-music.desktop1
6 files changed, 49 insertions, 1 deletions
diff --git a/gio/tests/apps.c b/gio/tests/apps.c
index 659796668..6a4b04f4d 100644
--- a/gio/tests/apps.c
+++ b/gio/tests/apps.c
@@ -51,6 +51,13 @@ main (int argc, char **argv)
}
g_free (results);
}
+ else if (g_str_equal (argv[1], "implementations"))
+ {
+ GList *results;
+
+ results = g_desktop_app_info_get_implementations (argv[2]);
+ print_app_list (results);
+ }
else if (g_str_equal (argv[1], "show-info"))
{
GAppInfo *info;
diff --git a/gio/tests/desktop-app-info.c b/gio/tests/desktop-app-info.c
index fceaabc81..69fe587fd 100644
--- a/gio/tests/desktop-app-info.c
+++ b/gio/tests/desktop-app-info.c
@@ -492,7 +492,7 @@ assert_strings_equivalent (const gchar *expected,
gint i, j;
expected_words = g_strsplit (expected, " ", 0);
- result_words = g_strsplit (result, " ", 0);
+ result_words = g_strsplit_set (result, " \n", 0);
for (i = 0; expected_words[i]; i++)
{
@@ -566,6 +566,20 @@ assert_search (const gchar *search_string,
g_free (result);
}
+static void
+assert_implementations (const gchar *interface,
+ const gchar *expected,
+ gboolean with_usr,
+ gboolean with_home)
+{
+ gchar *result;
+
+ result = run_apps ("implementations", interface, with_usr, with_home, NULL, NULL);
+ g_strchomp (result);
+ assert_strings_equivalent (expected, result);
+ g_free (result);
+}
+
#define ALL_USR_APPS "evince-previewer.desktop nautilus-classic.desktop gnome-font-viewer.desktop " \
"baobab.desktop yelp.desktop eog.desktop cheese.desktop gnome-clocks.desktop " \
"gnome-contacts.desktop kde4-kate.desktop gcr-prompter.desktop totem.desktop " \
@@ -671,6 +685,28 @@ test_search (void)
"kde4-konqbrowser.desktop\n", TRUE, TRUE, "en_US.UTF-8", "eo");
}
+static void
+test_implements (void)
+{
+ /* Make sure we can find our search providers... */
+ assert_implementations ("org.gnome.Shell.SearchProvider2",
+ "gnome-music.desktop gnome-contacts.desktop eog.desktop",
+ TRUE, FALSE);
+
+ /* And our image acquisition possibilities... */
+ assert_implementations ("org.freedesktop.ImageProvider",
+ "cheese.desktop",
+ TRUE, FALSE);
+
+ /* Make sure the user's eog is properly masking the system one */
+ assert_implementations ("org.gnome.Shell.SearchProvider2",
+ "gnome-music.desktop gnome-contacts.desktop",
+ TRUE, TRUE);
+
+ /* Make sure we get nothing if we have nothing */
+ assert_implementations ("org.gnome.Shell.SearchProvider2", "", FALSE, FALSE);
+}
+
int
main (int argc,
char *argv[])
@@ -690,6 +726,7 @@ main (int argc,
g_test_add_func ("/desktop-app-info/extra-getters", test_extra_getters);
g_test_add_func ("/desktop-app-info/actions", test_actions);
g_test_add_func ("/desktop-app-info/search", test_search);
+ g_test_add_func ("/desktop-app-info/implements", test_implements);
result = g_test_run ();
diff --git a/gio/tests/desktop-files/usr/applications/cheese.desktop b/gio/tests/desktop-files/usr/applications/cheese.desktop
index 614ddb59c..650c50075 100644
--- a/gio/tests/desktop-files/usr/applications/cheese.desktop
+++ b/gio/tests/desktop-files/usr/applications/cheese.desktop
@@ -44,3 +44,4 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=cheese
X-GNOME-Bugzilla-Component=general
X-GNOME-Bugzilla-Version=3.11.1
+Implements=org.freedesktop.ImageProvider
diff --git a/gio/tests/desktop-files/usr/applications/eog.desktop b/gio/tests/desktop-files/usr/applications/eog.desktop
index 998284266..8dc3911b8 100644
--- a/gio/tests/desktop-files/usr/applications/eog.desktop
+++ b/gio/tests/desktop-files/usr/applications/eog.desktop
@@ -41,3 +41,4 @@ Keywords[en_GB]=Picture;Slideshow;Graphics;
Keywords[eo]=Bildo;Lumbildprezentado;Grafiko;
Keywords[pt]=Imagem;Apresentação;Gráficos;
Keywords[pt_BR]=Fotos;Apresentação de slides;Gráficos;
+Implements=org.gnome.Shell.SearchProvider2
diff --git a/gio/tests/desktop-files/usr/applications/gnome-contacts.desktop b/gio/tests/desktop-files/usr/applications/gnome-contacts.desktop
index 13ccb35f7..388b26f49 100644
--- a/gio/tests/desktop-files/usr/applications/gnome-contacts.desktop
+++ b/gio/tests/desktop-files/usr/applications/gnome-contacts.desktop
@@ -23,3 +23,4 @@ Type=Application
StartupNotify=true
Categories=GNOME;GTK;Utility;
OnlyShowIn=GNOME;Unity;
+Implements=org.gnome.Shell.SearchProvider2
diff --git a/gio/tests/desktop-files/usr/applications/gnome-music.desktop b/gio/tests/desktop-files/usr/applications/gnome-music.desktop
index 8928b219e..e4262cdfc 100644
--- a/gio/tests/desktop-files/usr/applications/gnome-music.desktop
+++ b/gio/tests/desktop-files/usr/applications/gnome-music.desktop
@@ -20,3 +20,4 @@ Terminal=false
Type=Application
Categories=GNOME;GTK;AudioVideo;Player;Audio;
StartupNotify=true
+Implements=org.gnome.Shell.SearchProvider2