[virt-tools-list] [PATCH 07/10] uitests: Fix onscreen to return True only when full widget is on screen
Povilas Kanapickas
povilas at radix.lt
Sat Sep 1 22:24:05 UTC 2018
Signed-off-by: Povilas Kanapickas <povilas at radix.lt>
---
tests/uitests/utils.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/tests/uitests/utils.py b/tests/uitests/utils.py
index 392611ef..300731d2 100644
--- a/tests/uitests/utils.py
+++ b/tests/uitests/utils.py
@@ -12,6 +12,7 @@ import unittest
import pyatspi
import dogtail.tree
+from gi.repository import Gdk
import tests
@@ -223,7 +224,15 @@ class VMMDogtailNode(dogtail.tree.Node):
@property
def onscreen(self):
- return self.position[0] > 0 and self.position[1] > 0
+ # We need to check that full widget is on screen because we use this
+ # function to check whether we can click a widget. We may click
+ # anywhere within the widget and clicks outside the screen bounds are
+ # silently ignored.
+ screen = Gdk.Screen.get_default()
+ return (self.position[0] > 0 and
+ self.position[0] + self.size[0] < screen.get_width() and
+ self.position[1] > 0 and
+ self.position[1] + self.size[1] < screen.get_height())
def click_combo_entry(self):
"""
--
2.17.1
More information about the virt-tools-list
mailing list