Files
Aislo/resources/tester/test_307_pick_highlight.py
T
eomsangdonandClaude Opus 5.5 cb4bab7bf2 feat(구조물표): 323-5 고름 한 칸 — 관 세션 id(옮겨도 그대로 · 저장 안 함) · 고름 강조 한 규칙(pickLights · 카드 형상 · 3D 같은 함수) · 그린 것마다 신원표(data-structure-id + data-part) · 같은 자리 거리 = PIPE_MATCH_M 하나 · 322-0 이 깬 옛 시험 도움 파일 · 줄 수 고침
- `design_pipe_ids.ts` — 장부(세션 pipe-ids) · pipe-s{차례} · 자리 → id(찾는 거리 안 가장 가까운 것) · followMovedPipe 가 id 를 새 자리로(고름 id 그대로 · 순환 import 없게 design_selection 에서 옮김) · 설계 페이지가 프로젝트를 정함(usePipeIds) · 자리 이름 만들기 열 곳 · 되읽기 둘 걷음 · 측점 계획 주인 = 세션 id(withPipeIds)
- `design_pick_match.ts` — pickLights(① id ② 같은 자리 ③ 고른 부분) · paintPicked(카드 통째 형상 · 부분 · 관 계열 · 포장층은 제 손잡이) · tagShape — 관 세트 벽 · 집수정 · 관 · 세월교 측벽 · 몸체 · BOX 끝 · C군 벽 · 물넘이 콘크리트에 신원표 · 형상 판정면은 통째 형상 · 콘크리트만
- 3D — 부재 맞춤 = pickLights(옛 0.01 걷음) · C군 벽 솔리드 = 구조물 id(덮는 측점 어디서 골라도 한 번 스윕한 벽이 켜짐)
- 322-0 이 깬 것 고침 — 노면공 흐름 도움 파일(165 · 231-1) 정의 판 확인 흉내 · design_view_profile 700줄(322-0 이 704)
- 시험: test_323_5_pick(세션 id · 옮김 · 강조 규칙 · 칠하기) · 옛 시험 도움 파일 흉내 · 기대 글 고침

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
2026-10-14 18:06:13 +09:00

173 lines
9.0 KiB
Python

