fix(377 B07 전개도): 화면 검증 손질 — 돌 무늬가 박스 왼쪽을 넘던 흔들림 한도 · 콘크리트 · 쇄석 점 크기(화면 배율에서 안 보임) · 표 크게(그림 241 꼴) · 높이 · 폭 소수 둘째 자리 표기(면적이 쓴 값 그대로)
- 시험: 무늬는 박스 안(형태 다섯 · 견본 서른) · 확정본 kind development · 3.55 폭 표기 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Se7ytqbohmBQnfYpwYFnYf
This commit is contained in:
@@ -16,6 +16,7 @@ from B07_DesignDetail import B07_DesignDetail_Engine_Cad_Development as dev
|
||||
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_Development_Draw import (
|
||||
FILL_LAYER_ID,
|
||||
build_development_drawing,
|
||||
fill_entities,
|
||||
)
|
||||
from B07_DesignDetail.B07_DesignDetail_Engine_Frame_Export import drawing_to_dxf
|
||||
|
||||
@@ -197,6 +198,13 @@ def test_묶음_거리_높이(root):
|
||||
pave = _sheet(sheets, "development_concrete")
|
||||
assert pave["title"] == "콘크리트포장 전개도"
|
||||
assert [r["height_m"] for r in pave["rows"]] == [3.5, 4.5] # 빈 폭 = (4 + 5 + 4.5) / 3
|
||||
# 표 · 끝 글 = 면적이 쓴 폭 그대로(3.55 를 3.5 로 줄여 보이지 않음)
|
||||
odd = {**pave, "rows": [{**pave["rows"][0], "height_m": 3.55}]}
|
||||
drawing = build_development_drawing(odd["id"], odd, 20.0)
|
||||
cells = next(e for e in drawing["entities"] if e["type"] == "Table")["shapeData"]["cells"]
|
||||
assert [c["text"] for c in cells[2]] == ["No.22+00~No.26+05", "85.0", "3.55", "301.8"]
|
||||
labels = [e["shapeData"]["label"] for e in drawing["entities"] if e["type"] == "Text"]
|
||||
assert "B=3.55" in labels
|
||||
|
||||
|
||||
def test_설계_없으면_단수_안_거름_목록(root):
|
||||
@@ -239,6 +247,24 @@ def test_높이_빈칸_박스와_미입력_글_무늬_DXF(root):
|
||||
assert text.count("LINE\r\n") > 50 # 돌 무늬 = 선(DXF 에도 남음)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"form", ["돌쌓기(찰)", "돌쌓기(메)", "돌망태", "통나무·목재틀", "콘크리트"]
|
||||
)
|
||||
def test_무늬는_박스_안(form):
|
||||
for seed in range(30):
|
||||
width, height = 10 + seed * 9.7, 8 + seed % 7 * 5.0
|
||||
for entity in fill_entities(f"s{seed}", form, "soil", (0.0, 0.0, width, height)):
|
||||
for one in entity.get("children") or [entity]:
|
||||
shape = one["shapeData"]
|
||||
if "center" in shape:
|
||||
r, (x, y) = shape["radius"], (shape["center"]["x"], shape["center"]["y"])
|
||||
points = [(x - r, y - r), (x + r, y + r)]
|
||||
else:
|
||||
points = [(p["x"], p["y"]) for p in (shape["startPoint"], shape["endPoint"])]
|
||||
for x, y in points:
|
||||
assert -1e-6 <= x <= width + 1e-6 and -1e-6 <= y <= height + 1e-6, (seed, x, y)
|
||||
|
||||
|
||||
def test_목록_전_장_없으면_빈_장(root, tmp_path):
|
||||
long_path = tmp_path / "long.json"
|
||||
long_path.write_text(json.dumps({"stations": []}), encoding="utf-8")
|
||||
@@ -248,3 +274,19 @@ def test_목록_전_장_없으면_빈_장(root, tmp_path):
|
||||
assert kind == "development" and label == "관보호공 돌쌓기(메) 전개도" and not confirmed
|
||||
with pytest.raises(ValueError):
|
||||
dev.read_development(root, long_path, "development_x-1", DESIGNS)
|
||||
|
||||
|
||||
def test_확정본은_전개도_kind_로_읽음(root, tmp_path):
|
||||
from B07_DesignDetail.B07_DesignDetail_Engine_Cad import DRAWING_FORMAT
|
||||
from B07_DesignDetail.B07_DesignDetail_Router_Support import _design_root, _read_drawing
|
||||
|
||||
stage = _design_root(root)
|
||||
(stage / "drawings").mkdir(parents=True)
|
||||
saved = {"format": DRAWING_FORMAT, "entities": [], "layers": []}
|
||||
(stage / "drawings" / "development_pipe0.json").write_text(json.dumps(saved), "utf-8")
|
||||
manifest = {"drawings": {"development_pipe0": {"confirmed": True, "label": "관보호공"}}}
|
||||
(stage / "manifest.json").write_text(json.dumps(manifest, ensure_ascii=False), "utf-8")
|
||||
kind, label, drawing, confirmed, table = _read_drawing(
|
||||
root, tmp_path / "long.json", "development_pipe0"
|
||||
)
|
||||
assert (kind, label, confirmed, table) == ("development", "관보호공", True, None)
|
||||
|
||||
Reference in New Issue
Block a user