diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-29 17:48:21 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-29 19:38:53 -0300 |
| commit | 3a5db21504a653cc5e97b98edad59a6262a3b8e9 (patch) | |
| tree | dd07f6e0d77c22623832ca549e2fbdf176b55c01 /test | |
| parent | 2cce341e2c94fb3150dc1f3e7911c26502a70487 (diff) | |
| download | pardes-3a5db21504a653cc5e97b98edad59a6262a3b8e9.tar.gz pardes-3a5db21504a653cc5e97b98edad59a6262a3b8e9.zip | |
views: a view drawn while another is live takes no post_present (its acknowledgement moved the live session's pointer and hover, and a replica that draws nothing applied it to another view); daemon.py attaches a second terminal and a second window beside the first; views-term.snap pins a terminal shown at two sizes
Found by `pardes-monkey --views=3 --tape`: 4 of 6 seeds diverged at acknowledge_panel_presentation inside the pump, the recording having moved the look-hover of the view it drew and the headless replica that of the live one. A view's panels are acknowledged when it is live and drawn. With it, 6 of 6 seeds replay in all three replicas.
test/daemon.py: with the first terminal attached, a second `pardes --attach` gets a view of its own; both are drawn (a line run in the shell shows in each), then it is detached from inside (its stub ends 0, the first draws on) and, again, its terminal closed outright; fds of the session and the daemon level. --gui: a second `pardes-gui --attach` while the window is open opens another (its captures under view-1), and Detach closes only it. views-term.snap: a terminal typed into from the big view is sized for it and shown at that size in the small one, then the other way round. ponytail noted at Pardes.sizes: a view smaller than the terminal shows its top rows.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test')
| -rw-r--r-- | test/daemon.py | 19 | ||||
| -rw-r--r-- | test/snapshots/views-term.golden | 46 | ||||
| -rw-r--r-- | test/snapshots/views-term.snap | 27 |
3 files changed, 89 insertions, 3 deletions
diff --git a/test/daemon.py b/test/daemon.py index 04455f0f..41cfbaf7 100644 --- a/test/daemon.py +++ b/test/daemon.py @@ -212,11 +212,13 @@ def main(binary, cycles): # (src/views.zig), drawn beside the first. Detached from inside, its # stub ends and the first draws on; closed outright, the same. for how in ('detach', 'close'): - term2 = Term(20, 60) + # Bigger than the first: the shell, sized for the first (its + # last typist), shows whole in it. + term2 = Term(40, 120) stub2 = term2.spawn([binary, '--attach=work'], env) started.append(stub2.pid) wait_for('the second terminal\'s first frame', lambda: b'\x1b[?1049h' in term2.text()) - wait_for('the second terminal\'s view live', lambda: client.screen()['cols'] == 60) + wait_for('the second terminal\'s view live', lambda: client.screen()['cols'] == 120) seen = len(term.text()) run(client, shell, f'echo both-drawn-{how}\n'.encode()) wait_for('the first terminal drawn', lambda: f'both-drawn-{how}'.encode() in term.text()[seen:]) @@ -230,7 +232,7 @@ def main(binary, cycles): term2.close() else: term2.close() - assert stub2.wait(timeout=10) != 0 or True + stub2.wait(timeout=10) wait_for('the first terminal\'s view live again', lambda: client.screen()['cols'] == 100) seen = len(term.text()) run(client, shell, f'echo first-on-{how}\n'.encode()) @@ -359,6 +361,17 @@ def gui(binary, cycles): baseline = baseline or now assert now == baseline, (cycle, now, baseline) print(f'daemon: {cycles} window detach/attach cycles, fds/processes level: {baseline}') + # Attached already: another window, a view of its own (its test + # captures under view-1); Detach in it closes only it. + attach = subprocess.run([binary, '--attach=win'], env=env, cwd=root, timeout=10, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + assert attach.returncode == 0, attach.stderr + wait_for('the second window drawn', lambda: (root / 'caps' / 'view-1' / 'latest.ppm').exists()) + client.write(f'/pane/{shell}/exec', b'Detach\n') + time.sleep(.5) + assert not sized(client), 'the first window stays' + assert proc.poll() is None + print('daemon: a second window on an attached window session, detached alone') # Another kind is refused in words, and so is a name nobody has. client.write(f'/pane/{shell}/exec', b'Detach\n') wait_for('the window closed', lambda: sized(client)) diff --git a/test/snapshots/views-term.golden b/test/snapshots/views-term.golden new file mode 100644 index 00000000..d3cff726 --- /dev/null +++ b/test/snapshots/views-term.golden @@ -0,0 +1,46 @@ +== snap small grid=50x14 cursor=4,4 +| Newcol Joincol Find Grep Help Changelog Tutor Du +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/views-term/cwd Tty+bash Save Mo +| de Filter Collapse Del +| $ +| +| +| +| +| +| /tmp/pardes-snap/views-term/cwd/+New Save Tty Co +| llapse Del +| 1 +== snap big grid=80x24 cursor=4,5 +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/views-term/cwd Tty+bash Save Mode Filter Collapse Del +| $ echo from-the-big-one +| from-the-big-one +| $ +| +| +| +| +| +| +| +| +| +| +| +| /tmp/pardes-snap/views-term/cwd/+New Save Tty Collapse Del +| 1 +== snap small-sees grid=50x14 cursor=4,6 +|4: $ echo from-the-big-one +|5: from-the-big-one +|6: $ +== snap small-typed grid=50x14 cursor=4,8 +|6: $ echo from-the-small-one +|7: from-the-small-one +|8: $ +== snap big-sees grid=80x24 cursor=4,7 +|5: $ echo from-the-small-one +|6: from-the-small-one +|7: $ diff --git a/test/snapshots/views-term.snap b/test/snapshots/views-term.snap new file mode 100644 index 00000000..bbd1c368 --- /dev/null +++ b/test/snapshots/views-term.snap @@ -0,0 +1,27 @@ +# A terminal shown in two views at two sizes (src/views.zig): it takes the +# size of the view that typed into it last; the other shows it at that size. +config Verbose off +start 24 80 views=2 +wait 8000 $ +stable 700 20000 +view 2 +resize 14 50 +stable 500 10000 +snap small +# Typed in the big view: sized for it, shown so in the small one. +view 1 +text echo from-the-big-one +key enter +stable 500 10000 +snap big +view 2 +stable 500 10000 +snap small-sees +# Typed in the small view: sized for it now, the big one shows it so. +text echo from-the-small-one +key enter +stable 500 10000 +snap small-typed +view 1 +stable 500 10000 +snap big-sees |
