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

Function test_htmlbox2

tests/test_textbox.py:234–251  ·  view source on GitHub ↗

Test insertion without scaling

()

Source from the content-addressed store, hash-verified

232
233
234def test_htmlbox2():
235 """Test insertion without scaling"""
236 if not hasattr(pymupdf, "mupdf"):
237 print("'test_htmlbox2' not executed in classic.")
238 return
239
240 doc = pymupdf.open()
241 rect = pymupdf.Rect(100, 100, 200, 200) # large enough to hold text
242 page = doc.new_page()
243 bottoms = set()
244 for rot in (0, 90, 180, 270):
245 spare_height, scale = page.insert_htmlbox(
246 rect, "Hello, World!", scale_low=1, rotate=rot
247 )
248 assert scale == 1
249 assert 0 < spare_height < rect.height
250 bottoms.add(spare_height)
251 assert len(bottoms) == 1 # same result for all rotations
252
253
254def test_htmlbox3():

Callers

nothing calls this directly

Calls 3

new_pageMethod · 0.80
insert_htmlboxMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…