- 줄 = 배치 열 · 행 / [이 장] [모든 장] / 표 배율 [배율 적용] / [안내선 숨기기] · 한 줄 안 같은 너비 - 단추 · 숫자 칸 · 이름 = 줄 위 작은 단추 토큰(--btn-bar-* · 높이 16) · 옛 한 줄 감기 · 48px 고정 지움 - 안내선 숨김 뒤 남는 검은 선 = 인쇄 칸선(도각 층 · #8ea0b5 · 밝은 바탕에서 짙게) — 지우지 않음 - 새 시험 test_212_3 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TNMXVCZXMpHpVvqmFkeChL
80 lines
3.8 KiB
Python
80 lines
3.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""212-3 B07 좌측 「횡단도」 배치 칸 — 단추 · 숫자 칸 한 규격 · 한 줄에 한 일 · 남는 검은 선 판정.
|
|
|
|
못박는 것
|
|
- 줄 = 「배치 열 · 행」 · 「[이 장] [모든 장]」 · 「표 배율 [배율 적용]」
|
|
· [안내선 숨기기](부르는 쪽).
|
|
- 단추 · 숫자 칸 · 이름 = 줄 위 작은 단추 토큰(187 `--btn-bar-*` · 높이 16) · 한 줄 안 같은 너비.
|
|
- 옛 한 줄 감기(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_단추_숫자_칸_한_규격_토큰():
|
|
shared = _block(".b07-cross-layout .ui-btn,\n.b07-cross-layout .ui-field .ui-input")
|
|
assert _decl(shared, "padding") == "var(--btn-bar-padding)"
|
|
assert _decl(shared, "font-size") == "var(--btn-bar-font-size)"
|
|
assert _decl(shared, "line-height") == "1"
|
|
assert _decl(shared, "height") == "auto" # 공용 작은 칸 30px 를 풀어 단추 높이에 맞춤
|
|
label = _block(".b07-cross-layout .ui-field__label")
|
|
assert _decl(label, "font-size") == "var(--btn-bar-font-size)"
|
|
# 토큰은 theme 한 곳(187)
|
|
assert "--btn-bar-padding: 1px var(--spacing-8);" in THEME
|
|
assert "--btn-bar-font-size: var(--text-caption);" in THEME
|
|
|
|
|
|
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
|