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 4ceecd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions webdriver/tests/support/fixtures_bidi.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,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 cm_to_px(expected_dimensions["height"])
assert cm_to_px(expected_dimensions["width"])

return assert_pdf_dimensions

Expand Down
3 changes: 2 additions & 1 deletion webdriver/tests/support/image.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from math import floor
import struct

from tests.support.asserts import assert_png
Expand All @@ -8,7 +9,7 @@


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


def px_to_cm(px):
Expand Down

1 comment on commit 4ceecd6

@community-tc-integration
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh! Looks like an error! Details

HttpError: Invalid request.

Only 65535 characters are allowed; 2477746 were supplied.

Please sign in to comment.