Skip to content

Commit

Permalink
Merge pull request #35 from kcroker/update_tests
Browse files Browse the repository at this point in the history
Update pytest_image_diff to v0.0.14
  • Loading branch information
v-- authored Jan 27, 2025
2 parents 04495f8 + 8f0de1d commit 32fe296
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
5 changes: 3 additions & 2 deletions dpsprep/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def test_djvu_page_to_image_bitonal(image_diff: ImageDiffProtocol) -> None:
)
document.decoding_job.wait()

fixture = Image.open('fixtures/lipsum_01.png').convert('1')
fixture = Image.open('fixtures/lipsum_01.png')
result = djvu_page_to_image(document.pages[0], mode='infer', i=0)

assert image_diff(fixture, result, threshold=1e-2)
# pytest_image_diff (as of v0.0.14) wants to convert monochrome images to LA mode and fails, so we do it manually
assert image_diff(fixture.convert('LA'), result.convert('LA'), threshold=1e-2)
Binary file modified fixtures/lipsum_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion fixtures/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ all: lipsum_01.txt lipsum_01.png lipsum_lines.djvu lipsum_words.djvu
pdftotext -l 1 -layout $*.pdf $*_01.txt

%_01.png: %.pdf
gs -sDEVICE=png16m -r300 -dLastPage=1 -o $*_01.png $*.pdf
gs -sDEVICE=pngmono -r300 -dLastPage=1 -o $*_01.png $*.pdf

%_words.djvu: %.pdf
djvudigital --words $*.pdf
Expand Down
12 changes: 6 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dpsprep"
version = "2.2.11"
version = "2.2.12"
description = "A DjVu to PDF converter with a focus on small output size and the ability to preserve document outlines and text layers"
authors = ["Kevin Arthur Schiff Croker", "Ianis Vasilev"]
license = "GPL-3.0-or-later"
Expand All @@ -18,7 +18,7 @@ pillow = "^11.1.0"
[tool.poetry.group.dev.dependencies]
mypy = "^1.14.1"
pytest = "^7.4.4"
pytest-image-diff = "^0.0.11"
pytest-image-diff = "^0.0.14"
ruff = "^0.9.3"
types-fpdf2 = "^2.8.2.20241223"
types-pillow = "^10.2.0.20240822"
Expand Down

0 comments on commit 32fe296

Please sign in to comment.