Files
Aislo/resources/tester/test_514_1_mark_remove.py
T

66 lines
2.5 KiB
Python

"""514-1 알약 · 평면 마커 우클릭 「구조물 삭제」(요구 328-1 · 328-2) — 측점선 없는 구조물(대피로 · 노출형 횡단수로)도
알약 · 평면 마커 우클릭으로 지움 · 513-3 과 같은 주인 가르기(`removeMarkOwner`) · 삭제 글 = 「구조물 삭제」 하나.
TS 셈은 `helper_514_1_mark_remove.cjs`(Node · 주인 가르기 · 평면 항목 짓기는 진짜).
./venv/Scripts/python.exe -m pytest resources/tester/test_514_1_mark_remove.py -q
"""
import json
import subprocess
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[2]
HELPER = Path(__file__).with_name("helper_514_1_mark_remove.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["owners"] == [
["pipe", 55], # 관 세션 id = 장부 자리
["pipe", 12.5], # 옛 자리 이름 관
["structure", "evac-1"],
["structure", "cross-2"],
]
def test_평면_마커_우클릭(got) -> None:
assert got["planMark"] == ["구조물 삭제"]
assert got["planPipe"] == ["구조물 삭제"] # 관도 같은 글
assert got["planEmpty"] == ["A군"]
assert got["calls"] == [["removeMark", "evac-1"], ["remove", "pipe-1"]]
def _read(*parts: str) -> str:
return (ROOT.joinpath(*parts)).read_text(encoding="utf-8")
def test_배선() -> None:
marks = _read("B05_Profile", "B05_Profile_UI_Structures_Marks.ts")
assert 'mark.addEventListener("contextmenu"' in marks
assert '["구조물 삭제", () => remove(id)]' in marks
render = _read("B05_Profile", "B05_Profile_UI_Profile_Render.ts")
assert render.count("callbacks?.onStructureMarkRemove?.(structureId)") == 2 # 알약 · 평면
assert "배관 삭제" not in _read("B05_Profile", "B05_Profile_UI_Profile_Structures.ts")
assert 'toView(shared, "onStructureMarkRemove")' in _read(
"A00_Common", "design", "design_shared.ts"
)
view = _read("A00_Common", "design", "design_view_profile.ts")
assert "removeMarkOwner(structureId, removeOwner)" in view
cross = _read("B06_Section", "B06_Section_UI_Section_View_Profile.ts")
assert "removeMarkOwner(structureId, {" in cross