Skip to content

Commit

Permalink
Correct android probe assertion of image size.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Nov 2, 2023
1 parent b8aaf3c commit f66b543
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions android/tests_backend/probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from android.widget import Button
from java import dynamic_proxy
from org.beeware.android import MainActivity
from pytest import approx


class LayoutListener(dynamic_proxy(ViewTreeObserver.OnGlobalLayoutListener)):
Expand Down Expand Up @@ -94,7 +95,8 @@ async def redraw(self, message=None, delay=0):
await asyncio.sleep(delay)

def assert_image_size(self, image_size, size):
assert image_size.width == (
size[0] * self.scale_factor,
size[1] * self.scale_factor,
# Sizes are approximate because of scaling inconsistencies.
assert image_size == (
approx(size[0] * self.scale_factor, abs=2),
approx(size[1] * self.scale_factor, abs=2),
)

0 comments on commit f66b543

Please sign in to comment.