64 lines
2.3 KiB
Python
64 lines
2.3 KiB
Python
"""513-1 B05 평면 우클릭 구조물 메뉴(요구 327-1) — 종단 그래프 우클릭과 같은 항목 · 같은 동작(공용
|
|
`structureMenuItemsAt`) · 자리 = 노선에 내린 누가거리 · 가까운 배관 · 측점 = 삭제 · 노선 밖 · 노드 위 = 메뉴 없음.
|
|
|
|
TS 셈은 `helper_513_1_plan_structure_menu.cjs`(Node · 항목 짓기 · 노선 셈은 진짜).
|
|
|
|
./venv/Scripts/python.exe -m pytest resources/tester/test_513_1_plan_structure_menu.py -q
|
|
"""
|
|
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
HELPER = Path(__file__).with_name("helper_513_1_plan_structure_menu.cjs")
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def got() -> dict:
|
|
run = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", str(HELPER)],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=120,
|
|
)
|
|
assert run.returncode == 0, run.stderr
|
|
return json.loads(run.stdout)
|
|
|
|
|
|
def test_평면_메뉴는_종단_메뉴와_같음(got) -> None:
|
|
assert got["liveBefore"] is True # 종단 그래프가 서기 전 = 재료 없음
|
|
assert got["profileEmpty"] == got["planEmpty"] == [["A군", ["배수관"]]]
|
|
assert got["profilePipe"] == got["planPipe"] == ["구조물 삭제"] # 글 하나(514-1)
|
|
assert got["planPlus"] == ["측점 삭제"]
|
|
assert got["planMenuAt"] == [141, -4]
|
|
|
|
|
|
def test_같은_동작_같은_자리(got) -> None:
|
|
assert got["calls"] == [
|
|
["addType", 60, "pipe"], # 종단 60 m
|
|
["addType", 60, "pipe"], # 평면 60 m(노선에 내린 자리)
|
|
["remove", "pipe-1"],
|
|
["removePlus", 70],
|
|
]
|
|
|
|
|
|
def test_노선_밖_노드_위_떠난_종단은_메뉴_없음(got) -> None:
|
|
assert got["planFar"] is None
|
|
assert got["planNode"] is None # 노드 삭제(옛 동작) 몫
|
|
assert got["planGone"] is None
|
|
|
|
|
|
def test_배선() -> None:
|
|
pointer = (ROOT / "B05_Profile" / "B05_Profile_UI_RouteEdit_Pointer.ts").read_text(
|
|
encoding="utf-8"
|
|
)
|
|
assert "bindPlanStructureMenu(params, nodeAt);" in pointer
|
|
viewer = (ROOT / "B05_Profile" / "B05_Profile_UI_Profile_Structures.ts").read_text(
|
|
encoding="utf-8"
|
|
)
|
|
assert "structureMenuItemsAt(options, options.chainageAt(localX)" in viewer
|