53 lines
1.9 KiB
Python
53 lines
1.9 KiB
Python
"""455 (433-13 ①) 종단 ▲▼ — 누른 꼭짓점의 자동 R 을 지워 기본 L.
|
|
|
|
까닭: ▲▼ 가 누른 꼭짓점 자신의 R 을 남겨 거의 직선이 된 꼭짓점에 옛 자동 R(관 정착 역산값)로
|
|
짧은 곡선이 생김. 자동 R = 서버 저장분 곡선반경과 같은 값 · 사용자가 넣은 R 은 둠.
|
|
계산은 `helper_455_arrow_auto_radius.cjs` 가 진짜 TS 를 Node 로 돌림 · 부르는 곳 셋은 소스로 봄.
|
|
"""
|
|
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
ROOT = HERE.parent.parent
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def out() -> dict:
|
|
proc = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", str(HERE / "helper_455_arrow_auto_radius.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=60,
|
|
check=False,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_자동_R_은_지워_기본_L(out) -> None:
|
|
assert out["auto"]["radius"] is None
|
|
assert out["auto"]["length"] == pytest.approx(15.0, abs=1e-6)
|
|
# 옛 판(지우지 않음)은 같은 R 로 짧은 곡선 — 까닭 근거
|
|
assert out["legacy"]["radius"] == pytest.approx(3000.0)
|
|
assert out["legacy"]["length"] < 14.0
|
|
|
|
|
|
def test_사용자_R_은_그대로(out) -> None:
|
|
assert out["user"]["radius"] == 777
|
|
|
|
|
|
def test_부르는_곳_셋이_저장_R_을_넘김() -> None:
|
|
def read(rel: str) -> str:
|
|
return (ROOT / rel).read_text(encoding="utf-8")
|
|
|
|
render = read("B05_Profile/B05_Profile_UI_Profile_Render.ts")
|
|
assert render.count("chainage, delta, store.savedRadii())") == 2
|
|
tools = read("B05_Profile/B05_Profile_UI_Profile_Panel_Tools.ts")
|
|
assert "adjustStation(base, ctx.edits(), chainage, delta, ctx.savedRadii())" in tools
|
|
assert "savedRadii: () => store.savedRadii()," in read("A00_Common/design/design_profile.ts")
|