Further improvements to image DPI calculation

This commit is contained in:
James R. Barlow
2023-09-26 00:28:54 -07:00
parent 270e31fa67
commit d5128c5cf5
3 changed files with 75 additions and 61 deletions
+6 -5
View File
@@ -52,13 +52,14 @@ def test_dpi_needed(image, text, vector, result, rgb_image, outdir):
c.showPage()
c.save()
mock = Mock()
mock.oversample = DUMMY_OVERSAMPLE_RESOLUTION[0]
pi = pdfinfo.PdfInfo(outdir / 'dpi.pdf')
pageinfo = pi[0]
ctx = Mock()
ctx.options.oversample = DUMMY_OVERSAMPLE_RESOLUTION[0]
ctx.pageinfo = pageinfo
assert _pipeline.get_canvas_square_dpi(pi[0], mock) == result
assert _pipeline.get_page_square_dpi(pi[0], mock) == result
assert _pipeline.get_canvas_square_dpi(ctx) == result
assert _pipeline.get_page_square_dpi(ctx) == result
@pytest.mark.parametrize(