[gtk/a11y/atspi: 10/30] tests: Use the test ATContext for every test




commit fb552ba10ac59f73c0d9d660c7c211126c66082d
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri Oct 9 18:17:04 2020 +0100

    tests: Use the test ATContext for every test
    
    Otherwise we're going to need a full desktop session in order to run the
    test suite.

 testsuite/css/change/meson.build | 13 ++++++-------
 testsuite/css/meson.build        | 27 +++++++++++++++++----------
 testsuite/css/nodes/meson.build  | 13 +++++--------
 testsuite/css/style/meson.build  | 13 +++++--------
 testsuite/gdk/meson.build        | 33 ++++++++++++++++++---------------
 testsuite/gsk/meson.build        |  3 +++
 testsuite/gtk/meson.build        | 32 +++++++++++++++++---------------
 testsuite/reftests/meson.build   | 17 +++++++++++------
 testsuite/tools/meson.build      |  1 +
 9 files changed, 83 insertions(+), 69 deletions(-)
---
diff --git a/testsuite/css/change/meson.build b/testsuite/css/change/meson.build
index 04204ed5ba..83e37ae2f6 100644
--- a/testsuite/css/change/meson.build
+++ b/testsuite/css/change/meson.build
@@ -9,14 +9,13 @@ test_change = executable(
   install: get_option('install-tests'),
   install_dir: testexecdir,
 )
