110 lines
3.5 KiB
Python
110 lines
3.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""472 덧(요구 272 C · D) — B06 를 열기만 해도 초안이 생기던 흠 ·
|
|
카드 고름이 안 바꾼 지반을 박던 흠.
|
|
|
|
까닭
|
|
C. 표준 횡단 패널이 열 때 세션 `std-cross` 에 config 기본값을, 설정값 받기(`seedStandardCross`)가
|
|
저장분을 베껴 씀 → 조작 없이 초안 칸이 섬. 규칙 = 값이 저장분과 같으면 칸 없음 · 계산은 저장분.
|
|
D. 카드 단추 하나를 눌러도 지반 · 단면 유형 · 측구형식 · 포장 등 일곱 칸을 통째로 세션에 실음 →
|
|
[측구] 만 눌렀는데 ripping_rock 이 사용자 선택으로 박힘. 규칙 = 바꾼 칸만.
|
|
덧. 소단 사본(`berm` · 시설 줄이 열 때 구조물에서 씀)이 떠남 확인 고침으로 잡힘 →
|
|
소단 있는 프로젝트는 열기만 해도 물음.
|
|
|
|
Node 헬퍼 `helper_472_open_no_draft.mjs` 가 vite ssr 로 묶은 진짜 모듈
|
|
(`helper_472_open_no_draft_entry.ts`)을 부름.
|
|
"""
|
|
|
|
import json
|
|
import shutil
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
ROOT = HERE.parents[1]
|
|
FIXTURE = HERE / "fixtures" / "b06_364_6_rock_route_304.json"
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def out(tmp_path_factory):
|
|
work = tmp_path_factory.mktemp("b472_open")
|
|
build = subprocess.run(
|
|
[
|
|
"node",
|
|
str(ROOT / "config" / "node_modules" / "vite" / "bin" / "vite.js"),
|
|
"build",
|
|
"--configLoader",
|
|
"runner",
|
|
"--ssr",
|
|
"../resources/tester/helper_472_open_no_draft_entry.ts",
|
|
"--outDir",
|
|
str(work),
|
|
"--logLevel",
|
|
"error",
|
|
],
|
|
cwd=ROOT,
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=300,
|
|
)
|
|
assert build.returncode == 0, build.stderr
|
|
bundle = work / "bundle.mjs"
|
|
shutil.copy(work / "helper_472_open_no_draft_entry.js", bundle)
|
|
proc = subprocess.run(
|
|
["node", str(HERE / "helper_472_open_no_draft.mjs"), str(bundle), str(FIXTURE)],
|
|
cwd=ROOT,
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=120,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
@pytest.mark.parametrize("step", ["ctxDrafts", "panelDrafts", "afterStored", "configDrafts"])
|
|
def test_열기만_하면_초안_칸_0(step, out):
|
|
assert out[step] == []
|
|
|
|
|
|
def test_계산은_저장분(out):
|
|
assert out["panelRockDitch"] == 0.9
|
|
assert out["effectiveRockDitch"] == 0.9
|
|
|
|
|
|
def test_저장분_없으면_config(out):
|
|
assert out["configRockDitch"] == 0.69
|
|
|
|
|
|
def test_옛_판이_남긴_같은_값_칸은_걷음(out):
|
|
assert out["oldSameCell"] is None
|
|
|
|
|
|
def test_고친_값은_칸에_남음(out):
|
|
assert out["editedRoadWidth"] == 3.5
|
|
|
|
|
|
def test_카드_지반_글_상태는_상세_ground_type(out):
|
|
# 상세 = ripping_rock → 「토사」 단추 꺼짐(단추 이름은 늘 「토사」 · 켜짐/꺼짐이 값)
|
|
assert out["soilPressed"] == "false"
|
|
|
|
|
|
def test_측구_단추는_측구_칸만(out):
|
|
assert out["ditchChange"] == {"ditch_choice": False}
|
|
|
|
|
|
def test_토사_단추는_지반_칸만(out):
|
|
assert out["soilChange"] == {"ground_type": "soil"}
|
|
|
|
|
|
def test_세션_고름은_바꾼_칸끼리_얹음(out):
|
|
assert out["choice"] == {"20": {"ditch_choice": False, "two_stage_slope": True}}
|
|
assert out["choiceAfterEmpty"] == out["choice"]
|
|
|
|
|
|
def test_소단_사본은_떠남_확인에_안_잡힘(out):
|
|
assert out["dirtyBermOnly"] is False
|
|
assert out["dirtyWithEdit"] is True
|