[gnome-software/wip/jrocha/fix_popular_overrides: 20/20] Cover overriding popular apps in the dummy plugin
- From: Joaquim Manuel Pereira Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/jrocha/fix_popular_overrides: 20/20] Cover overriding popular apps in the dummy plugin
- Date: Wed, 5 Apr 2017 14:30:26 +0000 (UTC)
commit 2d6823ef652693016560cb92e6783f75e97226df
Author: Joaquim Rocha <jrocha endlessm com>
Date: Wed Apr 5 15:17:14 2017 +0100
Cover overriding popular apps in the dummy plugin
The override of the popular apps is done by setting the
GNOME_SOFTWARE_POPULAR environment variable.
plugins/dummy/gs-self-test.c | 31 +++++++++++++++++++++++++++----
1 files changed, 27 insertions(+), 4 deletions(-)
---
diff --git a/plugins/dummy/gs-self-test.c b/plugins/dummy/gs-self-test.c
index dd861a7..6349bf2 100644
--- a/plugins/dummy/gs-self-test.c
+++ b/plugins/dummy/gs-self-test.c
@@ -558,17 +558,40 @@ static void
gs_plugins_dummy_wildcard_func (GsPluginLoader *plugin_loader)
{
g_autoptr(GError) error = NULL;
- g_autoptr(GsAppList) list = NULL;
+ g_autoptr(GsAppList) list1 = NULL;
+ g_autoptr(GsAppList) list2 = NULL;
+ const gchar *popular_override = "chiron.desktop,zeus.desktop";
+ g_auto(GStrv) apps = NULL;
- list = gs_plugin_loader_get_popular (plugin_loader,
+ /* use the plugin's add_popular function */
+ list1 = gs_plugin_loader_get_popular (plugin_loader,
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
GS_PLUGIN_FAILURE_FLAGS_FATAL_ANY,
NULL,
&error);
gs_test_flush_main_context ();
g_assert_no_error (error);
- g_assert (list != NULL);
- g_assert_cmpint (gs_app_list_length (list), ==, 1);
+ g_assert (list1 != NULL);
+ g_assert_cmpint (gs_app_list_length (list1), ==, 1);
+
+ /* override the popular list (do not use the add_popular function) */
+ g_setenv ("GNOME_SOFTWARE_POPULAR", popular_override, TRUE);
+ list2 = gs_plugin_loader_get_popular (plugin_loader,
+ GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ANY,
+ NULL,
+ &error);
+ gs_test_flush_main_context ();
+ g_assert_no_error (error);
+ g_assert (list2 != NULL);
+
+ apps = g_strsplit (popular_override, ",", 0);
+ g_assert_cmpint (gs_app_list_length (list2), ==, g_strv_length (apps));
+
+ for (guint i = 0; i < gs_app_list_length (list2); ++i) {
+ GsApp *app = gs_app_list_index (list2, i);
+ g_assert (g_strv_contains (apps, gs_app_get_id (app)));
+ }
}
int
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]