Files
Aislo/resources/tester/test_270_1_cross_map.py
T
eomsangdonandClaude Opus 5.5 e09c6863f5 fix(design): 횡단 보기 배수유역도 = 고름 한 칸에서 파생 · 지도 고름 = 고름 한 칸 (270-1)
- 횡단 보기 구독이 낸 쪽과 무관하게 한 벌 배수유역도(관 마커 · 유역 · 측점 마름모)를 값으로 칠함 — 목록 · 카드 고름이 지도에 이어짐 · 종단 보기에서 칠한 옛 강조 안 남음
- 횡단 보기 종단도 알림에 유역 · 관 고름(onBasinSelected · onPipeSelected) = 고름 한 칸(from map) — 넘김 적용 길로 카드 · 폼 · 알약 · 표 열이 따라옴 · 같은 유역 다시 누름 = 모두 풂
- 배수 재계산(onPipesChanged) 뒤 횡단 보기가 보일 때 지도 강조 다시 얹음
- 시험 test_270_1_cross_map(진짜 bindCrossPick · paintMapPick)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LLCk2y5xE8YGVgjbTntWsY
2026-10-11 17:31:07 +09:00

83 lines
3.6 KiB
Python

# -*- coding: utf-8 -*-
"""270-1 횡단 보기 배수유역도 = 고름 한 칸에서 파생(요구 165-4).
까닭: 한 벌 배수유역도를 종단 보기 구독(`bindProfilePick`)만 칠해(보일 때만) 횡단 보기에서 고른 관 ·
세월교의 유역 · 관 마커가 안 켜지고 종단 보기에서 칠한 옛 강조가 남음 · 지도에서 유역을 눌러도 횡단 보기
알림(`onBasinSelected` · `onPipeSelected`)이 없어 카드 · 표 열 · 목록이 안 따라옴.
고침: 횡단 보기 구독이 낸 쪽과 무관하게 지도를 값으로 칠함(`paintMapPick` · 알림 없이) · 지도 고름 = 고름 한 칸
(from map → 넘김 적용 길) · 배수 재계산 · 보기 전환 뒤 다시 얹음.
진짜 TS 를 `helper_270_1_cross_map.cjs` 가 Node 로 돌린다.
"""
from __future__ import annotations
import json
import os
import subprocess
import pytest
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.abspath(os.path.join(HERE, "..", ".."))
pytestmark = pytest.mark.skipif(
not os.path.isdir(os.path.join(ROOT, "config", "node_modules")),
reason="프론트엔드 의존성 미설치",
)
def _read(*parts: str) -> str:
with open(os.path.join(ROOT, *parts), encoding="utf-8") as handle:
return handle.read()
@pytest.fixture(scope="module")
def out() -> dict:
proc = subprocess.run( # noqa: S603 — 고정 실행 파일
["node", os.path.join(HERE, "helper_270_1_cross_map.cjs")],
capture_output=True,
text=True,
encoding="utf-8",
timeout=60,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
def test_횡단_안_누름도_지도_칠함(out):
# 목록 · 카드로 관을 고르면(from b06) 지도 관 · 마름모가 켜지고 넘김 적용은 안 돎 · 알림 없이 칠함
assert out["b06Pipe"]["pipe"] == 95.38 and out["b06Pipe"]["station"] == 95.38
assert out["b06Pipe"]["reapplied"] == 0 and out["b06Pipe"]["notify"] is False
def test_관_없는_카드는_옛_관_강조_풂(out):
assert out["b06Card"]["pipe"] is None and out["b06Card"]["station"] == 80
def test_지도_고름은_넘김_적용(out):
# 지도(from map)에서 고르면 카드 · 폼 · 알약 · 표 열을 세우는 넘김 적용이 한 번 돎
assert out["fromMap"]["pipe"] == 292.22 and out["fromMap"]["reapplied"] == 1
def test_노면공은_관_강조_없음(out):
# 노면공(범위) 고름 = 관 없음 → 유역 · 관 마커 끔(노면공 범위가 관을 덮어 켜지 않음)
assert out["pave"]["pipe"] is None and out["pave"]["station"] == 30
def test_풀기_숨은_보기_다시_보임(out):
assert out["release"]["pipe"] is None and out["release"]["station"] is None
assert out["hidden"] == {"calls": 0, "reapplied": 2} # 숨은 횡단 보기는 종단 보기 몫
assert out["show"]["pipe"] == 95.38 and out["show"]["reapplied"] == 3
assert out["releaseKeepsMap"] == 95.38 # release 는 횡단 강조만 — 지도는 값이 비면 구독이 풂
def test_횡단_보기_이음():
view = _read("B06_Section", "B06_Section_UI_Section_View_Profile.ts")
assert "onBasinSelected: (chainageM) => pickFromMap(chainageM)" in view
assert "onPipeSelected: (chainageM) => pickFromMap(chainageM)" in view
assert '{ from: "map" }' in view and "NO_SELECTION" in view
# 배수 재계산 뒤 다시 얹음 — 횡단 보기가 보일 때만
assert 'shared.view() === "cross"' in view and "paintMapPick(shared.profile.side" in view
cross = _read("A00_Common", "design", "design_view_cross.ts")
assert "paintMap: (selection) =>" in cross and "paintMapPick(shared.profile.side" in cross