# -*- coding: utf-8 -*- """165 B06 노면공 고름 일관성 — 조사 K 재현 차례 6단계. 못박는 것(단계마다 폼 · 알약 · 포장층 · 고른 카드 · 세션 sid 가 같은 것을 가리킴) 1. 목록 노면공 = 범위 안 카드 · 포장층 · 알약 · 폼 · sid 모두 노면공(기준점이 범위 경계여도 범위 밖 카드로 안 감). 2. 범위 안 빈 카드(관 · 덮는 구조물 없음) = 노면공 그대로 · 카드만 옮김(165-1). 3. 고른 카드의 벽 = 관 폼 + 관 알약(알약이 꺼진 채 폼만 남지 않음 · 165-2) · 포장층 풂. 4. 알약 다시 = 1 과 같음. 관 자리 카드 = 관 · 범위 밖 카드 = 모두 풂(지금처럼). 5. B05 알약 → B06 복귀 = 1 과 같음 · 넘김 카드에서 안 튐. 6. 겹친 노면공 둘 = 고른 층만 · 범위 안 카드 눌러도 그 층 그대로. Node 헬퍼 `helper_165_pavement_flow.cjs` 가 진짜 SPN 에 폼 · 카드 · 알약 흉내를 붙여 돌림. 화면은 사용자 확인. """ 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_165_pavement_flow.cjs")], capture_output=True, text=True, encoding="utf-8", timeout=60, ) assert proc.returncode == 0, proc.stderr return json.loads(proc.stdout) def _pave(card, layer="pave", cards=12): return { "form": layer, "pill": layer, "paveLayer": layer, "paveCards": cards, "card": card, "sid": layer, } PIPE = {"form": "pipe-80.17", "pill": "pipe-80.17", "paveLayer": None, "paveCards": 0} def test_1_목록_노면공(out): assert out["step1"] == _pave(40) # 기준점 30 = 범위 경계 → 범위 안 첫 카드(20 아님) def test_2_범위_안_빈_카드는_노면공_그대로(out): assert out["step2re"] == _pave(40) # 이미 고른 카드 재누름도 그대로(167-3) assert out["step2"] == _pave(140) assert out["step2b"] == _pave(100) def test_3_벽은_관_폼과_관_알약_함께(out): assert out["step3"] == {**PIPE, "card": 100, "sid": None} def test_4_알약_다시_관_카드_범위_밖(out): assert out["step4"] == _pave(40) assert out["pipeCard"] == {**PIPE, "card": 80, "sid": None} assert out["outside"] == { "form": None, "pill": None, "paveLayer": None, "paveCards": 0, "card": 280, "sid": None, } assert out["outsideRe"]["card"] is None def test_5_B05_복귀(out): assert out["step5"] == _pave(40) def test_6_겹친_노면공(out): assert out["step6"] == _pave(100, "pave2", 6) assert out["step6b"] == _pave(160, "pave2", 6) def test_배선(): panel = _read("B06_Section", "B06_Section_UI_Page_Structures_Panel.ts") assert "deps.focusChainage(focusOf(structure));" in panel assert "return { chainageM, structureId: openId };" in panel # 관 알약은 폼 뒤(폼이 연 구조물을 닫으며 알약을 끔) at = panel.index("section.selectPipeByChainage(hit.pipeChainageM);") assert at < panel.index("deps.markStructure?.(`pipe-${hit.pipeChainageM.toFixed(2)}`);", at) view = _read("B06_Section", "B06_Section_UI_Section_View.ts") assert "spanMarkId = span || isPavement(structureId) ? structureId : null;" in view assert "if (selectedStationId === stationId && held) return;" in view