Files
Aislo/resources/tester/test_152_4_chute_pick.py
T

70 lines
2.6 KiB
Python

"""152-4 도수로 · 돌붙임 띠 고름 · 강조 — 118-1 관 고름 꼴(판정면 · setter · 좌측 상자 · 3D 키).
화면 TS 를 흉내 DOM 에서 돌린 값(`helper_152_4_chute_pick.cjs`) + 배선 문자열.
"""
import json
import subprocess
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[2]
HELPER = Path(__file__).parent / "helper_152_4_chute_pick.cjs"
NODE_MODULES = ROOT / "config" / "node_modules"
pytestmark = pytest.mark.skipif(not NODE_MODULES.is_dir(), reason="프론트엔드 의존성 미설치")
@pytest.fixture(scope="module")
def out() -> dict:
done = subprocess.run( # noqa: S603 — 고정 실행 파일
["node", str(HELPER)], cwd=str(ROOT), capture_output=True, text=True, encoding="utf-8"
)
assert done.returncode == 0, done.stderr
return json.loads(done.stdout)
def _src(relative: str) -> str:
return (ROOT / relative).read_text(encoding="utf-8")
def test_띠마다_판정면_벽_관_아래(out: dict) -> None:
overlay = out["overlay"]
assert overlay["bands"] == overlay["chuteHits"] == 2
assert overlay["sameShape"]
n = overlay["chuteHits"]
assert overlay["hitOrder"][:n] == ["chute"] * n # 벽 · 관 판정면이 위(겹치면 이김)
assert "chute" not in overlay["hitOrder"][n:]
def test_띠_누름_고름_강조(out: dict) -> None:
overlay = out["overlay"]
assert overlay["picked"] == ["chute"] and overlay["stopped"]
assert overlay["on"] == [True, True] and overlay["off"] == [False, False]
assert out["bare"] == {"hits": 0, "setter": "function"}
assert out["noChute"]
def test_조정창_없음_3D_키(out: dict) -> None:
assert out["panel"] == {"hidden": True, "side": "chute", "touched": []}
assert out["pick"] == [["revet", "chute"]]
def test_좌측_상자_강조_배선() -> None:
view = _src("B06_Section/B06_Section_UI_Cross_View.ts")
assert "attachChuteBandPick(" in view and 'toggleRevet("chute")' in view
assert 'setChuteActive(key === "chute");' in view
dock = _src("B06_Section/B06_Section_UI_Adjust_Dock.ts")
assert (
'fieldset[data-spec-container="chute_add"], fieldset[data-spec-container="chute"]' in dock
)
selection = _src("B06_Section/B06_Section_UI_Page_Structures_Selection.ts")
assert 'if (id === "chute_add" || id === "chute") return "chute";' in selection
assert (
'ownerM ?? (key === "chute" ? chainageM : ownerChainageOf(chainageM, key ?? undefined))'
in selection
)
css = _src("B06_Section/B06_Section_UI_Style_Cross_Areas.css")
assert ".b06-chart__culvert-pitching.is-active {" in css