Files
Aislo/resources/tester/test_cad_touch.py
T
eomsangdonandClaude Sonnet 5.5 161b0a9f78 fix(495-1 CAD): 손가락 단추 지움 · 리본 마우스 누름 초점 놓음 · 축척 칸 알림 한 줄 · 탭 구분선 진하게
- 오른쪽 손가락 단추(Esc · 엔터 · 삭제 · 뒤로 · 다시 · 스냅) 지움 — 끌기 · 집기 동작 그대로
- 리본 nav 마우스 누름 한 곳에서 단추 blur(키보드 초점 남김) · 단추별 blur 셋 걷음
- B07 축척 칸 = 칸 밑 오류 글 숨김 + 줄 아래 알림 한 줄(X · Y 높이 같음)
- CAD 탭 줄 밑 선 --color-smoke · 도면 탭 겹판 26 → 25
- 시험: test_cad_touch · test_280_5_b07_settings 고쳐 씀

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-20 19:51:25 +09:00

82 lines
3.1 KiB
Python

"""B07 CAD 손가락(PLAN_기기대응 4-1 · `openwebcad/src/inputController/input-touch.ts`) — 빌드된 CAD 화면.
① 손가락 명령 단추(.cad-touch-bar)는 없음(요구 298-1) — 마우스 · 손가락 화면 모두 DOM 0
② 확대 막기(user-scalable=no) 없음
③ 캔버스 touch-action none · 두 손가락 벌림 · 한 손가락 끌기가 페이지를 확대 · 밀지 않음(페이지 오류 0)
"""
import os
import urllib.request
import pytest
URL = os.environ.get("CAD_TOUCH_URL", "http://localhost:5174/b07-cad/")
def _up() -> bool:
try:
urllib.request.urlopen(URL, timeout=2)
return True
except Exception:
return False
def _touch(cdp, kind, points):
cdp.send(
"Input.dispatchTouchEvent",
{
"type": kind,
"touchPoints": [{"x": x, "y": y, "id": i} for i, (x, y) in enumerate(points)],
},
)
@pytest.mark.skipif(not _up(), reason="sub1 화면 서버(5174) 꺼짐")
def test_cad_no_touch_bar_and_gestures():
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(channel="msedge", headless=True)
mouse = browser.new_page(viewport={"width": 1440, "height": 900})
mouse.goto(URL)
mouse.wait_for_selector("canvas[data-id=canvas]", timeout=20000)
assert mouse.evaluate("document.querySelector('.cad-touch-bar')") is None
ctx = browser.new_context(
viewport={"width": 1180, "height": 820}, has_touch=True, is_mobile=True
)
page = ctx.new_page()
errors = []
page.on("pageerror", lambda e: errors.append(str(e)))
page.goto(URL)
page.wait_for_selector("canvas[data-id=canvas]", timeout=20000)
assert page.evaluate("document.querySelector('.cad-touch-bar')") is None
assert "user-scalable" not in page.evaluate(
"document.querySelector('meta[name=viewport]').content"
)
assert (
page.evaluate(
"getComputedStyle(document.querySelector('canvas[data-id=canvas]')).touchAction"
)
== "none"
)
box = page.evaluate(
"(() => { const r = document.querySelector('canvas[data-id=canvas]').getBoundingClientRect();"
" return [r.left + r.width / 2, r.top + r.height / 2]; })()"
)
cx, cy = box
cdp = ctx.new_cdp_session(page)
_touch(cdp, "touchStart", [(cx, cy)]) # 한 손가락 끌기 = 화면 옮기기
for i in range(1, 6):
_touch(cdp, "touchMove", [(cx + i * 20, cy + i * 10)])
_touch(cdp, "touchEnd", [])
_touch(cdp, "touchStart", [(cx - 30, cy), (cx + 30, cy)]) # 벌림 = 도면 확대
for i in range(1, 8):
_touch(cdp, "touchMove", [(cx - 30 - i * 10, cy), (cx + 30 + i * 10, cy)])
_touch(cdp, "touchEnd", [])
page.wait_for_timeout(300)
assert page.evaluate("visualViewport.scale") == 1
assert page.evaluate("[scrollX, scrollY]") == [0, 0]
assert not errors, errors
browser.close()