summaryrefslogtreecommitdiff
path: root/test/daemon.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/daemon.py')
-rw-r--r--test/daemon.py19
1 files changed, 16 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))