mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
tests/stacking: Add test hiding a modal with a not shown parent
This adds a test case for https://gitlab.gnome.org/GNOME/mutter/-/issues/862 that checks that hiding a dialog where its parent is not yet shown doesn't trigger any asserts or crashes. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1643>
This commit is contained in:
parent
76d1a64204
commit
c94d929332
@ -179,6 +179,7 @@ stacking_tests = [
|
||||
'fullscreen-maximize',
|
||||
'restore-position',
|
||||
'default-size',
|
||||
'modals',
|
||||
]
|
||||
|
||||
foreach stacking_test: stacking_tests
|
||||
|
32
src/tests/stacking/modals.metatest
Normal file
32
src/tests/stacking/modals.metatest
Normal file
@ -0,0 +1,32 @@
|
||||
new_client w wayland
|
||||
|
||||
# Create two Wayland windows, and make the second a transient of the
|
||||
# first. Then make the parent not actually ever show, but show the
|
||||
# transient.
|
||||
|
||||
# Then make sure that hiding the transient can hide without causing
|
||||
# issues.
|
||||
|
||||
# https://gitlab.gnome.org/GNOME/mutter/-/issues/862
|
||||
|
||||
create w/1 csd
|
||||
create w/2 csd
|
||||
|
||||
set_parent w/2 1
|
||||
|
||||
freeze w/1
|
||||
|
||||
show w/1 async
|
||||
show w/2
|
||||
|
||||
wait
|
||||
|
||||
assert_stacking w/1 w/2
|
||||
|
||||
hide w/2
|
||||
wait
|
||||
|
||||
assert_stacking w/1
|
||||
|
||||
hide w/2
|
||||
wait
|
@ -766,6 +766,34 @@ process_line (const char *line)
|
||||
|
||||
gtk_window_unfullscreen (GTK_WINDOW (window));
|
||||
}
|
||||
else if (strcmp (argv[0], "freeze") == 0)
|
||||
{
|
||||
if (argc != 2)
|
||||
{
|
||||
g_print ("usage: freeze <id>\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
GtkWidget *window = lookup_window (argv[1]);
|
||||
if (!window)
|
||||
goto out;
|
||||
|
||||
gdk_window_freeze_updates (gtk_widget_get_window (window));
|
||||
}
|
||||
else if (strcmp (argv[0], "thaw") == 0)
|
||||
{
|
||||
if (argc != 2)
|
||||
{
|
||||
g_print ("usage: thaw <id>\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
GtkWidget *window = lookup_window (argv[1]);
|
||||
if (!window)
|
||||
goto out;
|
||||
|
||||
gdk_window_thaw_updates (gtk_widget_get_window (window));
|
||||
}
|
||||
else if (strcmp (argv[0], "assert_size") == 0)
|
||||
{
|
||||
int expected_width;
|
||||
|
@ -561,8 +561,13 @@ test_case_do (TestCase *test,
|
||||
}
|
||||
else if (strcmp (argv[0], "show") == 0)
|
||||
{
|
||||
if (argc != 2)
|
||||
BAD_COMMAND("usage: %s <client-id>/<window-id>", argv[0]);
|
||||
gboolean show_async = FALSE;
|
||||
|
||||
if (argc != 2 && argc != 3)
|
||||
BAD_COMMAND("usage: %s <client-id>/<window-id> [async]", argv[0]);
|
||||
|
||||
if (argc == 3 && strcmp (argv[2], "async") == 0)
|
||||
show_async = TRUE;
|
||||
|
||||
TestClient *client;
|
||||
const char *window_id;
|
||||
@ -579,7 +584,8 @@ test_case_do (TestCase *test,
|
||||
if (!window)
|
||||
return FALSE;
|
||||
|
||||
test_client_wait_for_window_shown (client, window);
|
||||
if (!show_async)
|
||||
test_client_wait_for_window_shown (client, window);
|
||||
}
|
||||
else if (strcmp (argv[0], "resize") == 0)
|
||||
{
|
||||
@ -671,6 +677,8 @@ test_case_do (TestCase *test,
|
||||
strcmp (argv[0], "unmaximize") == 0 ||
|
||||
strcmp (argv[0], "fullscreen") == 0 ||
|
||||
strcmp (argv[0], "unfullscreen") == 0 ||
|
||||
strcmp (argv[0], "freeze") == 0 ||
|
||||
strcmp (argv[0], "thaw") == 0 ||
|
||||
strcmp (argv[0], "destroy") == 0)
|
||||
{
|
||||
if (argc != 2)
|
||||
|
Loading…
Reference in New Issue
Block a user