Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions tests/render_cases_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,16 +623,18 @@ def ceiling(limit, approvals):
UNANSWERED_CODE_PAGE = COLORED_CODE_PAGE.replace(
"</head>", "<style>[data-lf-syn] { color: inherit; }</style>\n</head>"
)
# What --syn-comment carried until this gate was written: 3.3:1 on --pre-bg, and the
# reading a user reported as the highlighting being gone.
# What --syn-comment carried until this gate was written: under 4.5:1 on --pre-bg, and
# the reading a user reported as the highlighting being gone. The colour is stated and
# the ratio is not, because the ratio is a reading of whatever --pre-bg currently is.
FAINT_CODE_PAGE = COLORED_CODE_PAGE.replace(
"</head>", '<style>[data-lf-syn="cm"] { color: #8b8577; }</style>\n</head>'
)

# A role that reads on the block and not on the tint one of its lines wears. The clean
# line comes first on purpose: a gate that stopped at a role's first span would take the
# 7.9:1 reading and never reach the 1.6:1 one two lines down, and a walkthrough's hi band
# is the surface where a code line is most often set on something other than --pre-bg.
# line comes first on purpose: a gate that stopped at a role's first span would take that
# line's reading, which clears the threshold, and never reach the one two lines down, and
# a walkthrough's hi band is the surface where a code line is most often set on something
# other than --pre-bg.
TINTED_LINE_PAGE = LONG_PAGE.replace(
"</head>", "<style>:root { --hi-tint: #6f6a60; }</style>\n</head>"
).replace(
Expand Down
16 changes: 9 additions & 7 deletions tests/test_render_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1874,21 +1874,23 @@ def test_the_render_gate_reports_code_the_reader_cannot_tell_from_its_block(
if f.startswith("[light] code marked cm is the ink of the code around it")
], unanswered

# The ratio the gate prints is a reading of the theme's own surfaces, so pinning
# its digits here makes every palette change a failure of this test rather than of
# the page. What the assertions ask instead is which role came back unread, which
# is the whole of what each case is arranged to distinguish: the gate names a role
# in this sentence only where it read under 4.5:1, so the finding is the claim.
faint = render_gate_model.render_version(browser, serve(FAINT_CODE_PAGE))
assert [
f for f in faint if f.startswith("[light] code marked cm reads at 3.3:1")
], faint
assert [f for f in faint if f.startswith("[light] code marked cm reads at ")], faint
assert not [f for f in faint if "code marked st" in f], (
"only the role the style touched is unread, so the rest name the reading "
"rather than the rule"
)

tinted = render_gate_model.render_version(browser, serve(TINTED_LINE_PAGE))
assert [
f for f in tinted if f.startswith("[light] code marked st reads at 1.6:1")
], (
assert [f for f in tinted if f.startswith("[light] code marked st reads at ")], (
"the reading is of the surface each span is actually set on, not of one "
f"block colour taken once per role — {tinted}"
"block colour taken once per role — that role clears the threshold on the "
f"block, so a gate stopping at its clean line says nothing at all: {tinted}"
)

page, errors = open_page(browser, serve(SHADOW_CODE_PAGE))
Expand Down
Loading