- B06 중심점 칸 = 버튼 없음 · 「▲▼ = 종단 계획고 · 좌우 이동은 평면에서」 · ◀▶ 키 먹어 막음 - B06_Section_UI_Cross_Center = 판정 원 · 한 축 끌기(암 경계선)만 남김 - B05 노선 좌우 host(_RouteEdit_Shift) · 고름 계산(logic/B05_Profile_RouteShift) 지움 · 페이지 · 편집기 배선 한 줄씩 걷음 - 시험 356 = 가짜 DOM 으로 중심점 고름 · 버튼 없음 · 키 · 끌기 없음 확인 · 356_4 = 중심점 좌우 걸음 뺌 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
80 lines
2.9 KiB
Python
80 lines
2.9 KiB
Python
"""PLAN 356-4 sub7 — 되돌리기 · 다시하기 = 그 걸음 사진(노선 + 계획고 편집) 그대로.
|
|
|
|
· 노선 바뀜 규칙(바뀐 구간 첫 계획선 맞춤 · 계획고 옮김)은 새 조작 때만 — 되살림 때는 안 탐
|
|
· 끌기 → 계획고 ▲(측점 C) → 다시 끌기(새 조작 = ▲ 버림) → 되돌리기 = ▲ 그대로 · 다시하기 = 다시 끌기 값
|
|
· 열기까지 되돌리기 = 노선 초안 없음 · 열 때 편집(중심점 좌우 꼴은 424 에서 걷음)
|
|
· 고침을 끈 판(옛 동작)은 되돌리기에서 ▲ 가 사라짐 — 시험이 흠을 실제로 잡음
|
|
짝: `helper_356_4_undo_grade.cjs`(판 = 349-0q · 실제 TS 를 Node 로 · 화면 부품 · 서버 창구만 가짜).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import subprocess
|
|
import tempfile
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
import test_349_0q_undo_echo as base
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
|
|
|
|
def _run(job: dict, mode: str) -> dict:
|
|
with tempfile.TemporaryDirectory() as folder:
|
|
path = Path(folder) / "job.json"
|
|
path.write_text(json.dumps(job), encoding="utf-8")
|
|
grid = Path(folder) / "grid.bin"
|
|
grid.write_bytes(base.dtm_grid_bytes(base.GRID))
|
|
proc = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", str(HERE / "helper_356_4_undo_grade.cjs"), str(path), str(grid), mode],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=300,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def job() -> dict:
|
|
return base.build_job() # 349-0q 판 입력(검증_sub7)
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def r(job) -> dict:
|
|
return _run(job, "on")
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def off(job) -> dict:
|
|
return _run(job, "off")
|
|
|
|
|
|
def test_새_조작은_바뀐_구간_계획고_편집을_버림(r):
|
|
c = f"{r['C']:.3f}"
|
|
assert c in json.loads(r["lift"]["offs"]) # ▲ 가 C 에
|
|
assert c not in json.loads(r["drag2"]["offs"]) # 다시 끌기(새 조작) = 버림
|
|
assert r["drag2"]["route"] != r["lift"]["route"]
|
|
|
|
|
|
def test_되돌리기_다시하기_그_걸음_사진(r):
|
|
assert r["undo1"]["route"] == r["lift"]["route"]
|
|
assert r["undo1"]["offs"] == r["lift"]["offs"] # ▲ 그대로
|
|
assert r["undo1"]["z"] == pytest.approx(r["lift"]["z"], abs=1e-4)
|
|
assert r["redo1"]["route"] == r["drag2"]["route"]
|
|
assert r["redo1"]["offs"] == r["drag2"]["offs"]
|
|
assert r["redo1"]["z"] == pytest.approx(r["drag2"]["z"], abs=1e-4)
|
|
|
|
|
|
def test_열기까지_되돌리기(r):
|
|
assert r["home"]["route"] is None and r["home"]["offs"] == r["open"]["offs"]
|
|
assert r["blocked"] == 0
|
|
|
|
|
|
def test_옛_동작은_되돌리기에서_편집이_사라짐(off):
|
|
c = f"{off['C']:.3f}"
|
|
assert c not in json.loads(off["undo1"]["offs"]) # ▲ 사라짐(고친 흠)
|