"""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("[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 칸 가득