- sub8 24-7a 되얹기(일부 칸)와 폼 「칸 전부」 규칙을 가름 — 되얹기는 안 온 칸 · 기슭막이 높이 · 형태를 건드리지 않음 - 기슭막이 조작값 쓰기가 세션이 없을 때 저장된 좌우 · 상하에서 출발 — 새 탭에서 폼 칸 하나만 고쳐도 저장값이 지워지던 것 - 시험 test_b06_adjust_single_form 7건(되얹기 1 추가) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019ACSGaHdLgnkEkoA4LDtMU
104 lines
3.6 KiB
Python
104 lines
3.6 KiB
Python
"""횡단 카드 조정 창 · 좌측 폼 — 같은 값을 고치는 칸이 한 곳뿐인가 (PLAN 24-4a).
|
|
|
|
짝: `B06_Section/B06_Section_UI_Cross_Structure_Panel.ts` · `_Ford_Panel.ts` · `_Box_Panel.ts`
|
|
(조정 창 · 폼 칸에 옮겨 붙는 사본 줄) · `B06_Section_UI_Page_Pipe_Options.ts`(폼 → 횡단 캐시).
|
|
실제 TS 를 `helper_b06_adjust_single_form.cjs` 가 Node 로 돌린다.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
HERE = os.path.dirname(__file__)
|
|
ROOT = Path(HERE).resolve().parents[1]
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def out() -> dict:
|
|
proc = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", os.path.join(HERE, "helper_b06_adjust_single_form.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) -> None:
|
|
"""옹벽(배관 벽 · 다단 벽 · 집수정) · 세월교 · BOX 조정 창의 input · select = 0."""
|
|
assert out["overlay"] == {"outlet": 0, "extra": 0, "basin": 0, "ford": 0, "box": 0}
|
|
|
|
|
|
def test_폼과_같은_값은_사본_줄로_만들지_않는다(out) -> None:
|
|
"""형태 · 높이 · 길이 · 전 · 후 · 관경 · 날개벽은 폼 칸 — 사본은 폼에 없는 줄만."""
|
|
assert out["dock"]["outlet"] == ["options", "readout", "tier"]
|
|
assert out["dock"]["basin"] == ["basin-size", "basin-size", "options", "readout"]
|
|
assert out["dock"]["ford"] == ["readout", "wall-height"]
|
|
assert out["dock"]["box"] == ["readout"]
|
|
|
|
|
|
def test_다단_벽은_폼에_자기_칸이_없어_줄이_간다(out) -> None:
|
|
assert out["dock"]["extra"] == [
|
|
"form",
|
|
"height",
|
|
"options",
|
|
"readout",
|
|
"span",
|
|
"span",
|
|
"span",
|
|
"tier",
|
|
]
|
|
|
|
|
|
def test_폼_값이_그림으로_가고_비운_칸은_자동(out) -> None:
|
|
cache = out["cache"]
|
|
assert {"role": "outlet", "h": 2.5, "m": "돌쌓기(메)"} in cache["filled"]
|
|
assert cache["cleared"] == [
|
|
{"role": "inlet", "h": None, "m": None},
|
|
{"role": "outlet", "h": None, "m": None},
|
|
]
|
|
assert cache["outletSpec"] == {} and cache["inletSpec"] == {}
|
|
|
|
|
|
def test_초안_되얹기는_온_칸만(out) -> None:
|
|
"""24-7a 되얹기는 일부 칸만 보낸다 — 높이 · 형태(조정값)와 안 온 칸은 그대로."""
|
|
assert out["replay"]["updates"] == []
|
|
assert out["replay"]["outletSpec"] == {
|
|
"revet_height_m": 3,
|
|
"revet_form": "콘크리트",
|
|
"revet_length_m": 12,
|
|
}
|
|
|
|
|
|
def test_사본_줄은_모두_폼_칸으로_옮겨_붙는다() -> None:
|
|
"""사본이 만드는 줄 종류가 옮김 목록에 다 있어야 [횡단 조정] 상자 없이도 보인다."""
|
|
dock = (ROOT / "B06_Section" / "B06_Section_UI_Adjust_Dock.ts").read_text(encoding="utf-8")
|
|
for row in (
|
|
"readout",
|
|
"tier",
|
|
"options",
|
|
"basin-size",
|
|
"wall-height",
|
|
"form",
|
|
"height",
|
|
"span",
|
|
):
|
|
assert f".b06-structure-panel__struct--{row}" in dock, row
|
|
assert "dockRoot.hidden = true" in dock
|
|
|
|
|
|
def test_폼_옵션은_조정_예약으로_따로_담지_않는다() -> None:
|
|
"""관 옵션은 가게(pipes) 하나 — 조정 예약(culvertopt)에 담으면 비운 칸이 [저장] 때 되살아난다."""
|
|
panel = (ROOT / "B06_Section" / "B06_Section_UI_Page_Structures_Panel.ts").read_text(
|
|
encoding="utf-8"
|
|
)
|
|
assert "queuePipeOptions" not in panel
|
|
assert "mergeFacilityOptions(" in panel
|