- design_view_profile_sections: 노선마다 상세 갈아끼움을 듣고 종단도 · 표 · 3D 측점선 다시(보일 때만 · 숨으면 flushSwap 이 다시 보일 때) · 가게 stations 도 들어 횡단 보기를 안 열어도 갈아끼움(먼저 부른 쪽만 · 다음은 「같은 목록」) - design_view_profile: 받는 줄만(보임 · 떠날 때 끊음 · 다시 보일 때 flushSwap) - 갈아끼움 알림판 B06_Section_Swap_Bus(가져오기 없음 · 돌고 도는 가져오기 막음) — 조정창 값 · 암 경계 옮김을 어느 보기가 갈아끼웠든 한 번 · 횡단 보기는 알림으로 다시 그림 - 시험: 종단 보기 보임 7 → 8 · 숨음 = 안 그림 · 다시 보임 = 6 · 3D 측점선 같은 차례 · 옛 시험 둘(342-1 화면 선 = listedBase · 323-9 열쇠 모듈 진짜로) 맞춤 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QfHKQs7J3hQELKMWQMUJEy
131 lines
4.8 KiB
Python
131 lines
4.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""346-2 4파 — 측점 수가 바뀔 때 횡단 목록 갈아끼움.
|
|
|
|
못박는 것
|
|
- 측점 셋 늘고 둘 빠진 목록 → 새 상세 객체(카드 8 · 종단 측점 8) · 이어 받은 측점은 설계 그대로 ·
|
|
새 측점은 지반 표본 + 기본 설계 · 옛 상세는 그대로 · 같은 목록이면 안 갈아끼움.
|
|
- 가게 `stations` → 캐시 상세 갈아끼움 · 듣는 쪽에 새 상세 + 누가거리 옮김 ·
|
|
카드 선택은 측점 열쇠로 새 자리(관 45.054 → 47 m) · 노선 모양이 바뀌면 넘김 규칙
|
|
(단면 유형 버림) · 사라진 측점 고침 버림 · 조정창 값도 옮긴 자리로.
|
|
- 종단 보기(B05) · 3D 측점선 — 횡단 보기를 안 열어도 가게 측점으로 갈아끼움 · 보일 때만 다시 그림.
|
|
- 보이는 카드 먼저 — 보이는 줄 + 한 줄만 바로.
|
|
- `formatStation` ↔ 파이썬 `format_station` 같은 글.
|
|
|
|
Node 헬퍼 `helper_346_2_station_swap.mjs` 가 vite ssr 로 묶은 진짜 모듈
|
|
(`helper_346_2_swap_entry.ts`)을 부름.
|
|
"""
|
|
|
|
import json
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
ROOT = HERE.parents[1]
|
|
if str(ROOT) not in sys.path:
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from B05_Profile.B05_Profile_Engine_Sections_Core import format_station # noqa: E402
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def out(tmp_path_factory):
|
|
work = tmp_path_factory.mktemp("b346")
|
|
build = subprocess.run(
|
|
[
|
|
"node",
|
|
str(ROOT / "config" / "node_modules" / "vite" / "bin" / "vite.js"),
|
|
"build",
|
|
"--configLoader",
|
|
"runner",
|
|
"--ssr",
|
|
"../resources/tester/helper_346_2_swap_entry.ts",
|
|
"--outDir",
|
|
str(work),
|
|
"--logLevel",
|
|
"error",
|
|
],
|
|
cwd=ROOT,
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=300,
|
|
)
|
|
assert build.returncode == 0, build.stderr
|
|
bundle = work / "bundle.mjs"
|
|
shutil.copy(work / "helper_346_2_swap_entry.js", bundle)
|
|
proc = subprocess.run(
|
|
["node", str(HERE / "helper_346_2_station_swap.mjs"), str(bundle)],
|
|
cwd=ROOT,
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=120,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_셋_늘고_둘_빠진_목록으로_갈아끼움(out):
|
|
pure = out["pure"]
|
|
assert pure["count"] == 8 and pure["longCount"] == 8
|
|
assert pure["added"] == ["structure:st-1", "structure:st-2", "structure:st-3"]
|
|
assert pure["removed"] == ["grid:2", "grid:4"]
|
|
assert pure["moves"] == {"45.05": "47.00", "100.00": "90.00"}
|
|
assert pure["keptMark"] == [
|
|
"old-0",
|
|
"old-20",
|
|
"old-45.054",
|
|
None,
|
|
"old-60",
|
|
None,
|
|
None,
|
|
"old-100",
|
|
]
|
|
assert pure["kinds"] == [
|
|
"bp",
|
|
"regular",
|
|
"irregular",
|
|
"irregular",
|
|
"regular",
|
|
"irregular",
|
|
"irregular",
|
|
"ep",
|
|
]
|
|
assert pure["labels"] == ["STA.0+047.000", "STA.0+090.000"]
|
|
assert pure["samples"] == [-0.5, 0, 0.5]
|
|
assert pure["oldUntouched"] is True and pure["length"] == 90
|
|
assert pure["same"] is False and pure["sameSelf"] is True
|
|
|
|
|
|
def test_측점_글_파이썬과_같음(out):
|
|
assert out["format"] == [format_station(c) for c in (0, 45.054, 1234.5)]
|
|
|
|
|
|
def test_가게_측점으로_상세_갈아끼움_열쇠로_이어_받기(out):
|
|
store = out["store"]
|
|
assert store["replaced"] is True and store["count"] == 8
|
|
assert store["heard"] == [{"count": 8, "moves": {"45.05": "47.00", "100.00": "90.00"}}]
|
|
# 관 고침은 47 m 로 · 노선 모양이 바뀌어 단면 유형은 버림 · 40 m(grid:2) 고침은 노선 밖
|
|
assert store["choices"] == [[20, "soil", None], [47, "blasting_rock", None]]
|
|
assert store["rawKeys"] == ["grid:1", "pipe:pipe-s1"]
|
|
assert store["widths"] == {"47.00": 12, "47.00:outlet": 3, "20.00": 8}
|
|
assert store["redraws"] == 1 # 보이는 횡단 보기 = 카드 · 그림 한 번 다시
|
|
assert store["again"] is True # 같은 목록 = 안 갈아끼움
|
|
|
|
|
|
def test_종단_보기_3D_측점선도_새_목록_보일_때만(out):
|
|
profile = out["profile"]
|
|
assert profile["afterShown"] == [7, 8] # 처음 7 → 가게 측점으로 갈아끼움 8(횡단 보기 없이)
|
|
assert profile["whileHidden"] == [7, 8] # 숨은 동안은 안 그림
|
|
assert profile["afterShow"] == [7, 8, 6] # 다시 보일 때 새 목록(6)
|
|
assert profile["lines"] == 3 # 3D 측점선도 같은 차례로 다시
|
|
|
|
|
|
def test_보이는_카드_먼저(out):
|
|
assert out["eager"] == [12, 27, 4] # 3열 · 600 px · (250+12) px 줄 = 3 줄 + 1
|
|
assert out["rename"] == {"47.00": 1, "b47.00": 2, "47.00:outlet": 3, "60.00": 4}
|