Files
Aislo/resources/tester/test_557_2_part_fixes.py
T
eomsangdonandClaude Opus 5.5 271c460641 fix(부품·테마): 위험 채움 대비 4.72 · 남은 옛 꼴 → 부품(계산 줄 · 칸 램프 · 넓은 중간 창 · 규칙 꼴 · 구역 머리 · 입력 칸 2열) (PLAN 557-2)
- 위험 채움 토큰 밝음 #e5484d → #d6363c(흰 글 3.91 → 4.72) · 어두움 5.6 · 위험 글 #c0392b 그대로
- 새 부품 계산 줄(ui_template_calc_row) — B08 수리집수면적표 b08-hydro__row · 식 칸 배치를 대신함
- 표 부품 칸 램프(ui-data-table__lamp · --only · ✓) — B08 집계표 · 거리이정표 · B09 설계내역 램프 CSS 세 벌을 걷음(표지 class 는 풍선 · 가이드용으로 남김)
- 모달 넓은 중간 창(wide + width 1100px · 1100 × 680) — B09 운반 창 손 인라인 크기를 걷음
- 값 목록 규칙 꼴(rule) — ☰ 설정 규칙 줄 ul/li 를 걷음
- 접이 구역 머리(createCollapsibleHead = 패널 머리 + 접는 제목) — B08 구조물도 「조합 연결」 제목(옛 b08-sheets__title)을 대신함
- 일반 화면 틀 좁은 폭 · 입력 칸 2열 · 끝 단추 줄 — D01 · E01 이 B02 CSS 를 빌리던 것을 끊음(가이드 장면 선택자 맞춤)
- 부품 모음 견본 · 지킴 시험 test_557_2 · 낡은 시험(198_1 · 247_1 · 251_1 · 257_1 · 276_1 · 551_1)은 부품 CSS · 새 class 로 맞춤

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 10:53:34 +09:00

125 lines
4.9 KiB
Python

"""557-2 부품 · 테마 작은 흠 지킴 시험 — 위험 채움 흰 글 대비 · 계산 줄 · 칸 램프 · 넓은 중간 창 · 값 목록 규칙 꼴 ·
구역 머리 · 입력 칸 2열(D01 · E01 이 B02 클래스를 안 빌림)."""
import re
from test_552_3_card import ROOT, _text, check_part, kit_line
def _lum(h: str) -> float:
c = [int(h[i : i + 2], 16) / 255 for i in (1, 3, 5)]
c = [v / 12.92 if v <= 0.03928 else ((v + 0.055) / 1.055) ** 2.4 for v in c]
return 0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2]
def _ratio(a: str, b: str) -> float:
x, y = sorted((_lum(a), _lum(b)), reverse=True)
return (x + 0.05) / (y + 0.05)
def _tokens(block: str) -> dict[str, str]:
return dict(re.findall(r"--(color-[a-z-]+):\s*(#[0-9a-fA-F]{6})\b", block))
def test_위험_채움_흰_글_대비():
theme = _text("ui_template_theme.css")
light = _tokens(theme[theme.index(":root {") :].split("\n}\n", 1)[0])
dark = _tokens(theme[theme.index(':root[data-theme="dark"]') :].split("\n}\n", 1)[0])
# 채운 바탕 위 글 = canvas(밝음 흰 · 어두움 짙은 바탕)
assert _ratio(light["color-danger-fill"], light["color-canvas"]) >= 4.5
assert _ratio(dark["color-danger-fill"], dark["color-canvas"]) >= 4.5
assert _ratio(light["color-danger"], light["color-canvas"]) >= 4.5 # 위험 단추 · 글
assert _ratio(dark["color-danger"], dark["color-canvas"]) >= 4.5
assert light["color-danger"] == "#c0392b" # 위험 글 색 그대로
def test_계산_줄():
check_part(
"calc-row",
"ui_template_calc_row.ts",
["ui_template_calc_row.css"],
["createCalcRow", "createCalcFormulaRow", "createCalcFormula"],
[
"ui-calc-row",
"ui-calc-row--formula",
"ui-calc-row__label",
"ui-calc-row__out",
"ui-calc-row__in",
],
)
sheet = (ROOT / "B08_Quantity" / "B08_Quantity_UI_Hydro_Sheet.ts").read_text(encoding="utf-8")
css = (ROOT / "B08_Quantity" / "B08_Quantity_UI_Hydro.css").read_text(encoding="utf-8")
for old in (
"b08-hydro__row",
"b08-hydro__label",
"b08-hydro__formula",
"b08-hydro__out",
"b08-hydro__in",
):
assert old not in sheet and old not in css, old
def test_칸_램프():
css = _text("ui_template_data_table.css")
assert "td.ui-data-table__lamp::before" in css and "var(--color-warning)" in css
assert re.search(r"td\.ui-data-table__lamp\.is-linked::before\s*\{[^}]*content: \"✓\"", css)
assert "td.ui-data-table__lamp--only" in css
assert "칸 램프" in kit_line("table") and "kitLampTable()" in kit_line("table")
for page, old in (
("B08_Quantity/B08_Quantity_UI_Page.css", "b08-summary__lamp"),
("B08_Quantity/B08_Quantity_UI_Milestone.css", "b08-milestone__lamp"),
("B09_Estimation/B09_Estimation_UI_Page.css", "b09-bill__lamp"),
):
assert old not in (ROOT / page).read_text(encoding="utf-8"), page
def test_넓은_중간_창():
css = _text("ui_template_modal.css")
assert re.search(
r'\.ui-modal\.ui-modal--wide\[data-width="1100px"\]\s*\{[^}]*min\(1100px, 94vw\)', css
)
assert '"1100px"' in _text("ui_template_modal.ts") and "1100" in kit_line("modal")
haul = (ROOT / "B09_Estimation" / "B09_Estimation_UI_Haul_Modal.ts").read_text(encoding="utf-8")
assert 'width: "1100px"' in haul and "--modal-max:min(680px" not in haul
def test_값_목록_규칙_꼴():
assert "ui-kv--rule" in _text("ui_template_kv.css") and "rule: true" in kit_line("kv")
app = (ROOT / "A00_Common" / "app_settings.ts").read_text(encoding="utf-8")
assert "createKv(rows, { rule: true })" in app
assert "app-settings__rules" not in (ROOT / "A00_Common" / "app_settings.css").read_text(
encoding="utf-8"
)
def test_구역_머리():
ts = _text("ui_template_collapsible.ts")
assert "export function createCollapsibleHead" in ts and "kitSection()" in kit_line(
"collapsible"
)
link = (ROOT / "B08_Quantity" / "B08_Quantity_UI_Link.ts").read_text(encoding="utf-8")
assert "createCollapsibleHead(" in link and "b08-sheets__title" not in link
def test_입력_칸_2열_안_빌림():
css = _text("ui_template_general_layout.css")
assert (
".ui-form-grid" in css
and ".ui-general-layout--narrow" in css
and ".ui-general-block__actions--end" in css
)
for page in (
"D01_PlanRegister/D01_PlanRegister_UI_Page.ts",
"E01_StabRegister/E01_StabRegister_UI_Page.ts",
):
src = (ROOT / page).read_text(encoding="utf-8")
assert (
"b02-proj" not in src
and "B02_ProjRegister_UI_Style" not in src
and "createFormGrid(" in src
), page
for scene in ("D01", "E01"):
assert "b02-proj" not in (
ROOT / "A05_EduDetail" / "guide" / scene / "_scenes.json"
).read_text(encoding="utf-8")