+
 test('change', test_change,
-     args: [ '--tap', '-k' ],
-     protocol: 'tap',
-     env: [
-            'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
-            'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
-          ],
-     suite: 'css')
+  args: [ '--tap', '-k' ],
+  protocol: 'tap',
+  env: csstest_env,
+  suite: 'css',
+)
 
 test_data = [
   'test1.css', 'test1.ui', 'test1.nodes',
diff --git a/testsuite/css/meson.build b/testsuite/css/meson.build
index bac0ebd074..931502bef7 100644
--- a/testsuite/css/meson.build
+++ b/testsuite/css/meson.build
@@ -1,3 +1,12 @@
+csstest_env = environment()
+csstest_env.set('GTK_TEST_ACCESSIBLE', '1')
+csstest_env.set('GSK_RENDERER', 'cairo')
+csstest_env.set('G_TEST_SRCDIR', meson.current_source_dir())
+csstest_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
+csstest_env.set('GIO_USE_VFS', 'local')
+csstest_env.set('GSETTINGS_BACKEND', 'memory')
+csstest_env.set('G_ENABLE_DIAGNOSTIC', '0')
+
 subdir('parser')
 subdir('nodes')
 subdir('style')
@@ -14,10 +23,7 @@ test_api = executable('api', 'api.c',
 test('api', test_api,
      args: ['--tap', '-k' ],
      protocol: 'tap',
-     env: [
-            'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
-            'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
-          ],
+     env: csstest_env,
      suite: 'css')
 
 test_data = executable('data', ['data.c', '../../gtk/css/gtkcssdataurl.c'],
@@ -29,10 +35,7 @@ test_data = executable('data', ['data.c', '../../gtk/css/gtkcssdataurl.c'],
 test('data', test_data,
      args: ['--tap', '-k' ],
      protocol: 'tap',
-     env: [
-            'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
-            'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
-          ],
+     env: csstest_env,
      suite: 'css')
 
 if get_option('install-tests')
@@ -46,20 +49,24 @@ endif
 
 if false and get_option ('profiler')
 
+  adwaita_env = csstest_env
+  adwaita_env.set('GTK_THEME', 'Adwaita')
   test('performance-adwaita', test_performance,
        args: [ '--mark', 'css validation',
                '--name',  'performance-adwaita',
                '--output', join_paths(meson.current_build_dir(), 'output'),
                join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
-       env: [ 'GTK_THEME=Adwaita' ],
+       env: adwaita_env,
        suite: [ 'css' ])
 
+  empty_env = csstest_env
+  empty_env.set('GTK_THEME', 'Empty')
   test('performance-empty', test_performance,
        args: [ '--mark', 'css validation',
                '--name',  'performance-empty',
                '--output', join_paths(meson.current_build_dir(), 'output'),
                join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
-       env: [ 'GTK_THEME=Empty' ],
+       env: empty_env,
        suite: [ 'css' ])
 
 endif
diff --git a/testsuite/css/nodes/meson.build b/testsuite/css/nodes/meson.build
index 720ba46db8..11ed48b9e5 100644
--- a/testsuite/css/nodes/meson.build
+++ b/testsuite/css/nodes/meson.build
@@ -7,13 +7,11 @@ test_nodes = executable('test-css-nodes', 'test-css-nodes.c',
                         install_dir: testexecdir,
                         dependencies: libgtk_dep)
 test('nodes', test_nodes,
-     args: [ '--tap', '-k' ],
-     protocol: 'tap',
-     env: [
-            'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
-            'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
-          ],
-     suite: 'css')
+  args: [ '--tap', '-k' ],
+  protocol: 'tap',
+  env: csstest_env,
+  suite: 'css',
+)
 
 test_data = [
   'box.ltr.nodes',
@@ -77,5 +75,4 @@ if get_option('install-tests')
                  install_dir: testdatadir)
 
   install_data(test_data, install_dir: testexecdir)
-
 endif
diff --git a/testsuite/css/style/meson.build b/testsuite/css/style/meson.build
index cadbf8dc16..b54adf7c68 100644
--- a/testsuite/css/style/meson.build
+++ b/testsuite/css/style/meson.build
@@ -17,13 +17,11 @@ test_style = executable(
   install_dir: testexecdir,
 )
 test('style', test_style,
-     args: [ '--tap', '-k' ],
-     protocol: 'tap',
-     env: [
-            'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
-            'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
-          ],
-     suite: 'css')
+  args: [ '--tap', '-k' ],
+  protocol: 'tap',
+  env: csstest_env,
+  suite: 'css',
+)
 
 test_data = [
   'adjacent-states.css',
@@ -65,5 +63,4 @@ if get_option('install-tests')
                  install_dir: testdatadir)
 
   install_data(test_data, install_dir: testexecdir)
-
 endif
diff --git a/testsuite/gdk/meson.build b/testsuite/gdk/meson.build
index bd7744ee0e..aa93f8384d 100644
--- a/testsuite/gdk/meson.build
+++ b/testsuite/gdk/meson.build
@@ -16,28 +16,31 @@ tests = [
 
 foreach t : tests
   test_exe = executable(t, '@0@.c'.format(t),
-                        c_args: common_cflags,
-                        dependencies: libgtk_dep,
-                        install: get_option('install-tests'),
-                        install_dir: testexecdir)
+    c_args: common_cflags,
+    dependencies: libgtk_dep,
+    install: get_option('install-tests'),
+    install_dir: testexecdir,
+  )
 
   test(t, test_exe,
-       args: [ '--tap', '-k' ],
-       protocol: 'tap',
-       env: [
-              'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
-              'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
-            ],
-       suite: 'gdk')
+    args: [ '--tap', '-k' ],
+    protocol: 'tap',
+    env: [
+      'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
+      'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
+    ],
+    suite: 'gdk',
+  )
 
   if get_option('install-tests')
     test_cdata = configuration_data()
     test_cdata.set('testexecdir', testexecdir)
     test_cdata.set('test', t)
     configure_file(input: 'gdk.test.in',
-                   output: '@0@.test'.format(t),
-                   configuration: test_cdata,
-                   install: true,
-                   install_dir: testdatadir)
+      output: '@0@.test'.format(t),
+      configuration: test_cdata,
+      install: true,
+      install_dir: testdatadir,
+    )
   endif
 endforeach
diff --git a/testsuite/gsk/meson.build b/testsuite/gsk/meson.build
index d9cb63f1ec..07b2d05955 100644
--- a/testsuite/gsk/meson.build
+++ b/testsuite/gsk/meson.build
@@ -101,6 +101,7 @@ foreach renderer : renderers
                   join_paths(meson.current_source_dir(), 'compare', test + '.png')],
            env: [
                   'GSK_RENDERER=' + renderer[0],
+                  'GTK_TEST_ACCESSIBLE=1',
                   'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
                   'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
                 ],
@@ -178,6 +179,7 @@ foreach test : node_parser_tests
                ],
          env: [
                 'GSK_RENDERER=opengl',
+                'GTK_TEST_ACCESSIBLE=1',
                 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
                 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
               ],
@@ -211,6 +213,7 @@ foreach t : tests
        protocol: 'tap',
        env: [
               'GSK_RENDERER=cairo',
+              'GTK_TEST_ACCESSIBLE=1',
               'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
               'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
             ],
diff --git a/testsuite/gtk/meson.build b/testsuite/gtk/meson.build
index 11509fa5bc..6b973c1d9b 100644
--- a/testsuite/gtk/meson.build
+++ b/testsuite/gtk/meson.build
@@ -146,6 +146,15 @@ is_debug = get_option('buildtype').startswith('debug')
 
 test_cargs = []
 
