# -*- coding: utf-8 -*- """177-5 좌측 폼 「측점 범위」 줄 — 사면안정군(C군)만 숨김. 못박는 것 - PNL5 `syncRangeDisplay` 가 C군이면 `rangeWrap.hidden` · 다른 구간형(B 소단배수로 · E 대피소 등)은 그대로. - `hasComputedRange` 자체는 그대로(시작 · 종료 칸 숨김에도 씀). - C군 = 사면안정 6종(정의 기준) · 그 밖 범위 종류는 C 가 아님. 화면은 사용자 확인. """ import os from B05_Profile.B05_Profile_Structures_Schema import load_structure_types HERE = os.path.dirname(os.path.abspath(__file__)) ROOT = os.path.abspath(os.path.join(HERE, "..", "..")) def _read(*parts: str) -> str: with open(os.path.join(ROOT, *parts), encoding="utf-8") as handle: return handle.read() def test_범위_줄은_C군만_숨김(): panel = _read("B05_Profile", "B05_Profile_UI_Structures_Panel.ts") at = panel.index("function syncRangeDisplay(): void {") body = panel[at : panel.index("\n }", at)] assert ( 'const computed = hasComputedRange(currentType()) && currentType()?.group !== "C";' in body ) assert "rangeWrap.hidden = !computed;" in body def test_hasComputedRange_는_그대로(): types = _read("B05_Profile", "B05_Profile_UI_Structures_Panel_Types.ts") assert "export function hasComputedRange(" in types assert '"C"' not in types[types.index("export function hasComputedRange(") :][:600] def test_C군은_사면안정_6종_다른_범위_종류는_C_아님(): groups = {t.type_id: t.group for t in load_structure_types()} slope = { "retaining_wall", "masonry_wet", "masonry_dry", "soil_guard", "boulder_masonry", "berm", } assert {k for k, g in groups.items() if g == "C"} == slope for kept in ("ditch_berm", "refuge", "work_yard", "guardrail"): assert groups.get(kept) not in (None, "C"), kept