- 서버 initial_profile 펴기(세션에 안 적음) · 실패면 이유 한 줄 - 종단 그림에 초기 종단 선(주황 점선 · 끔이면 지반선 + 초기 종단) · 범례 - 한 줄 = 꼭짓점 · 종단곡선 · 직선화 수 · 최대 종단경사(L) - [적용] = 「종단 손 편집은 새 초기 종단으로 바뀜」 확인 뒤 - 시험 test_476_2 · test_421 [적용] 단언 = 확인 창 뒤 고른 후보 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
64 lines
2.8 KiB
Python
64 lines
2.8 KiB
Python
"""476-2 추천 모달 — 「적용될 초기 종단」 선 · 한 줄 · [적용] 확인 글(요구 276).
|
|
|
|
./venv/Scripts/python.exe -m pytest resources/tester/test_476_2_recommend_initial_line.py -q
|
|
"""
|
|
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
B05 = ROOT / "B05_Profile"
|
|
HELPER = Path(__file__).with_name("helper_476_2_initial_profile.cjs")
|
|
|
|
|
|
def _out() -> dict:
|
|
return json.loads(
|
|
subprocess.run(
|
|
["node", str(HELPER)], capture_output=True, text=True, encoding="utf-8", check=True
|
|
).stdout
|
|
)
|
|
|
|
|
|
def test_펴기와_캐시_빼기() -> None:
|
|
out = _out()
|
|
p = out["parsed"]
|
|
assert p["withProfile"] is False and p["curveLengthM"] == 20
|
|
assert p["pviCount"] == 3 and p["curveCount"] == 1 and p["straightened"] == 2
|
|
assert p["line"][3] == [30, 101.5] and p["planM"] == [100, 102, 101]
|
|
assert "initialProfile" not in out["cached"] # 세션에 안 적음
|
|
assert out["missing"] is None # 옛 서버 답
|
|
assert out["shortLine"] is None # 선 점 하나 = 꼴 틀림
|
|
|
|
|
|
def test_한_줄과_실패_글() -> None:
|
|
out = _out()
|
|
assert out["line"] == "초기 종단: 꼭짓점 3 · 종단곡선 1 · 직선화 2 · 최대 종단경사 10.0%(L 20)"
|
|
assert out["failed"] == {"error": "지반고 종단 — 측점이 모자랍니다"}
|
|
assert out["failedLine"].startswith("초기 종단을 셈하지 못했습니다 — 지반고 종단")
|
|
|
|
|
|
def test_그림_선() -> None:
|
|
out = _out()
|
|
# 끔 = 지반선 + 초기 종단(계획선 빔)
|
|
assert 'class="is-ground" d="M6.0 90.0L300.0 6.0L594.0 62.0"' in out["svgOff"]
|
|
assert 'class="is-plan" d=""' in out["svgOff"]
|
|
initial = 'class="is-initial" d="M6.0 90.0L153.0 62.0L300.0 34.0L447.0 48.0L594.0 62.0"'
|
|
assert initial in out["svgOff"] and initial in out["svgOn"]
|
|
assert 'class="is-plan" d="M6.0 90.0L300.0 62.0L594.0 62.0"' in out["svgOn"]
|
|
assert "is-initial" not in out["svgOld"] # 옛 답 = 지반 · 균형만
|
|
assert "is-plan" not in out["legendOff"] and "적용될 초기 종단" in out["legendOff"]
|
|
|
|
|
|
def test_모달_배선과_확인_글() -> None:
|
|
rec = (B05 / "B05_Profile_UI_RouteEdit_Recommend.ts").read_text(encoding="utf-8")
|
|
assert '<div data-line="initial" hidden></div>' in rec
|
|
assert "profileSvg(balance, initialShape)" in rec
|
|
assert 'line("profile").hidden = !balance && !initialShape;' in rec
|
|
apply = rec[rec.index('applyButton.addEventListener("click"') :][:400]
|
|
assert 'showConfirmDialog(APPLY_CONFIRM, "적용")' in apply
|
|
assert apply.index("showConfirmDialog") < apply.index("params.onApply(picked);")
|
|
assert "종단 손 편집은 새 초기 종단으로 바뀝니다" in rec
|
|
css = (B05 / "B05_Profile_UI_Style_RouteRecommend.css").read_text(encoding="utf-8")
|
|
assert ".b05-routerec__profile .is-initial" in css and "var(--map-route" in css
|