[gnome-software/wip/hughsie/flatpak] f



commit af2272ac46451e6b117ef85442916e20a7365781
Author: Richard Hughes <richard hughsie com>
Date:   Fri May 13 10:01:31 2016 +0100

    f

 src/gs-self-test.c                |   37 +++++++++++++++++++++++++++----------
 src/plugins/gs-plugin-appstream.c |   13 ++++++++-----
 2 files changed, 35 insertions(+), 15 deletions(-)
---
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index aee5d09..c3bbadd 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -775,7 +775,17 @@ if(0)      gs_test_idle_delay (1000);
        g_assert_cmpstr (gs_app_get_id (app), ==, "org.gnome.Hello.desktop");
        g_assert_cmpint (gs_app_get_kind (app), ==, AS_APP_KIND_DESKTOP);
        g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_AVAILABLE);
+#endif
 
+#if 1
+app = gs_app_new ("org.test.Chiron.desktop");
+gs_app_set_management_plugin (app, "flatpak");
+gs_app_add_source (app, "app/org.test.Chiron/x86_64/master");
+gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
+gs_app_set_origin (app, "test");
+#endif
+
+#if 1
        /* install */
        //XDG_DATA_HOME=/var/tmp/self-test flatpak --user install test org.test.Chiron
        ret = gs_plugin_loader_app_action (plugin_loader, app,
@@ -811,19 +821,13 @@ if(0)     gs_test_idle_delay (1000);
        g_assert (g_file_test (desktop_fn, G_FILE_TEST_IS_REGULAR));
 
        /* remove the application */
-app = gs_app_new ("org.test.Chiron.desktop");
-gs_app_set_management_plugin (app, "flatpak");
-gs_app_add_source (app, "app/org.test.Chiron/x86_64/master");
-gs_app_set_state (app, AS_APP_STATE_INSTALLED);
        ret = gs_plugin_loader_app_action (plugin_loader, app,
                                           GS_PLUGIN_LOADER_ACTION_REMOVE,
                                           NULL,
                                           &error);
        g_assert_no_error (error);
        g_assert (ret);
-       /* NOTE: this isn't AVAILABLE as we don't know if the app is
-        * re-installable */
-       g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_UNKNOWN);
+       g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_AVAILABLE);
        g_assert (!g_file_test (metadata_fn, G_FILE_TEST_IS_REGULAR));
        g_assert (!g_file_test (desktop_fn, G_FILE_TEST_IS_REGULAR));
 }
@@ -865,9 +869,6 @@ main (int argc, char **argv)
        g_setenv ("GS_SELF_TEST_PROVENANCE_LICENSE_URL", "https://www.debian.org/";, TRUE);
        g_setenv ("GS_SELF_TEST_FLATPACK_DATADIR", tmp_root, TRUE);
 
-       /* needed so we can pick up the new AppStream root */
-       g_setenv ("AS_GLIB_FLATPAK_EXTRA_DATADIR", tmp_root, TRUE);
-
        /* ensure test root does not exist */
        if (0 && g_file_test (tmp_root, G_FILE_TEST_EXISTS)) {
                ret = gs_test_rmtree (tmp_root, &error);
@@ -924,8 +925,24 @@ main (int argc, char **argv)
                "    <name>test</name>\n"
                "    <icon type=\"remote\">file://%s</icon>\n"
                "  </component>\n"
+               "  <component type=\"desktop\">\n"
+               "    <id>org.test.Chiron.desktop</id>\n"
+               "    <name>Chiron</name>\n"
+               "    <summary>Single line synopsis</summary>\n"
+               "    <description><p>Long description.</p></description>\n"
+               "    <icon height=\"128\" width=\"128\" type=\"cached\">128x128/org.test.Chiron.png</icon>\n"
+               "    <icon height=\"64\" width=\"64\" type=\"cached\">64x64/org.test.Chiron.png</icon>\n"
+               "    <keywords>\n"
+               "      <keyword>Bingo</keyword>\n"
+               "    </keywords>\n"
+               "    <project_license>GPL-2.0+</project_license>\n"
+               "    <url type=\"homepage\">http://127.0.0.1/</url>\n"
+               "    <bundle type=\"flatpak\" 
runtime=\"org.gnome.Platform/x86_64/3.20\">app/org.test.Chiron/x86_64/master</bundle>\n"
+               "  </component>\n"
                "</components>\n", fn);
        g_setenv ("GS_SELF_TEST_APPSTREAM_XML", xml, TRUE);
+       g_setenv ("GS_SELF_TEST_APPSTREAM_ICON_ROOT",
+                 "/var/tmp/self-test/flatpak/appstream/test/x86_64/active/", TRUE);
 
        /* only critical and error are fatal */
        g_log_set_fatal_mask (NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 27fd631..13f4b9c 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -148,7 +148,8 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
        GPtrArray *items;
        gboolean ret;
        const gchar *origin;
-       const gchar *tmp;
+       const gchar *test_xml;
+       const gchar *test_icon_root;
        guint *perc;
        guint i;
        g_autoptr(GHashTable) origins = NULL;
@@ -160,10 +161,12 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
        }
 
        /* only when in self test */
-       tmp = g_getenv ("GS_SELF_TEST_APPSTREAM_XML");
-       if (tmp != NULL) {
-               g_debug ("using self test data of %s", tmp);
-               if (!as_store_from_xml (priv->store, tmp, NULL, error))
+       test_xml = g_getenv ("GS_SELF_TEST_APPSTREAM_XML");
+       if (test_xml != NULL) {
+               test_icon_root = g_getenv ("GS_SELF_TEST_APPSTREAM_ICON_ROOT");
+               g_debug ("using self test data of %s... with icon root %s",
+                        test_xml, test_icon_root);
+               if (!as_store_from_xml (priv->store, test_xml, test_icon_root, error))
                        return FALSE;
        } else {
                ret = as_store_load (priv->store,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]