Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,21 @@ def get_requires_for_build_wheel(config_settings=None):
#wheel_compression = zipfile.ZIP_DEFLATED if (darwin or pyodide) else zipfile.ZIP_LZMA,
wheel_compresslevel = 9,
)

# Patch up macos platform tag - we require at least 10.15 because otherwise
# std::filesystem appears to be not available.
if pipcl.darwin():
pt = p.tag_platform()
#pipcl.log(f'{pt=}')
m = re.match('^(macosx_)(([0-9]+)_([0-9]+))(.*)', pt)
#pipcl.log(f'{m=}')
if m:
v = int(m.group(3)), int(m.group(4))
#pipcl.log(f'{v=}')
if v < (10, 15):
pt2 = f'{m.group(1)}10_15{m.group(5)}'
pipcl.log(f'Changing tag_platform from {pt!r} to {pt2!r}')
p.tag_platform_ = pt2

def get_requires_for_build_wheel(config_settings=None):
'''
Expand Down
Binary file added tests/resources/test_5001.pdf
Binary file not shown.
Binary file added tests/resources/test_5001_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/resources/test_natural.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions tests/test_annots.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,8 @@ def test_4944():
print()
with pymupdf.open(path) as document:
page = document[0]
print()
print(f'{page.rect=}')
print(f'{page.rotation=}')
print(f'{page.rotation_matrix=}')
print(f'{page.transformation_matrix=}')
Expand Down
47 changes: 47 additions & 0 deletions tests/test_pixmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,3 +667,50 @@ def test_4699():
wt = pymupdf.TOOLS.mupdf_warnings()
assert 'syntax error: cannot find ExtGState resource' in wt
assert rms > 20


def test_5001():
'''
#5001 is fixed with mupdf>=1.28.
'''
path = os.path.normpath(f'{__file__}/../../tests/resources/test_5001.pdf')
path_expected = os.path.normpath(f'{__file__}/../../tests/resources/test_5001_expected.png')
path_out = os.path.normpath(f'{__file__}/../../tests/test_5001_out.png')
with pymupdf.open(path) as document:
page = document[0]
zoom = 0.3
pixmap = page.get_pixmap(matrix=pymupdf.Matrix(zoom, zoom))
pixmap.save(path_out)
rms = gentle_compare.pixmaps_rms(path_expected, pixmap)
print()
print(f'test_5001(): {rms=}')
if pymupdf.mupdf_version_tuple >= (1, 28):
assert rms == 0
else:
assert rms != 0
wt = pymupdf.TOOLS.mupdf_warnings()
assert wt

def test_natural():
if pymupdf.mupdf_version_tuple < (1, 28):
print('test_natural(): Not running because segv fixed on mupdf master (1.28).')
return
path = os.path.normpath(f'{__file__}/../../tests/resources/test_natural.pdf')
with pymupdf.open(path) as document:
page = document[0]
ctm = pymupdf.mupdf.fz_make_matrix(200 / 72, 0, 0, 200 / 72, 0, 0)
rect = pymupdf.mupdf.ll_fz_make_rect(*page.rect)
RGB = pymupdf.mupdf.fz_device_rgb()
GRAY = pymupdf.mupdf.fz_device_gray()
# displaylist = page.get_displaylist()
# print(f"{displaylist=}, {rect=}, {ctm=}, {GRAY=}")
# pm = mupdf.fz_new_pixmap_from_display_list_culling_text2(
pm = pymupdf.mupdf.fz_new_pixmap_from_page_culling_text2(
page,
ctm,
RGB,
0,
[rect],
)
pix=pymupdf.Pixmap(pm)
print(f"{pix=}")
Loading