- 측점 계획 planStations(TS) ↔ plan_stations(py): 관 · 구조물 + 구조물 표 → 측점 · 역할 · 카드 이름 · 덮는 구조물 id · 빈칸 경고(형상 부품 필수 칸) · 같은 m 하나(이름 = 관 먼저 · 앞선 것) - 서버 resolve_extra_stations = 계획(같은 자리 한 번 · 옛 「마지막 이름」 걷음) · _stale_marks = 자리 + 이름(종류 · 관 공식 · 정의 판 이름) - 카드 목록(Section_Drafts) = 계획 이름 · 일반 측점 자리(regular)에 새로 놓은 구조물 = 그 자리 구조물 없는 사본에 이름 칩 · 관 그림 · 벽 · 포장(219 흠) - B05 종단 · 3D 측점 = 계획(design_structure_status.plannedIrregular) · 배수유역도로 관 자리 되먹임 끊음 - B06 종단 띠 = 계획(관만 → 모든 종류 · 관 구간도 넘김) - 고름: followMovedPipe — 고른 관을 옮기면 고름도 새 자리(B05 폼 · 종단 끌기 · B06 옮김) - 부품 상자 형상 「필수 칸」(관경 · 벽 높이 · 맹암거 높이 · 물넘이 높이 · 기슭막이 높이) - 시험: test_322_3_plan_mirror(거울 · 규칙 · 서버 공급자 · 낡음) · test_322_3_flow(흐름 일곱 + 고름 따라감) · 272_1 = 같은 자리 한 번 · 318 도움 파일 표 모듈 한 줄 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
89 lines
2.9 KiB
Python
89 lines
2.9 KiB
Python
"""PLAN 322-3 카드 목록 흐름 일곱 — 초안 측점 맞춤(`withDraftStations`)이 측점 계획 한 벌을 따름.
|
|
|
|
놓기 · 일반 측점에 놓기(219 흠 — No.N+0 자리 새 구조물 = 이름 칩 · 관 그림) · 옮기기 · 같은 군 바꿈 ·
|
|
정본 넘는 바꿈(관 → 맹암거) · 지우기 · 저장 뒤 다시 열기(빼 둔 옛 자리 돌아옴).
|
|
각 줄 = [측점, 카드 이름, 미리 뜬 사본, 관 계열 그림 열쇠]. TS 쪽 = `helper_322_3_flow.cjs`(Node).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
HERE = Path(__file__).parent
|
|
ROOT = HERE.parent.parent
|
|
|
|
pytestmark = pytest.mark.skipif(
|
|
not (ROOT / "config" / "node_modules").is_dir(), reason="프론트엔드 의존성 미설치"
|
|
)
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def flows() -> dict:
|
|
out = subprocess.run(
|
|
["node", str(HERE / "helper_322_3_flow.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=120,
|
|
check=True,
|
|
)
|
|
return json.loads(out.stdout)
|
|
|
|
|
|
def _marked(rows: list) -> list:
|
|
return [row for row in rows if row[1] or row[2] or row[3]]
|
|
|
|
|
|
def test_place(flows: dict) -> None:
|
|
assert _marked(flows["place"]) == [
|
|
[93, "옹벽", True, []],
|
|
[101, "옹벽", True, []],
|
|
[113, "옹벽", True, []],
|
|
]
|
|
|
|
|
|
def test_place_on_general_station_gets_name_and_shape(flows: dict) -> None:
|
|
# 219 흠 — 일반 측점 자리(100 · 120)에 새로 놓은 맹암거 · 관 = 그 자리 사본에 이름 칩 · 관 그림
|
|
assert _marked(flows["gridPlace"]) == [
|
|
[100, "맹암거", True, []],
|
|
[120, "파형강관 D800", True, ["culvert"]],
|
|
]
|
|
assert len(flows["gridPlace"]) == 11 # 측점 수 그대로(사본으로 갈음)
|
|
|
|
|
|
def test_move_hides_old_and_adds_new(flows: dict) -> None:
|
|
assert _marked(flows["move"]) == [[75, "파형강관 D1000", True, ["culvert"]]]
|
|
assert all(row[0] != 61 for row in flows["move"])
|
|
|
|
|
|
def test_same_group_switch_renames(flows: dict) -> None:
|
|
assert _marked(flows["sameGroup"]) == [
|
|
[93, "흙막이", True, []],
|
|
[101, "흙막이", True, []],
|
|
[113, "흙막이", True, []],
|
|
]
|
|
|
|
|
|
def test_cross_owner_switch_drops_pipe_drawing(flows: dict) -> None:
|
|
assert _marked(flows["crossOwner"]) == [[101, "맹암거", True, []]]
|
|
|
|
|
|
def test_pick_follows_moved_pipe(flows: dict) -> None:
|
|
moved, other = flows["follow"]
|
|
assert (moved["chainageM"], moved["structureId"]) == (75, "pipe-75.00")
|
|
assert (other["chainageM"], other["structureId"]) == (101, "w1") # 구조물 고름은 그대로
|
|
|
|
|
|
def test_remove_and_reopen(flows: dict) -> None:
|
|
assert _marked(flows["remove"]) == []
|
|
assert [row[0] for row in flows["remove"]] == list(range(0, 201, 20))
|
|
assert _marked(flows["reopen"]) == [
|
|
[93, "옹벽", False, []],
|
|
[101, "옹벽", False, []],
|
|
[113, "옹벽", False, []],
|
|
]
|