MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / test_pageboxes

Function test_pageboxes

tests/test_geometry.py:322–339  ·  view source on GitHub ↗

Tests concerning ArtBox, TrimBox, BleedBox.

()

Source from the content-addressed store, hash-verified

320
321
322def test_pageboxes():
323 """Tests concerning ArtBox, TrimBox, BleedBox."""
324 doc = pymupdf.open()
325 page = doc.new_page()
326 assert page.cropbox == page.artbox == page.bleedbox == page.trimbox
327 rect_methods = (
328 page.set_cropbox,
329 page.set_artbox,
330 page.set_bleedbox,
331 page.set_trimbox,
332 )
333 keys = ("CropBox", "ArtBox", "BleedBox", "TrimBox")
334 rect = pymupdf.Rect(100, 200, 400, 700)
335 for f in rect_methods:
336 f(rect)
337 for key in keys:
338 assert doc.xref_get_key(page.xref, key) == ("array", "[100 142 400 642]")
339 assert page.cropbox == page.artbox == page.bleedbox == page.trimbox
340
341def test_3163():
342 b = {'number': 0, 'type': 0, 'bbox': (403.3577880859375, 330.8871765136719, 541.2731323242188, 349.5766296386719), 'lines': [{'spans': [{'size': 14.0, 'flags': 4, 'font': 'SFHello-Medium', 'color': 1907995, 'ascender': 1.07373046875, 'descender': -0.26123046875, 'text': 'Inclusion and diversity', 'origin': (403.3577880859375, 345.9194030761719), 'bbox': (403.3577880859375, 330.8871765136719, 541.2731323242188, 349.5766296386719)}], 'wmode': 0, 'dir': (1.0, 0.0), 'bbox': (403.3577880859375, 330.8871765136719, 541.2731323242188, 349.5766296386719)}]}

Callers

nothing calls this directly

Calls 3

fFunction · 0.85
new_pageMethod · 0.80
xref_get_keyMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…