Files
Aislo/resources/tester/test_384_4_cross_window.py
T
eomsangdonandClaude Opus 5.5 6a3f9647f3 refactor(387-4): 횡단 다시 셈 창구 하나 · 면적 얹기 한 곳 — 화면은 묶음에 부탁
- 다시 셈(refreshCrossDesigns) 부르는 곳 = 묶음 cross 단계 하나(design_shared savedCross)
- 종단 미리 셈 · B06 설계 맞춤 · 3D 업데이트 = pipelineCross · reconcilePagePipeline(▲ 한 번 = cross 한 번)
- 입력 칸 밖 세션 고침(노견 · 소단 · 단면 유형 · 조정창)은 forceCross 로 같은 입력이어도 한 번 더
- 카드 그리기 · 횡단 보기 면적 쓰기 지움 · 다시 셈 창구가 면적을 늘 얹음(바뀐 측점만 알림)
- 저장 안 한 조정창 값을 상세 가게가 읽을 때 얹음(새 Section_Adjusts · B05 만 열어도 같은 면적)
- 새 test_384_4_cross_window · 옛 약속 시험 넷 새 약속으로

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014utrjfoW831Vc5wJUd13kL
2026-10-17 18:19:21 +09:00

87 lines
3.6 KiB
Python

"""387-4(384 단계 4) 횡단 다시 셈 창구 하나 · 면적 얹기 한 곳.
· 다시 셈(`refreshCrossDesigns`) 부르는 곳 = 계산 묶음 cross 단계 하나(design_shared savedCross) — 종단 미리
셈 · B06 설계 맞춤 · 3D 업데이트는 묶음에 부탁(`pipelineCross` · `reconcilePagePipeline`) · ▲ 한 번 = cross 한 번
· 화면(횡단 보기 · 카드 그리기)은 구조물 면적을 안 고침 — 다시 셈 창구 · 상세 가게만 얹음(카드 안 그려도 면적 같음)
· 저장 안 한 조정창 값(세션)은 상세 가게가 읽을 때 얹음 — B05 만 연 페이지도 같은 면적 · 다른 노선 칸은 안 얹음
./venv/Scripts/python.exe -m pytest resources/tester/test_384_4_cross_window.py -q
"""
from __future__ import annotations
import json
import re
import subprocess
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[2]
HELPER = Path(__file__).parent / "helper_384_4_adjusts.cjs"
def _code(relative: str) -> str:
text = (ROOT / relative).read_text(encoding="utf-8")
text = re.sub(r"/\*.*?\*/", "", text, flags=re.S)
return re.sub(r"(?m)^\s*//.*$|\s//\s.*$", "", text)
def _screen_and_page_ts() -> list[Path]:
files = list((ROOT / "A00_Common" / "design").rglob("*.ts"))
files += (ROOT / "B05_Profile").rglob("B05_Profile_*.ts")
files += (ROOT / "B06_Section").rglob("B06_Section_*.ts")
return files
def test_다시_셈_부르는_곳_하나() -> None:
callers = [
str(p.relative_to(ROOT))
for p in _screen_and_page_ts()
for _ in re.findall(r"(?<!function )refreshCrossDesigns\(", _code(str(p.relative_to(ROOT))))
]
assert callers == [str(Path("A00_Common/design/design_shared.ts"))]
def test_화면은_면적_안_고침() -> None:
hits = [
str(p.relative_to(ROOT))
for p in _screen_and_page_ts()
if ("_UI_" in p.name or p.name.startswith("design_view"))
and re.search(r"applyStructureArea\w*\(", _code(str(p.relative_to(ROOT))))
]
assert hits == []
def test_화면은_묶음에_부탁() -> None:
sync = _code("B06_Section/B06_Section_UI_Page_Design_Sync.ts")
assert "pipelineCross(projectId)" in sync and "await reconcilePagePipeline(projectId)" in sync
preview = _code("B05_Profile/B05_Profile_UI_Profile_Preview.ts")
assert "pipelineCross(ctx.projectId)" in preview
corridor = _code("B05_Profile/B05_Profile_UI_Corridor.ts")
assert "await reconcilePagePipeline(projectId)" in corridor
# 입력 칸 밖 세션 고침(노견 · 소단 · 조정창)은 「한 번 더」 표시로 같은 입력이어도 cross 다시
cross = _code("A00_Common/design/design_pipeline_cross.ts")
assert "export const forceCross" in cross and "|${forced}`" in cross
@pytest.fixture(scope="module")
def adjusts() -> dict:
done = subprocess.run( # noqa: S603 — 고정 실행 파일
["node", str(HELPER)], cwd=str(ROOT), capture_output=True, text=True, encoding="utf-8"
)
assert done.returncode == 0, done.stderr
return json.loads(done.stdout)
def test_세션_조정값을_상세_가게가_얹음(adjusts: dict) -> None:
assert adjusts["otherRoute"]["x"] != 3 # 다른 노선 칸은 안 얹음
assert adjusts["laid"] == {
"revet": {"x": 1.5, "d": None, "h": None, "m": None}, # d 0 = 기본 자리(조정창 읽기와 같음)
"inlet": "L",
"extra": {"outlet": 2, "basin": 0},
}
# 얹은 값으로 구조물 면적이 바뀜 · 두 번 얹어도 같음
assert adjusts["after"] != adjusts["before"]
assert adjusts["again"] == adjusts["after"]