mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
tests: add tests for GDesktopAppInfo Implements=
https://bugzilla.gnome.org/show_bug.cgi?id=712391
This commit is contained in:
parent
0b27719293
commit
880e8e8cb2
@ -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;
|
||||
|
@ -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 ();
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -23,3 +23,4 @@ Type=Application
|
||||
StartupNotify=true
|
||||
Categories=GNOME;GTK;Utility;
|
||||
OnlyShowIn=GNOME;Unity;
|
||||
Implements=org.gnome.Shell.SearchProvider2
|
||||
|
@ -20,3 +20,4 @@ Terminal=false
|
||||
Type=Application
|
||||
Categories=GNOME;GTK;AudioVideo;Player;Audio;
|
||||
StartupNotify=true
|
||||
Implements=org.gnome.Shell.SearchProvider2
|
||||
|
Loading…
Reference in New Issue
Block a user