Files
Aislo/resources/tester/test_b05_b06_selection_single.py
T
eomsangdonandClaude Opus 5.5 26c2e8b05f fix(b06): 횡단도 구조물 고르기 → 좌측 패널 연결 점검 · 고침(53-1)
- 다른 측점 부재를 누를 때 옛 카드 선택 풀기가 폼 · 선택 칸을 비우던 것 막음(첫 누름부터 잡힘)
- 컨테이너 상자 강조가 폼 다시 그리기에 지워지던 것 · 옛 상자 강조 남던 것 · 유입 · 유출도 보이게 스크롤
- 고른 구조물 기준 측점 고침 = 바로 반영 · 횡단 카드 · 알약 · 선택 칸이 따라감
- 부재키는 같은 것을 다시 적을 때만 지킴 · 풀면 지움(B05 ↔ B06 오갈 때 옛 조정창 안 열림)
- 카드 고름이 일반 측점 · 이음 카드 알약을 지우던 것 → 연 구조물 알약 지킴
- B05 되살리기 = 구조물 id 가 같은 측점 관보다 먼저 · B06 다시 들어올 때 넘김값 다시 적용
- 시험: ui_checks/53-1_횡단_고르기.js(점검 116 · 흠 0) · 선택 시험 새 규칙으로

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W4uKaV4ZBhsJN4GHG7yRj4
2026-10-06 10:20:37 +09:00

210 lines
8.8 KiB
Python

