- 원인: 숨김(크기 0) 알림에 크기 0 으로 화면을 되살려 가운데가 도엽 구석 · 배율 1/8 로 바뀌고 그 값이 기억에도 적힘 - resize 크기 0 이면 그대로 돌아감 · 기억 꾼은 칸 너비 0 이면 안 잡음 · 처음 열기(기억 없음) = 등고 영역 맞춤 그대로 - 시험: test_349_0h_routeedit_hidden_keep 3 · test_b05_routeedit_view 숨김 1(옛 길 재현) · 관련 20 통과 · typecheck 0 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Se7ytqbohmBQnfYpwYFnYf
55 lines
2.5 KiB
Python
55 lines
2.5 KiB
Python
"""349-0h — B06 다녀와도 노선 편집 평면은 떠나기 전 화면 그대로.
|
|
|
|
숨은 동안(크기 0) 칸 크기 알림에 화면을 다시 셈하지 않고 기억도 적지 않음 ·
|
|
다시 보이면 떠나기 전 화면(가운데 · 배율)을 새 칸 크기로 되살림 · 처음 열기는 등고 영역 맞춤.
|
|
배선은 글로 봄.
|
|
./venv/Scripts/python.exe -m pytest resources/tester/test_349_0h_routeedit_hidden_keep.py -q
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
B05 = ROOT / "B05_Profile"
|
|
EDITOR = (B05 / "B05_Profile_UI_RouteEdit.ts").read_text(encoding="utf-8")
|
|
VIEW = (B05 / "B05_Profile_UI_RouteEdit_View.ts").read_text(encoding="utf-8")
|
|
|
|
|
|
def _body(text: str, head: str) -> str:
|
|
at = text.index(head)
|
|
return text[at : text.index("\n }", at)]
|
|
|
|
|
|
def test_숨은_동안_화면을_다시_셈하지_않음() -> None:
|
|
resize = _body(EDITOR, "function resize(): void {")
|
|
kept = resize.index("const kept = meta && viewReady ? captureView(")
|
|
fit = resize.index("fitCanvas(canvas, context);")
|
|
guard = resize.index("if (width <= 0 || height <= 0) return;")
|
|
assign = resize.index("view = { ...view, width, height,")
|
|
restore = resize.index("restoreSavedView(meta, view, kept)")
|
|
opening = resize.index("if (!viewReady) openView();")
|
|
# 떠나기 전 화면을 잡고 · 크기 0 이면 그대로 둠 · 보이면 새 크기로 되살림 · 처음이면 맞춤
|
|
assert kept < fit < guard < assign < restore < opening
|
|
assert len(EDITOR.splitlines()) <= 700
|
|
|
|
|
|
def test_숨은_동안_기억을_적지_않음() -> None:
|
|
assert (
|
|
"meta && viewReady && view.width > 0 ? captureView(meta, view, rotation.radians())"
|
|
in EDITOR
|
|
)
|
|
# 보임 · 숨김 알림 — 보이면 크기 다시 셈 · 숨으면 그 전 화면을 적음
|
|
assert "host.onShow(() => (historyControls.listen(true), resize()));" in EDITOR
|
|
assert "host.onHide(() => (historyControls.listen(false), viewMemory.flush()));" in EDITOR
|
|
|
|
|
|
def test_처음_열기는_기억_없으면_등고_영역_맞춤() -> None:
|
|
opening = VIEW[
|
|
VIEW.index("export function openingView(") : VIEW.index("export function fitView(")
|
|
]
|
|
assert "const saved = readSavedView(projectId);" in opening
|
|
assert "return { view: fitView(meta, view, nodes, contours), rotationRad: 0 };" in opening
|
|
open_view = _body(EDITOR, "function openView(): void {")
|
|
assert "view.width <= 0) return;" in open_view # 크기 0 이면 맞춤도 미룸
|