[gtk/better-test-isolation-2: 1/6] Don't use xsettings or xft defaults in testsuite
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/better-test-isolation-2: 1/6] Don't use xsettings or xft defaults in testsuite
- Date: Thu, 6 Feb 2020 04:05:46 +0000 (UTC)
commit a3be0ec5f0af5e78540dfecfc95cdedc31b91b56
Author: Alexander Larsson <alexl redhat com>
Date: Mon Feb 3 15:11:35 2020 +0100
Don't use xsettings or xft defaults in testsuite
This adds a GDK_DEBUG=default-settings flag which disables reads
from xsettings and Xft resources, and enables this for the testsuite.
This is one less way to get different testresults depending on the
environment. In particular, it was failing the css tests for me
due to getting the wrong font size because i have a different dpi.
gdk/gdk.c | 3 ++-
gdk/gdkinternals.h | 3 ++-
gdk/x11/gdkxftdefaults.c | 35 +++++++++++++++++++++++------------
gdk/x11/xsettings-client.c | 3 ++-
testsuite/a11y/meson.build | 1 +
testsuite/css/change/meson.build | 1 +
testsuite/css/meson.build | 2 ++
testsuite/css/nodes/meson.build | 1 +
testsuite/css/parser/meson.build | 1 +
testsuite/css/style/meson.build | 1 +
testsuite/gdk/meson.build | 1 +
testsuite/gsk/meson.build | 3 +++
testsuite/gtk/meson.build | 3 +++
testsuite/reftests/meson.build | 1 +
testsuite/tools/meson.build | 1 +
15 files changed, 45 insertions(+), 15 deletions(-)
---
diff --git a/gdk/gdk.c b/gdk/gdk.c
index ae456dc3e2..375f711e79 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -148,7 +148,8 @@ static const GDebugKey gdk_debug_keys[] = {
{ "gl-gles", GDK_DEBUG_GL_GLES },
{ "gl-debug", GDK_DEBUG_GL_DEBUG },
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE },
- { "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE }
+ { "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE },
+ { "default-settings",GDK_DEBUG_DEFAULT_SETTINGS },
};
#endif
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 12abe1186d..579f0a755a 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -63,7 +63,8 @@ typedef enum {
GDK_DEBUG_GL_GLES = 1 << 16,
GDK_DEBUG_GL_DEBUG = 1 << 17,
GDK_DEBUG_VULKAN_DISABLE = 1 << 18,
- GDK_DEBUG_VULKAN_VALIDATE = 1 << 19
+ GDK_DEBUG_VULKAN_VALIDATE = 1 << 19,
+ GDK_DEBUG_DEFAULT_SETTINGS= 1 << 20
} GdkDebugFlags;
extern guint _gdk_debug_flags;
diff --git a/gdk/x11/gdkxftdefaults.c b/gdk/x11/gdkxftdefaults.c
index cb6c8be2ae..68b5f7d138 100644
--- a/gdk/x11/gdkxftdefaults.c
+++ b/gdk/x11/gdkxftdefaults.c
@@ -81,13 +81,17 @@ parse_boolean (char *v)
}
static gboolean
-get_boolean_default (Display *dpy,
+get_boolean_default (GdkX11Screen *x11_screen,
const gchar *option,
gboolean *value)
{
+ Display *dpy = GDK_SCREEN_XDISPLAY (x11_screen);
gchar *v;
gint i;
-
+
+ if (GDK_DISPLAY_DEBUG_CHECK (GDK_SCREEN_DISPLAY (x11_screen), DEFAULT_SETTINGS))
+ return FALSE;
+
v = XGetDefault (dpy, "Xft", option);
if (v)
{
@@ -103,12 +107,16 @@ get_boolean_default (Display *dpy,
}
static gboolean
-get_double_default (Display *dpy,
+get_double_default (GdkX11Screen *x11_screen,
const gchar *option,
gdouble *value)
{
+ Display *dpy = GDK_SCREEN_XDISPLAY (x11_screen);
gchar *v, *e;
-
+
+ if (GDK_DISPLAY_DEBUG_CHECK (GDK_SCREEN_DISPLAY (x11_screen), DEFAULT_SETTINGS))
+ return FALSE;
+
v = XGetDefault (dpy, "Xft", option);
if (v)
{
@@ -126,12 +134,16 @@ get_double_default (Display *dpy,
}
static gboolean
-get_integer_default (Display *dpy,
+get_integer_default (GdkX11Screen *x11_screen,
const gchar *option,
gint *value)
{
+ Display *dpy = GDK_SCREEN_XDISPLAY (x11_screen);
gchar *v, *e;
-
+
+ if (GDK_DISPLAY_DEBUG_CHECK (GDK_SCREEN_DISPLAY (x11_screen), DEFAULT_SETTINGS))
+ return FALSE;
+
v = XGetDefault (dpy, "Xft", option);
if (v)
{
@@ -149,7 +161,6 @@ get_integer_default (Display *dpy,
static void
init_xft_settings (GdkX11Screen *x11_screen)
{
- Display *xdisplay = GDK_SCREEN_XDISPLAY (x11_screen);
double dpi_double;
gboolean b;
@@ -158,21 +169,21 @@ init_xft_settings (GdkX11Screen *x11_screen)
x11_screen->xft_init = TRUE;
- if (!get_boolean_default (xdisplay, "antialias", &b))
+ if (!get_boolean_default (x11_screen, "antialias", &b))
b = TRUE;
x11_screen->xft_antialias = b;
- if (!get_boolean_default (xdisplay, "hinting", &b))
+ if (!get_boolean_default (x11_screen, "hinting", &b))
b = TRUE;
x11_screen->xft_hinting = b;
- if (!get_integer_default (xdisplay, "hintstyle", &x11_screen->xft_hintstyle))
+ if (!get_integer_default (x11_screen, "hintstyle", &x11_screen->xft_hintstyle))
x11_screen->xft_hintstyle = FC_HINT_MEDIUM;
- if (!get_integer_default (xdisplay, "rgba", &x11_screen->xft_rgba))
+ if (!get_integer_default (x11_screen, "rgba", &x11_screen->xft_rgba))
x11_screen->xft_rgba = FC_RGBA_UNKNOWN;
- if (!get_double_default (xdisplay, "dpi", &dpi_double))
+ if (!get_double_default (x11_screen, "dpi", &dpi_double))
dpi_double = 96.0;
x11_screen->xft_dpi = (int)(0.5 + PANGO_SCALE * dpi_double);
diff --git a/gdk/x11/xsettings-client.c b/gdk/x11/xsettings-client.c
index 8c309c9227..d43d06a0e5 100644
--- a/gdk/x11/xsettings-client.c
+++ b/gdk/x11/xsettings-client.c
@@ -489,7 +489,8 @@ check_manager_window (GdkX11Screen *x11_screen,
gdk_x11_display_grab (display);
- x11_screen->xsettings_manager_window = XGetSelectionOwner (xdisplay, get_selection_atom (x11_screen));
+ if (!GDK_DISPLAY_DEBUG_CHECK (display, DEFAULT_SETTINGS))
+ x11_screen->xsettings_manager_window = XGetSelectionOwner (xdisplay, get_selection_atom (x11_screen));
if (x11_screen->xsettings_manager_window != 0)
XSelectInput (xdisplay,
diff --git a/testsuite/a11y/meson.build b/testsuite/a11y/meson.build
index 01fab478fd..6df0b25b2f 100644
--- a/testsuite/a11y/meson.build
+++ b/testsuite/a11y/meson.build
@@ -56,6 +56,7 @@ foreach t: a11y_state_tests
env: [
'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
+ 'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
diff --git a/testsuite/css/change/meson.build b/testsuite/css/change/meson.build
index 59a2562710..3637a244a8 100644
--- a/testsuite/css/change/meson.build
+++ b/testsuite/css/change/meson.build
@@ -12,6 +12,7 @@ test('change', test_change,
args: [ '--tap', '-k' ],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
+ 'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
diff --git a/testsuite/css/meson.build b/testsuite/css/meson.build
index 00f54efb2c..237f4732d2 100644
--- a/testsuite/css/meson.build
+++ b/testsuite/css/meson.build
@@ -14,6 +14,7 @@ test('api', test_api,
args: ['--tap', '-k' ],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
+ 'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
@@ -30,6 +31,7 @@ test('data', test_data,
args: ['--tap', '-k' ],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
+ 'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
diff --git a/testsuite/css/nodes/meson.build b/testsuite/css/nodes/meson.build
index 984cca6047..42e7b215dc 100644
--- a/testsuite/css/nodes/meson.build
+++ b/testsuite/css/nodes/meson.build
@@ -9,6 +9,7 @@ test('nodes', test_nodes,
args: [ '--tap', '-k' ],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
+ 'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
diff --git a/testsuite/css/parser/meson.build b/testsuite/css/parser/meson.build
index 607faab0bb..1c83d3863d 100644
--- a/testsuite/css/parser/meson.build
+++ b/testsuite/css/parser/meson.build
@@ -464,6 +464,7 @@ foreach testname : test_data
],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
+ 'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
diff --git a/testsuite/css/style/meson.build b/testsuite/css/style/meson.build
index 3198b85c05..4f4921e946 100644
--- a/testsuite/css/style/meson.build
+++ b/testsuite/css/style/meson.build
@@ -19,6 +19,7 @@ test('style', test_style,
args: [ '--tap', '-k' ],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
+ 'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
diff --git a/testsuite/gdk/meson.build b/testsuite/gdk/meson.build
index d7049af572..36d424ebe1 100644
--- a/testsuite/gdk/meson.build
+++ b/testsuite/gdk/meson.build
@@ -22,6 +22,7 @@ foreach t : tests
args: [ '--tap', '-k' ],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
+ 'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
diff --git a/testsuite/gsk/meson.build b/testsuite/gsk/meson.build
index bee40fd32e..f303dd5f79 100644
--- a/testsuite/gsk/meson.build
+++ b/testsuite/gsk/meson.build
@@ -91,6 +91,7 @@ foreach renderer : renderers
join_paths(meson.current_source_dir(), 'compare', test + '.png')],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
+ 'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
@@ -171,6 +172,7 @@ foreach test : node_parser_tests
],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
+ 'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
@@ -204,6 +206,7 @@ foreach t : tests
args: [ '--tap', '-k' ],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
+ 'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'GSK_RENDERER=cairo',
diff --git a/testsuite/gtk/meson.build b/testsuite/gtk/meson.build
index e721ceaf49..7a029d4f11 100644
--- a/testsuite/gtk/meson.build
+++ b/testsuite/gtk/meson.build
@@ -95,6 +95,7 @@ foreach t : tests
args: [ '--tap', '-k' ],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
+ 'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'GSK_RENDERER=cairo',
@@ -117,6 +118,7 @@ if add_languages('cpp', required: false)
args: [ '--tap', '-k' ],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
+ 'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
@@ -159,6 +161,7 @@ foreach test : focus_chain_tests
join_paths(meson.current_source_dir(), 'focus-chain', test[0] + '.' + test[1]) ],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
+ 'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
diff --git a/testsuite/reftests/meson.build b/testsuite/reftests/meson.build
index 9a9845ee1c..71080d6f32 100644
--- a/testsuite/reftests/meson.build
+++ b/testsuite/reftests/meson.build
@@ -445,6 +445,7 @@ foreach testname : testdata
'GSETTINGS_BACKEND=memory',
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
'GTK_CSD=1',
+ 'GDK_DEBUG=default-settings',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
diff --git a/testsuite/tools/meson.build b/testsuite/tools/meson.build
index 4e6a605056..1364a98679 100644
--- a/testsuite/tools/meson.build
+++ b/testsuite/tools/meson.build
@@ -21,6 +21,7 @@ if bash.found()
workdir: meson.current_build_dir(),
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
+ 'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]