# -*- coding: utf-8 -*-
"""측점 · 구조물 고름 한 곳 회귀검증 — PLAN 24-2d (2026-09-29).
• 관 찾는 거리 한 값(`PIPE_MATCH_M = 0.51`) — 정의는 한 곳, 옛 0.05 는 없음
• 횡단 카드 · 종단 알약 · 목록 · 3D 표지 어디서 골라도 같은 순서(관 → 구조물) · 같은 거리로 폼이 열 항목을 풂
• 세션 값(`structure-pick`) 읽기 · 쓰기 · 알림 — 부재키 지킴 · 같은 값 조용 · 되울림 막음
• B06 진입 때 옹벽 · 기슭막이 카드를 구조물 id 로 찾음
화면 그릇 없이 Node 헬퍼가 TS 를 트랜스파일해 돌린다(`helper_b05_b06_selection.cjs`).
실제 화면 조작은 ORCA(자체 확인)로 따로 본다.
"""
import json
import os
import re
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_b05_b06_selection.cjs")],
capture_output=True,
text=True,
timeout=60,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
# ── 거리 한 값 ─────────────────────────────────────────────────────────────
def test_거리_값은_0_51_하나(out):
assert out["matchM"] == 0.51
def test_거리_정의는_한_곳뿐이고_옛_0_05는_없다():
definitions = []
for folder in ("A00_Common", "B05_Profile", "B06_Section"):
for current, _dirs, names in os.walk(os.path.join(ROOT, folder)):
if "node_modules" in current:
continue
for name in names:
if not name.endswith(".ts"):
continue
text = _read(os.path.relpath(os.path.join(current, name), ROOT))
if re.search(r"\b(const|let)\s+PIPE_MATCH_M\b", text):
definitions.append(name)
assert definitions == ["design_selection.ts"]
for name, folder in (
("B05_Profile_UI_Structures_Panel.ts", "B05_Profile"),
("design_view_profile.ts", "A00_Common/design"),
("design_view_cross.ts", "A00_Common/design"),
("B05_Profile_UI_Selection.ts", "B05_Profile"),
("B06_Section_UI_Page_Structures_Panel.ts", "B06_Section"),
("B06_Section_UI_Page_Structure_Pick.ts", "B06_Section"),
("B05_Profile_UI_Structure_Pick_Session.ts", "B05_Profile"),
):
text = _read(folder, name)
assert not re.search(r"<\s*0\.05\b", text), name
assert not re.search(r"[-+]\s*0\.51\b", text), name
# ── 카드 누름 → 폼이 열 항목 ────────────────────────────────────────────
def test_카드_측점이_관에서_0_05보다_어긋나도_관을_찾는다(out):
assert out["card"]["pipeNear"] == {"pipeChainageM": 173.09, "structureId": None}
assert out["card"]["pipeFar"]["pipeChainageM"] is None # 0.51 m 밖은 다른 자리
def test_옹벽_기슭막이_카드는_구조물_폼을_연다(out):
for key in ("wallStart", "wallMiddle", "wallEdge"):
assert out["card"][key] == {"pipeChainageM": None, "structureId": "wall"}, key
assert out["card"]["revet"]["structureId"] == "revet"
def test_같은_측점에_관과_구조물이_겹치면_관이_먼저(out):
assert out["card"]["pipeBeatsStructure"]["pipeChainageM"] == 205.2
def test_구조물_id가_있으면_id가_이기고_없는_id는_측점으로_되돌아간다(out):
assert out["card"]["byId"]["structureId"] == "revet"
assert out["card"]["staleId"]["structureId"] == "wall"
def test_고를_것이_없으면_해제(out):
assert out["card"]["none"] == {"pipeChainageM": None, "structureId": None}
assert out["card"]["cleared"] == {"pipeChainageM": None, "structureId": None}
# ── 세션 값 + 알림 ─────────────────────────────────────────────────────
def test_세션에_적고_읽는다(out):
assert out["store1"] == {"chainageM": 205, "structureId": "wall", "partKey": "own"}
assert out["handoff"] == {"at": 205, "key": "right", "structureId": "wall"}
assert out["handoffNone"] is None
assert out["noProject"] is None
def test_부재키를_안_주면_지키고_해제하면_비운다(out):
assert out["keyKept"] == "own"
assert out["keyDropped"] is None # 다른 구조물로 옮기면 옛 부재가 안 따라옴(53-1)
assert out["cleared"] is None
def test_같은_값은_알리지_않고_출처를_함께_알린다(out):
assert out["sameQuiet"] == 1
assert out["heardFrom"] == [
[205, "wall", "b06"],
[205.2, "wall", "b06"],
[173.09, None, "b05"],
[None, None, "b05"],
]
assert out["afterOff"] == 4 # 구독을 끊으면 더는 안 들림
def test_알림_도중_다시_낸_값은_적기만_한다(out):
assert out["echoes"] == 1
assert out["lastWritten"] == 2
# ── B06 진입 때 카드 찾기 ──────────────────────────────────────────────
def test_관_카드는_거리_안에서_바로_찾는다(out):
assert out["apply"]["pipeOffsetCard"] == [["focus", "s173.09"]]
def test_옹벽은_구조물_id로_시작_카드를_찾는다(out):
assert out["apply"]["wallByAnchor"] == [["focus", "s200"]]
assert out["apply"]["wallNoId"] == [["focus", "s200"]]
def test_기슭막이_부재키는_그_카드의_조정창을_연다(out):
assert out["apply"]["revetCardFirst"] == [
["focus", "s80"],
["revet", 80, "own"],
["refresh", 80],
]
def test_카드를_못_찾으면_false로_알려_나중에_다시_부르게_한다(out):
assert out["retry"] == {
"before": False,
"after": True,
"notFound": False,
"emptyHandoff": False,
}
def test_모르는_자리_또는_값_없음은_아무것도_안_한다(out):
assert out["apply"]["unknown"] == []
assert out["apply"]["none"] == []
# ── B05 진입 때 되살리기 ───────────────────────────────────────────────
def test_B05_되살리기_관은_측점만으로_구조물을_짐작하지_않는다(out):
pipe = out["restore"]["pipeOnly"]
assert pipe["calls"] == [["3d", 85.05, None], ["station", 85.05]]
assert pipe["done"] is False # 관 목록이 실리면 다시 불린다
def test_B05_되살리기_구조물_id가_있으면_그_구조물을_연다(out):
structure = out["restore"]["structure"]
assert structure["calls"] == [
["3d", 205, "own"],
["station", 205],
["selectAt", 205, "wall"],
]
assert structure["done"] is True
def test_B05_되살리기_적힌_것이_없으면_끝난_것(out):
assert out["restore"]["nothing"] == {"calls": [], "done": True}
def test_B05_되살리기_같은_측점_관보다_구조물_id가_먼저(out):
# B06 에서 고른 반사경(22+0) — 측점이 관을 먼저 열어도 id 의 구조물로 연다(53-1)
over = out["restore"]["structureOverPipe"]
assert over["calls"][-1] == ["selectAt", 440.24, "mirror"]
assert over["done"] is True
# ── 배선 ───────────────────────────────────────────────────────────────
def test_횡단도_벽_구체_눌러도_폼은_같은_길_하나():
panel = _read("B06_Section", "B06_Section_UI_Page_Structures_Panel.ts")
assert "showPipeAt" not in panel # 관 전용 길을 없앰
assert panel.count("panel.showAtChainage(") == 3 # 기슭막이 · 세월교 · BOX
assert panel.count("panel.releasePipe()") == 3 # 벽 선택을 풀 때는 관 폼만 비움
assert "section.selectAt(" in panel
page = _read("A00_Common/design", "design_view_cross.ts")
assert "writeStructurePick" not in page
assert "selectDesign(" in page
def test_고름은_selectDesign_한_길로_적는다():
for folder, name in (
("A00_Common/design", "design_view_profile.ts"),
("B05_Profile", "B05_Profile_UI_Structure_Pick_Session.ts"),
("B06_Section", "B06_Section_UI_Page_Structures_Panel.ts"),
):
text = _read(folder, name)
assert "writeStructurePick" not in text, name
assert "rememberStructurePick" not in text, name
assert "selectDesign(" in _read("B05_Profile", "B05_Profile_UI_Structure_Pick_Session.ts")