[gnome-software: 6/110] tests: Ensure GTK resources are registered for icon test




commit 180370fd9a0d8eff1d78293a6b22f298cda2593e
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Oct 5 19:52:56 2021 +0100

    tests: Ensure GTK resources are registered for icon test
    
    The GTK icon resources are needed for the icon test, and they’re
    compiled into libgtk. Normally they’re registered when `gtk_init()` is
    called, but we can’t call that in the tests as they’re often run
    headless.
    
    Call `gtk_init_check()` instead. It will fail to completely set up GTK,
    but will not abort the program, and will successfully register the
    resources first.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 plugins/dummy/gs-self-test.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/plugins/dummy/gs-self-test.c b/plugins/dummy/gs-self-test.c
index 2ecd860a3..8d80f08d2 100644
--- a/plugins/dummy/gs-self-test.c
+++ b/plugins/dummy/gs-self-test.c
@@ -742,6 +742,9 @@ main (int argc, char **argv)
        g_content_type_set_mime_dirs (NULL);
 #endif
 
+       /* Force the GTK resources to be registered, needed for fallback icons. */
+       gtk_init_check ();
+
        /* Similarly, add the system-wide icon theme path before it’s
         * overwritten by %G_TEST_OPTION_ISOLATE_DIRS. */
        gs_test_expose_icon_theme_paths ();


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