[PATCH 07/10] uitests: Fix onscreen to return True only when full widget is on screen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Povilas Kanapickas <povilas@xxxxxxxx>
---
 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


_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux