[kms-tests] [PATCH 1/6] kmstest: Extend Rect class

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

 



Add a helper isEmpty() method to the Rect class, as well as a __repr__()
method to pretty-print the rectangle.

Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
---
 tests/kmstest.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/kmstest.py b/tests/kmstest.py
index f13e3fb7aa32..0281c6727271 100755
--- a/tests/kmstest.py
+++ b/tests/kmstest.py
@@ -212,6 +212,13 @@ class Rect(object):
         self.width = width
         self.height = height
 
+    def __repr__(self):
+        return "(%d,%d)/%ux%u" % (self.left, self.top, self.width, self.height)
+
+    def isEmpty(self):
+        """Check if the rectangle has a zero width or height"""
+        return self.width == 0 or self.height == 0
+
 
 class AtomicRequest(pykms.AtomicReq):
     """pymkms.AtomicReq wrapper to track state changes"""
-- 
Regards,

Laurent Pinchart




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux