"""381-2 B05 평면 [측점] [기울기] 켬끔(요구 241-11). - 단추 = 절/성토선 왼쪽 · 켬끔 모듈(기본 [측점] 켬 · [기울기] 끔(390-1 요구 242-17) · 페이지 동안) - [측점] 끔 = 눈금 · 번호 안 그림 · 눈금 집기 안 함(라벨 0개 = 전부 집힘 함정) · 시점 · 종점 이름표 남김 - [기울기] 끔 = 기울기 라벨(높이 묻기) 안 부름 """ from pathlib import Path B05 = Path(__file__).resolve().parents[2] / "B05_Profile" def _read(name: str) -> str: return (B05 / name).read_text(encoding="utf-8") def test_켬끔_모듈_기본_측점_켬_기울기_끔(): marks = _read("B05_Profile_UI_RouteEdit_Marks.ts") assert "{ stations: true, slopes: false }" in marks assert "scheduleRedraw();" in marks assert "export function scheduleRedraw" in _read("B05_Profile_UI_RouteEdit_Footprint.ts") def test_단추는_절성토선_왼쪽_배선(): chrome = _read("B05_Profile_UI_RouteEdit_Chrome.ts") stations = chrome.index('data-act="stations"') slopes = chrome.index('data-act="slopes"') assert stations < slopes < chrome.index('data-act="footprint"') assert ">측점" in chrome and ">기울기" in chrome assert '[data-act="stations"]\')!, "stations")' in chrome assert '[data-act="slopes"]\')!, "slopes")' in chrome def test_측점_끄면_눈금만_빠지고_이름표_남음(): render = _read("B05_Profile_UI_RouteEdit_Render.ts") body = render[render.index("function drawStationMarks(") : render.index("function endLabel(")] # 라벨 상자를 먼저 비우고(누름 판정) · 눈금은 켬일 때만 · 이름표는 밖 assert body.index("setStationLabelBoxes(") < body.index('if (markShown("stations"))') guard = body.index('if (markShown("stations"))') assert guard < body.index("drawStationTicks(") < body.index("`시점 ") assert body.count("endLabel(") == 2 def test_기울기_끄면_라벨도_높이_요청도_없음(): render = _read("B05_Profile_UI_RouteEdit_Render.ts") assert 'if (markShown("slopes")) scene.overStations?.(context);' in render assert render.count("scene.overStations?.(context)") == 1 def test_측점_끄면_눈금_집기_없음(): pointer = _read("B05_Profile_UI_RouteEdit_Pointer.ts") # 집기에 쓰는 눈금 찾기는 켬일 때만 — 라벨 0개면 전부 집히는 함정 at = 0 calls = 0 while (at := pointer.find("stationAtScreen(", at + 1)) >= 0: calls += 1 assert 'markShown("stations")' in pointer[at - 300 : at], at assert calls >= 1