[gtksourceview] testsuite: use in-tree paths for style schemes



commit 6dc0a58d60bea65573046dc08b781fdd7c217ac4
Author: Christian Hergert <chergert redhat com>
Date:   Sat Jan 8 12:39:26 2022 -0800

    testsuite: use in-tree paths for style schemes
    
    Avoid any side-effects from the system installation or user schemes.
    
    Fixes #244

 testsuite/test-vim-input.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/testsuite/test-vim-input.c b/testsuite/test-vim-input.c
index 3457ccbf..05703ee3 100644
--- a/testsuite/test-vim-input.c
+++ b/testsuite/test-vim-input.c
@@ -236,10 +236,21 @@ int
 main (int argc,
       char *argv[])
 {
+       const char *srcdir = g_getenv ("G_TEST_SRCDIR");
+       char *schemes_search_path[2] = { NULL };
+       GtkSourceStyleSchemeManager *schemes;
        int ret;
 
+       g_assert_true (g_file_test (srcdir, G_FILE_TEST_IS_DIR));
+
        gtk_init ();
        gtk_source_init ();
+
+       schemes = gtk_source_style_scheme_manager_get_default ();
+       schemes_search_path[0] = g_build_filename (srcdir, "..", "data", "styles", NULL);
+       gtk_source_style_scheme_manager_set_search_path (schemes, (const char * const *)schemes_search_path);
+       g_free (schemes_search_path[0]);
+
        g_test_init (&argc, &argv, NULL);
        g_test_add_func ("/GtkSourceView/vim-input/yank", test_yank);
        g_test_add_func ("/GtkSourceView/vim-input/insert", test_insert);


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