Skip to content

Commit 7e65d91

Browse files
author
Thiago Perrotta
committed
use floor in cm_to_px instead of round
1 parent f20a9d5 commit 7e65d91

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

webdriver/tests/support/fixtures_bidi.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from math import floor
12
import base64
23

34
from tests.support.image import cm_to_px, png_dimensions, ImageDifference
@@ -207,8 +208,8 @@ async def assert_pdf_dimensions(pdf, expected_dimensions):
207208
png = await render_pdf_to_png_bidi(pdf)
208209
width, height = png_dimensions(png)
209210

210-
assert (height - 1) <= cm_to_px(expected_dimensions["height"]) <= (height + 1)
211-
assert (width - 1) <= cm_to_px(expected_dimensions["width"]) <= (width + 1)
211+
assert floor(cm_to_px(expected_dimensions["height"])) == height
212+
assert floor(cm_to_px(expected_dimensions["width"])) == width
212213

213214
return assert_pdf_dimensions
214215

webdriver/tests/support/image.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
def cm_to_px(cm):
11-
return round(cm * PPI / inch_in_cm)
11+
return cm * PPI / inch_in_cm
1212

1313

1414
def px_to_cm(px):

0 commit comments

Comments
 (0)