forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
4ab12ab755
commit
a3be0ec5f0
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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()),
|
||||
|
@ -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()),
|
||||
|
@ -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()),
|
||||
|
@ -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()),
|
||||
|
@ -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()),
|
||||
|
@ -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()),
|
||||
|
@ -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()),
|
||||
|
@ -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',
|
||||
|
@ -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()),
|
||||
|
@ -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()),
|
||||
|
@ -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()),
|
||||
|
Loading…
Reference in New Issue
Block a user