[mutter/gnome-3-38] tests/stacking: Add test hiding a modal with a not shown parent
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-3-38] tests/stacking: Add test hiding a modal with a not shown parent
- Date: Fri, 18 Dec 2020 22:03:03 +0000 (UTC)
commit fbb9a34f265ddd12ab9996ef18e595fd95b2a92e
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Wed Dec 16 23:27:19 2020 +0100
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.
(cherry picked from commit c94d929332d9371646fde15668097c4ea136147c)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1650>
src/tests/meson.build | 1 +
src/tests/stacking/modals.metatest | 32 ++++++++++++++++++++++++++++++++
src/tests/test-client.c | 28 ++++++++++++++++++++++++++++
src/tests/test-runner.c | 14 +++++++++++---
4 files changed, 72 insertions(+), 3 deletions(-)
---
diff --git a/src/tests/meson.build b/src/tests/meson.build
index 77ab3b5d6d..1eab95f9a9 100644
--- a/src/tests/meson.build
+++ b/src/tests/meson.build
@@ -168,6 +168,7 @@ stacking_tests = [
'fullscreen-maximize',
'restore-position',
'default-size',
+ 'modals',
]
foreach stacking_test: stacking_tests
diff --git a/src/tests/stacking/modals.metatest b/src/tests/stacking/modals.metatest
new file mode 100644
index 0000000000..6c76eadf8d
--- /dev/null
+++ b/src/tests/stacking/modals.metatest
@@ -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
diff --git a/src/tests/test-client.c b/src/tests/test-client.c
index 81ce51ab63..9c2f17863a 100644
--- a/src/tests/test-client.c
+++ b/src/tests/test-client.c
@@ -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;
diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c
index 1a5ccd944a..65fa546825 100644
--- a/src/tests/test-runner.c
+++ b/src/tests/test-runner.c
@@ -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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]