Files
Aislo/resources/tester/test_507_3_mc_label.py
T
eomsangdonandClaude Sonnet 5.5 7312b095bd fix(507-3 덧 MC): B07 계획평면도 MC 큰 글 (MC) · B05 종단 아래 표 측점 행 (MC) · B07 횡단 장 단추 (MC) — 요구 311-4
- 평면도 측점 글 = 5 배수만 → 종단 kind curve 측점도 큰 글 + 원 + (MC)
- 종단 표 측점 행 · 고른 측점 값 열 = (MC) · 굵게 · 경고색 · 칸 폭 판정은 옛 글 그대로
- 횡단 장 단추 이름 뒤 (MC) · 긴 이름이라 두 열 가로지름
- test_507_3_mc_label 칸 넷 더함

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 16:23:33 +09:00

126 lines
5.6 KiB
Python

"""PLAN 507-3 — MC(곡선 가운데 · 측점 `kind` curve) 강조 · B07~B09 (MC).
B05 · B06 화면 = (MC) · 한 단계 크게 · 굵게 · 경고색(`--color-warning` — 밝음 · 어두움 테마 둘 다) ·
B07 CAD 종단 표 · 횡단 제목 = 09-03 표기 뒤 「 (MC)」(평면은 5 배수 측점만 글 · MC 글 없음) ·
B08 토적표(B09 인쇄가 같은 표) = 서버가 MC 줄에 `mc` ·
브라우저 측점 갈아끼움 이름 = 서버 꼴 「STA… (MC)」.
"""
from __future__ import annotations
import json
from pathlib import Path
from B07_DesignDetail.B07_DesignDetail_Engine_Cad import mc_suffix
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_Long import _long_table_values
from B08_Quantity.B08_Quantity_Router_Earthwork import _mc_chainages
ROOT = Path(__file__).resolve().parents[2]
STATIONS = [
{"chainage_m": 580.0, "kind": "regular", "center_z": 10.0},
{"chainage_m": 599.0, "kind": "curve", "center_z": 10.5},
{"chainage_m": 600.0, "kind": "regular", "center_z": 11.0},
]
def _src(relative: str) -> str:
return (ROOT / relative).read_text(encoding="utf-8")
def test_mc_suffix_only_curve() -> None:
assert mc_suffix({"kind": "curve"}) == " (MC)"
assert mc_suffix({"kind": "regular"}) == ""
assert mc_suffix({"kind": "irregular"}) == ""
assert mc_suffix(None) == ""
def test_b07_long_table_station_mc() -> None:
rows = _long_table_values(STATIONS, STATIONS, [(0.0, 10.0), (700.0, 12.0)], {}, 20.0)
assert [row["station"] for row in rows] == ["No.29", "No.29+19.0 (MC)", "No.30"]
def test_b08_mc_chainages_from_longitudinal(tmp_path: Path) -> None:
relative = "B06_Section/longitudinal/longitudinal.json"
path = tmp_path / relative
path.parent.mkdir(parents=True)
path.write_text(json.dumps({"stations": STATIONS}), encoding="utf-8")
assert _mc_chainages(tmp_path, {"longitudinal_file_path": relative}) == {599.0}
assert _mc_chainages(tmp_path, {"longitudinal_file_path": "none.json"}) == set()
assert _mc_chainages(tmp_path, None) == set()
def test_b07_cross_title_mc() -> None:
support = _src("B07_DesignDetail/B07_DesignDetail_Router_Support.py")
assert support.count("+ mc_suffix(source)") == 2 # 횡단 장 제목 · 횡단 한 장 제목
def test_b08_b09_earthwork_station_mc() -> None:
tables = _src("B08_Quantity/B08_Quantity_Earthwork_Tables.ts")
assert '(row.mc ? " (MC)" : "")' in tables
# B09 인쇄 토적표 = B08 표 옵션 그대로
assert "earthworkSheetOptions(table, interval)" in _src(
"B09_Estimation/draft/B09_Draft_Print_Quantity.ts"
)
def test_b05_b06_screen_mc_emphasis() -> None:
css = _src("B06_Section/B06_Section_UI_Style_Cross.css")
assert "header strong.b06-station--mc {" in css # 카드 머리 strong 규칙을 이김
for rule in ("\n.b06-chart__station-label--mc {", "\n.b06-station--mc {"):
body = css[css.index(rule) : css.index("}", css.index(rule))]
assert "var(--color-warning)" in body
assert "var(--font-weight-bold)" in body
# 고름 빨강이 MC 색을 이김 — 뒤에 섬
assert css.index(".b06-chart__station-label--mc {") < css.index(
".b06-chart__station-label--selected {"
)
assert "b06-chart__station-label--mc" in _src("B06_Section/B06_Section_UI_Longitudinal.ts")
assert 'label.className = "b06-station--mc"' in _src(
"B06_Section/B06_Section_UI_Cross_Card_Chrome.ts"
)
cross = _src("B05_Profile/B05_Profile_UI_RouteEdit_Cross.ts")
assert "kind: section.kind ?? null" in cross
assert '${mc ? " b06-station--mc" : ""}' in cross
ticks = _src("B04_PreProcess/B04_PreProcess_UI_MapOverlays.ts")
assert 'mc ? "bold 13px' in ticks
assert 'themeColor("--color-warning"' in ticks
swap = _src("B06_Section/logic/B06_Section_Station_Swap.ts")
assert 'formatStation(station.chainageM) + (kind === "curve" ? " (MC)" : "")' in swap
def test_b07_plan_station_mc_label() -> None:
"""계획평면도 측점 글 = 5 배수만이었음 → MC 도 큰 글(major) + (MC)."""
plan = _src("B07_DesignDetail/B07_DesignDetail_Router_Support_Plan.py")
assert 'label, major = label + " (MC)", True' in plan
assert "if mc_suffix(item)" in plan # 종단 kind curve 측점만
def test_b07_sheet_button_mc() -> None:
"""B07 횡단 장 단추 「3장 (No.29+19.0 (MC))」 — 그 장 첫 측점이 MC 일 때."""
support = _src("B07_DesignDetail/B07_DesignDetail_Router_Support.py")
assert "station += mc_suffix(first)" in support
assert "label=f\"{sheet['number']}장 ({station})\"" in support
def test_b05_profile_table_station_mc() -> None:
table = _src("B05_Profile/B05_Profile_UI_Profile_Table.ts")
# 칸 글 · 굵게 · 경고색 = B06 공용 규칙 · 칸 폭 판정(`longest`)은 (MC) 없는 글 그대로
assert 'spec.cell(stationIndex) + (mc ? " (MC)" : "")' in table
assert '${mc ? " b06-station--mc" : ""}' in table
assert 'display.station) + (mc ? " (MC)" : "")' in table # 고른 측점 값 열
render = _src("B05_Profile/B05_Profile_UI_Profile_Render.ts")
assert 'station.kind === "curve"' in render
css = _src("B05_Profile/B05_Profile_UI_Style_Table.css")
body = css[css.index("__irregular-col-cell.is-mc {") : css.index("}", css.index(".is-mc {"))]
assert "var(--color-warning)" in body
assert "var(--font-weight-bold)" in body
def test_b07_sheet_button_spans_row() -> None:
panels = _src("B07_DesignDetail/B07_DesignDetail_UI_Panels.ts")
assert 'button.dataset.mc = "true"' in panels
css = _src("B07_DesignDetail/B07_DesignDetail_UI_Style.css")
rule = css[css.index('.b07-drawing-button[data-mc="true"] {') :]
assert "grid-column: 1 / -1" in rule[: rule.index("}")]