diff options
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 |
