# -*- coding: utf-8 -*- """153-1 · 523-1 B07 횡단 장 배치 — ⚙ 횡단 모달. 못박는 것 - 배치 칸 자리 = 「횡단도」 카드 ⚙ 모달(280-5) — 카드엔 ⚙ 하나 · 배치 칸 없음. - 그룹 상자 「장 배치」(배치 열 · 행 · 적용) · 「표」(표 배율) · 공용 작은 칸(ui-input--sm). - 단추 줄 = 맨 아래 하나([안내선 숨기기] [취소] [확인]) · 그 밖 단추 없음. - [확인] = 바뀐 것만 저장 — 이 장만 · 모든 장(장마다 값 지움) · 표 배율만 · 손 안 대면 저장 없이 닫음. - 범위 밖 = 칸 붉음 + [확인] 꺼짐 · 장이 아니면 적용 = 모든 장 하나 · [취소] = 그대로 닫음. Node 헬퍼 `helper_153_b07_cross_layout.cjs` 가 화면 그릇 흉내로 돌림. """ import json import os import subprocess import pytest HERE = os.path.dirname(os.path.abspath(__file__)) @pytest.fixture(scope="module") def out(): proc = subprocess.run( ["node", os.path.join(HERE, "helper_153_b07_cross_layout.cjs")], capture_output=True, text=True, encoding="utf-8", timeout=60, ) assert proc.returncode == 0, proc.stderr return json.loads(proc.stdout) def test_횡단도_카드는_설정_단추만(out): card = out["card"] assert card["gears"] == 1 assert card["layoutInCard"] == 0 assert card["settings"] == ["cross"] def test_그룹_상자와_단추_줄_하나(out): sheet = out["sheet"] assert sheet["legends"] == ["장 배치", "표"] assert sheet["labels"] == ["배치 열", "행", "적용", "표 배율"] assert [i["value"] for i in sheet["inputs"]] == ["3", "4", "1"] # 지금 장(1장) 값 for field in sheet["inputs"][:2]: assert field["type"] == "number" and field["min"] == "1" and field["max"] == "10" table = sheet["inputs"][2] assert (table["min"], table["max"], table["step"]) == ("0.5", "2", "0.1") assert all("ui-input--sm" in field["cls"] for field in sheet["inputs"]) assert sheet["scope"] == {"options": ["이 장만", "모든 장"], "value": "sheet"} assert sheet["footers"] == 1 and sheet["buttonsOutsideFooter"] == 0 assert sheet["footerButtons"] == ["안내선 숨기기", "취소", "확인"] def test_확인은_바뀐_것만_저장(out): assert out["applySheet"] == { "saved": [[{"default": [4, 4], "sheets": {"1": [2, 5]}, "table_scale": 1}, 1]], "closed": True, } assert out["applyAll"] == [[{"default": [3, 4], "sheets": {}, "table_scale": 1}, 1]] assert out["applyTable"] == [ [{"default": [4, 4], "sheets": {"1": [3, 4]}, "table_scale": 1.5}, 1] ] def test_범위_밖_장_아님_취소(out): assert out["badGrid"] == {"disabled": True, "error": True, "saved": 0, "open": True} assert out["badTable"] is True assert out["notSheet"] == { "options": ["모든 장"], "values": ["4", "4", "1"], "saved": 0, "closed": True, } assert out["cancel"] == {"saved": 0, "closed": True}