Skip to content

Commit

Permalink
use floor in cm_to_px instead of round
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagowfx committed Jun 13, 2023
1 parent f20a9d5 commit 7e65d91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions webdriver/tests/support/fixtures_bidi.py
@@ -1,3 +1,4 @@
from math import floor
import base64

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

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

return assert_pdf_dimensions

Expand Down
2 changes: 1 addition & 1 deletion webdriver/tests/support/image.py
Expand Up @@ -8,7 +8,7 @@


def cm_to_px(cm):
return round(cm * PPI / inch_in_cm)
return cm * PPI / inch_in_cm


def px_to_cm(px):
Expand Down

0 comments on commit 7e65d91

Please sign in to comment.