- onReveal = 사용자 고름이면 「구조물 배치」 카드 폄만 · revealLeft 지움(부르는 열네 길 그대로) - 좌측 패널 열림 알림(workflow_layout onOptionsOpenChange) → 고른 목록 줄 · 강조 상자로 한 번 밂 - addsAtOnce = 등록부 기본값 뒤 필수 빈칸만 봄 · 포장 폼만 갈래 지움(물넘이 걸침 = 확인창 그대로) - design_page.css 횡단 보기 가운데 칸 position: static · 평면 z 4 그대로 - 시험 398_1 뒤집음 · 116 · 126 포장 바로 추가 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
111 lines
4.4 KiB
Python
111 lines
4.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""126-1 우클릭 세월교 · 물넘이포장도 바로 추가 · 월류 높이 실시간.
|
|
|
|
못박는 것
|
|
- 세월교 · 물넘이포장 = 바로 추가 + 그 측점 관을 고른 채 · 알림 한 줄(높이는 유량 뒤).
|
|
- 배수유역 재계산 응답에 유량이 오면 기다리던 항목의 빈 월류 높이 = 필요 수심(서버 `ford_height_m` 거울).
|
|
- 유량이 아직 없으면 빈칸으로 다음 응답까지 · 손 값은 안 덮음 · 기다리지 않는 옛 항목은 그대로.
|
|
- 세부유역 요청은 최신 응답만 채택 · 채운 뒤 세션 초안에 다시 담음.
|
|
|
|
Node 헬퍼 `helper_126_ford_fill.cjs` 가 판정 · 끝맺음 · 채움을 돌림. 화면은 사용자 확인.
|
|
"""
|
|
|
|
import json
|
|
import os
|
|
import subprocess
|
|
|
|
import pytest
|
|
|
|
from B04_PreProcess import B04_PreProcess_Router_Basins as basins
|
|
|
|
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():
|
|
proc = subprocess.run(
|
|
["node", os.path.join(HERE, "helper_126_ford_fill.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):
|
|
assert out["once"] == {"fordBridge": True, "fordPavement": True, "pavement": True}
|
|
|
|
|
|
def test_추가_뒤_목록에_들고_그_관을_고른_채_알림_한_줄(out):
|
|
for key in ("bridge", "paveRc"):
|
|
r = out[key]
|
|
assert r["done"] is True and r["commits"] == 1
|
|
assert r["picked"] == [["pipe", 120]]
|
|
assert r["toasts"] == [out["notice"]]
|
|
assert out["pipe"]["toasts"] == [] # 배관은 알림 없음
|
|
|
|
|
|
def test_빈_높이만_기다림(out):
|
|
assert out["waits"] == {
|
|
"bridgeEmpty": True,
|
|
"paveEmpty": True,
|
|
"bridgeHand": False,
|
|
"pipe": False,
|
|
}
|
|
|
|
|
|
def test_유량_오기_전엔_빈칸_오면_그_항목에_채움(out):
|
|
assert out["noFlow"] == {"filled": False, "heights": [None], "pending": [120]}
|
|
assert out["withFlow"] == {"filled": True, "heights": [0.16], "pending": []}
|
|
|
|
|
|
def test_채운_높이는_서버_풀이와_같음(out):
|
|
assert out["need"]["w10"] == basins.ford_height_m(8.0, 10) == 0.16
|
|
assert out["need"]["w5"] == basins.ford_height_m(8.0, 5)
|
|
|
|
|
|
def test_손_값은_안_덮음(out):
|
|
assert out["hand"] == {"filled": False, "heights": [0.5], "pending": []}
|
|
|
|
|
|
def test_기다리지_않는_옛_항목은_그대로_폭_없으면_기본_폭(out):
|
|
assert out["other"]["heights"] == [0.16, None] # 물넘이 기본 폭 10 · 옛 세월교 빈칸 그대로
|
|
assert out["other"]["pending"] == []
|
|
|
|
|
|
def test_관이_사라지거나_종류가_바뀌면_그만_기다림(out):
|
|
assert out["gone"] == {"filled": False, "heights": [None], "pending": []}
|
|
|
|
|
|
def test_배수유역_패널_배선():
|
|
src = _read("B05_Profile", "B05_Profile_UI_Drainage_Panel.ts")
|
|
# 최신 응답만 채택 — 요청 감싸기는 347-2 에 `B05_Profile_UI_Drainage_Run.ts` 로 나눔
|
|
runner = _read("B05_Profile", "B05_Profile_UI_Drainage_Run.ts")
|
|
run = runner[runner.index("async run(") :]
|
|
assert "const seq = ++requestSeq;" in run
|
|
assert run.index("await request()") < run.index("if (seq !== requestSeq) return false;")
|
|
assert run.index("if (seq !== requestSeq) return false;") < run.index("deps.apply(response)")
|
|
# 채움은 보관소가 응답을 받기 전에 · 채웠으면 세션 초안에 다시 담음
|
|
apply = src[src.index("function apply(") : src.index("const runner = createDetailRunner(")]
|
|
order = [
|
|
apply.index("fillFordHeights(response.pipe_points, response.basins, fordWaits())"),
|
|
apply.index("facilityStore.replaceFromResponse(response.pipe_points)"),
|
|
apply.index("if (fordFilled) rememberPipes()"),
|
|
apply.index("callbacks.onPipesChanged?.("),
|
|
]
|
|
assert order == sorted(order)
|
|
add = src[src.index(" addPipe(chainageM, attributes) {") : src.index(" removePipe(")]
|
|
assert "waitsFordHeight(attributes?.facility, attributes?.options)" in add
|
|
assert add.index("fordWaits().add(chainageM)") < add.index(
|
|
"pipeEditor.addAtChainage(chainageM)"
|
|
)
|
|
assert "if (fordWaits().delete(fromChainageM)) fordWaits().add(toChainageM);" in add
|