Files
Aislo/resources/tester/test_129_menu_equals_panel.py
T
eomsangdonandClaude Opus 5.5 6c2ae466c9 fix(B05): 종단 · 배수유역도 · 3D · B06 우클릭 구조물군 · 종류 목록 = 좌측 패널 드롭다운 목록 한 벌(129-1)
- 패널이 자기 드롭다운 목록(pickGroups — 군 차례 · 정의 이름 · 켜진 종류 · 옛 대피 뺌 · 숨김)을 내고 우클릭 메뉴가 그것을 그대로 씀
- 옛 메뉴 = 꺼진 종류(F 야생동물 이동통로 · 비탈면 녹화 · G 쇄석 포설) · 옛 대피 종류(대피소 · 정차작업장 · 차돌림곳) 더 보임 · 군 이름은 정의(48) 대신 고정 이름
- 시험 test_129(실제 레지스트리 + 정의로 패널 = 메뉴 · B05 · B06)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UoSr2sqvYtBf1dtQdus88s
2026-10-08 20:10:19 +09:00

90 lines
3.5 KiB
Python

# -*- coding: utf-8 -*-
"""129-1 종단 우클릭 구조물군 · 종류 목록 = 좌측 패널 「구조물 배치」 군 · 종류 드롭다운.
못박는 것
- 실제 레지스트리(`with_visible`) + 구조물 정의(`구조물정의.json`)로 화면과 같은 종류 목록을 세워,
패널 드롭다운에 보이는 군(차례 · 이름) · 종류(차례 · 이름 · id) = 우클릭 메뉴 — B05(켜진 종류) · B06(전부).
- 메뉴 길 넷(B05 종단 · 배수유역도 · 3D · B06 종단 = 한 profile)이 모두 패널 `pickGroups()` 를 봄.
Node 헬퍼 `helper_129_menu_equals_panel.cjs` 가 패널 · 메뉴 목록을 뽑음. 화면은 사용자 확인.
"""
import json
import os
import subprocess
import pytest
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
from M02_MasterTemplete.StructOptions.M02_SO_Options import with_visible
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 f:
return f.read()
@pytest.fixture(scope="module")
def out(tmp_path_factory):
folder = tmp_path_factory.mktemp("t129")
types_path = folder / "types.json"
definition_path = folder / "definition.json"
types_path.write_text(json.dumps(with_visible().model_dump()["types"]), "utf-8")
definition_path.write_text(json.dumps(definition.read()), "utf-8")
proc = subprocess.run(
[
"node",
os.path.join(HERE, "helper_129_menu_equals_panel.cjs"),
str(types_path),
str(definition_path),
],
capture_output=True,
text=True,
encoding="utf-8",
timeout=60,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
@pytest.mark.parametrize("page", ["b05", "b06"])
def test_우클릭_목록은_패널_드롭다운과_같음(out, page):
panel, menu = out[page]["panel"], out[page]["menu"]
assert panel, "패널 목록이 비면 대조가 안 됨"
assert menu == panel # 군 차례 · 이름 · 종류 차례 · 이름 · 누르면 넘어가는 id
def test_B05_는_꺼진_종류를_안_보임(out):
shown = {type_id for group in out["b05"]["menu"] for _, type_id in group["types"]}
off = {t["type_id"] for t in with_visible().model_dump()["types"] if not t["enabled"]}
assert off and not shown & off
def test_옛_대피_종류는_어느_쪽도_안_보임(out):
for page in ("b05", "b06"):
shown = {type_id for group in out[page]["menu"] for _, type_id in group["types"]}
assert not shown & {"refuge", "work_yard", "turnaround"}
def test_메뉴_길_넷이_패널_목록을_봄():
assert "pickGroups: () => pickGroups(types, canPick)" in _read(
"B05_Profile", "B05_Profile_UI_Structures_Panel.ts"
)
# B05 · B06 한 profile — 종단그래프 · 배수유역도 우클릭은 공용 콜백 하나
assert "structureGroups: () => sharedStructures(shared).pickGroups()" in _read(
"A00_Common", "design", "design_shared.ts"
)
assert "structureGroups: callbacks?.structureGroups," in _read(
"B05_Profile", "B05_Profile_UI_Profile_Render.ts"
)
assert "structureGroupMenuItems(callbacks?.structureGroups?.() ?? []" in _read(
"A00_Common", "design", "design_profile.ts"
)
# 3D
assert "structureGroups: () => deps.panel().structures.pickGroups()" in _read(
"B05_Profile", "B05_Profile_UI_Page_Structures.ts"
)