- Ctrl+Z · Y · 편집기 [되돌리기] · [다시하기] · [반영 전으로] = 페이지 사진첩(_Profile_History) — 평면 · 종단 · 횡단 · 관 · 구조물을 만진 차례 거꾸로 - 편집기 쌓기 · [반영 전으로] 뒤 사진첩 한 걸음(_Draft.watch) · 사진첩이 되쓴 route-draft 는 fromPage 로 편집기 새 걸음(같은 선 옛 걸음의 고정 · 추천 꼬리표째) - 쌓는 줄 없는 조작(횡단 카드 등) = 놓은 뒤 · change 뒤 400 ms 한 번 찍음 · 고름 · 관 id · 종류 캐시 · 구조물 넘김 · b08 · b09 칸은 사진 밖 - 「마지막에 만진 판만」(_RouteEdit_UndoOwner) 지움 · 편집기는 단축키 안 들음 - 시험 test_346_4_one_undo.py · 345-3 시험 · 219-1 헬퍼 새 꼴로 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013QyNXY2TUKXCFMwAca2APG
69 lines
2.7 KiB
Python
69 lines
2.7 KiB
Python
"""346-4 되돌리기 한 줄 — 평면 점 옮김 → 계획고 ▲ → 횡단 카드 고침 → Ctrl+Z 세 번이 거꾸로.
|
||
|
||
./venv/Scripts/python.exe -m pytest resources/tester/test_346_4_one_undo.py -q
|
||
|
||
사진 크기(300 KB 칸 셋 × 100단 heap)는 `test_346_4_profile_history.py`.
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import json
|
||
import subprocess
|
||
from pathlib import Path
|
||
|
||
import pytest
|
||
|
||
HERE = Path(__file__).resolve().parent
|
||
ROOT = HERE.parents[1]
|
||
|
||
|
||
@pytest.fixture(scope="module")
|
||
def out() -> dict:
|
||
run = subprocess.run( # noqa: S603 — 고정 실행 파일
|
||
["node", str(HERE / "helper_346_4_one_undo.cjs")],
|
||
capture_output=True,
|
||
text=True,
|
||
encoding="utf-8",
|
||
)
|
||
assert run.returncode == 0, run.stderr
|
||
return json.loads(run.stdout)
|
||
|
||
|
||
def test_끄는_중간은_안_찍고_놓을_때_한_걸음(out) -> None:
|
||
assert out["start"]["undo"] is False
|
||
assert out["heldUndo"] is False
|
||
edited = out["afterEdits"]
|
||
assert edited["route"] == 70 and edited["grade"] and edited["cross"] and edited["undo"]
|
||
|
||
|
||
def test_Ctrl_Z_세_번이_거꾸로(out) -> None:
|
||
u1, u2, u3 = out["undo1"], out["undo2"], out["undo3"]
|
||
assert u1["cross"] is None and u1["grade"] and u1["route"] == 70 # 횡단부터
|
||
assert u2["grade"] is None and u2["route"] == 70 # 그다음 계획고
|
||
assert out["editorBeforeRouteUndo"] == 0 # 노선이 그대로인 걸음은 편집기를 안 건드림
|
||
assert u3["route"] is None and u3["undo"] is False and u3["redo"] # 마지막 평면 · 열 때로
|
||
assert out["editorAfterUndo"] == [[50, False, "tag-open", "되돌렸습니다."]]
|
||
|
||
|
||
def test_다시하기는_앞으로(out) -> None:
|
||
assert out["redo1"]["route"] == 70 and out["redo1"]["grade"] is None
|
||
r3 = out["redo3"]
|
||
assert r3["route"] == 70 and r3["grade"] and r3["cross"] and r3["redo"] is False
|
||
# 옮긴 걸음의 고정 · 추천 꼬리표까지 되살림(같은 선의 옛 걸음)
|
||
assert out["editorAfterRedo"] == [[70, True, "tag-moved", "다시 했습니다."]]
|
||
assert out["profileReads"] == 6 # 종단도도 걸음마다 다시 읽음
|
||
|
||
|
||
def test_반영_전으로도_한_걸음(out) -> None:
|
||
assert out["reset"]["route"] is None and out["reset"]["cross"] # 노선만 열 때로
|
||
assert out["resetUndo"]["route"] == 70
|
||
|
||
|
||
def test_단축키는_사진첩_한_곳():
|
||
tools = (ROOT / "B05_Profile/B05_Profile_UI_Profile_Panel_Tools.ts").read_text(encoding="utf-8")
|
||
assert "undoOwner" not in tools
|
||
assert 'isCtrlKey(event, "y")' in tools and "setPageHistory(history)" in tools
|
||
plan = (ROOT / "B05_Profile/B05_Profile_UI_RouteEdit_History.ts").read_text(encoding="utf-8")
|
||
assert '"keydown"' not in plan
|
||
assert not (ROOT / "B05_Profile/B05_Profile_UI_RouteEdit_UndoOwner.ts").exists()
|