fix(B05 평면 곡선 창): 곡선 없는 교각점(삼각)도 하단에 「내각 N° · 곡선 없음」 표기 (403-1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Se7ytqbohmBQnfYpwYFnYf
This commit is contained in:
2026-10-17 21:32:15 +09:00
co-authored by Claude Opus 5.5
parent 614f12bb88
commit 192fa6cf7c
3 changed files with 92 additions and 13 deletions
@@ -0,0 +1,34 @@
/* 403 곡선 창 하단 글 헬퍼 — `_Label.curveInfoText` 를 트랜스파일해 경우별 글을 JSON 으로 낸다. */
const fs = require("fs");
const path = require("path");
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
const B05 = path.join(__dirname, "..", "..", "B05_Profile");
const STUBS = {
"@ui/ui_template_elements": { createButton: () => null },
"./B05_Profile_UI_Panel_Fields": { numberField: () => null, toggleButton: () => null },
};
function loadTs(full) {
const js = ts.transpileModule(fs.readFileSync(full, "utf8"), {
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
}).outputText;
const box = { exports: {} };
const localRequire = (request) => {
if (STUBS[request]) return STUBS[request];
if (request.startsWith(".")) return loadTs(path.join(path.dirname(full), `${request}.ts`));
return require(request);
};
new Function("exports", "module", "require", js)(box.exports, box, localRequire);
return box.exports;
}
const { curveInfoText } = loadTs(path.join(B05, "B05_Profile_UI_RouteEdit_Label.ts"));
process.stdout.write(
JSON.stringify({
curve: curveInfoText(true, 132.4, false),
curveOptional: curveInfoText(true, 160.2, true),
triangle: curveInfoText(false, 132.6, false),
triangleOptional: curveInfoText(false, 168.4, true),
triangleUnknown: curveInfoText(false, null, false),
}),
);
@@ -0,0 +1,47 @@
"""403 곡선 없는 교각점(삼각) 각도 글(요구 250-5) — 곡선 창 하단에 곡선 있는 자리와 같은 「내각 N°」.
Node 헬퍼(`helper_403_triangle_angle.cjs`)가 `_Label.curveInfoText` 를 트랜스파일해 돌림.
./venv/Scripts/python.exe -m pytest resources/tester/test_403_triangle_angle.py -q
"""
import json
import subprocess
from pathlib import Path
import pytest
HERE = Path(__file__).resolve().parent
@pytest.fixture(scope="module")
def texts():
proc = subprocess.run(
["node", str(HERE / "helper_403_triangle_angle.cjs")],
capture_output=True,
text=True,
encoding="utf-8",
timeout=60,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
def test_곡선_있는_자리_그대로(texts):
assert texts["curve"] == "내각 132°"
assert texts["curveOptional"] == "내각 160° · 155° 이상 — 곡선 생략 가능"
def test_삼각_자리도_내각(texts):
assert texts["triangle"] == "내각 133° · 곡선 없음 — 직선이 그대로 꺾입니다"
assert texts["triangleOptional"].startswith("내각 168° · ")
def test_내각_모르면_곡선_없음만(texts):
assert texts["triangleUnknown"] == "곡선 없음 — 직선이 그대로 꺾입니다"
def test_화면이_같은_함수를_씀():
label = (HERE.parents[1] / "B05_Profile" / "B05_Profile_UI_RouteEdit_Label.ts").read_text(
encoding="utf-8"
)
assert "info.textContent = curveInfoText(state.curveOn, state.innerAngleDeg" in label