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.
This commit is contained in:
Emmanuele Bassi
2020-10-09 18:17:04 +01:00
parent e6c5d57ffe
commit 88113956a3
9 changed files with 83 additions and 69 deletions

View File

@@ -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',

View File

@@ -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

View File

@@ -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

View File

@@ -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