- ui_template_native_menu.ts releaseSelectAfterPick — 창 캡처 pointerdown · keydown · change · 아직 그 select 에 초점일 때만 blur - 시험 test_280_6_select_release 새로 · 옛 가짜 import 두 헬퍼(282-1 · 224-1c)에 새 함수 흉내 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
1.6 KiB
Python
49 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""280-6 드롭다운 — 마우스로 고르면 한 박자 뒤 초점 뺌 · 키보드로 고르면 그대로 · 부르는 자리 셋.
|
|
|
|
Node 헬퍼(`helper_280_6_select_release.cjs`)가 `ui_template/ui_template_native_menu.ts` 를 트랜스파일해
|
|
가짜 창 · 가짜 select · 가짜 타이머로 돌리고, 여기서 값을 판정함.
|
|
"""
|
|
|
|
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_280_6_select_release.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_마우스로_고르면_한_박자_뒤_초점_뺌(r):
|
|
assert r["mouse"] == {"before": 0, "blurs": 1}
|
|
assert r["keyThenMouse"]["blurs"] == 1
|
|
assert r["none"]["blurs"] == 1 # 입력 없이 온 change(스크립트 · 손가락)도 뺌
|
|
|
|
|
|
def test_키보드로_고르면_초점_남음(r):
|
|
assert r["keyboard"]["blurs"] == 0
|
|
assert r["mouseThenKey"]["blurs"] == 0 # 마우스로 펼친 뒤 ↑↓ + Enter
|
|
|
|
|
|
def test_select_밖_이미_옮긴_초점은_안_건드림(r):
|
|
assert r["input"]["blurs"] == 0
|
|
assert r["moved"]["blurs"] == 0
|
|
|
|
|
|
def test_창_캡처_듣기와_부르는_자리_셋(r):
|
|
assert sorted(r["listeners"]) == [["change", True], ["keydown", True], ["pointerdown", True]]
|
|
assert r["wiring"] == {"main": True, "cad": True, "popout": True}
|