# -*- coding: utf-8 -*- """284 종단도 알약 고름 · 풂(요구 178 · 179-1 · 조사 AM). 못박는 것 - 측점 있음 = 제 측점을 심는 알약(272 한 벌 — A군 · C · D 구간형 · 관 = 물넘이포장까지 · 286-1) · 종류 모르면 옛 길. - 측점 없는 알약(B군 · 표지 · 바닥막이)은 같은 자리 · 근처 측점선을 짝으로 켜지 않음. - 관 측점선을 다시 누르면 측점 없는 표지가 아니라 그 관 알약. - B06 알약 다시 누름 = 풀기 한 길(Esc 값) · 측점 없는 관 = 카드 안 고름 · 스크롤만 · 고름 값에 알약 id. - B05 물넘이포장 알약 = 고름 값에 알약 id(같은 m 일반 측점선 안 켬). Node 헬퍼 `helper_284_1_pill_pick.cjs` 가 진짜 TS 를 돌림. 화면은 사용자 확인. """ import json import os import subprocess import pytest HERE = os.path.dirname(os.path.abspath(__file__)) ROOT = os.path.abspath(os.path.join(HERE, "..", "..")) def _read(*parts: str) -> str: with open(os.path.join(ROOT, *parts), encoding="utf-8") as handle: return handle.read() @pytest.fixture(scope="module") def out(): proc = subprocess.run( ["node", os.path.join(HERE, "helper_284_1_pill_pick.cjs")], capture_output=True, text=True, encoding="utf-8", timeout=60, ) assert proc.returncode == 0, proc.stderr return json.loads(proc.stdout) def test_측점_심기_규칙(out): assert out["plants"] == { "drain": True, # A군 점 "wall": True, # C군 구간형 "ditch": False, # B군 "sign": False, # E군 표지 "sill": False, # D군 점 "unknown": True, # 종류 모름 = 옛 길 "pipe-80.00": True, # 관 "pipe-120.00": True, # 물넘이포장(286-1 측점 심음) } def test_측점_없는_알약은_측점선_짝_없음(out): line = out["line"] assert line["drain"] == "irregular:drain" and line["wall"] == "irregular:wall" assert line["pipe-80.00"] == "irregular:pipe-80.00" # 표지는 관 측점(80)과 같은 m 여도 그 선을 안 켬 · B군 · D군 점도 없음 · 물넘이포장 = 제 측점선(286-1) assert line["sign"] is None and line["pipe-120.00"] == "irregular:pipe-120.00" assert line["ditch"] is None and line["sill"] is None assert out["lineNoTypes"] == "irregular:pipe-80.00" # 종류 없이 부르면 옛 길 def test_관_측점선_다시_누름은_관_알약(out): assert out["keepSign"] == "pipe-80.00" assert out["keepPipe"] == "pipe-80.00" def test_종단도는_종류를_넘김(): profile = _read("A00_Common", "design", "design_profile.ts") assert ( "stationIdAtStructureOf(structureId, irregularStations, structures, structureTypes)" in profile ) assert " detail,\n structureTypes,\n );" in profile def test_B06_알약_풂과_측점_없는_관(): view = _read("B06_Section", "B06_Section_UI_Section_View_Profile.ts") assert "if (structureId === null) {" in view assert "selectDesign(shared.projectId, NO_SELECTION, { from: ESCAPE_FROM });" in view assert "if (edit?.selectPipe && !plantsStation(hit, types)) {" in view cross = _read("A00_Common", "design", "design_view_cross.ts") assert "selectPipe: (chainageM) => structuresPanel.selectPipeAt(chainageM)," in cross panel = _read("B06_Section", "B06_Section_UI_Page_Structures_Panel.ts") body = panel[panel.index("selectPipeAt: (chainageM) => {") :][:900] assert "deps.focusChainage(pipe.chainage_m, true);" in body assert "deps.markStructure?.(id);" in body assert "{ chainageM: pipe.chainage_m, structureId: id }," in body and '{ from: "b06" },' in body def test_B05_물넘이포장_알약은_id_를_남김(): view = _read("A00_Common", "design", "design_view_profile.ts") assert "const keepId = chainage === null || bridge.stationlessPipeMark(structureId);" in view assert "rememberPick(bridge.markChainage(structureId), keepId ? structureId : null);" in view page = _read("B05_Profile", "B05_Profile_UI_Page_Structures.ts") assert "stationlessPipeMark: (structureId: string | null): boolean => {" in page assert "return !!mark && !plantsStation(mark, []);" in page