Files
Aislo/resources/tester/test_150_detail_pick.py
T
eomsangdonandClaude Opus 5.5 410c4042b6 feat(b06): 면적표 열 연동 · [상세] 그림 테마 색 · 칸 가득(173-3 · 173-4)
- 면적표 글자 = 그림 칸 폭 비례(clamp · cqw) · 표 높이 변수 같은 식 · 4열부터 「계」만(그리드 data-columns)
- [상세] 그림 = 테마 토큰(어두운 고정색 지움) · 카드 그리기 함수로 모달 칸 크기에 맞춰 새로 그림(fitPlotBase · 빈 띠 없음)
- 칸 크기 바뀌면 다시 그림(ResizeObserver) · clip id 카드와 가름 · 그리는 동안 refresh 되먹임 막음
- 시험 test_173_areas_detail 새로 · test_164 · test_150 단정 고침

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JywHxQuWPk6UYXTebyrBoU
2026-10-10 08:42:45 +09:00

99 lines
3.6 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
assert "highlightDetail(svg, state.section.design, picked)" in src
assert 'closest<HTMLElement>("[data-key]")' 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
assert "body.append(cad, note, tableBox)" in src
assert "pointer-events: none" not in css 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 칸 가득