Files
Aislo/resources/tester/test_421_recommend_profile.py
T
eomsangdonandClaude Opus 5.5 f3322d1575 feat(476-2 추천 초기 종단): 추천 모달에 적용될 초기 종단 선 · 한 줄 · [적용] 확인 글
- 서버 initial_profile 펴기(세션에 안 적음) · 실패면 이유 한 줄
- 종단 그림에 초기 종단 선(주황 점선 · 끔이면 지반선 + 초기 종단) · 범례
- 한 줄 = 꼭짓점 · 종단곡선 · 직선화 수 · 최대 종단경사(L)
- [적용] = 「종단 손 편집은 새 초기 종단으로 바뀜」 확인 뒤
- 시험 test_476_2 · test_421 [적용] 단언 = 확인 창 뒤 고른 후보

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 16:23:06 +09:00

68 lines
3.2 KiB
Python

"""421 추천 창 — 「측점 맞춤」 → 「종단 반영」 · [재계산] 늘 켜짐 + `recompute`.
./venv/Scripts/python.exe -m pytest resources/tester/test_421_recommend_profile.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_421_profile_toggle.cjs")
def _read(name: str) -> str:
return (B05 / name).read_text(encoding="utf-8")
def test_종단_반영_값_정하기() -> None:
out = json.loads(
subprocess.run(
["node", str(HELPER)], capture_output=True, text=True, encoding="utf-8", check=True
).stdout
)
assert out["sent"] is False # 옛 서버 = 보낸 값
assert out["server"] is True # 서버 답 `with_profile` 이 먼저
assert out["serverHasUnsnapped"] is False # 맞추기 전 선은 화면이 안 씀
assert out["oldFollow"] is False and out["oldEarth"] is True # 옛 캐시 = 갈래로
assert out["base"] is False and out["baseProfile"] is False
assert out["oldBase"] is None and out["oldBaseProfile"] is True
assert out["sameOff"] is True and out["sameOn"] is False and out["sameOld"] is True
assert out["readBack"] is False # 캐시에 남아 다시 열 때 되살림
def test_창_단추와_재계산() -> None:
rec = _read("B05_Profile_UI_RouteEdit_Recommend.ts")
assert "측점 맞춤" not in rec and "snapOn" not in rec and "unsnapped" not in rec
assert 'toggleButton("종단 반영", profileOn,' in rec
assert "let profileOn = params.withProfile;" in rec
toggle = rec[rec.index('toggleButton("종단 반영"') :][:200]
assert "profileOn = active;" in toggle and "void run();" in toggle # 누르면 바로
assert "rerun.before(profileToggle);" in rec
assert "rerun.disabled = busy || invalid.size > 0;" in rec # 늘 켜짐
assert 'rerun.addEventListener("click", () => void run(true));' in rec
assert "const withProfile = profileOn;" in rec
assert "params.onApply(picked);" in rec # 476 — 확인 창 뒤 미리 본 그 후보
def test_요청과_적용에_종단_반영() -> None:
init = _read("B05_Profile_UI_RouteEdit_Initial.ts")
assert "with_profile: withProfile," in init
assert "...(recompute ? { recompute: true } : {})," in init
assert "withProfile: choice?.withProfile ?? base.withProfile ?? true," in init
on_apply = init[init.index("onApply: (picked) => {") :][:900]
assert "with_profile: choiceWithProfile(picked)," in on_apply
assert on_apply.count("choiceWithProfile(picked)") == 2 # 저장 칸 · 균형 종단
assert "withProfileOf(" not in init
assert "with_profile: choiceWithProfile(now)" in init # [저장]에도 실음
api = _read("B05_Profile_Api_RouteInitial.ts")
assert "recompute?: boolean;" in api
def test_도움말_글() -> None:
help_ts = _read("B05_Profile_UI_RouteEdit_Recommend_Help.ts")
assert "「측점 맞춤」을 끄면" not in help_ts and "끔 = 옮기기 전 선" not in help_ts
assert 'name: "재계산",' in help_ts and 'name: "측점 맞춤(늘)",' in help_ts
assert "단추로 켬 · 끔(기본 켬 · 다섯 갈래 모두)" in help_ts