diff options
Diffstat (limited to 'test/test_wacom.py')
-rw-r--r-- | test/test_wacom.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/test/test_wacom.py b/test/test_wacom.py index 26a01aa..19999ac 100644 --- a/test/test_wacom.py +++ b/test/test_wacom.py @@ -327,4 +327,60 @@ def test_axis_updates_wheel(mainloop, opts, stylus_type): assert first_wheel == current_wheel +def test_scroll(mainloop, opts): + """ + Check panscrolling works correctly + """ + dev = Device.from_name("PTH660", "Pen") + opts["PanScrollThreshold"] = "150" + + prox_in = [ + Sev("ABS_X", 50), + Sev("ABS_Y", 50), + Sev("BTN_TOOL_PEN", 1), + Sev("SYN_REPORT", 0), + ] + + prox_out = [ + Sev("BTN_TOOL_PEN", 0), + Sev("SYN_REPORT", 0), + ] + + press_button2 = [ + Sev("BTN_STYLUS", 1), + Sev("SYN_REPORT", 0), + ] + + touchdown_pen = [ + Sev("BTN_TOUCH", 1), + Sev("ABS_PRESSURE", 20), + Sev("SYN_REPORT", 0), + ] + + move_pen_x = [Sev("ABS_X", 75), Sev("SYN_REPORT", 0)] + + up_pen = [Sev("BTN_TOUCH", 0), Sev("ABS_PRESSURE", 0), Sev("SYN_REPORT", 0)] + + depress_button2 = [Sev("BTN_STYLUS", 0), Sev("SYN_REPORT", 0)] + + monitor = Monitor.new_from_device(dev, opts) + monitor.wacom_device.set_runtime_option("PanButton", "2") + + monitor.write_events(prox_in) + monitor.write_events(press_button2) + monitor.write_events(touchdown_pen) # Pen touchdown + monitor.write_events(move_pen_x) # Move pen 25% towards positive x + monitor.write_events(up_pen) # Pen up + monitor.write_events(depress_button2) # Depress button2 + monitor.write_events(prox_out) + + mainloop.run() + have_we_scrolled = False + for event in monitor.events: + if event.axes.scroll_x != 0: + assert event.axes.scroll_x == -1223320 + have_we_scrolled = True + assert have_we_scrolled + + # vim: set expandtab tabstop=4 shiftwidth=4: |