summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-08-08 01:41:15 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-08-08 01:41:15 +0300
commit3876d0f987400355c9865017662e03a7f999be4d (patch)
tree4f1a1d1932662ff077387aac2d4051928c66d336
parentb94abf0327b2ba3731b6c415be73a163e4754aee (diff)
kmstest: Extend Rect class
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@ideasonboard.com>
-rwxr-xr-xtests/kmstest.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/kmstest.py b/tests/kmstest.py
index f13e3fb..0281c67 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"""