Files
Aislo/resources/tester/test_221_1_loupe_cad.py
T

70 lines
2.3 KiB
Python

# -*- coding: utf-8 -*-
"""돋보기 CAD 영역 빼기(계획서 221-1) 회귀검증 — CAD(cad_host 상자 · iframe) 위에선 안 켬 ·
켜진 채 들어가면 숨김 · 나오면 다시 보임(배율 그대로) · CAD 위 휠은 안 막음 · 복제에서 CAD 는 빈칸.
218-1 헬퍼(`helper_218_1_loupe.cjs`)의 CAD 장면을 판정함.
"""
import json
import os
import subprocess
import pytest
HERE = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture(scope="module")
def r():
proc = subprocess.run(
["node", os.path.join(HERE, "helper_218_1_loupe.cjs")],
capture_output=True,
text=True,
encoding="utf-8",
timeout=60,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
def test_CAD_판정(r):
c = r["cad"]
assert c["skip"] == ".cad-host, iframe"
assert c["isCad"] == [True, False, False, False]
def test_CAD_위_Z_안_켬_나오면_보임(r):
k = r["cad"]["keyOnCad"]
assert k["onCad"] == 0 and k["wheelPrevented"] is False
assert k["out"] == ["show", 50, 60] # 나온 자리에 뜸
assert k["off"] == "hide"
def test_CAD_위_우클릭_길게_안_켬_메뉴_그대로(r):
assert r["cad"]["press"] == {"log": 0, "menuPrevented": False}
def test_켜진_채_CAD_위_숨김_휠_안_막음_나오면_배율_그대로(r):
e = r["cad"]["enter"]
assert e["hidden"] == "hide"
assert e["wheel"] == {"prevented": False, "stopped": False} # CAD 휠 줌 그대로
assert e["quiet"] # 숨긴 동안 원을 안 움직임
assert e["back"] == [["show", 70, 80], ["zoom", 2.25]]
assert e["moveHide"] == "hide" and e["moveBack"] == ["show", "zoom", "move"]
def test_초점이_CAD_로_넘어가도_끄지_않고_숨김(r):
b = r["cad"]["blur"]
assert b["blurHidden"] == ["show", "hide"]
assert b["frameKeyup"] is True # Z 떼기는 CAD 창에서 들음
assert b["afterRelease"] == ["show", "hide"] # 뗀 뒤 나와도 안 뜸
assert b["pressBack"] == ["show", "hide", "show", "move"] # 우클릭 누른 채 나오면 다시
assert b["pressOff"] == "hide"
def test_복제에서_CAD_빈칸(r):
c = r["capture"]
assert c["frameTag"] == "DIV" and c["frameEmpty"] == 0
assert c["frameSize"] == ["320px", "240px"]
assert c["cadBoxEmpty"] == 0 and c["cadBoxSize"] == ["400px", "300px"]