|
This version is still in development and is not considered stable yet. For the latest stable version, please use nvda-addon-testkit 2.x! |
nvda.keys
Sending gestures through NVDA’s own input pipeline — not simulated at the OS level, so it
exercises the same gesture-handling code your add-on’s __gestures map runs under.
def test_a_gesture_reaches_nvda(nvda):
nvda.keys.press("NVDA+shift+control+F12")
assert "NVDA+shift+control+F12" in [entry["gesture"] for entry in nvda.keys.sent()]
sent() returns every gesture NVDA has processed this session, in order — useful for asserting
that a gesture was actually delivered even when it produces no speech or log line of its own.
press(gesture, *, timeout=10.0) returns once the gesture has run on NVDA’s main thread. It
does not wait for whatever NVDA does next, so wait on speech or state
(nvda.speech.wait_for, wait_for) before asserting the effect. press_all(*gestures, timeout=10.0) sends gestures one after another, and
type_text(text, *, timeout=30.0) types a string.