"""307 B06 고름 강조 — 측점 고름은 형상 안 켬 · 연동 관 = 콘크리트만 · 측점 없는 구조물 = 카드 · 스크롤 없음.
공통(「관」 setter 가름 · 벽 고름 콘크리트 표식)은 진짜 TS 를 Node 로 돌려 보고(helper_307),
길마다(측점선 · 알약 · 좌측 목록 측점 · 영역 × 노면공 · 물넘이포장 · 연동 관 · 측점 없는 구조물)는
그 길이 모이는 자리의 배선을 본다.
"""
import json
import re
import subprocess
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[2]
HELPER = Path(__file__).with_name("helper_307_pick_highlight.cjs")
def _read(*parts: str) -> str:
return (ROOT.joinpath(*parts)).read_text(encoding="utf-8")
@pytest.fixture(scope="module")
def out() -> dict:
run = subprocess.run(
["node", str(HELPER)], capture_output=True, text=True, encoding="utf-8", cwd=ROOT
)
assert run.returncode == 0, run.stderr
return json.loads(run.stdout)
# ── 공통 ───────────────────────────────────────────────────────────────
def test_공통_관_setter_콘크리트와_관_가름(out):
split = out["split"]
assert split["concretePipe"] == {"base": [None], "shape": [True]} # 콘크리트만
assert split["pipePipe"] == {"base": ["pipe"], "shape": [False]} # 관만
assert split["concreteWall"] == {"base": ["inlet"], "shape": [False]} # 다른 벽 그대로
assert split["none"] == {"base": [None], "shape": [False]}
def test_공통_벽고름_콘크리트_표식(out):
cases = out["revetCases"]
assert cases["pipeOnPipeCard"] == {"shape": False, "selected": "pipe"}
assert cases["concreteOnPipeCard"] == {"shape": True, "selected": "pipe"}
assert cases["concreteOnOwnCard"] == {"shape": True, "selected": "pipe"}
assert cases["handoffOnOwnCard"] == {"shape": True, "selected": "pipe"}
assert cases["wall"] == {"shape": False, "selected": "inlet"}
assert cases["released"] == {"shape": False, "selected": None}
assert cases["changes"] == 6 # 고를 때마다 연동 카드 다시 칠함(그대로)
# ── 물넘이포장 × 측점 길 넷 ────────────────────────────────────────────
def test_물넘이포장_측점길은_콘크리트_안켬(out):
# 측점선 · 알약 · 좌측 목록 측점 · 영역 = 끝에 `selectMark("pipe-…")` → highlightShapes
assert out["byStationPath"] == {"concreteOff": False, "concreteLitKept": True}
view = _read("B06_Section", "B06_Section_UI_Section_View.ts")
assert "highlightShapes(card, pickedMarkId);" in view
shape = _read("B06_Section", "B06_Section_UI_Cross_Shape_Pick.ts")
assert "paintPicked(root, { structureId })" in shape # 고름 강조 한 규칙(323-5)
paint = _read("A00_Common", "design", "design_pick_match.ts")
assert (
'if (id.startsWith("pipe-") || shape.getAttribute("data-part") !== null) continue;' in paint
)
# 네 길이 모이는 자리 — 카드 고름 리스너 · 목록 관 줄 · 폼 관 열기 · 측점 없는 관
cross = _read("A00_Common", "design", "design_view_cross.ts")
assert "sectionView.selectMark(mark, false);" in cross
panel = _read("B06_Section", "B06_Section_UI_Page_Structures_Panel.ts")
# 알약 id = 관 세션 id(323-5)
assert (
"deps.markStructure?.(pipeIdAt(hit.pipeChainageM, deps.projectId));" in panel
) # 카드 → 폼
assert "deps.markStructure?.(chainageM === null ? null : pipeIdAt(" in panel # 목록 관 줄
# 측점 길은 「관」 벽 고름을 안 엶 — 카드만 고르면 벽 고름을 비움(그대로)
assert "stationControls.revetOffset.select(target.chainage_m, null);" in cross
def test_물넘이포장_형상누름은_콘크리트(out):
view = _read("B06_Section", "B06_Section_UI_Cross_View.ts")
assert 'shapePickRoute(svg, (at) => toggleRevet("pipe", at))' in view
assert "splitPipePick(setRevetActive, setShapeActive, shapePicked)" in view
assert "setRevetActive(highlightRevet);" in view
assert out["revetCases"]["concreteOnOwnCard"]["shape"] is True
# ── 노면공 × 측점 길 넷 ──────────────────────────────────────────────
def test_노면공_포장층은_포장층_누름만():
view = _read("B06_Section", "B06_Section_UI_Section_View.ts")
assert "const pave = span && isPavement(spanMarkId) && paveShapeId === spanMarkId;" in view
# 알약 · 목록 · 측점 길 = 누름 턴 밖 selectMark → 포장층 표식 풂
assert "if (!paveShapeTurn) paveShapeId = null;" in view
# 포장층 누름 = 턴 안에서 목록 고름 길을 타고 · 끝나면 그 노면공 포장층만 켬
grid = re.search(
r"const pave = pavementAt\(event\.target, spanMarks\);(.*?)\n \},", view, re.S
)
assert grid, "포장층 누름 처리 없음"
body = grid.group(1)
assert body.index("paveShapeTurn = true;") < body.index("pavementSelectListener?.(")
assert body.index("paveShapeTurn = false;") < body.index("paveShapeId = pave.structure_id;")
assert body.index("paveShapeId = pave.structure_id;") < body.index("syncSpanHighlights();")
# 범위 테두리(--span)는 그대로 — 다른 구간형 구조물과 같은 길
assert 'card.classList.toggle("b06-cross-card--span", span);' in view
assert "spanMarkId = span || isPavement(structureId) ? structureId : null;" in view
# ── 연동 관 ───────────────────────────────────────────────────────────
def test_연동관_콘크리트누름은_관형상_안켬(out):
assert out["revetCases"]["concreteOnPipeCard"] == {"shape": True, "selected": "pipe"}
assert out["split"]["concretePipe"]["base"] == [None] # 관 그림 setter 엔 「관」 안 감
select = _read("B06_Section", "B06_Section_UI_Page_Structures_Selection.ts")
assert "origRevet(chainageM, key, ownerM);" in select
view = _read("B06_Section", "B06_Section_UI_Cross_View.ts")
# 콘크리트 ↔ 관 그림 바꿔 누름 = 풀지 않고 옮김 · 같은 것 다시 누름 = 풂
assert (
"activeRevet = activeRevet === key && (ownerM !== undefined) === shapePicked() ? null : key;"
in view
)
# 좌측 하위 컨테이너 켬(경사각도 상자)은 그대로 — 「관」 벽 고름 길
dock = _read("B06_Section", "B06_Section_UI_Adjust_Dock.ts")
assert 'side === "pipe" && (!own || own.closest("[hidden]")) ? visibleBox(SLOPE_BOX)' in dock
# ── 측점 없는 구조물 ──────────────────────────────────────────────────
def test_측점없는_구조물_카드_스크롤_없음():
view = _read("B06_Section", "B06_Section_UI_Section_View.ts")
body = re.search(r"revealStation\(\) \{(.*?)\n \},", view, re.S)
assert body, "revealStation 없음"
assert "revealCard" not in body.group(1)
assert "markCard(previous);" in body.group(1) # 옛 카드는 풂
panel = _read("B06_Section", "B06_Section_UI_Page_Structures_Panel.ts")
# B06 알약 · 좌측 목록 = 폼 onSelect · 측점 없는 관 = selectPipeAt — 둘 다 revealOnly 길
assert (
"const revealOnly = !coverable(structure) || !plantsStation(structure, markTypes);" in panel
)
assert "deps.focusChainage(pipe.chainage_m, true);" in panel
# B05 알약 · 3D · 지도 넘김 = focusPicked — 측점 없는 구조물은 카드 고름을 안 부름
focus = re.search(r"focusPicked: \(structureId, focus\) => \{(.*?)\n \},", panel, re.S)
assert focus, "focusPicked 없음"
assert "if (!known || plantsStation(known, markTypes)) {" in focus.group(1)
assert "if (known) section.selectById(structureId);" in focus.group(1)
cross = _read("A00_Common", "design", "design_view_cross.ts")
assert "structuresPanel.focusPicked(handoff?.structureId ?? null, () =>" in cross
profile = _read("B06_Section", "B06_Section_UI_Section_View_Profile.ts")
assert "edit.selectStructure(hit.structure_id);" in profile
# ── 지킬 것 ───────────────────────────────────────────────────────────
def test_맹암거_형상강조_그대로(out):
assert out["drainLit"] is True
assert out["afterRelease"] == {"drain": False, "concreteLit": True}
def test_줄_한도():
assert len(_read("A00_Common", "design", "design_view_cross.ts").splitlines()) <= 685
for name in (
"B06_Section_UI_Cross_View.ts",
"B06_Section_UI_Section_View.ts",
"B06_Section_UI_Page_Station_Controls.ts",
"B06_Section_UI_Page_Structures_Panel.ts",
):
assert len(_read("B06_Section", name).splitlines()) <= 700, name