1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
|
#!/usr/bin/env python3
"""The two things that drive shaders: focus, and a drag in progress.
Both are derived from the current frame rather than attached and remembered,
so most of what is worth checking is that they turn *off* again — a pane left
grey by a path that forgot to clear it is the failure mode this design exists
to make impossible.
Colours are asserted through the style runs the snapshot already reports, so
these are real end-to-end checks: a program's output, composed, shaded, and
read back the way a client would see it.
"""
import sys
import tempfile
from harness import Session, check, report
# A pane that paints a known, non-default colour into its own content.
GREEN = "#00ff00"
SH = [
"/bin/sh",
"-c",
'printf "\\033]2;p\\007"; printf "\\033[38;2;0;255;0mBLOCK\\033[0m\\n"; '
"stty raw -echo; cat",
]
def cfg(text):
f = tempfile.NamedTemporaryFile("w", suffix=".kdl", delete=False)
f.write(text)
f.close()
return f.name
def unfocused_cfg(amount):
return "states {\n unfocused { dim amount=%d }\n}\n" % amount
def drag_cfg(chain):
"""Both drop states get the same chain, which is what the defaults do."""
return "states {\n drop_target { %s }\n drop_hover { %s }\n}\n" % (
chain,
chain,
)
def content_fg(snap, pane):
"""The colour of the pane's own first content cell."""
run = snap.style_at(pane["content_x"], pane["content_y"])
return (run or {}).get("fg")
def frame_fg(snap, pane):
run = snap.style_at(pane["x"], pane["y"])
return (run or {}).get("fg")
def check_at_rest(s, label):
"""Assert every pane looks the way it should with nothing transient going
on: the one you are in keeps its colour, the others are pushed back.
Stated as the rule rather than as "the same as before the drag", because a
drag *moves focus* -- press a title and that pane is yours -- so the two
panes legitimately swap appearances across one. Comparing to a remembered
snapshot said they had both changed, which was true and not the point."""
snap = s.snapshot()
for p in s.panes():
fg = content_fg(snap, p)
ok = fg == GREEN if p["focused"] else fg not in (GREEN, None)
check(
f"{label}: pane {p['id']} is at rest", ok, f"{fg} (focused={p['focused']})"
)
def split(s):
s.key("\\\\")
s.settle()
return s.panes()
def by_focus(s):
panes = s.panes()
focused = [p for p in panes if p["focused"]][0]
other = [p for p in panes if not p["focused"]][0]
return focused, other
def press(s, x, y):
s.send(rf"\e[<0;{x + 1};{y + 1}M")
# Drop-state hovers aim at the target's *centre*: since the drop zones (the
# edge bands that mean "insert beside") arrived, only the centre means the
# swap, and only there is the pane the drop_hover state -- a band hover is an
# ordinary candidate plus the zone's own fill, which would contaminate the
# colours these tests sample.
def motion(s, x, y):
s.send(rf"\e[<32;{x + 1};{y + 1}M")
def release(s, x, y):
s.send(rf"\e[<0;{x + 1};{y + 1}m")
# ---- the unfocused state ---------------------------------------------------
def test_the_default_dims_the_pane_you_are_not_in():
"""`dim_unfocused` writes the unfocused chain when a config has not, so out
of the box the pane you left is pushed back and the one you are in is not.
(This asserted the opposite until the knob existed to turn it off with.)"""
with Session(SH, cols=80, rows=14) as s:
s.until_text("BLOCK")
split(s)
focused, other = by_focus(s)
snap = s.snapshot()
check(
"the unfocused pane is dimmed",
content_fg(snap, other) not in (GREEN, None),
str(content_fg(snap, other)),
)
check(
"and the focused one is left alone",
content_fg(snap, focused) == GREEN,
str(content_fg(snap, focused)),
)
def test_nothing_is_dimmed_with_the_knob_at_zero():
with Session(SH, cols=80, rows=14, config=cfg("dim_unfocused 0\n")) as s:
s.until_text("BLOCK")
split(s)
focused, other = by_focus(s)
snap = s.snapshot()
check(
"neither pane is touched",
content_fg(snap, other) == GREEN and content_fg(snap, focused) == GREEN,
f"{content_fg(snap, other)} {content_fg(snap, focused)}",
)
def test_dims_everything_but_the_focused_pane():
with Session(SH, cols=80, rows=14, config=cfg(unfocused_cfg(128))) as s:
s.until_text("BLOCK")
split(s)
focused, other = by_focus(s)
snap = s.snapshot()
check(
"the focused pane keeps its colour",
content_fg(snap, focused) == GREEN,
str(content_fg(snap, focused)),
)
check(
"an unfocused pane is dimmed",
content_fg(snap, other) not in (GREEN, None),
str(content_fg(snap, other)),
)
check(
"dimmed means darker, not merely different",
int(content_fg(snap, other)[3:5], 16) < 0xFF,
str(content_fg(snap, other)),
)
def test_the_dimming_follows_focus():
with Session(SH, cols=80, rows=14, config=cfg(unfocused_cfg(128))) as s:
s.until_text("BLOCK")
split(s)
first_focused, first_other = by_focus(s)
s.api("focus", id=first_other["id"])
snap = s.snapshot()
now_focused = [p for p in s.panes() if p["id"] == first_other["id"]][0]
now_other = [p for p in s.panes() if p["id"] == first_focused["id"]][0]
check(
"the newly focused pane is undimmed",
content_fg(snap, now_focused) == GREEN,
str(content_fg(snap, now_focused)),
)
check(
"and the one that lost focus is dimmed now",
content_fg(snap, now_other) not in (GREEN, None),
str(content_fg(snap, now_other)),
)
def test_dimming_never_touches_the_chrome():
with Session(SH, cols=80, rows=14, config=cfg(unfocused_cfg(200))) as s:
s.until_text("BLOCK")
split(s)
_, other = by_focus(s)
snap = s.snapshot()
check(
"a dimmed pane's frame keeps its full colour",
frame_fg(snap, other) == "#45454a",
str(frame_fg(snap, other)),
)
# Find where the strip actually starts rather than assuming a column:
# status_pad decides that, and a test should not have an opinion on it.
strip = snap.line(1)
first = len(strip) - len(strip.lstrip())
check(
"and the tab strip is untouched",
"#" in str(snap.style_at(first, 1)),
f"col {first}: " + str(snap.style_at(first, 1)),
)
# ---- the drag states -------------------------------------------------------
def test_dragging_greys_the_other_panes():
with Session(SH, cols=90, rows=16) as s:
s.until_text("BLOCK")
left, right = split(s)
press(s, left["x"] + 4, left["y"])
motion(s, right["x"] + right["w"] // 2, right["y"] + right["h"] // 2)
snap = s.snapshot()
check(
"the pane being dragged keeps its colour",
content_fg(snap, left) == GREEN,
str(content_fg(snap, left)),
)
check(
"every other pane goes grey",
content_fg(snap, right) not in (GREEN, None),
str(content_fg(snap, right)),
)
# The default strength is 200, not 255: a partial desaturation that
# keeps a trace of the original hue. So the test is that the channels
# have converged, not that they are equal.
grey = content_fg(snap, right)
ch = [int(grey[i : i + 2], 16) for i in (1, 3, 5)]
check(
"the colour has collapsed towards grey",
max(ch) - min(ch) < 80,
f"{grey} spread={max(ch) - min(ch)}",
)
check(
"the two channels that started equal stay equal", ch[0] == ch[2], str(grey)
)
release(s, right["x"] + 5, right["y"] + 3)
check_at_rest(s, "after the drop")
def test_full_strength_is_a_true_grey():
with Session(
SH, cols=90, rows=16, config=cfg(drag_cfg("grayscale amount=255"))
) as s:
s.until_text("BLOCK")
left, right = split(s)
press(s, left["x"] + 4, left["y"])
motion(s, right["x"] + right["w"] // 2, right["y"] + right["h"] // 2)
s.settle(120)
grey = content_fg(s.snapshot(), right)
check(
"at 255 every channel agrees exactly",
grey and grey[1:3] == grey[3:5] == grey[5:7],
str(grey),
)
release(s, right["x"] + 5, right["y"] + 3)
s.settle(120)
def test_a_press_that_never_moves_greys_nothing():
"""A click on a title is a click. It must not flash the session grey."""
with Session(SH, cols=90, rows=16) as s:
s.until_text("BLOCK")
left, right = split(s)
press(s, left["x"] + 4, left["y"])
check_at_rest(s, "a press that never moved")
release(s, left["x"] + 4, left["y"])
s.settle(120)
def test_the_drag_greying_outranks_the_focus_dimming():
"""Two reasons to be grey would compound into one muddy grey."""
with Session(SH, cols=90, rows=16, config=cfg(unfocused_cfg(128))) as s:
s.until_text("BLOCK")
left, right = split(s)
# Drag the *unfocused* pane, so focus policy would dim it if it applied.
focused, other = by_focus(s)
press(s, other["x"] + 4, other["y"])
motion(s, focused["x"] + focused["w"] // 2, focused["y"] + focused["h"] // 2)
snap = s.snapshot()
check(
"the dragged pane lifts off the page, dimming or not",
content_fg(snap, other) == GREEN,
str(content_fg(snap, other)),
)
release(s, focused["x"] + 5, focused["y"] + 3)
s.settle(200)
def drag_and_sample(conf):
"""Colour of a non-dragged pane's content mid-drag, under `conf`."""
with Session(SH, cols=90, rows=16, config=cfg(conf)) as s:
s.until_text("BLOCK")
left, right = split(s)
press(s, left["x"] + 4, left["y"])
motion(s, right["x"] + right["w"] // 2, right["y"] + right["h"] // 2)
got = content_fg(s.snapshot(), right)
release(s, right["x"] + 5, right["y"] + 3)
s.settle(120)
return got
def test_the_two_drag_knobs_are_independent():
both_off = drag_and_sample(drag_cfg(""))
check(
"with both off a drag leaves every pane alone", both_off == GREEN, str(both_off)
)
# Desaturate only: channels converge, brightness roughly survives.
gray_only = drag_and_sample(drag_cfg("grayscale amount=255"))
ch = [int(gray_only[i : i + 2], 16) for i in (1, 3, 5)]
check(
"grayscale alone desaturates without darkening much",
ch[0] == ch[1] == ch[2] and ch[1] > 0x60,
str(gray_only),
)
# Darken only: the hue survives, the brightness does not.
dim_only = drag_and_sample(drag_cfg("dim amount=200"))
ch = [int(dim_only[i : i + 2], 16) for i in (1, 3, 5)]
check(
"dim alone darkens without desaturating",
ch[0] == 0 and ch[2] == 0 and 0 < ch[1] < 0x60,
str(dim_only),
)
def test_the_default_drag_look_is_grey_and_recessed():
"""Both together: the dragged pane has to win on contrast, not just hue."""
got = drag_and_sample("")
ch = [int(got[i : i + 2], 16) for i in (1, 3, 5)]
check(
"a non-dragged pane is pushed well below full brightness",
max(ch) < 0x80,
f"{got} max={max(ch):#x}",
)
check(
"and towards grey", max(ch) - min(ch) < 60, f"{got} spread={max(ch) - min(ch)}"
)
# ---- the drop-target border (chrome, not a shader) -------------------------
DASH_H = "\u2504"
SOLID_H = "\u2500"
def test_non_dragged_panes_get_a_dashed_border():
with Session(SH, cols=90, rows=16) as s:
s.until_text("BLOCK")
left, right = split(s)
snap = s.snapshot()
check(
"borders are solid when nothing is being dragged",
DASH_H not in snap.line(right["y"]),
repr(snap.line(right["y"])),
)
press(s, left["x"] + 4, left["y"])
motion(s, right["x"] + right["w"] // 2, right["y"] + right["h"] // 2)
snap = s.snapshot()
top = snap.line(right["y"])[right["x"] : right["x"] + right["w"]]
dragged_top = snap.line(left["y"])[left["x"] : left["x"] + left["w"]]
check("a pane you could drop onto is dashed", DASH_H in top, repr(top))
check(
"the pane in your hand stays solid",
DASH_H not in dragged_top and SOLID_H in dragged_top,
repr(dragged_top),
)
release(s, right["x"] + 5, right["y"] + 3)
snap = s.snapshot()
for p in s.panes():
row = snap.line(p["y"])[p["x"] : p["x"] + p["w"]]
check(
f"pane {p['id']} is solid again after the drop",
DASH_H not in row,
repr(row),
)
def test_a_press_that_never_moves_dashes_nothing():
with Session(SH, cols=90, rows=16) as s:
s.until_text("BLOCK")
left, right = split(s)
press(s, left["x"] + 4, left["y"])
snap = s.snapshot()
check("pressing without moving dashes nothing", DASH_H not in snap.screen(), "")
release(s, left["x"] + 4, left["y"])
s.settle(120)
def test_the_hovered_target_is_still_highlighted_over_the_dashes():
with Session(SH, cols=90, rows=16) as s:
s.until_text("BLOCK")
left, right = split(s)
press(s, left["x"] + 4, left["y"])
motion(s, right["x"] + right["w"] // 2, right["y"] + right["h"] // 2)
snap = s.snapshot()
run = snap.style_at(right["x"], right["y"])
check(
"the pane under the pointer keeps its drop highlight",
run and run["fg"] == "#7aa2f7" and "bold" in run["attrs"],
str(run),
)
release(s, right["x"] + 5, right["y"] + 3)
s.settle(120)
def test_a_drag_that_ends_off_a_pane_still_clears():
"""The clear is derived, so even a drop into nowhere cannot leave it on."""
with Session(SH, cols=90, rows=16) as s:
s.until_text("BLOCK")
left, right = split(s)
press(s, left["x"] + 4, left["y"])
motion(s, right["x"] + right["w"] // 2, right["y"] + right["h"] // 2)
s.settle(120)
motion(s, 0, 0) # out into the margin
release(s, 0, 0)
check_at_rest(s, "a drop into nowhere")
def test_a_keystroke_mid_drag_clears_the_greying():
"""Any key ends a drag (so the mouse cannot wedge); colour must follow."""
with Session(SH, cols=90, rows=16) as s:
s.until_text("BLOCK")
left, right = split(s)
press(s, left["x"] + 4, left["y"])
motion(s, right["x"] + right["w"] // 2, right["y"] + right["h"] // 2)
s.settle(120)
s.send("x")
check_at_rest(s, "a keystroke mid-drag")
# ---- the config block ------------------------------------------------------
def test_config_shaders_reach_the_screen():
"""`shaders { ... }` is the surface these are actually driven from."""
conf = 'shaders {\n ruler amount=255 at=4 color="#ff0000"\n}\n'
with Session(SH, cols=60, rows=12, config=cfg(conf)) as s:
s.until_text("BLOCK")
p = s.pane()
snap = s.snapshot()
on = snap.style_at(p["content_x"] + 4, p["content_y"])
off = snap.style_at(p["content_x"] + 3, p["content_y"])
check(
"a configured ruler marks its column",
(on or {}).get("bg") == "#ff0000",
str(on),
)
check(
"and leaves the neighbouring column alone",
(off or {}).get("bg") != "#ff0000",
str(off),
)
def test_config_shaders_run_in_written_order():
"""Order in the block is order in the chain."""
a = 'shaders {\n tint amount=255 color="#ff0000"\n tint amount=255 color="#0000ff"\n}\n'
b = 'shaders {\n tint amount=255 color="#0000ff"\n tint amount=255 color="#ff0000"\n}\n'
def last(conf):
with Session(SH, cols=50, rows=10, config=cfg(conf)) as s:
s.settle(200)
p = s.pane()
return content_fg(s.snapshot(), p)
check(
"the last shader written is the last one applied",
last(a) == "#0000ff" and last(b) == "#ff0000",
f"{last(a)} / {last(b)}",
)
def test_an_unknown_shader_is_refused_not_guessed():
with Session(
SH, cols=50, rows=10, config=cfg("shaders {\n bloom amount=255\n}\n")
) as s:
s.until_text("BLOCK")
check(
"an unknown shader leaves the session running and unshaded",
s.alive() and content_fg(s.snapshot(), s.pane()) == GREEN,
str(content_fg(s.snapshot(), s.pane())),
)
def test_positional_shaders_stay_off_the_chrome():
conf = "shaders {\n vignette amount=255\n zebra amount=255 band=1\n}\n"
with Session(SH, cols=60, rows=12, config=cfg(conf)) as s:
s.until_text("BLOCK")
p = s.pane()
snap = s.snapshot()
check(
"a full-strength positional stack still leaves the frame alone",
frame_fg(snap, p) == "#7aa2f7",
str(frame_fg(snap, p)),
)
# ---- states as a table -----------------------------------------------------
def lay(text):
f = tempfile.NamedTemporaryFile("w", suffix=".kdl", delete=False)
f.write(text)
f.close()
return f.name
def test_the_dragged_pane_can_have_a_state_of_its_own():
conf = 'states {\n dragging { tint amount=255 color="#0000ff" }\n}\n'
with Session(SH, cols=90, rows=16, config=cfg(conf)) as s:
s.until_text("BLOCK")
left, right = split(s)
press(s, left["x"] + 4, left["y"])
motion(s, right["x"] + right["w"] // 2, right["y"] + right["h"] // 2)
snap = s.snapshot()
check(
"the pane in your hand takes the dragging state",
content_fg(snap, left) == "#0000ff",
str(content_fg(snap, left)),
)
release(s, right["x"] + 5, right["y"] + 3)
check_at_rest(s, "after the drop")
def test_the_hovered_pane_is_a_different_state_from_the_rest():
conf = (
"states {\n"
' drop_hover { tint amount=255 color="#ff0000" }\n'
' drop_target { tint amount=255 color="#0000ff" }\n'
"}\n"
)
with Session(SH, cols=120, rows=20, config=cfg(conf)) as s:
s.settle(200)
s.key("\\\\")
s.settle(150)
s.key("\\\\")
s.settle(250)
panes = sorted(s.panes(), key=lambda p: p["x"])
if len(panes) < 3:
check("three panes for the drop-state test", False, str(len(panes)))
return
a, b, c = panes
press(s, a["x"] + 4, a["y"])
motion(s, b["x"] + b["w"] // 2, b["y"] + b["h"] // 2)
snap = s.snapshot()
check(
"the pane under the pointer is the hover state",
content_fg(snap, b) == "#ff0000",
str(content_fg(snap, b)),
)
check(
"the other candidates are the plain target state",
content_fg(snap, c) == "#0000ff",
str(content_fg(snap, c)),
)
release(s, b["x"] + 3, b["y"] + 3)
s.settle(150)
def test_a_suspended_pane_is_a_state():
"""It draws a label rather than a program, and that is still contents."""
l = lay(
'layout {\n tab name="t" {\n pane\n'
' pane suspended=true command="sleep 1"\n }\n}\n'
)
conf = 'states {\n suspended { tint amount=255 color="#00aaff" }\n}\n'
with Session(SH, cols=90, rows=14, config=cfg(conf), layout=l) as s:
s.settle(250)
panes = s.panes()
susp = [p for p in panes if p["suspended"]]
check("the layout made a suspended pane", len(susp) == 1, str(panes))
if not susp:
return
snap = s.snapshot()
run = snap.style_at(
susp[0]["content_x"] + susp[0]["content_w"] // 2,
susp[0]["content_y"] + susp[0]["content_h"] // 2,
)
check(
"a suspended pane reaches the shader pass at all",
(run or {}).get("fg") == "#00aaff",
str(run),
)
def test_scrollback_is_a_state():
noisy = [
"/bin/sh",
"-c",
'printf "\\033]2;p\\007"; i=0; while [ $i -lt 200 ]; do '
'printf "\\033[38;2;0;255;0mline %d\\033[0m\\n" $i; i=$((i+1)); done; '
"stty raw -echo; cat",
]
conf = 'states {\n scrolled { tint amount=255 color="#ffaa00" }\n}\n'
with Session(noisy, cols=80, rows=14, config=cfg(conf)) as s:
s.settle(300)
p = s.pane()
check(
"not scrolled yet, so no state colour",
content_fg(s.snapshot(), p) == GREEN,
str(content_fg(s.snapshot(), p)),
)
# No scroll command exists, so drive it the way a person does: the
# wheel. SGR button 64 is wheel-up.
for _ in range(6):
s.send(rf"\e[<64;{p['content_x'] + 2};{p['content_y'] + 2}M")
check(
"looking at the past is a state you can colour",
content_fg(s.snapshot(), p) == "#ffaa00",
str(content_fg(s.snapshot(), p)),
)
def test_exactly_one_state_wins():
"""A pane is in several at once; the ranking decides, and does not stack."""
l = lay(
'layout {\n tab name="t" {\n pane\n'
' pane suspended=true command="sleep 1"\n }\n}\n'
)
conf = (
"states {\n"
' suspended { tint amount=255 color="#00aaff" }\n'
' unfocused { tint amount=255 color="#ff0000" }\n'
"}\n"
)
with Session(SH, cols=90, rows=14, config=cfg(conf), layout=l) as s:
s.settle(250)
susp = [p for p in s.panes() if p["suspended"]]
if not susp or susp[0]["focused"]:
check(
"a suspended, unfocused pane to test with", bool(susp), str(s.panes())
)
return
run = s.snapshot().style_at(
susp[0]["content_x"] + susp[0]["content_w"] // 2,
susp[0]["content_y"] + susp[0]["content_h"] // 2,
)
check(
"suspended outranks unfocused, and they do not mix",
(run or {}).get("fg") == "#00aaff",
str(run),
)
def test_an_unknown_state_is_refused():
conf = "states {\n haunted { dim amount=255 }\n}\n"
with Session(SH, cols=60, rows=12, config=cfg(conf)) as s:
s.until_text("BLOCK")
check(
"an unknown state name leaves the session running",
s.alive() and content_fg(s.snapshot(), s.pane()) == GREEN,
str(content_fg(s.snapshot(), s.pane())),
)
if __name__ == "__main__":
test_the_default_dims_the_pane_you_are_not_in()
test_nothing_is_dimmed_with_the_knob_at_zero()
test_dims_everything_but_the_focused_pane()
test_the_dimming_follows_focus()
test_dimming_never_touches_the_chrome()
test_dragging_greys_the_other_panes()
test_full_strength_is_a_true_grey()
test_a_press_that_never_moves_greys_nothing()
test_the_drag_greying_outranks_the_focus_dimming()
test_the_two_drag_knobs_are_independent()
test_the_default_drag_look_is_grey_and_recessed()
test_non_dragged_panes_get_a_dashed_border()
test_a_press_that_never_moves_dashes_nothing()
test_the_hovered_target_is_still_highlighted_over_the_dashes()
test_a_drag_that_ends_off_a_pane_still_clears()
test_a_keystroke_mid_drag_clears_the_greying()
test_config_shaders_reach_the_screen()
test_config_shaders_run_in_written_order()
test_an_unknown_shader_is_refused_not_guessed()
test_positional_shaders_stay_off_the_chrome()
test_the_dragged_pane_can_have_a_state_of_its_own()
test_the_hovered_pane_is_a_different_state_from_the_rest()
test_a_suspended_pane_is_a_state()
test_scrollback_is_a_state()
test_exactly_one_state_wins()
test_an_unknown_state_is_refused()
sys.exit(report())
|