From aa7653bed7e1885c1e98d4001bc7c43f3935a336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 3 Aug 2022 23:10:00 +0200 Subject: [PATCH] tests: Test hotplugs when having unmapped Wayland window This checks that an unmapped but created Wayland window correctly handle monitor changes. This is specifically added to test an edge case causing a crash with the following backtrace: ``` ... 4) 0x00007ffff78a2a6b in g_assertion_message_expr () 5) 0x00007ffff7defd5b in meta_window_update_for_monitors_changed () at ../src/core/window.c:3745 6) 0x00007ffff7899758 in g_slist_foreach () at ../glib/gslist.c:885 7) 0x00007ffff7dbe562 in meta_display_foreach_window () at ../src/core/display.c:3185 8) 0x00007ffff7dbe5fd in on_monitors_changed_internal () at ../src/core/display.c:3210 9) 0x00007ffff796f4ff in g_closure_invoke () at ../gobject/gclosure.c:830 10) 0x00007ffff7981316 in signal_emit_unlocked_R () at ../gobject/gsignal.c:3740 11) 0x00007ffff7987699 in g_signal_emit_valist () at ../gobject/gsignal.c:3495 12) 0x00007ffff7987bc2 in g_signal_emit () at ../gobject/gsignal.c:3551 13) 0x00007ffff7d89915 in meta_monitor_manager_notify_monitors_changed () at ../src/backends/meta-monitor-manager.c:3517 ... ``` Part-of: --- src/tests/meson.build | 1 + src/tests/stacking/map-on-hotplug.metatest | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/tests/stacking/map-on-hotplug.metatest diff --git a/src/tests/meson.build b/src/tests/meson.build index cbd223129..127aa52b8 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -408,6 +408,7 @@ stacking_tests = [ 'modals', 'map-fixed-size', 'client-resize-respect-constraints', + 'map-on-hotplug', ] foreach stacking_test: stacking_tests diff --git a/src/tests/stacking/map-on-hotplug.metatest b/src/tests/stacking/map-on-hotplug.metatest new file mode 100644 index 000000000..664ae21f1 --- /dev/null +++ b/src/tests/stacking/map-on-hotplug.metatest @@ -0,0 +1,20 @@ +# Test that monitor hotplugs with unmapped windows are handled + +new_client w wayland + +create w/1 csd +freeze w/1 +resize w/1 100 200 +show w/1 async + +resize_monitor primary 1024 768 + +wait + +thaw w/1 +wait +sync_shown w/1 +assert_stacking w/1 +assert_size w/1 100 200 + +destroy w/1