- 노드 반지름 4 → 6(고름 +2) · 노드 · 손잡이를 라벨 뒤 맨 위로
- 집기 문턱 노드 9 → 12 · pickAtScreen: 노드 가운데 6px 안 = 노드 · 밖 = 노드와 눈금 중 가까운 쪽
- stationAtScreen → {chainage, distance} · 맴돔은 집기와 같은 셈 · 노드 = 고리 · 눈금 = 파랑(새 _Hover)
- 누를 때 · 끄는 동안 · 재는 중 · 캔버스 밖 = 맴돔 끔 · [측점] 끔이면 눈금 안 봄
- 시험 test_b05_routeedit_pick 겹침 경우 · test_381_3_routeedit_node_pick
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013QyNXY2TUKXCFMwAca2APG
85 lines
2.7 KiB
Python
85 lines
2.7 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""계획노선 편집 창 — **측점 라벨 고르기**(계획서 22-2) · **호 고르기**(22-3) 회귀검증.
|
|
|
|
Node 헬퍼(`helper_b05_routeedit_pick.cjs`)가 TS 를 트랜스파일해 돌리고, 여기서 값을 판정한다.
|
|
"""
|
|
|
|
import json
|
|
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_pick.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_호_점열은_그려지는_선의_시작_끝_조각과_같다(results):
|
|
assert results["arcMatchesDrawn"] is True
|
|
|
|
|
|
def test_호를_누르면_그_곡선_노드_번호(results):
|
|
pick = results["pick"]
|
|
assert pick["onArc"] == results["node"]
|
|
assert pick["nearArc"] == results["node"]
|
|
assert results["pick2"] == results["node"] # 반대로 도는 곡선도
|
|
|
|
|
|
def test_곧은_선_빈_곳_곡선_없음은_안_고름(results):
|
|
pick = results["pick"]
|
|
assert pick["farFromArc"] == -1
|
|
assert pick["onStraight"] == -1
|
|
assert pick["empty"] == -1
|
|
assert pick["noCurves"] == -1
|
|
|
|
|
|
def test_라벨_상자는_실제로_그린_사각형과_같다(results):
|
|
assert results["labelsMatchRects"] is True
|
|
assert results["label"]["chainages"] == [0, 40, 80]
|
|
|
|
|
|
def test_라벨_글자를_누르면_그_측점(results):
|
|
label = results["label"]
|
|
assert label["onLabel"] == 40
|
|
assert label["insideCorner"] == 40 # 돌린 상자 모서리 안쪽
|
|
assert label["outsideCorner"] is None # 모서리 바깥
|
|
|
|
|
|
def test_눈금이_라벨보다_먼저(results):
|
|
assert results["label"]["tickBeatsLabel"] == 40
|
|
|
|
|
|
def test_솎여_안_보이는_눈금은_안_잡힘(results):
|
|
assert results["label"]["hiddenTick"] is None
|
|
assert results["label"]["hiddenTickNoInfo"] == 20 # 라벨 정보가 없으면 예전처럼 전부
|
|
|
|
|
|
def test_라벨이_없거나_빈_곳은_안_고름(results):
|
|
label = results["label"]
|
|
assert label["emptyNoLabels"] is None
|
|
assert label["emptyElsewhere"] is None
|
|
|
|
|
|
def test_381_3_노드_눈금_겹침은_가까운_쪽(results):
|
|
o = results["overlap"]
|
|
assert o["center"] == {"node": 1}
|
|
assert o["coreNearTick"] == {"node": 1} # 가운데 6px 안 = 노드
|
|
assert o["tickCloser"] == {"chainage": 40}
|
|
assert o["nodeCloser"] == {"node": 1}
|
|
assert o["edgeTick"] == {"chainage": 40}
|
|
assert o["stationsOff"] == {"node": 1} # [측점] 끔 = 눈금 안 봄
|
|
assert o["far"] is None
|
|
assert o["tickOnly"] == {"chainage": 80}
|
|
assert o["distance"] == {"chainage": 40, "distance": 6}
|