+test_env = environment()
+test_env.set('GTK_TEST_ACCESSIBLE', '1')
+test_env.set('GSK_RENDERER', 'cairo')
+test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
+test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
+test_env.set('GIO_USE_VFS', 'local')
+test_env.set('GSETTINGS_BACKEND', 'memory')
+test_env.set('G_ENABLE_DIAGNOSTIC', '0')
+
 if os_unix
   # tests += [['defaultvalue']]  # disabled in Makefile.am as well
   test_cargs += ['-DHAVE_UNIX_PRINT_WIDGETS']
@@ -182,11 +191,7 @@ foreach t : tests
        args: [ '--tap', '-k' ],
        protocol: 'tap',
        timeout: test_timeout,
-       env: [
-              'GSK_RENDERER=cairo',
-              'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
-              'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
-            ],
+       env: test_env,
        suite: ['gtk'] + test_extra_suites,
        should_fail: expect_fail,
   )
@@ -203,10 +208,7 @@ if add_languages('cpp', required: false)
   test('c++ keywords', test_exe,
        args: [ '--tap', '-k' ],
        #protocol: 'tap',
-       env: [
-              'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
-              'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
-            ],
+       env: test_env,
        suite: 'gtk')
   if get_option('install-tests')
     conf = configuration_data()
@@ -254,10 +256,7 @@ foreach test : focus_chain_tests
   test(test[0] + ' ' + test[1], focus_chain,
        args: [ join_paths(meson.current_source_dir(), 'focus-chain', test[0] + '.ui'),
                join_paths(meson.current_source_dir(), 'focus-chain', test[0] + '.' + test[1]) ],
-       env: [
-              'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
-              'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
-             ],
+       env: test_env,
        suite: [ 'gtk', 'focus' ])
 endforeach
 
@@ -282,14 +281,17 @@ endif
 
 if false and get_option ('profiler')
 
+  performance_env = test_env
+  performance_env.set('GTK_THEME', 'Empty')
+
   test('performance-layout', test_performance,
        args: [ '--mark', 'size allocation', join_paths(meson.current_build_dir(), 
'../../demos/widget-factory/gtk4-widget-factory') ],
-       env: [ 'GTK_THEME=Empty' ],
+       env: performance_env,
        suite: [ 'gtk' ])
 
   test('performance-snapshot', test_performance,
        args: [ '--mark', 'widget snapshot', join_paths(meson.current_build_dir(), 
'../../demos/widget-factory/gtk4-widget-factory') ],
-       env: [ 'GTK_THEME=Empty' ],
+       env: performance_end,
        suite: [ 'gtk' ])
 
 endif
diff --git a/testsuite/reftests/meson.build b/testsuite/reftests/meson.build
index 0e8bdbc16e..da1edd67c8 100644
--- a/testsuite/reftests/meson.build
+++ b/testsuite/reftests/meson.build
@@ -450,6 +450,16 @@ xfails = [
   'label-sizing.ui',
 ]
 
+reftest_env = environment()
+reftest_env.set('GTK_TEST_ACCESSIBLE', '1')
+reftest_env.set('GSK_RENDERER', 'opengl')
+reftest_env.set('G_TEST_SRCDIR', meson.current_source_dir())
+reftest_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
+reftest_env.set('GIO_USE_VFS', 'local')
+reftest_env.set('GSETTINGS_BACKEND', 'memory')
+reftest_env.set('G_ENABLE_DIAGNOSTIC', '0')
+reftest_env.set('REFTEST_MODULE_DIR', meson.current_build_dir())
+
 foreach testname : testdata
   if testname.endswith('.ui') and not testname.endswith('.ref.ui')
     test('reftest ' + testname, gtk_reftest,
@@ -459,12 +469,7 @@ foreach testname : testdata
                  join_paths(meson.current_source_dir(), testname),
          ],
          protocol: 'tap',
-         env: [
-                'GSK_RENDERER=opengl',
-                'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
-                'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
-                'REFTEST_MODULE_DIR=@0@'.format(meson.current_build_dir())
-              ],
+         env: reftest_env,
          suite: 'reftest',
          should_fail: xfails.contains(testname))
   endif
diff --git a/testsuite/tools/meson.build b/testsuite/tools/meson.build
index 85fc54aac4..1369ccfedc 100644
--- a/testsuite/tools/meson.build
+++ b/testsuite/tools/meson.build
@@ -23,6 +23,7 @@ if bash.found()
          env: [
                 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
                 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
+                'GTK_TEST_ACCESSIBLE=1',
                 'GTK_BUILDER_TOOL=@0@'.format(get_variable('gtk4_builder_tool').full_path()),
                 'GTK_QUERY_SETTINGS=@0@'.format(get_variable('gtk4_query_settings').full_path())
               ],


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