From fdf055312cda23ab7c7419b0c8cead6d8b80b726 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 Feb 2020 10:07:55 +0530 Subject: [PATCH] DRYer --- kitty_tests/mouse.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/kitty_tests/mouse.py b/kitty_tests/mouse.py index 662a1df4b..b921bdb84 100644 --- a/kitty_tests/mouse.py +++ b/kitty_tests/mouse.py @@ -73,6 +73,9 @@ class TestMouse(BaseTest): count -= 1 ev(GLFW_MOUSE_BUTTON_LEFT, x=x, y=y) + def scroll(x=0, y=0, up=True): + move(x=x, y=y, button=-2 if up else -3) + # Simple, click, move, release test init() press() @@ -131,15 +134,14 @@ class TestMouse(BaseTest): release() # scrolling - UP, DOWN = -2, -3 init() press(x=1) - move(x=1, button=UP) + scroll(x=1) self.ae(sel(), 'LMNO12') - move(x=1, button=UP) + scroll(x=1) self.ae(sel(), 'GHIJKLMNO12') - move(x=1, button=DOWN) + scroll(x=1, up=False) self.ae(sel(), 'LMNO12') - move(x=2, button=DOWN) + scroll(x=2, up=False) self.ae(sel(), '23') release()