- 예정노선 수정 켬에도 추천 선 불투명 그대로(Render) - 스냅 + 스냅 간격 = 고르기 메뉴 하나(측점 No. · 10 m · 끔) · 도구줄 표 snap-step 줄 걷음 - 추천노선 = 여럿 고르기(공용 부품 multi · 줄 색 점 PickMenuItem.color · 끔 줄 없음) · 선 색 --draw-map-rec-1~4 · 예정노선 가이드 선은 켬끔 한 줄 - 켠 동안 등고선 띠 = LAS 는 자르지 않음 · 도엽은 계획선 + 예정노선으로 넓힘(캔버스 · GL · 도엽 다시 받기) - 시험 624_2 · 634_2 · 626_1 · 636_2 · 390_4 · b05_routeedit_initial 을 새 꼴로 고침 · 새 시험 756_1 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
76 lines
2.9 KiB
Python
76 lines
2.9 KiB
Python
"""390-4 스냅 상태줄 글 = 고른 간격 따라 — `B05_Profile_UI_RouteEdit_SnapStep.ts` 의 `snapFitText`
|
|
를 Node 로 돌려 간격별 글 판정 + 편집기 두 자리(전체 · 놓을 때)가 그 글을 씀.
|
|
|
|
./venv/Scripts/python.exe -m pytest resources/tester/test_390_4_snap_step_text.py -q
|
|
"""
|
|
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
B05 = ROOT / "B05_Profile"
|
|
SNAP = B05 / "B05_Profile_UI_RouteEdit_SnapStep.ts"
|
|
TS = ROOT / "config" / "node_modules" / "typescript"
|
|
STEPS = ["10", "station"] # 280-4 — 0.1 · 1 m 지움
|
|
|
|
NODE = """
|
|
const fs = require("fs");
|
|
const ts = require(process.argv[1]);
|
|
const js = ts.transpileModule(fs.readFileSync(process.argv[2], "utf8"), {
|
|
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
|
|
}).outputText;
|
|
const box = { exports: {} };
|
|
new Function("exports", "module", "require", js)(box.exports, box, () => ({}));
|
|
const steps = JSON.parse(process.argv[3]);
|
|
console.log(JSON.stringify(Object.fromEntries(steps.map((s) => [s, box.exports.snapFitText(s)]))));
|
|
"""
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def texts() -> dict:
|
|
run = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", "-e", NODE, str(TS), str(SNAP), json.dumps(STEPS)],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=60,
|
|
)
|
|
assert run.returncode == 0, run.stderr
|
|
return json.loads(run.stdout)
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
("step", "want"),
|
|
[
|
|
("station", "곡선 가운데(MC)를 일반측점에 맞췄습니다."),
|
|
("10", "곡선 가운데(MC)를 10 m 배수에 맞췄습니다."),
|
|
],
|
|
)
|
|
def test_간격별_상태줄_글(texts, step, want) -> None:
|
|
assert texts[step] == want
|
|
|
|
|
|
def test_편집기는_고른_간격_글을_씀() -> None:
|
|
edit = (B05 / "B05_Profile_UI_RouteEdit.ts").read_text(encoding="utf-8")
|
|
assert "일반측점에 맞췄" not in edit
|
|
assert edit.count("applyEdit(snap.text())") == 1 # 켬 · 간격 바꿈
|
|
assert 'applyEdit(stationSnap ? snap.text() : "옮겼습니다.")' in edit # 놓을 때(430)
|
|
snap = SNAP.read_text(encoding="utf-8")
|
|
assert "text: () => snapFitText(value())" in snap # 634-3 고르기 메뉴 값
|
|
|
|
|
|
def test_고르기는_10_m_측점_No_둘() -> None:
|
|
"""280-4 — 고르기 줄 둘 · STEPS 둘(옛 pref 0.1 · 1 = 측점 No.) · 634-3 날 <select> → 고르기 메뉴 하나."""
|
|
import re
|
|
|
|
chrome = (B05 / "B05_Profile_UI_RouteEdit_Chrome.ts").read_text(encoding="utf-8")
|
|
block = chrome[chrome.index('icon: "magnet"') :]
|
|
block = block[: block.index("onPick")]
|
|
assert 'offLabel: "끔"' in block # 589-4 스냅 켬끔 + 간격 한 아이콘
|
|
assert re.findall(r'value: "([^"]+)"', block) == ["10", "station"]
|
|
assert "<select" not in chrome
|
|
assert 'const STEPS = ["10", "station"];' in SNAP.read_text(encoding="utf-8")
|