"""568-1 지도 도구줄 부품 지킴 시험 — 화면 확인은 부품 모음(`#/b01-account?view=ui-kit`) · ORCA. · 단추 목록의 아이콘이 모두 아이콘 묶음에 있음 · 새 아이콘 여덟(도구 넷 · 겹 넷) · 켬끔 단추 = aria-pressed · [?] = data-act="hint-toggle" + aria-expanded · 안내 판 기본 접힘 ./venv/Scripts/python.exe -m pytest resources/tester/test_568_1_map_tools.py -q """ from __future__ import annotations import re from pathlib import Path ROOT = Path(__file__).resolve().parents[2] UI = ROOT / "ui_template" TS = (UI / "ui_template_map_tools.ts").read_text(encoding="utf-8") ICONS = (UI / "ui_template_icons.ts").read_text(encoding="utf-8") CSS = (UI / "ui_template_map_tools.css").read_text(encoding="utf-8") def _icon_names() -> set[str]: body = ICONS[ICONS.index("const PATHS") : ICONS.index("} as const")] return set(re.findall(r"^ (\w+):", body, re.M)) def test_새_아이콘_여덟(): names = _icon_names() for n in ( "ripple", "tallymarks", "percentage", "magnet", "satellite", "droplet", "borderAll", "angle", ): assert n in names, n def test_단추_목록_아이콘_차례(): table = TS[TS.index("export const MAP_TOOLS") : TS.index("satisfies")] rows = re.findall( r'^ "?([\w-]+)"?: \{ icon: "(\w+)", title: "[^"]+"(, toggle: true)? \}', table, re.M ) acts = [a for a, _, _ in rows] assert acts == [ "undo", "redo", "view3d", "rotate-ccw", "rotate-cw", "contour-minor", "stations", "slopes", "footprint", "measure", "station-snap", ] names = _icon_names() assert all(icon in names for _, icon, _ in rows) toggles = {a for a, _, t in rows if t} assert toggles == { "contour-minor", "stations", "slopes", "footprint", "measure", "station-snap", } def test_켬끔_안내_판(): assert "pressed: tool.toggle ? (opts.pressed ?? false) : undefined" in TS assert "button.dataset.act = act;" in TS assert 'toggle.dataset.act = "hint-toggle";' in TS assert 'toggle.setAttribute("aria-expanded", String(open));' in TS assert "setOpen(opts.hint.open ?? false);" in TS # 기본 접힘 hint = CSS[CSS.index(".ui-map-tools__hint {") :] assert "display: none;" in hint[: hint.index("}")] assert "display: grid;" in CSS[CSS.index(".ui-map-tools__hint.is-open {") :] assert "pointer-events: none;" in CSS # 빈 자리 · 글판은 지도 조작 통과 def test_571_1_한_줄_가로_밀기(): bar = CSS[CSS.index(".ui-map-tools > .ui-toolbar {") :] bar = bar[: bar.index("}")] assert "flex-wrap: nowrap;" in bar # 줄바꿈 없음 assert "overflow-x: auto;" in bar # 밀기 칸 assert "scrollbar-width: none;" in bar assert "mask-image" in bar # 넘친 끝 흐림 assert ".ui-toolbar.is-more-end" in CSS and ".ui-toolbar.is-more-start" in CSS assert "flex-shrink: 0;" in CSS # 단추가 찌그러지지 않음 assert "watchOverflow(bar);" in TS assert '"wheel"' in TS and "passive: false" in TS # 휠 = 가로 밀기