Skip to content

Commit

Permalink
tests/: added test_3994().
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-smith-artifex-com committed Oct 29, 2024
1 parent ebdb8ba commit 576a576
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Binary file added tests/resources/test_3994.pdf
Binary file not shown.
12 changes: 12 additions & 0 deletions tests/test_pixmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,15 @@ def test_3848():
rect = annot['rect']
pixmap = page.get_pixmap(clip=rect)
color_bytes = pixmap.color_topusage()


def test_3994():
path = os.path.normpath(f'{__file__}/../../tests/resources/test_3994.pdf')
with pymupdf.open(path) as document:
page = document[0]
txt_blocks = [blk for blk in page.get_text('dict')['blocks'] if blk['type']==0]
for blk in txt_blocks:
pix = page.get_pixmap(clip=pymupdf.Rect([int(v) for v in blk['bbox']]), colorspace=pymupdf.csRGB, alpha=False)
percent, color = pix.color_topusage()
wt = pymupdf.TOOLS.mupdf_warnings()
assert wt == 'premature end of data in flate filter\n... repeated 2 times...'

0 comments on commit 576a576

Please sign in to comment.