69 lines
3.3 KiB
Python
69 lines
3.3 KiB
Python
"""512-2(요구 326-6) 배수유역도 [업데이트] — 점선 원 · 단추 셋 걷음 · 노선선 = 답의 노선 · B06 [>] 확인 창.
|
|
|
|
- 서버 답 `route_xy` = 그 답을 셈한 노선(사업지 m) — 화면 노선선 · 관 자리 · 유역이 늘 짝
|
|
(초안 노선 [업데이트] 뒤 저장 노선을 그려 생기던 「노선 곁 빈 곳」).
|
|
- 낡은 답(세부 유역 없음)이 와도 그림이 있으면 옛 그림 그대로 · 관만 받음.
|
|
- 흐름(낡음 · 늘 다시 셈 · 저절로 셈 없음)은 test_349 · 화면 실측은 PLAN 512-2.
|
|
"""
|
|
|
|
from pathlib import Path
|
|
from uuid import uuid4
|
|
|
|
from B04_PreProcess import B04_PreProcess_Router_Basins as basins
|
|
from common_util.common_util_drainage_context import DrainageContext
|
|
from common_util.common_util_drainage_detail import DrainageDetail, pipes_from_chainages
|
|
from common_util.common_util_route_geometry import RouteVertex
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
B05 = ROOT / "B05_Profile"
|
|
|
|
|
|
def _read(path: Path) -> str:
|
|
return path.read_text(encoding="utf-8")
|
|
|
|
|
|
def test_답에_셈한_노선이_실림():
|
|
vertices = [RouteVertex(10.0, 20.0, 100.0, 0.0), RouteVertex(310.1234, 20.0, 90.0, 300.1234)]
|
|
context = DrainageContext(stored_path="x", project_root=ROOT, vertices=vertices)
|
|
detail = DrainageDetail(route_lonlat=[], pipes=pipes_from_chainages(vertices, [100.0]))
|
|
points = basins.carry_facility_attributes(basins._rebuilt(detail), [])
|
|
payload = basins._payload(uuid4(), context, detail, points, False)
|
|
assert payload["route_xy"] == [[10.0, 20.0], [310.123, 20.0]]
|
|
|
|
|
|
def test_단추는_업데이트_자동제안_둘():
|
|
chrome = _read(B05 / "B05_Profile_UI_Drainage_Chrome.ts")
|
|
assert "header.append(updateButton, proposeButton);" in chrome
|
|
for gone in ("analyzeButton", "deleteButton", "autoButton"):
|
|
assert gone not in chrome
|
|
locale = _read(ROOT / "ui_template" / "ui_template_locale_b2.ts")
|
|
assert "B05_Drainage_Btn_Auto:" not in locale and "B05_Drainage_Btn_Analyze" not in locale
|
|
|
|
|
|
def test_점선_원_없음():
|
|
render = _read(B05 / "B05_Profile_UI_Drainage_Render.ts")
|
|
assert "candidates" not in render and "setLineDash" not in render
|
|
assert "candidates" not in _read(B05 / "B05_Profile_UI_Drainage_Propose.ts")
|
|
|
|
|
|
def test_노선선은_답의_노선_낡은_답은_옛_그림():
|
|
panel = _read(B05 / "B05_Profile_UI_Drainage_Panel.ts")
|
|
apply = panel[panel.index("function apply(") : panel.index("function takePipes(")]
|
|
assert apply.index("if (keep) return void takePipes(response);") < apply.index("basins = ")
|
|
assert "const keep = !!response.stale && basins.length > 0;" in apply
|
|
assert "takeRoute(answered, false)" in apply
|
|
assert "if (!routeFromAnswer) takeRoute(points, true);" in panel # 페이지 노선 = 첫 답 전만
|
|
|
|
|
|
def test_B06_다음은_낡으면_확인_뒤_업데이트():
|
|
shared = _read(ROOT / "A00_Common" / "design" / "design_shared.ts")
|
|
go = shared[shared.index("export function confirmAndGo(") :]
|
|
go = go[: go.index("\n}\n", go.index("async function drainageFirst("))]
|
|
assert "void drainageFirst(shared).then((ready) => (ready ? go() : undefined));" in go
|
|
first = go[go.index("async function drainageFirst(") :]
|
|
assert (
|
|
first.index("side?.stale()")
|
|
< first.index("showConfirmDialog(")
|
|
< first.index("side.update()")
|
|
)
|