summaryrefslogtreecommitdiff
path: root/sw/qa/uitest
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-05-16 20:59:37 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-05-16 22:52:37 +0200
commit141c75847a0fc470915a16c83e80f8effb7a22b6 (patch)
tree40d06fd6418e36b7be7a51b182008d602056156c /sw/qa/uitest
parent7ed69df31bb5f3f4e89ca2ef914e103676836362 (diff)
More precisely count different event types in xwindow.py
Change-Id: I6872684292b4e7ef04f4c590012f1af25243f22f Reviewed-on: https://gerrit.libreoffice.org/72426 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sw/qa/uitest')
-rw-r--r--sw/qa/uitest/writer_tests5/xwindow.py56
1 files changed, 36 insertions, 20 deletions
diff --git a/sw/qa/uitest/writer_tests5/xwindow.py b/sw/qa/uitest/writer_tests5/xwindow.py
index bdfbfecff17e..7e561fe8de2f 100644
--- a/sw/qa/uitest/writer_tests5/xwindow.py
+++ b/sw/qa/uitest/writer_tests5/xwindow.py
@@ -17,8 +17,12 @@ from com.sun.star.awt import XKeyListener
mouseListenerCount = 0
-mouseEventsIntercepted = 0
-keymouseEventsIntercepted = 0
+mousePressedEventsIntercepted = 0
+mouseReleasedEventsIntercepted = 0
+mouseEnteredEventsIntercepted = 0
+mouseExitedEventsIntercepted = 0
+keymousePressedEventsIntercepted = 0
+keymouseReleasedEventsIntercepted = 0
class XMouseListenerExtended(unohelper.Base, XMouseListener):
@@ -30,41 +34,41 @@ class XMouseListenerExtended(unohelper.Base, XMouseListener):
# is invoked when a mouse button has been pressed on a window.
@classmethod
def mousePressed(self, xMouseEvent):
- global mouseEventsIntercepted
- mouseEventsIntercepted += 1
+ global mousePressedEventsIntercepted
+ mousePressedEventsIntercepted += 1
# is invoked when a mouse button has been released on a window.
@classmethod
def mouseReleased(self, xMouseEvent):
- global mouseEventsIntercepted
- mouseEventsIntercepted += 1
+ global mouseReleasedEventsIntercepted
+ mouseReleasedEventsIntercepted += 1
# is invoked when the mouse enters a window.
@classmethod
def mouseEntered(self, xMouseEvent):
- global mouseEventsIntercepted
- mouseEventsIntercepted += 1
+ global mouseEnteredEventsIntercepted
+ mouseEnteredEventsIntercepted += 1
# is invoked when the mouse exits a window.
@classmethod
def mouseExited(self, xMouseEvent):
- global mouseEventsIntercepted
- mouseEventsIntercepted += 1
+ global mouseExitedEventsIntercepted
+ mouseExitedEventsIntercepted += 1
class XKeyListenerExtended(unohelper.Base, XKeyListener):
# is invoked when a key has been pressed
@classmethod
def keyPressed(self, xKeyEvent):
- global keymouseEventsIntercepted
- keymouseEventsIntercepted += 1
+ global keymousePressedEventsIntercepted
+ keymousePressedEventsIntercepted += 1
return super(XKeyListenerExtended, self).keyPressed(xKeyEvent)
# is invoked when a key has been released
@classmethod
def keyReleased(self, xKeyEvent):
- global keymouseEventsIntercepted
- keymouseEventsIntercepted += 1
+ global keymouseReleasedEventsIntercepted
+ keymouseReleasedEventsIntercepted += 1
return super(XKeyListenerExtended, self).keyReleased(xKeyEvent)
# Test that registered mouse/key listeners for top window receive mouse/key events
@@ -149,13 +153,25 @@ class XWindow(UITestCase):
xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
xToolkit.processEventsToIdle()
- global keymouseEventsIntercepted
- # Not expected 2 interceptions
- self.assertEqual(0, keymouseEventsIntercepted)
+ global keymousePressedEventsIntercepted
+ # Not expected any interceptions
+ self.assertEqual(0, keymousePressedEventsIntercepted)
- global mouseEventsIntercepted
- # mousePressed (2x), mouseReleased (2x) and mouseEntered (1x) should be triggered
- self.assertEqual(5, mouseEventsIntercepted)
+ global keymouseReleasedEventsIntercepted
+ # Not expected any interceptions
+ self.assertEqual(0, keymouseReleasedEventsIntercepted)
+
+ global mousePressedEventsIntercepted
+ self.assertEqual(2, mousePressedEventsIntercepted)
+
+ global mouseReleasedEventsIntercepted
+ self.assertEqual(2, mouseReleasedEventsIntercepted)
+
+ global mouseEnteredEventsIntercepted
+ self.assertEqual(1, mouseEnteredEventsIntercepted)
+
+ global mouseExitedEventsIntercepted
+ self.assertEqual(0, mouseExitedEventsIntercepted)
# close document
self.ui_test.close_doc()