summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/daemon.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/test/daemon.py b/test/daemon.py
index 06458ff4..5603131d 100644
--- a/test/daemon.py
+++ b/test/daemon.py
@@ -2309,6 +2309,23 @@ def client_resize_real(binary, gui_binary):
state = drift('state')['Ok']['State']
return next((w for w in state['windows'] if w.get('pid') == pid), None)
+ def away(pid, x, y):
+ """The window moved far from the desktop user's view, and kept
+ there: driftwm places a window again when it maps, after a move made
+ before (it came back beside the user's view, 2026-11-24)."""
+ wid = window_of(pid)['id']
+ still = 0
+ for _ in range(300):
+ if window_of(pid)['position'] != [x, y]:
+ drift('move', '--id', wid, x, y)
+ still = 0
+ else:
+ still += 1
+ if still == 40:
+ return wid
+ time.sleep(0.05)
+ raise AssertionError(('a test window would not stay away from the desktop user\'s view', window_of(pid)))
+
scratch = Path(__file__).resolve().parent.parent.parent / '.scratch' / 'daemon' / 'dmn'
scratch.mkdir(parents=True, exist_ok=True)
root = Path(tempfile.mkdtemp(prefix='cr-', dir=os.environ.get('TMPDIR') or scratch))
@@ -2333,8 +2350,8 @@ def client_resize_real(binary, gui_binary):
cwd=root, stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=open(root / 's.err', 'w'),
start_new_session=True)
started.append(sess.pid)
- sid = wait_for('the session\'s window', lambda: (window_of(sess.pid) or {}).get('id'), timeout=30)
- drift('move', '--id', sid, 59400, -18000)
+ wait_for('the session\'s window', lambda: (window_of(sess.pid) or {}).get('id'), timeout=30)
+ away(sess.pid, 59400, -18000)
if focused is not None:
drift('focus', '--id', focused)
sock = root / 'pardes-replica.sock'
@@ -2357,9 +2374,9 @@ def client_resize_real(binary, gui_binary):
PARDES_REPLICA_STATS=str(stats), SDL_EVENT_LOGGING='2'),
cwd=root, stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=open(err, 'w'), start_new_session=True)
started.append(w.pid)
- wid = wait_for('the client\'s window', lambda: (window_of(w.pid) or {}).get('id'), timeout=30)
+ wait_for('the client\'s window', lambda: (window_of(w.pid) or {}).get('id'), timeout=30)
# Far from where the desktop's user looks, the focus given back.
- drift('move', '--id', wid, 62000, -18000)
+ wid = away(w.pid, 62000, -18000)
if focused is not None:
drift('focus', '--id', focused)
time.sleep(3)
@@ -2376,7 +2393,8 @@ def client_resize_real(binary, gui_binary):
w.wait(timeout=15)
line = checks(stats)[-1].split() if checks(stats) else []
sent = int(line[line.index('inputs') + 1]) if 'inputs' in line else -1
- asserted = said.count('Assertion failure')
+ # SDL's default handler's words, and pardes's own (gui.zig sdlAssertion).
+ asserted = said.count('Assertion failure') + said.count('SDL assertion: ')
# A pointer that crossed the window (one sliding under it as it was
# moved away) is motion's, --client-motion's: not counted here.
motions = said.count('SDL_EVENT_MOUSE_MOTION')