Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix checking against frame_count in Screencopy.match #119

Merged
merged 1 commit into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions mir-ci/mir_ci/tests/robot/platforms/wayland/Screencopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()

Expand All @@ -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."""
Expand Down
Loading