Merge remote-tracking branches 'origin/sub_laptop_2', 'origin/sub_laptop_7' and 'origin/sub_laptop_8' into sub_laptop_5

This commit is contained in:
2026-10-08 13:38:09 +09:00
8 changed files with 82 additions and 25 deletions
@@ -3,6 +3,7 @@
* 결과 = JSON {pass, fail, failures} 한 줄(`test_spreadsheet_toolbar_unit.py` 가 읽음) */
import {
attachUnitToFormat,
prefixUnit,
UNIT_GROUPS,
UNIT_PREFIX,
} from "../../../A00_Common/spreadsheet/spreadsheet_toolbar";
@@ -36,4 +37,12 @@ eq("Φ 서식 — 빈 코드도 0 기준", attachUnitToFormat("", PHI), '"Φ"0')
eq("Φ 서식 — 옛 Φ 바꿈(겹쳐 안 붙음)", attachUnitToFormat('"Φ"0', PHI), '"Φ"0');
eq("Φ 서식 — 뒤 단위와 공존", attachUnitToFormat('0"㎡"', PHI), '"Φ"0"㎡"');
// 앞 단위 글 — 낫표(강제 글)는 맨 앞에 두고 그 뒤에 붙임 · 이미 붙었으면 그대로(81-5 흠)
eq("Φ 글 — 숫자 앞", prefixUnit("300", PHI), "Φ300");
eq("Φ 글 — 낫표 뒤", prefixUnit("'300", PHI), "'Φ300");
eq("Φ 글 — 두 번 안 붙음", prefixUnit("Φ300", PHI), "Φ300");
eq("Φ 글 — 낫표 뒤 두 번 안 붙음", prefixUnit("'Φ300", PHI), "'Φ300");
eq("Φ 글 — 빈 칸", prefixUnit("", PHI), "Φ");
eq("Φ 글 — 식은 그대로", prefixUnit("=A1", PHI), "=A1");
console.log(JSON.stringify({ pass, fail: failures.length, failures }));
@@ -85,7 +85,8 @@ def test_node_bundle_measures_screen_overlay() -> None:
assert set(extents) == {0, 85.05} # 측점 키는 0.01 m 로 끊는다(cross_station)
x_min, x_max, y_min, y_max = extents[85.05]
assert x_max == pytest.approx(13.8216, abs=1e-3)
assert x_min == pytest.approx(-10.4371, abs=1e-3)
assert y_max - y_min == pytest.approx(16.9505, abs=1e-3)
# 유입 집수정 끝 절토 = 암 1:0.4 → 토사 1:1.0 복합경사(91-4 · 옛 한 줄 −10.4371 · 16.9505)
assert x_min == pytest.approx(-11.6239, abs=1e-3)
assert y_max - y_min == pytest.approx(17.7502, abs=1e-3)
# 0 m: 노폭 글자(2 mm, 세로 가운데 정렬)가 맨 위 — 글자 반높이 0.1 m 까지
assert extents[0][3] == pytest.approx(879.8831, abs=1e-3)
@@ -54,4 +54,4 @@ def test_단위_파이_순수_길():
assert run.stdout.strip(), run.stderr
result = json.loads(run.stdout)
assert result["fail"] == 0, result["failures"]
assert result["pass"] == 9
assert result["pass"] == 15
@@ -66,7 +66,23 @@ def test_Φ_길이_묶음_끝_칸_글_편집기():
assert '["UnitGroup_area", ["㎡", "㎥", "m", "㎝", "㎜", "㎞", "Φ"]]' in src
body = src.split("function insertUnit")[1].split("function renderRecent")[0]
assert "UNIT_PREFIX.includes(unit)" in body
assert (
"now.startsWith(unit)" in body and "unit + now" in body
) # 「300」 → 「Φ300」 · 두 번 안 붙음
assert "const s = front ? 0" in body # 편집 중에도 글 맨 앞
assert "prefixUnit(now, unit)" in body # 칸 글 — 「300」 → 「Φ300」 · 두 번 안 붙음
assert "prefixUnit(active.value, unit)" in body # 편집 중에도 같은 규칙
@pytest.mark.skipif(shutil.which("node") is None, reason="node 가 없음")
def test_앞_단위_글_낫표_뒤에_붙음():
"""강제 글 낫표(`'300`)는 맨 앞에 두고 그 뒤에 붙임 — 「Φ'300」 처럼 낫표가 가운데 남지 않음."""
func = re.search(r"^export function prefixUnit[\s\S]*?^}", _text(), re.M)
assert func
script = (
func.group(0).replace("export ", "").replace(": string", "")
+ """
const f = prefixUnit;
console.log(JSON.stringify([f("300", "Φ"), f("'300", "Φ"), f("Φ300", "Φ"), f("'Φ300", "Φ"), f("=A1", "Φ"), f("", "Φ")]));
"""
)
out = subprocess.run(
["node", "-e", script], capture_output=True, text=True, encoding="utf-8", check=True
)
assert json.loads(out.stdout) == ["Φ300", "'Φ300", "Φ300", "'Φ300", "=A1", "Φ"]