From 9bbfa26c072a32b1147b70d2e1f37604fbc17427 Mon Sep 17 00:00:00 2001 From: Harlen Batagelo Date: Tue, 30 Apr 2024 18:04:32 -0300 Subject: [PATCH] Fix checking against frame_count in Screencopy.match --- .../mir_ci/tests/robot/platforms/wayland/Screencopy.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mir-ci/mir_ci/tests/robot/platforms/wayland/Screencopy.py b/mir-ci/mir_ci/tests/robot/platforms/wayland/Screencopy.py index 9ea685b6..af50676d 100644 --- a/mir-ci/mir_ci/tests/robot/platforms/wayland/Screencopy.py +++ b/mir-ci/mir_ci/tests/robot/platforms/wayland/Screencopy.py @@ -50,9 +50,9 @@ async def match(self, template: str, timeout: int = 5) -> List[dict]: last_checked_frame_count = 0 screenshot = None while time.time() <= end_time: - screenshot = await asyncio.wait_for(self.grab_screenshot(), timeout) - if last_checked_frame_count != self.frame_count: - last_checked_frame_count = self.frame_count + frame_count, screenshot = await asyncio.wait_for(self.grab_screenshot(), timeout) + if last_checked_frame_count != frame_count: + last_checked_frame_count = frame_count try: regions = self._rpa_images.find_template_in_image( screenshot, @@ -82,7 +82,7 @@ async def grab_screenshot(self): """ Grabs the current frame tracked by the screencopy tracker. - :return Pillow Image of the frame + :return Tuple (frame count, Pillow Image of the frame) """ await self.connect() @@ -100,7 +100,7 @@ async def grab_screenshot(self): b, g, r, a, *_ = image.split() image = Image.merge("RGBA", (r, g, b, a)) - return image + return (self.frame_count, image) async def connect(self): """Connect to the display."""