tests: add tests for GDesktopAppInfo Implements=

https://bugzilla.gnome.org/show_bug.cgi?id=712391
This commit is contained in:
Ryan Lortie 2013-11-15 14:44:33 -05:00
parent 0b27719293
commit 880e8e8cb2
6 changed files with 49 additions and 1 deletions

View File

@ -51,6 +51,13 @@ main (int argc, char **argv)
} }
g_free (results); 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")) else if (g_str_equal (argv[1], "show-info"))
{ {
GAppInfo *info; GAppInfo *info;

View File

@ -492,7 +492,7 @@ assert_strings_equivalent (const gchar *expected,
gint i, j; gint i, j;
expected_words = g_strsplit (expected, " ", 0); 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++) for (i = 0; expected_words[i]; i++)
{ {
@ -566,6 +566,20 @@ assert_search (const gchar *search_string,
g_free (result); 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 " \ #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 " \ "baobab.desktop yelp.desktop eog.desktop cheese.desktop gnome-clocks.desktop " \
"gnome-contacts.desktop kde4-kate.desktop gcr-prompter.desktop totem.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"); "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 int
main (int argc, main (int argc,
char *argv[]) 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/extra-getters", test_extra_getters);
g_test_add_func ("/desktop-app-info/actions", test_actions); 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/search", test_search);
g_test_add_func ("/desktop-app-info/implements", test_implements);
result = g_test_run (); result = g_test_run ();

View File

@ -44,3 +44,4 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=cheese X-GNOME-Bugzilla-Product=cheese
X-GNOME-Bugzilla-Component=general X-GNOME-Bugzilla-Component=general
X-GNOME-Bugzilla-Version=3.11.1 X-GNOME-Bugzilla-Version=3.11.1
Implements=org.freedesktop.ImageProvider

View File

@ -41,3 +41,4 @@ Keywords[en_GB]=Picture;Slideshow;Graphics;
Keywords[eo]=Bildo;Lumbildprezentado;Grafiko; Keywords[eo]=Bildo;Lumbildprezentado;Grafiko;
Keywords[pt]=Imagem;Apresentação;Gráficos; Keywords[pt]=Imagem;Apresentação;Gráficos;
Keywords[pt_BR]=Fotos;Apresentação de slides;Gráficos; Keywords[pt_BR]=Fotos;Apresentação de slides;Gráficos;
Implements=org.gnome.Shell.SearchProvider2

View File

@ -23,3 +23,4 @@ Type=Application
StartupNotify=true StartupNotify=true
Categories=GNOME;GTK;Utility; Categories=GNOME;GTK;Utility;
OnlyShowIn=GNOME;Unity; OnlyShowIn=GNOME;Unity;
Implements=org.gnome.Shell.SearchProvider2

View File

@ -20,3 +20,4 @@ Terminal=false
Type=Application Type=Application
Categories=GNOME;GTK;AudioVideo;Player;Audio; Categories=GNOME;GTK;AudioVideo;Player;Audio;
StartupNotify=true StartupNotify=true
Implements=org.gnome.Shell.SearchProvider2