- 상세 창 차례 = 그림 → 표 → CAD 칸 · 칸 머리 한 줄 접기(공용 ui-collapsible) · 열 때 일반 측점 접힘 · 구조물 측점 폄 · 처음 펼 때 칸 만듦 - 미리 넣는 글 = 그 측점 구조물(관 지점 · 구조물 배치 기준 측점)마다 지정된 구조물 조합 이름 줄 · 미지정 = 「이름 조합 미지정」 · 배관 = 원형 마크(본체 줄 없음) · 옛 관보호공 · 관유출부보강 짜 맞춘 글 버림 - B07 짝(CulvertNote.py) 같은 규칙 · 정본 structures.json · 구조물정의 이름까지 읽음 - 시험 test_265_note_cad 넓힘 · test_260 · test_150 기대값 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TNMXVCZXMpHpVvqmFkeChL
103 lines
4.0 KiB
Python
103 lines
4.0 KiB
Python
"""PLAN 150-4 — B06 [상세] 수량표 칸 누름 = 그림 복제 안 그 항목 강조.
|
|
|
|
짝: `B06_Section/B06_Section_UI_Cross_Detail_Pick.ts`(짝 표 · 구역) · `_UI_Cross_Detail.ts`(칸 키 · 누름).
|
|
실제 TS 를 `helper_150_detail_pick.cjs` 가 Node 로 돌린다.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
import subprocess
|
|
|
|
import pytest
|
|
|
|
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_Table import QUANTITY_VALUE_KEYS
|
|
|
|
HERE = os.path.dirname(__file__)
|
|
ROOT = os.path.join(HERE, "..", "..")
|
|
|
|
pytestmark = pytest.mark.skipif(
|
|
not os.path.isdir(os.path.join(ROOT, "config", "node_modules")),
|
|
reason="프론트엔드 의존성 미설치",
|
|
)
|
|
|
|
# 늘 빈칸(`Engine_Cross_Quantity` 근거 없음) = 누름 없음
|
|
NO_PICK = {"fence", "grubbing", "topsoil_fill", "topsoil_cut"}
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def out() -> dict:
|
|
proc = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", os.path.join(HERE, "helper_150_detail_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_표_키_22_모두_짝_또는_누름_없음(out):
|
|
assert set(out["targets"]) | NO_PICK == set(QUANTITY_VALUE_KEYS)
|
|
assert not set(out["targets"]) & NO_PICK
|
|
|
|
|
|
def test_판정_선_구역(out):
|
|
assert out["zone"] == {
|
|
"road": "road",
|
|
"ditch": "ditch",
|
|
"cutSlope": "cut_slope",
|
|
"fillSlope": "fill",
|
|
}
|
|
|
|
|
|
def test_칸마다_그림_강조(out):
|
|
active = out["active"]
|
|
assert active["null"] == [] # 카드에서 묻어 온 강조도 지움
|
|
assert active["cut_soil"] == ["b06-chart__area--cut_soil"]
|
|
assert active["cut_rock"] == ["b06-chart__area--cut_rock"]
|
|
assert active["embankment"] == ["b06-chart__area--fill"]
|
|
assert active["spoil_fill"] == ["b06-chart__spoil-fill"]
|
|
assert active["ground"] == ["b06-chart__center"]
|
|
assert active["ditch_soil"] == ["ditch"]
|
|
assert active["grading_cut"] == ["cutSlope"]
|
|
assert active["grading_fill"] == ["fillSlope"]
|
|
assert active["road_compaction"] == ["road"]
|
|
assert active["fence"] == []
|
|
|
|
|
|
def test_대상_있는_키만_빈칸은_빠짐(out):
|
|
"""164-2 — 그림에 대상이 없는 칸(암석 띠 · 사토장 없음)은 `data-empty`."""
|
|
assert out["present"] == sorted(out["targets"])
|
|
assert set(out["present"]) - set(out["presentBare"]) == {"cut_rock", "spoil_fill"}
|
|
|
|
|
|
def test_상세_표_칸_키_누름_배선():
|
|
with open(
|
|
os.path.join(ROOT, "B06_Section", "B06_Section_UI_Cross_Detail.ts"), encoding="utf-8"
|
|
) as f:
|
|
src = f.read()
|
|
assert "element.dataset.key = key" in src
|
|
# 259-2 — 저장 띠 출처면 그 띠 · 저장 조각이면 강조 없음(그래프 고름) · 값 칸(data-cell)도 누름
|
|
assert "highlightDetail(svg, state.section.design, band)" in src
|
|
assert 'closest<HTMLElement>("[data-key], [data-cell]")' in src
|
|
|
|
|
|
def test_상세_큰_창_공용_막_그림_글_표_순서():
|
|
"""150-2 — 투명 막 지움(밖 누르면 공용 닫기) · 큰 창 · 그림 → 글 → 표 · 스크롤 없음."""
|
|
base = os.path.join(ROOT, "B06_Section")
|
|
with open(os.path.join(base, "B06_Section_UI_Cross_Detail.ts"), encoding="utf-8") as f:
|
|
src = f.read()
|
|
with open(os.path.join(base, "B06_Section_UI_Style_Cross_Detail.css"), encoding="utf-8") as f:
|
|
css = f.read().replace(chr(13), "")
|
|
assert "wide: true" in src and "backdropClass" not in src
|
|
# 265-1 — 그림 → 표 → CAD 칸(글 칸 자리)
|
|
assert "body.append(cad, tableBox, noteBox)" in src
|
|
# 막 없음 — 259-3 표 강조 바깥 줄(누름 통과)만 pointer-events: none
|
|
backdrop = css.split(".b06-detail__pick-outline {")[0]
|
|
assert "pointer-events: none" not in backdrop and "b06-detail__backdrop" not in css
|
|
assert ".ui-modal.b06-detail > .ui-modal__body {\n overflow: hidden;" in css
|
|
assert "flex: 1;\n min-height: 0;" in css and "height: 100%;" in css # 173-4 칸 가득
|