- ui_template: .ui-panel-form(칸 26px · 라벨 틈 2px · 캡션 글자 · 단추 크기) · .ui-panel-btn · createPanelCard - 칸 높이 · 라벨 틈 토큰 = theme 한 곳 · 「구조물 배치」도 같은 토큰 - B07 평면도 · 횡단도 묶음 = 공용 카드 · 도면 단추 = .ui-panel-btn · 페이지 덧칠 걷음 - 시험 test_269_panel_form · 212-3 기대값 · 130 · 153 헬퍼 공용 카드 연결 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QND7Co43B24zK2P937rdxt
77 lines
3.7 KiB
Python
77 lines
3.7 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""212-3 B07 좌측 「횡단도」 배치 칸 — 단추 · 숫자 칸 한 규격 · 한 줄에 한 일 · 남는 검은 선 판정.
|
|
|
|
못박는 것
|
|
- 줄 = 「배치 열 · 행」 · 「[이 장] [모든 장]」 · 「표 배율 [배율 적용]」
|
|
· [안내선 숨기기](부르는 쪽).
|
|
- 단추 · 숫자 칸 · 이름 = 좌측 패널 공용 양식(269 `.ui-panel-form`) · 한 줄 안 같은 너비.
|
|
- 옛 한 줄 감기(flex-wrap) · 숫자 칸 48px 고정 없음.
|
|
- [안내선 숨기기] 뒤 남는 검은 선 = 인쇄 칸선(도각 층 도면 개체 · 회청 `#8ea0b5`
|
|
· 밝은 바탕에서 짙게 그려짐) — 안내선(겹판)과 다른 것이라 지우지 않음 · 단추는 겹판만 끔.
|
|
"""
|
|
|
|
import re
|
|
from pathlib import Path
|
|
|
|
from B07_DesignDetail.B07_DesignDetail_Engine_Cad import FRAME_LAYER_ID, TABLE_LINE_COLOR
|
|
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_Sheet import _grid_lines
|
|
from B07_DesignDetail.B07_DesignDetail_Engine_Template import use_project_templates
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
CSS = (ROOT / "B07_DesignDetail/B07_DesignDetail_UI_Style.css").read_text(encoding="utf-8")
|
|
PANELS = (ROOT / "B07_DesignDetail/B07_DesignDetail_UI_Panels.ts").read_text(encoding="utf-8")
|
|
PAGE = (ROOT / "B07_DesignDetail/B07_DesignDetail_UI_Page.ts").read_text(encoding="utf-8")
|
|
GUIDE = (ROOT / "B07_DesignDetail/openwebcad/src/integration/guide-area.ts").read_text(
|
|
encoding="utf-8"
|
|
)
|
|
THEME = (ROOT / "ui_template/ui_template_theme.css").read_text(encoding="utf-8")
|
|
|
|
|
|
def _block(selector: str) -> str:
|
|
m = re.search(r"(?:^|\n)" + re.escape(selector) + r"\s*\{([^}]*)\}", CSS)
|
|
assert m, selector
|
|
return m.group(1)
|
|
|
|
|
|
def _decl(block: str, prop: str) -> str:
|
|
m = re.search(r"(?:^|;|\s)" + re.escape(prop) + r"\s*:\s*([^;]+);", block)
|
|
assert m, prop
|
|
return m.group(1).strip()
|
|
|
|
|
|
def test_단추_숫자_칸_한_규격_토큰():
|
|
# 269 — 크기는 좌측 패널 공용 양식(`.ui-panel-form`)이 줌 · B07 덧칠(줄 위 작은 단추 토큰) 없음
|
|
assert ".b07-cross-layout .ui-btn" not in CSS
|
|
assert ".b07-cross-layout .ui-field .ui-input {" in CSS # 폭만
|
|
assert "height" not in _block(".b07-cross-layout .ui-field .ui-input")
|
|
label = _block(".b07-cross-layout .ui-field__label")
|
|
assert "font-size" not in label
|
|
assert "createPanelCard(" in PANELS # 배치 칸이 사는 횡단도 묶음 = 공용 카드
|
|
|
|
|
|
def test_한_줄에_한_일_같은_너비():
|
|
box = _block(".b07-cross-layout")
|
|
assert _decl(box, "flex-direction") == "column"
|
|
assert "flex-wrap" not in box
|
|
assert _decl(_block(".b07-cross-layout__row > *"), "flex") == "1 1 0"
|
|
assert "width: 48px" not in CSS
|
|
assert 'line.className = "b07-cross-layout__row"' in PANELS
|
|
assert "row(cols.root, rows.root)" in PANELS
|
|
assert re.search(r"row\(\s*action\(\"이 장\"[^;]*action\(\"모든 장\"", PANELS, re.S)
|
|
assert "box.append(row(scale.root, button));" in PANELS
|
|
# 안내선 단추 = 배치 칸 맨 아래 한 줄(전체 폭)
|
|
assert "controls.append(guideToggle);" in PAGE
|
|
|
|
|
|
def test_남는_검은_선은_인쇄_칸선_지우지_않음():
|
|
use_project_templates(None)
|
|
lines = _grid_lines("cross_s00000m", 4, 4)
|
|
assert len(lines) == 10 # 세로 5 · 가로 5 그대로
|
|
assert all(e["layerId"] == FRAME_LAYER_ID for e in lines)
|
|
assert all(e["lineColor"] == TABLE_LINE_COLOR == "#8ea0b5" for e in lines)
|
|
# 안내선 단추는 겹판(점선 영역 + 붉은 틀)만 — 도면 개체를 안 건드림
|
|
draw = GUIDE[GUIDE.index("export function drawGuide") :]
|
|
draw = draw[: draw.index("\n}\n")]
|
|
assert "if (!guide || !guideVisible) return;" in draw
|
|
assert "getEntities" not in draw and "setEntities" not in draw
|