Files
Aislo/resources/tester/test_307_pick_highlight.py
T
eomsangdonandClaude Opus 5.5 281c71b55b refactor(logic): 348-1 순수 계산 TS 49 파일 <페이지>/logic/ 로 옮김 — 이름 앞머리 그대로 · 동작 고침 없음
- 옮김: B04 2 · B05 23 · B06 11 · A00_Common/design 13 (9,299 줄) · 이미 logic/ 에 있던 16 파일 그대로
- 안 옮김: 묶음 입구(package.json build:*) · 파이썬 · 순수지만 계산 아닌 8 (보기 결선 · 콜백 · API 타입 · 갈아끼움 알림판)
- import 266 줄(142 파일) · 시험 · 주석 · 짝 표시 문자열 경로 고침 · B05 · B06 CLAUDE.md 짝 줄 logic/
- 시험 도우미 새 경로: 가짜 require 열쇠 · B05()/B06() 부름 · 형제 import 자리 · tsc 묶어 돌리는 시험 · 정규식 · rglob
- design_view_cross 줄 한도 시험 685 → 688 (긴 import 경로 줄바꿈 3줄)
- 확인: typecheck 0 · 서버 묶음 넷(corridor · server-calc · b07-extent · b07-note) 다시 지어 코드 같음(//#region 경로 주석만 다름) · 관련 시험 270 파일 — 남은 실패 19 는 옮기기 전과 같음

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014utrjfoW831Vc5wJUd13kL
2026-10-16 13:44:50 +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()) <= 688
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