- 마커 · 띠에 맞은 누름은 3D 부재 고름이 빈 곳 누름으로 읽지 않음(pressedMarker) - 3D 빈 곳 누름 = 고름 안 풂 · 같은 띠 · 같은 부재 다시 누름 = 풂 - 핀 · 라벨 = 표시만(레이캐스트 뺌) · 숨은 측점선은 누름 대상에서 뺌 - 3D 누름 길 통째 시험(three + 가짜 캔버스) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01STqEqztUthVFBmEP18wBSz
92 lines
3.2 KiB
Python
92 lines
3.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""232-1 3D 띠 강조 바로 꺼짐(요구 104 · 조사 AF a1 · a2) — 3D 누름 길 통째.
|
|
|
|
까닭: 띠 누름을 마커 듣개가 켜고(누를 때) 3D 부재 고름이 뗄 때 「빈 곳 누름」으로 읽어 고름 전체를 지움.
|
|
고침: ① 마커 · 띠에 맞은 누름은 부재 고름이 건너뜀 ② 숨은 핀 · 꺼 둔 측점선 · 라벨은 누름을 안 가로챔
|
|
③ 3D 빈 곳 누름 = 고름 안 풂(08-05) · 같은 띠 · 같은 부재 다시 누름 = 풂.
|
|
진짜 TS 를 `helper_232_1_3d_press.cjs` 가 three + 가짜 캔버스로 한 누름씩(창 캡처 → 캔버스 듣개 차례) 돌림.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
import subprocess
|
|
|
|
import pytest
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
ROOT = os.path.abspath(os.path.join(HERE, "..", ".."))
|
|
|
|
pytestmark = pytest.mark.skipif(
|
|
not os.path.isdir(os.path.join(ROOT, "config", "node_modules")),
|
|
reason="프론트엔드 의존성 미설치",
|
|
)
|
|
|
|
RED = "#ef4444"
|
|
YELLOW = "#facc15"
|
|
AT_120 = {"chainageM": 120, "structureId": None}
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def out() -> dict:
|
|
proc = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", os.path.join(HERE, "helper_232_1_3d_press.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_띠_누름은_뗀_뒤에도_빨강_핀_기록_유지(out) -> None:
|
|
for phase in ("down", "up"):
|
|
state = out["bar"][phase]
|
|
assert state["s120"] == RED
|
|
assert state["pin"] is True
|
|
assert state["session"] == AT_120
|
|
assert state["graph"] == "s120"
|
|
|
|
|
|
def test_빈_곳_누름은_고름_안_풂(out) -> None:
|
|
assert out["empty"]["up"]["s120"] == RED
|
|
assert out["empty"]["up"]["session"] == AT_120
|
|
assert out["memberEmpty"]["up"]["member"] is True
|
|
assert out["memberEmpty"]["up"]["session"]["chainageM"] == 160
|
|
|
|
|
|
def test_같은_띠_다시_누름은_풂(out) -> None:
|
|
up = out["again"]["up"]
|
|
assert (up["s120"], up["pin"], up["session"], up["graph"]) == (YELLOW, False, None, None)
|
|
|
|
|
|
def test_숨은_핀_라벨이_있던_띠_가운데도_켜짐(out) -> None:
|
|
assert out["center"]["up"]["s120"] == RED
|
|
assert out["center"]["up"]["session"] == AT_120
|
|
|
|
|
|
def test_부재_고름과_같은_부재_다시_누름(out) -> None:
|
|
up = out["memberPick"]["up"]
|
|
assert up["member"] is True
|
|
assert up["session"] == {"chainageM": 160, "structureId": None, "partKey": "inlet"}
|
|
again = out["memberAgain"]["up"]
|
|
assert again["member"] is False
|
|
assert again["session"] is None
|
|
|
|
|
|
def test_꺼_둔_측점선은_누름을_안_가로챔(out) -> None:
|
|
up = out["hiddenLines"]["up"]
|
|
assert up["s100"] == YELLOW
|
|
assert up["session"] == AT_120 # 앞 고름 그대로 · 빈 곳 누름이라 안 풂
|
|
assert out["hiddenPressedMarker"] is False
|
|
|
|
|
|
def test_배선() -> None:
|
|
with open(
|
|
os.path.join(ROOT, "B05_Profile", "B05_Profile_UI_Viewer.ts"), encoding="utf-8"
|
|
) as handle:
|
|
viewer = handle.read()
|
|
assert "pressedMarker: () => markerInput.pressedMarker()" in viewer
|