- 측점 사이 종단기울기(지반고 %) 라벨 — 측점 간격이 화면 90px 이상일 때만 · 측점 라벨 맞은편 · 회전해도 글 바로 섬 · 끄는 동안 안 물음 - 「1m 등고선」 단추(기본 꺼짐 · LAS 없으면 잠김) — 1m 선 얇고 옅게 · 켰을 때 처음 한 번만 준비 · 5m 선은 한 단 짙게(--map-contour-major) - 회전 · 가운데 · 배율을 화면 취향(routeedit-view · 프로젝트마다 · 계정에도 올라감)에 적고 다시 열면 그대로 - 700줄 한도 — 화면 셈·기억은 _View, 재기 배선은 _Measure, 바탕 읽기는 _Contour, 노드 끼우기·빼기는 _Edits 로 나눔 - 시험 test_b05_routeedit_view.py (창 크기 달라도 같은 자리 · 저장소 왕복 · 노드 편집값 자리) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015sCeZz8z8YnbovsKgn7HK7
64 lines
2.4 KiB
Python
64 lines
2.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""계획노선 편집 창 — **보던 화면 기억**(계획서 18 ③)과 노드 끼우기·빼기 회귀검증.
|
|
|
|
화면은 창 크기와 무관한 꼴(가운데 m · 1m 당 픽셀 · 회전각)로 기억한다. 창 크기가 바뀌어도
|
|
같은 자리를 같은 배율로 다시 열어야 한다. 자리는 화면 취향 통(`aislo:pref:`)의 프로젝트 칸.
|
|
|
|
Node 헬퍼(`helper_b05_routeedit_view.cjs`)가 TS 를 트랜스파일해 돌리고, 여기서 값을 판정한다.
|
|
"""
|
|
|
|
import json
|
|
import math
|
|
import os
|
|
import subprocess
|
|
|
|
import pytest
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def results():
|
|
proc = subprocess.run(
|
|
["node", os.path.join(HERE, "helper_b05_routeedit_view.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_다른_창_크기에서도_같은_가운데와_배율(results):
|
|
saved, again = results["saved"], results["again"]
|
|
assert again["cx"] == pytest.approx(saved["cx"], abs=1e-6)
|
|
assert again["cy"] == pytest.approx(saved["cy"], abs=1e-6)
|
|
assert again["pxPerMeter"] == pytest.approx(saved["pxPerMeter"], rel=1e-9)
|
|
assert saved["rotationDeg"] == pytest.approx(30.0)
|
|
|
|
|
|
def test_저장소_왕복은_프로젝트마다(results):
|
|
assert results["readBack"] == pytest.approx(results["saved"])
|
|
assert results["otherProject"] is None
|
|
assert results["storedKeys"] == ["aislo:pref:routeedit-view:p-1"]
|
|
|
|
|
|
def test_보던_화면이_없으면_노선에_맞추고_회전_0(results):
|
|
assert results["fresh"]["rotationRad"] == 0
|
|
assert results["fresh"]["scale"] > 0
|
|
assert results["withSaved"]["rotationRad"] == pytest.approx(math.radians(30))
|
|
|
|
|
|
def test_노드_끼우기_빼기는_편집값이_같은_자리로(results):
|
|
inserted = results["afterInsert"]
|
|
assert inserted["planned"][1] == [5, 5]
|
|
assert inserted["curveOn"] == [True, True, False, True]
|
|
assert inserted["curveRadius"] == [None, None, 30, None]
|
|
assert inserted["curveLock"] == [None, None, "radius", None]
|
|
assert inserted["curveArc"] == [None, None, 12, None]
|
|
assert inserted["apexLock"] == [False, False, True, False]
|
|
removed = results["afterRemove"]
|
|
assert removed["planned"] == [[0, 0], [10, 0], [20, 0]]
|
|
assert removed["curveRadius"] == [None, 30, None]
|
|
assert removed["apexLock"] == [False, True, False]
|