- 624-3 도구줄 = 공용 표 「b05」 · 아래 줄 = 공용 겹 줄(띠 · 올린 임도망도 숨김 · 처음 = 등고선 · 하천) · 범례 = 공용 legendRows(상태 글판 위) - 노선 띠 300 m 자르기 = B05 자기 칸(등고선 · 하천 · 1 m)만 · 그 밖 겹 = 안 자르는 둘째 GL 칸(맨 밑 · 켠 겹 있을 때만 · GL 만) · 등고선 끔 = 등고 글도 숨김 - 626-1 추천 보기 = 도구줄 아이콘 + 아래 판(영선 · 토공 최소 · 기울기 최소 · 비중 계산 · 끔) — route_recommend 저장본(지금 설계 지형) 선만 · 다시 셈 · 쓰기 없음 - 지형 칩 → 확인창 → 새 POST /route/design-terrain(설계 지형만 바꿈 · 노선 저장 체인 다시 · 노선 · 초기값 · 추천 저장본 그대로 · 잠금 · 실패 되돌림) - 걷음 — 추천 모달(_Recommend · _Help · _Map · CSS) · 좌측 「노선 추천」 칸 · saveRecommendedRoute · UI_RouteReset(서버 as_initial 길 · 시험은 남김) - 부품 상자 — createPickMenu(아이콘 고르기 메뉴 · 판 = body fixed · ✓) - 낡은 시험 고침 · 지움 — 모달 · 좌측 칸 · [적용] 화면 배선을 보던 시험(283 · 346_3 · 349 · 364_4 · 383_1 · 390_5 · 418 · 421 · 421_2 · 476_2 · 509_2 · 509_5 · 551_2 · 600_3 · b05_routeedit_initial · design_view_parity · modal_top · 133_1 · 133_2) · test_508_2 · helper_283 지움(모달 전용) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
128 lines
5.6 KiB
Python
128 lines
5.6 KiB
Python
"""346-3 화면 — [노선 반영] 없앰 · [저장]이 노선부터 · 저장 뒤 초안 넘김(추천 [적용] 화면 부름 = 626-1 걷음).
|
|
|
|
노선 이음(`B05_Profile_UI_RouteEdit_Apply`)은 Node 헬퍼 `helper_346_3_route_save.cjs` 가 서버 · 화면
|
|
창구만 가짜로 두고 돌림 · 서버 길 시험은 `test_346_3_route_save.py` · 저장 차례(노선 먼저 · 안 바뀌면
|
|
안 보냄 · 실패 때 초안 남음)는 `test_design_store_save.py`.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import re
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
ROOT = HERE.parents[1]
|
|
|
|
|
|
def _read(rel: str) -> str:
|
|
return (ROOT / rel).read_text(encoding="utf-8")
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def out() -> dict:
|
|
run = subprocess.run(
|
|
["node", str(HERE / "helper_346_3_route_save.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
check=True,
|
|
)
|
|
return json.loads(run.stdout)
|
|
|
|
|
|
def test_노선_안_바뀜_안_보냄(out):
|
|
assert out["noneAtAll"] is None
|
|
assert out["unchanged"] is None # 편집기가 정함 — 가게에 초안이 남아 있어도
|
|
assert out["storeOnly"]["draft"]["rev"] == 3 # 편집기 없으면 가게 routeDraft
|
|
|
|
|
|
def test_초안은_계약_RouteDraft_꼴(out):
|
|
draft = out["body"]["draft"]
|
|
assert set(draft) == {
|
|
"rev",
|
|
"nodes",
|
|
"curveOn",
|
|
"curveRadius",
|
|
"curveLock",
|
|
"curveArc",
|
|
"stationSnap",
|
|
"stationSnapStep",
|
|
"terrain",
|
|
}
|
|
n = len(draft["nodes"])
|
|
assert all(
|
|
len(draft[name]) == n for name in ("curveOn", "curveRadius", "curveLock", "curveArc")
|
|
)
|
|
assert draft["curveOn"] == [True, False, True] and draft["curveRadius"] == [None, 25, None]
|
|
assert draft["stationSnap"] is True and draft["terrain"] is None # 손 저장 = 설계 지형(509-5)
|
|
assert draft["stationSnapStep"] == 20 # 390-5 간격도 함께 실림
|
|
assert out["body"]["initial"] == {"mode": "follow"}
|
|
assert "balanced_profile" not in out["body"] # 손으로 고친 노선 = 계획고 옮김만(349-0v)
|
|
assert "as_initial" not in out["body"] # 손으로 고친 노선 = 초기값 그대로
|
|
|
|
|
|
def test_저장_뒤_가게_초안_비움_결과_한_줄(out):
|
|
assert out["savedRouteId"] == 9
|
|
assert out["storeAfterSave"] is None
|
|
assert out["keptAfterSave"] == 1
|
|
assert out["summary"] == "undefined" # 498-3 — 결과 한 줄(관 지킴 · 노선 밖 고침 …) 걷음
|
|
|
|
|
|
def test_초안_넘김_차례(out):
|
|
"""472-6 6-B — 넘김(측점 열쇠 · 누가거리 칸 · 얹기 · patch)은 서버가 같은 TS 로(Node `stations.carry` ·
|
|
`test_472_6_route_save`) · 브라우저는 옛 노선 세션 칸 원본 + 횡단 본문만 · 저장 뒤 상단측 · 종류 바꿈 비움."""
|
|
assert out["carryCalls"][0] == "carryInputs:7"
|
|
assert out["carry"] == {"from_keys": [], "from": 7}
|
|
assert out["crossBody"] == {
|
|
"standard": {"std": 1},
|
|
"massHaul": {"balloon_offsets": {"b": [1, 2]}},
|
|
}
|
|
assert out["uphillBeforeAfter"] == {"40.00": "right"} # 다 저장하기 전엔 그대로
|
|
assert out["uphillAfter"] is None and out["kindresetAfter"] is None
|
|
assert any("상단측 손 고침 1곳" in c for c in out["carryCalls"]) # 요구 274 — 새 지형이 정함
|
|
|
|
|
|
def test_노선_반영_단추_없앰_배선():
|
|
chrome = _read("B05_Profile/B05_Profile_UI_RouteEdit_Chrome.ts")
|
|
assert 'data-act="apply"' not in chrome and "노선 반영</button>" not in chrome
|
|
apply = _read("B05_Profile/B05_Profile_UI_RouteEdit_Apply.ts")
|
|
assert "addEventListener" not in apply # 단추 듣기 없음 — [저장]이 부름
|
|
save = _read("A00_Common/design/design_save.ts")
|
|
assert "await pendingRouteSave(ctx.projectId)" in save
|
|
# 6-B — 노선 초안 = 한 본문 `route` 칸 · 서버가 맨 앞에서 노선 저장(옛 차례 길 걷음)
|
|
assert re.search(r"route \? \{ route, carry: carried\?\.carry[^}]*\} : \{\}", save)
|
|
assert "carryAfterRouteSave" not in save and "saveRouteDraft" not in save
|
|
server = _read("B06_Section/B06_Section_Router_DesignSave.py")
|
|
assert server.index('step("route"') < server.index('step("settings"')
|
|
# 626-1 — 추천 [적용] 화면 부름 걷음(서버 `as_initial` 길 · 시험은 남김)
|
|
assert "saveRecommendedRoute" not in apply
|
|
replan = _read("B05_Profile/B05_Profile_Api_Replan.ts")
|
|
assert "body: JSON.stringify(body)" in replan and "as_initial?: boolean;" in replan
|
|
|
|
|
|
def test_넘김_알림은_결과_한_줄에_합침():
|
|
"""346-3 덧 — [저장] 뒤 「노선 밖 고침」 두 줄 → 한 줄 · 넘김은 조용히 수만 · 기본은 알림 그대로."""
|
|
keys = _read("B06_Section/B06_Section_Station_Keys.ts")
|
|
assert "{ quiet = false, applyTo = toRouteId }: { quiet?: boolean; applyTo?: number }" in keys
|
|
assert "if (outside.size && !quiet)" in keys
|
|
patch = _read("B06_Section/logic/B06_Section_Route_Carry_Patch.ts")
|
|
assert "outside: keyed.outside.size + chain.outside.size" in patch
|
|
# 498-3 — 결과 한 줄 걷음 · 남김 = 따라감 실패 · 새 교차 관
|
|
save = _read("A00_Common/design/design_save.ts")
|
|
assert "routeSaveSummary" not in save and "새 교차 관 ${crossing}개" in save
|
|
|
|
|
|
def test_노선_반영_글자_없음():
|
|
for rel in (
|
|
"B05_Profile/B05_Profile_UI_RouteEdit.ts",
|
|
"B05_Profile/B05_Profile_UI_RouteEdit_History.ts",
|
|
"B05_Profile/B05_Profile_UI_RouteEdit_Draft.ts",
|
|
"A00_Common/design/design_view_profile.ts",
|
|
):
|
|
text = _read(rel)
|
|
assert "[노선 반영]" not in text and "[반영 전으로]" not in text, rel
|