공용 줌 부품 wheelZoom 에 "ctrl" 갈래 · 트랙패드 핀치 같은 확대 · 그래프 위 브라우저 확대 막음. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013QyNXY2TUKXCFMwAca2APG
53 lines
1.5 KiB
Python
53 lines
1.5 KiB
Python
"""397 B06 횡단 카드 Ctrl+휠 확대 · 축소(요구 245).
|
|
|
|
Node 헬퍼(`helper_397_cross_ctrl_wheel.cjs`)가 실제 TS 를 트랜스파일해 가짜 SVG 로 돌림.
|
|
./venv/Scripts/python.exe -m pytest resources/tester/test_397_cross_ctrl_wheel.py -q
|
|
"""
|
|
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def r():
|
|
proc = subprocess.run(
|
|
["node", str(HERE / "helper_397_cross_ctrl_wheel.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_맨_휠은_스크롤(r):
|
|
# 줌 안 바뀜 · 기본 동작(카드 목록 스크롤) 안 막음
|
|
assert r["plain"] == {"prevented": False, "scale": 1}
|
|
assert r["touchAction"] == "pan-x pan-y" # 한 손가락 목록 밀기 그대로
|
|
|
|
|
|
def test_Ctrl_휠은_마우스_자리_줌(r):
|
|
assert r["ctrl"]["prevented"] is True # 브라우저 확대 막음
|
|
assert r["ctrl"]["scale"] == 1.15
|
|
assert r["ctrl"]["anchorKept"] is True
|
|
assert r["ctrlOut"] == round(1.15 * 0.87, 6)
|
|
|
|
|
|
def test_트랙패드_핀치도_확대(r):
|
|
assert r["pinch"] == round(1.15 * 0.87 * 1.15, 6)
|
|
|
|
|
|
def test_단추와_같은_상태_같은_한도(r):
|
|
assert r["button"] == round(1.15 * 0.87 * 1.15 / 0.85, 6)
|
|
assert r["max"] == 8
|
|
assert r["fit"] == {"scale": 1, "tx": 0, "ty": 0} # ⤢ 원배율
|
|
|
|
|
|
def test_휠_줌_화면은_그대로(r):
|
|
assert r["wheelTrue"] == {"scale": 1.15, "touchAction": "none"}
|