112 lines
4.3 KiB
Python
112 lines
4.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""506-3 나 · 다 · 정함 — 죽은 길 걷음 · CAD 되돌리기 이음 · B09 [인쇄 미리보기] · M02 도움말.
|
|
|
|
못박는 것
|
|
6-a 이전 · 다음 도면 길(navigateDrawing · onNavigate · aislo:b08:navigate · hasPrev · hasNext) 없음.
|
|
6-b CAD `cad-host-save` 클래스 토글 없음(CSS 규칙 0).
|
|
4-2 B08 안 쓰는 로케일 글 11 없음.
|
|
6-f 특성 판 색 칸 = `paintNowCommitLater`(리본과 한 벌 · `selection-style.ts`) — 동작은 vitest `cad/undo-506-3`.
|
|
4-1 B09 [인쇄 미리보기] = 저장(`DRAFT.save`) 성공 뒤 이동 · 실패면 머묾 · 단계 그대로(complete 안 부름).
|
|
6-e M02 카드 단축키 도움말에 DWG 불러오기 한 줄.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
ROOT = Path(HERE).parents[1]
|
|
CAD = ROOT / "B07_DesignDetail" / "openwebcad" / "src"
|
|
|
|
|
|
def _read(path: Path) -> str:
|
|
return path.read_text(encoding="utf-8").replace("\r\n", "\n")
|
|
|
|
|
|
def test_6a_이전_다음_길_없음():
|
|
page = _read(ROOT / "B07_DesignDetail" / "B07_DesignDetail_UI_Page.ts")
|
|
host = _read(ROOT / "ui_template" / "cad_host" / "cad_host.ts")
|
|
types = _read(CAD / "App.types.ts")
|
|
for text, words in (
|
|
(page, ("navigateDrawing", "onNavigate", "hasPrev", "hasNext")),
|
|
(host, ("onNavigate", "aislo:b08:navigate", "direction")),
|
|
(types, ("hasPrev", "hasNext")),
|
|
):
|
|
for word in words:
|
|
assert word not in text, word
|
|
|
|
|
|
def test_6b_host_save_클래스_없음():
|
|
state = _read(CAD / "state.ts")
|
|
assert "cad-host-save" not in state
|
|
assert "export const setHostSave" in state and "export const isHostSave" in state
|
|
|
|
|
|
def test_4_2_안_쓰는_글_없음():
|
|
locale = _read(ROOT / "ui_template" / "ui_template_locale_b5.ts") # B08 칸 = b5(512-2 나눔)
|
|
for key in (
|
|
"B08_Quantity_Side_Pending",
|
|
"B08_Quantity_Btn_Confirm",
|
|
"B08_Quantity_Confirm_Success",
|
|
"B08_Quantity_Confirm_Failed",
|
|
"B08_Quantity_Dev_Title",
|
|
"B08_Quantity_Dev_Unlock",
|
|
"B08_Quantity_Dev_Relock",
|
|
"B08_Quantity_Dev_Bypassed",
|
|
"B08_Quantity_Dev_Normal",
|
|
"B08_Quantity_Dev_Done",
|
|
"B08_Quantity_Dev_Failed",
|
|
):
|
|
assert key not in locale, key
|
|
assert "B08_Quantity_Title" in locale
|
|
|
|
|
|
def test_6f_색_칸_한_벌():
|
|
style = _read(CAD / "helpers" / "selection-style.ts")
|
|
assert "export function paintNowCommitLater" in style
|
|
ribbon = _read(CAD / "components" / "RibbonWidgets.tsx")
|
|
assert "function paintNowCommitLater" not in ribbon and "paintNowCommitLater(" in ribbon
|
|
editor = _read(CAD / "components" / "PropertiesEditor.tsx")
|
|
color = editor[editor.index("<span>색상</span>") :]
|
|
color = color[: color.index("</label>")]
|
|
assert "paintNowCommitLater(styleTargets(getSelectedEntities())" in color
|
|
assert "applyToLines" not in color
|
|
|
|
|
|
def test_6g_laymrg_사본():
|
|
tools = _read(CAD / "tools" / "utility" / "layer-tools.ts")
|
|
merge = tools[tools.index("export const layerMergeToolStateMachine") :]
|
|
merge = merge[: merge.index("\n});")]
|
|
assert "restyle(" in merge
|
|
assert (
|
|
"entity.layerId = targetId;" in merge and "for (const entity of getEntities())" not in merge
|
|
)
|
|
|
|
|
|
def test_4_1_인쇄_미리보기_저장_뒤_이동():
|
|
proc = subprocess.run(
|
|
["node", os.path.join(HERE, "helper_506_3_b09_print.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
out = json.loads(proc.stdout)
|
|
assert out["saved"] == ["save", "go:/b09-print"]
|
|
assert out["failed"] == ["save"]
|
|
shell = _read(ROOT / "B09_Estimation" / "B09_Estimation_UI_Shell.ts")
|
|
assert "DRAFT.save = saveChanged;" in shell
|
|
ui = _read(ROOT / "B09_Estimation" / "draft" / "B09_Draft_Print_UI.ts")
|
|
assert "complete" not in ui.split("DRAFT.actions.push(")[1] # 단계 그대로
|
|
|
|
|
|
def test_6e_m02_dwg_도움말():
|
|
card = _read(ROOT / "M02_MasterTemplete" / "M02_MasterTemplete_DrawingCard.ts")
|
|
keys = card[card.index("export const DRAWING_KEYS") :]
|
|
keys = keys[: keys.index("];")]
|
|
assert '["IMPORT · 파일 끌어 놓기", "DWG · DXF 불러오기(고치기 카드)"]' in keys
|