tests: add tests for GDesktopAppInfo Implements=
authorRyan Lortie <desrt@desrt.ca>
Fri, 15 Nov 2013 19:44:33 +0000 (14:44 -0500)
committerRyan Lortie <desrt@desrt.ca>
Thu, 8 May 2014 20:19:55 +0000 (16:19 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=712391

gio/tests/apps.c
gio/tests/desktop-app-info.c
gio/tests/desktop-files/usr/applications/cheese.desktop
gio/tests/desktop-files/usr/applications/eog.desktop
gio/tests/desktop-files/usr/applications/gnome-contacts.desktop
gio/tests/desktop-files/usr/applications/gnome-music.desktop

index 6597966..6a4b04f 100644 (file)
@@ -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;
index fceaabc..69fe587 100644 (file)
@@ -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 ();
 
index 614ddb5..650c500 100644 (file)
@@ -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
index 9982842..8dc3911 100644 (file)
@@ -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
index 13ccb35..388b26f 100644 (file)
@@ -23,3 +23,4 @@ Type=Application
 StartupNotify=true
 Categories=GNOME;GTK;Utility;
 OnlyShowIn=GNOME;Unity;
+Implements=org.gnome.Shell.SearchProvider2
index 8928b21..e4262cd 100644 (file)
@@ -20,3 +20,4 @@ Terminal=false
 Type=Application
 Categories=GNOME;GTK;AudioVideo;Player;Audio;
 StartupNotify=true
+Implements=org.gnome.Shell.SearchProvider2