Skip to content

Commit

Permalink
Fixed tests/test-remove-rotation.py.
Browse files Browse the repository at this point in the history
Renamed to tests/test_remove-rotation.py and changed to 'import pymupdf'. This
matches the other test files and ensures that it is also tested with the 'fitz'
alias.
  • Loading branch information
julian-smith-artifex-com committed May 2, 2024
1 parent 08422b4 commit 3612ae1
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
import fitz
import pymupdf
from gentle_compare import gentle_compare

scriptdir = os.path.dirname(__file__)
Expand All @@ -8,7 +8,7 @@
def test_remove_rotation():
"""Remove rotation verifying identical appearance and text."""
filename = os.path.join(scriptdir, "resources", "test-2812.pdf")
doc = fitz.open(filename)
doc = pymupdf.open(filename)

# We always create fresh pages to avoid false positves from cache content.
# Text on these pages consists of pairwise different strings, sorting by
Expand All @@ -18,7 +18,7 @@ def test_remove_rotation():
pix0 = doc[i].get_pixmap() # make image
words0 = []
for w in doc[i].get_text("words"):
words0.append(list(fitz.Rect(w[:4]) * doc[i].rotation_matrix) + [w[4]])
words0.append(list(pymupdf.Rect(w[:4]) * doc[i].rotation_matrix) + [w[4]])
words0.sort(key=lambda w: w[4]) # sort by word strings
# derotate page and confirm nothing else has changed
doc[i].remove_rotation()
Expand Down

0 comments on commit 3612ae1

Please sign in to comment.