# -*- coding: utf-8 -*- """계획노선 편집 창 — 가운데 단추 팬 튐(401 · 요구 250-3) 회귀검증. 까닭: 팬이 누를 때 offset 을 쥐고 「처음 + 민 만큼」으로 덮어써, 끄는 중 휠 확대 · Ctrl+휠 회전 · 둘째 손가락이 바꾼 화면을 옛 값이 덮었다(지도가 튐). 고침 = 걸음마다 지금 화면에 더함 · 시작 포인터만 · 단추 놓침(buttons) · 캡처 잃음에 팬 끝. Node 헬퍼(`helper_401_routeedit_pan.cjs`)가 진짜 `bindRouteEditNavigation` 에 가짜 캔버스를 붙여 돌린다. 판정 = 잡은 땅 점이 손(커서) 밑에 남나(px). """ import json import os import subprocess import pytest HERE = os.path.dirname(os.path.abspath(__file__)) TOL = 1e-6 @pytest.fixture(scope="module") def results(): proc = subprocess.run( ["node", os.path.join(HERE, "helper_401_routeedit_pan.cjs")], capture_output=True, text=True, timeout=60, ) assert proc.returncode == 0, proc.stderr return json.loads(proc.stdout) def test_가운데_끌기_여러_걸음_손_따라감(results): assert results["follow0"] < TOL assert results["follow15"] < TOL def test_끄는_중_휠_확대_뒤에도_튐_없음(results): for key in ("wheel0", "wheel15"): case = results[key] assert case["scale"] < 1 # 휠이 실제로 배율을 바꿨나 assert case["afterWheel"] < TOL assert case["afterMove"] < TOL def test_끄는_중_회전_뒤_손이_민_만큼_움직임(results): assert results["rotateMid"] < TOL def test_창_밖에서_놓고_들어오면_팬_끝(results): assert results["outside"]["moved"] == pytest.approx(0, abs=TOL) assert results["outside"]["lostMoved"] == pytest.approx(0, abs=TOL) def test_둘째_손가락은_팬을_넘겨받지_않음(results): assert results["secondTouch"] < TOL def test_편집_창_왼쪽_단추는_팬_안_함(results): assert results["leftPan"] == 0