smoke tests: gate on surface map / painted frame before capture

Two more tests had the same latent race fixed for
test_standalone_headless_virtual_pointer_motion_click: injecting an
end-to-end capture too soon after wait_any_active/[claim], when the
surface may not be mapped/composited yet, so the event/capture is
silently lost under load.

- test_touch_delivery_to_client: dropped its time.sleep(1.0) and now
  waits on wait_surface_mapped(0) before the touch down/motion/up, so a
  pick never races surface mapping.
- test_standalone_headless_output_power_blank: waits on
  wait_active_frame() before the baseline screencopy, so the ',content'
  assert never sees the pre-map black placeholder.
This commit is contained in:
Andrew Hamilton 2026-09-04 12:27:41 +10:00
parent 7194e59e8c
commit 9d1e3e802c

View file

@ -3476,7 +3476,13 @@ def test_touch_delivery_to_client():
[f"{WL} --touch-log {logf} '#306090'"])
try:
s.wait_for(r"\[claim\] app=0", timeout=15)
time.sleep(1.0) # client mapped; surface ready for picks
# Wait until the surface has actually mapped: [claim] only means
# the client connected/compositor claimed it, before its Wayland
# surface is necessarily mapped. A touch pick landing before the
# surface maps finds nothing and the down/motion/up are silently
# dropped -- the load-sensitive race this closes (see
# wait_surface_mapped).
s.wait_surface_mapped(0)
s.touch(7, TOUCH_DOWN, 300, 300)
s.touch(7, TOUCH_MOTION, 340, 340)
s.touch(7, TOUCH_UP, 340, 340)
@ -4060,6 +4066,11 @@ def test_standalone_headless_output_power_blank(tmp_path):
{}, "%s --app-id testwin '#ff0000' 320x240" % WL)
try:
s.wait_any_active()
# Wait until the window has actually composited a frame: wait_any_active
# only means the window object exists, but the baseline screencopy needs
# client content on screen (not the pre-map black placeholder) to pass
# the .",content" assert.
s.wait_active_frame()
# Baseline: the red window is visible.
text = _oneshot_sc(s.socket, sc_out)
assert ",content" in text, \