tests/stacking: Test stacking order with raise-on-click = false
Makes sure the focus changes but the stacking stays the same. Also checks that the stacking and focus on a workspace stays the same when changing between them. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2748>
This commit is contained in:
parent
f6d96a6118
commit
1920d55ef9
@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
#define G_SETTINGS_ENABLE_BACKEND
|
||||||
|
#include <gio/gsettingsbackend.h>
|
||||||
|
|
||||||
#include "core/meta-context-private.h"
|
#include "core/meta-context-private.h"
|
||||||
#include "tests/meta-backend-test.h"
|
#include "tests/meta-backend-test.h"
|
||||||
@ -59,6 +61,18 @@ struct _MetaContextTestClass
|
|||||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaContextTest, meta_context_test,
|
G_DEFINE_TYPE_WITH_PRIVATE (MetaContextTest, meta_context_test,
|
||||||
META_TYPE_CONTEXT)
|
META_TYPE_CONTEXT)
|
||||||
|
|
||||||
|
static void
|
||||||
|
ensure_gsettings_memory_backend (void)
|
||||||
|
{
|
||||||
|
g_autoptr (GSettingsBackend) memory_backend = NULL;
|
||||||
|
GSettingsBackend *default_backend;
|
||||||
|
|
||||||
|
memory_backend = g_memory_settings_backend_new ();
|
||||||
|
default_backend = g_settings_backend_get_default ();
|
||||||
|
g_assert_true (G_TYPE_FROM_INSTANCE (memory_backend) ==
|
||||||
|
G_TYPE_FROM_INSTANCE (default_backend));
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
meta_context_test_configure (MetaContext *context,
|
meta_context_test_configure (MetaContext *context,
|
||||||
int *argc,
|
int *argc,
|
||||||
@ -92,6 +106,8 @@ meta_context_test_configure (MetaContext *context,
|
|||||||
plugin_name = "libdefault";
|
plugin_name = "libdefault";
|
||||||
meta_context_set_plugin_name (context, plugin_name);
|
meta_context_set_plugin_name (context, plugin_name);
|
||||||
|
|
||||||
|
ensure_gsettings_memory_backend ();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
resize_monitor primary 800 600
|
resize_monitor primary 800 600
|
||||||
|
|
||||||
|
num_workspaces 2
|
||||||
|
|
||||||
new_client w wayland
|
new_client w wayland
|
||||||
|
|
||||||
create w/1 csd
|
create w/1 csd
|
||||||
@ -25,9 +27,38 @@ assert_size w/1 100 100
|
|||||||
assert_position w/2 100 0
|
assert_position w/2 100 0
|
||||||
assert_size w/2 100 100
|
assert_size w/2 100 100
|
||||||
|
|
||||||
|
# click on window w/1 and check that it gets focused and raised
|
||||||
move_cursor_to 50 50
|
move_cursor_to 50 50
|
||||||
click
|
click
|
||||||
wait
|
wait
|
||||||
|
|
||||||
assert_stacking w/2 w/1
|
assert_stacking w/2 w/1
|
||||||
assert_focused w/1
|
assert_focused w/1
|
||||||
|
|
||||||
|
# click on window w/2 and check that it gets focused but not raised
|
||||||
|
# when raise-on-click false is false
|
||||||
|
set_pref raise-on-click false
|
||||||
|
|
||||||
|
move_cursor_to 150 50
|
||||||
|
click
|
||||||
|
wait
|
||||||
|
|
||||||
|
assert_stacking w/2 w/1
|
||||||
|
assert_focused w/2
|
||||||
|
|
||||||
|
# Change to another workspace, create a window with focus, change back to the
|
||||||
|
# original workspace and make sure the focus for that workspace didn't change
|
||||||
|
activate_workspace 1
|
||||||
|
wait
|
||||||
|
|
||||||
|
create w/3 csd
|
||||||
|
resize w/3 100 100
|
||||||
|
show w/3
|
||||||
|
|
||||||
|
wait_reconfigure
|
||||||
|
|
||||||
|
activate_workspace 0
|
||||||
|
wait
|
||||||
|
|
||||||
|
assert_stacking_workspace 0 w/2 w/1
|
||||||
|
assert_focused w/2
|
||||||
|
@ -1203,6 +1203,32 @@ test_case_do (TestCase *test,
|
|||||||
CLUTTER_BUTTON_STATE_RELEASED);
|
CLUTTER_BUTTON_STATE_RELEASED);
|
||||||
meta_flush_input (test->context);
|
meta_flush_input (test->context);
|
||||||
}
|
}
|
||||||
|
else if (strcmp (argv[0], "set_pref") == 0)
|
||||||
|
{
|
||||||
|
GSettings *settings;
|
||||||
|
|
||||||
|
if (argc != 3)
|
||||||
|
BAD_COMMAND("usage: %s <KEY> <VALUE>", argv[0]);
|
||||||
|
|
||||||
|
settings = g_settings_new ("org.gnome.desktop.wm.preferences");
|
||||||
|
g_assert_nonnull (settings);
|
||||||
|
|
||||||
|
if (strcmp (argv[1], "raise-on-click") == 0)
|
||||||
|
{
|
||||||
|
gboolean value;
|
||||||
|
if (g_ascii_strcasecmp (argv[2], "true") == 0)
|
||||||
|
value = TRUE;
|
||||||
|
else if (g_ascii_strcasecmp (argv[2], "false") == 0)
|
||||||
|
value = FALSE;
|
||||||
|
else
|
||||||
|
BAD_COMMAND("usage: %s %s [true|false]", argv[0], argv[1]);
|
||||||
|
|
||||||
|
g_assert_true (g_settings_set_boolean (settings, "raise-on-click", value));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
BAD_COMMAND("Unknown preference %s", argv[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BAD_COMMAND("Unknown command %s", argv[0]);
|
BAD_COMMAND("Unknown command %s", argv[0]);
|
||||||
|
Loading…
Reference in New Issue
Block a user