Files
Aislo/resources/tester/test_180_b07_cross_group.py
T
eomsangdonandClaude Opus 5.5 a2c3c0fc1f fix(526-1): B07 횡단 장 인쇄 칸선 지움 · 칸마다 안내선 · 처음 맞춤 작도 영역까지
- 횡단 장 칸 격자선(도각 층 인쇄 개체) 지움 — 칸은 화면 안내선 겹판(guide.cells · 단면마다 점선)
  · 안내선 숨기기에 함께 꺼짐 · 넘친 칸 붉은 틀은 그대로
- 옛 확정 · 저장본 장은 열 때 칸선만 걷고 칸 안내선은 지금 배치로(refresh_saved_sheet)
- CAD 처음 맞춤 · 전체 맞춤 = 내용 + 작도 영역(가이드) — 표준 횡단도가 내용에만 확대돼
  도면 한 장 안 자리가 안 보이던 흠
- 낡은 시험 고침: test_169 칸선 단언 → 칸선 없음 + 칸 안내선 · test_212_3 「남는 검은 선 =
  인쇄 칸선 지우지 않음」(212-3 결정) → 요구 343-4 로 칸선 지움 · guide-area 시험 칸 그리기

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 14:39:18 +09:00

89 lines
3.2 KiB
Python

# -*- coding: utf-8 -*-
"""180-1 B07 횡단 장 — 원지반선 고르기 · 측점 한 벌 groupId.
못박는 것
- 횡단 장 · 측점 한 장의 원지반 층은 안 잠김(종단은 그대로 잠김).
- 측점마다 groupId 하나(원지반 · 계획선 · 표 · 글 전부) · 측점끼리 다름.
- 도각엔 groupId 없음.
- cross_placements 의 group_id = 그 측점 엔티티 값(화면 덧그림이 같은 묶음).
"""
from B07_DesignDetail.B07_DesignDetail_Engine_Cad import (
FRAME_LAYER_ID,
GROUND_COLOR,
GROUND_LAYER_ID,
build_cross_drawing,
)
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_Sheet import (
build_cross_sheet,
plan_cross_sheets,
)
from B07_DesignDetail.B07_DesignDetail_Engine_Template import use_project_templates
def _source(chainage: float) -> dict:
return {
"chainage_m": chainage,
"samples": [
{"valid": True, "offset_m": float(x), "elevation_m": 100.0 + 0.1 * x}
for x in range(-5, 6)
],
}
def _design_line() -> list[dict]:
return [{"offset_m": x, "elevation_m": 100.0} for x in (-3.0, 0.0, 3.0)]
def _drawing() -> dict:
use_project_templates(None)
chainages = [0.0, 20.0, 40.0, 60.0]
sheet = plan_cross_sheets(chainages, {"default": [2, 2]})[0]
sections = [
{
"chainage": c,
"source": _source(c),
"design_line": _design_line(),
"design": {"structure_note": "L형 측구"},
"quantity_table": {"ground": 1.0, "planned": 0.5},
"title": f"No.{int(c // 20)}",
}
for c in chainages
]
return build_cross_sheet(sheet, sections)
def _ground_locked(drawing: dict) -> bool:
return next(layer for layer in drawing["layers"] if layer["id"] == GROUND_LAYER_ID)["isLocked"]
def test_원지반_층_안_잠김() -> None:
# 장 = 원지반이 측점 층에(212-2) · 도각 말고 잠긴 층 없음
layers = _drawing()["layers"]
assert not any(layer["isLocked"] for layer in layers if layer["id"] != FRAME_LAYER_ID)
single = build_cross_drawing(_source(0.0), "cross_00000m", _design_line(), None, None, "")
assert _ground_locked(single) is False
def test_측점마다_groupId_하나() -> None:
drawing = _drawing()
placements = drawing["cross_placements"]
assert len(placements) == 4
group_ids = [p["group_id"] for p in placements]
assert len(set(group_ids)) == 4 # 측점끼리 다름
grouped = [e for e in drawing["entities"] if "groupId" in e]
assert {e["groupId"] for e in grouped} == set(group_ids)
for group_id in group_ids:
members = [e for e in grouped if e["groupId"] == group_id]
types = {e["type"] for e in members}
ground = any(e["type"] == "PolyLine" and e["lineColor"] == GROUND_COLOR for e in members)
assert ground and "Table" in types and "Text" in types
# 도각은 묶지 않음
assert all("groupId" not in e for e in drawing["entities"] if e["layerId"] == FRAME_LAYER_ID)
assert all(e["layerId"] != FRAME_LAYER_ID for e in grouped)
def test_groupId_결정적() -> None:
first = [p["group_id"] for p in _drawing()["cross_placements"]]
assert first == [p["group_id"] for p in _drawing()["cross_placements"]]