Size the board and the rail by proportion, not by pixel constants
"Some screens scroll sideways, some don't" had two causes, and both were a number that was right on one monitor. The lanes. _KanbanColumn set a 150px floor with a comment claiming seven of them fit a 1280 window; measured, the row wanted 1242px where 1280 leaves 1091, so a 1280 screen scrolled and a 1920 one did not — this machine has one of each. The floor is gone. The seven lanes share the board through the layout's stretch, which is a proportion of whatever width there is, and the only pixel question left — how narrow before scrolling beats squeezing — is answered from the font: eight characters of a title plus padding, so it holds at 125%/150% scaling too. No horizontal scroll now at 1280×720 through 1936×1048, at three rail widths each, including the rail dragged to its maximum. Each lane also grew its own scrollbar: QListWidget's column hint runs 1-6px past its viewport, and which lanes overflowed changed with the window width — 36 of 38 widths had at least one. Cards word-wrap, so there was never anything to reach sideways; the bar is off. The rail. Its 360px ceiling was a quarter of a 1440 screen and more than that of a 1280 one. It is now 22% of the window, capped at 360 — and recomputed on resize, which is its own bug fixed: read once at construction off a not-yet-sized window, it sat at 162px on every monitor, so the handle barely moved. check_kanban_scroll covers five screen sizes × three rail widths. A rail dragged to maximum on a 1280 screen still scrolls the board — that is the user's own trade, so it is reported rather than failed. 19/19 checkers pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
a0cef768c9
commit
77976405b1
@@ -38,7 +38,7 @@ def main() -> int:
|
||||
seed()
|
||||
|
||||
from cowork_local.app import (
|
||||
_NAV_COLLAPSED_WIDTH, _NAV_MAX_WIDTH, _NAV_MIN_WIDTH, MainWindow)
|
||||
_NAV_COLLAPSED_WIDTH, _NAV_MIN_WIDTH, MainWindow)
|
||||
from cowork_local.config import AppConfig
|
||||
from cowork_local.i18n import set_language
|
||||
from cowork_local.state import AppContext
|
||||
@@ -72,10 +72,12 @@ def main() -> int:
|
||||
if narrow >= wide:
|
||||
fails.append(f"keo hep lai khong an: {narrow}px")
|
||||
|
||||
over = drag_to(_NAV_MAX_WIDTH + 200)
|
||||
print(f"keo qua max: {over}px (tran {_NAV_MAX_WIDTH})")
|
||||
if over > _NAV_MAX_WIDTH:
|
||||
fails.append(f"rail vuot tran: {over} > {_NAV_MAX_WIDTH}")
|
||||
# The ceiling is a share of the window now, so ask the window for it.
|
||||
ceiling = win._nav_max_width()
|
||||
over = drag_to(ceiling + 200)
|
||||
print(f"keo qua max: {over}px (tran {ceiling} = {ceiling * 100 // win.width()}% cua so)")
|
||||
if over > ceiling:
|
||||
fails.append(f"rail vuot tran: {over} > {ceiling}")
|
||||
|
||||
under = drag_to(20)
|
||||
print(f"keo duoi min: {under}px (san {_NAV_MIN_WIDTH})")
|
||||
@@ -83,7 +85,7 @@ def main() -> int:
|
||||
fails.append(f"rail thap hon san: {under} < {_NAV_MIN_WIDTH}")
|
||||
|
||||
# a dragged width has to come back after a fold
|
||||
chosen = drag_to(280)
|
||||
chosen = drag_to(min(280, win._nav_max_width()))
|
||||
win._toggle_nav()
|
||||
app.processEvents()
|
||||
folded = rail.width()
|
||||
@@ -97,6 +99,22 @@ def main() -> int:
|
||||
if abs(back - chosen) > 4:
|
||||
fails.append(f"mo lai quen be rong da keo: {back} thay vi {chosen}")
|
||||
|
||||
# The ceiling is a share, so it has to move with the window — it was read
|
||||
# once at construction and stuck at 162px on every monitor.
|
||||
seen = {}
|
||||
for w in (1280, 1600, 1936):
|
||||
win.resize(w, 900)
|
||||
app.processEvents()
|
||||
split.setSizes([2000, 1]) # drag the handle as far right as it goes
|
||||
app.processEvents()
|
||||
seen[w] = (rail.width(), win._nav_max_width())
|
||||
print(f"cua so {w}: keo het co -> {seen[w][0]}px (tran {seen[w][1]}px)")
|
||||
for w, (got, ceiling) in seen.items():
|
||||
if abs(got - ceiling) > 4:
|
||||
fails.append(f"cua so {w}: keo het chi duoc {got}px, tran la {ceiling}px")
|
||||
if len({c for _g, c in seen.values()}) == 1:
|
||||
fails.append("tran khong doi theo be rong cua so — dang la px co dinh")
|
||||
|
||||
print()
|
||||
for f in fails:
|
||||
print("FAIL " + f)
|
||||
|
||||
Reference in New Issue
Block a user