137 lines
7.2 KiB
Python
137 lines
7.2 KiB
Python
"""626-3 B05 평면 예정노선 변경 → 다시 추적 → 편집기 한 걸음 → [저장](요구 530 · 531 · 535-1 · 536 · 결정 D3 · D4 · D9).
|
|
|
|
- 예정노선 키트 `createPlanKit` 「b05」 한 벌(긋기 · 고르기 · 메뉴 · 속성 판 · 칸 · 숨김 = 기능 표 — 한 선 · 갈래 · 연도 ·
|
|
지점 · 635-1 · 635-3) · 지도 입력 = 키트 `bindPlanInput` capture.
|
|
- 지킴(글 대조) — 다시 추적 = `/route/follow` 만(저장 0) · `/route/replan` · `as_initial` · `expected_route.csv` 안 부름 ·
|
|
결과 = 편집기 `restoreSnapshot(…, true)` 한 걸음 · [저장] = 손 편집 같은 길(`bindRouteApply`) + 초안 `expected` ·
|
|
걸음 사진 · 노선 초안에 고친 예정노선 실림(되돌리기 · 세션 되살림) · 같은 선 판정에 예정노선 · 켠 동안 캔버스 누름을
|
|
먼저 받음(재기 · 계획선 고르기 막음) · 받은 노선 켬끔(왼쪽 「그리기」 칸 · 635-3) · RouteEdit 700 줄 안.
|
|
|
|
./venv/Scripts/python.exe -m pytest resources/tester/test_626_3_expected_edit.py -q
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
B05 = ROOT / "B05_Profile"
|
|
D03 = ROOT / "D03_PlanAnalysis"
|
|
|
|
|
|
def _src(path: Path) -> str:
|
|
return path.read_text(encoding="utf-8")
|
|
|
|
|
|
def test_다시_추적_follow_만_저장_0_초기값_추천_안_건드림():
|
|
ui = _src(B05 / "B05_Profile_UI_ExpectedDraw.ts").split("*/", 1)[1] # 머리 글 뺀 몸
|
|
assert "/route/follow" in ui and "askConfirm(" in ui and "flattenServerPlan(" in ui
|
|
for banned in (
|
|
"/route/replan",
|
|
"as_initial",
|
|
"expected_route.csv",
|
|
"/route/initial",
|
|
"replanRoute",
|
|
):
|
|
assert banned not in ui, banned
|
|
# B05 화면 어디서도 as_initial: true 를 안 보냄(D8)
|
|
for path in B05.glob("B05_Profile_UI_*.ts"):
|
|
assert not re.search(r"as_initial:\s*true", _src(path)), path.name
|
|
|
|
|
|
def test_결과는_편집기_한_걸음_저장은_손_편집_같은_길():
|
|
main = _src(B05 / "B05_Profile_UI_RouteEdit.ts")
|
|
assert "createExpectedDraw({" in main and "restoreSnapshot(" in main
|
|
assert re.search(r"onFollow: \(flat, line\) =>\s+restoreSnapshot\(", main)
|
|
assert (
|
|
'"예정노선을 따라 평면을 다시 추적했습니다.",\n true,' in main
|
|
) # 새 걸음(되돌리기 됨)
|
|
assert "expected: expectedDraw.edit()," in main # 걸음 사진 칸
|
|
assert "expectedDraw.setEdit(snapshot.expected ?? null);" in main # 되돌리기 = 예정노선도
|
|
assert "expected: () => expectedDraw.edit()," in main # [저장] 초안 칸
|
|
assert "plan.expected_edited ?? []" in main # 다시 열면 고친 예정노선
|
|
assert len(main.splitlines()) <= 700
|
|
apply = _src(B05 / "B05_Profile_UI_RouteEdit_Apply.ts")
|
|
assert "...(expected ? { expected } : {})" in apply # null = 안 실음(그대로) · [] = 지움
|
|
|
|
|
|
def test_걸음_사진_초안_같은_선에_예정노선():
|
|
history = _src(B05 / "B05_Profile_UI_RouteEdit_History.ts")
|
|
assert "expected?: Vertex[] | null;" in history and "!sameExpected(a, b)" in history
|
|
draft = _src(B05 / "B05_Profile_UI_RouteEdit_Draft.ts")
|
|
assert "...(snapshot.expected" in draft and "expected: draft.expected ?? null," in draft
|
|
types = _src(ROOT / "A00_Common" / "design" / "logic" / "design_pipeline_types.ts")
|
|
assert "expected?: Vertex[] | null;" in types
|
|
server = _src(B05 / "B05_Profile_Route_Save.py")
|
|
assert "expected: list[tuple[float, float]] | None = None" in server
|
|
|
|
|
|
def test_D03_긋기_고르기_메뉴_속성판_그대로_한_선():
|
|
ui = _src(B05 / "B05_Profile_UI_ExpectedDraw.ts")
|
|
assert "createPlanKit({" in ui and ui.count('page: "b05",') == 1 # 키트 한 벌(635-3)
|
|
kit = _src(D03 / "D03_PlanAnalysis_UI_Kit.ts")
|
|
for call in ("createPlanDraw({", "createPlanEdit({", "createPlanMenu({", "createPlanProps({"):
|
|
assert call in kit, call
|
|
for fake in ("NO_POINTS", "epsg: () => 0", "addPoint: () => undefined", "oneLine"):
|
|
assert fake not in ui, fake
|
|
assert "if (!kit.key(event)) return;" in ui # 같은 단축키(키트)
|
|
assert (
|
|
'keyIs(event, "plan.undo") || keyIs(event, "plan.redo")' in ui
|
|
) # 되돌리기 = 페이지 사진첩
|
|
# 지도 입력 = 키트 한 함수 · 잡기 단계(capture) — 재기 · 계획선 고르기보다 먼저
|
|
assert "capture: { active: () => open, busy: () => busy }," in ui
|
|
assert "canvas.addEventListener(type, run, !!capture)" in kit
|
|
assert "event.stopImmediatePropagation()" in kit
|
|
assert "event.buttons & (capture ? 6 : 4)" in kit # 오른쪽 · 가운데 끌기 = 지도 이동 그대로
|
|
assert 'createElement("button")' not in ui
|
|
# 숨김 = 기능 표 읽기(635-1 · 플래그 없음)
|
|
draw = _src(D03 / "D03_PlanAnalysis_UI_Draw.ts")
|
|
assert 'featureOn(params.page, "branch") ? null : lineLimitBlock(target.kind, network)' in draw
|
|
assert 'markButton.hidden = !featureOn(opts.page, "years");' in _src(
|
|
D03 / "D03_PlanAnalysis_UI_DrawPanel.ts"
|
|
)
|
|
menu = _src(D03 / "D03_PlanAnalysis_UI_Menu.ts")
|
|
assert '!featureOn(page, "branch") && lineLimitBlock(aim, params.network())' in menu
|
|
assert 'if (featureOn(page, "years"))' in menu
|
|
props = _src(D03 / "D03_PlanAnalysis_UI_Props.ts")
|
|
assert '!featureOn(page, "points") ||' in props and "yearsShown(network)" in props
|
|
for src in (draw, menu, props):
|
|
assert "oneLine" not in src
|
|
table = _src(D03 / "D03_PlanAnalysis_UI_Features.ts")
|
|
# 638-3 — 세트 칸 · 세트 줄 = B05 보기만 · [잇기] = B05 숨김 · 세트 고침 = assignSet 한 길
|
|
assert 'disabled: !params.editable() || !featureOn(page, "set")' in props
|
|
assert 'featureOn(page, "join") && edit.isEnd(' in props + menu
|
|
assert "setPiecesYear" not in props and "setLineYear" not in _src(
|
|
D03 / "D03_PlanAnalysis_UI_Pieces.ts"
|
|
)
|
|
for key, b05 in (
|
|
("branch", "hide"),
|
|
("years", "view"),
|
|
("set", "view"),
|
|
("join", "hide"),
|
|
("points", "hide"),
|
|
("draw", "use"),
|
|
):
|
|
assert re.search(rf'key: "{key}",[^}}]*b05: "{b05}"', table, re.S), key
|
|
# 635-3 — 도구줄 「예정노선 변경」 · 「원본」 걷음(왼쪽 「그리기」 칸 「예정노선 수정」)
|
|
for path in (
|
|
ROOT / "A00_Common" / "map" / "map_toolbar.ts",
|
|
ROOT / "ui_template" / "ui_template_map_tools.ts",
|
|
B05 / "B05_Profile_UI_RouteEdit_Chrome.ts",
|
|
):
|
|
assert "expected-draw" not in _src(path) and "expected-original" not in _src(path), path
|
|
render = _src(B05 / "B05_Profile_UI_RouteEdit_Render.ts")
|
|
# 맨 위 = 구조물 마커 뒤 · 회전 끝 앞
|
|
assert render.index("scene.overAll?.paint(context);") < render.index(
|
|
"context.restore(); // 회전 끝"
|
|
)
|
|
|
|
|
|
def test_받은_예정노선_안_덮음_옅은_점선_켬끔():
|
|
ui = _src(B05 / "B05_Profile_UI_ExpectedDraw.ts")
|
|
assert "showOriginal && original.length > 1 && line() !== original" in ui
|
|
assert "expected_route.csv" in ui.split("*/")[0] # 머리 = 원본 안 덮음 적음
|
|
for banned in ("write_route_csv", 'expected_route.csv"', "/route/initial"):
|
|
assert banned not in ui.split("*/", 1)[1], banned
|