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

Function test_htmlbox3

tests/test_textbox.py:254–270  ·  view source on GitHub ↗

Test insertion with opacity

()

Source from the content-addressed store, hash-verified

252
253
254def test_htmlbox3():
255 """Test insertion with opacity"""
256 if not hasattr(pymupdf, "mupdf"):
257 print("'test_htmlbox3' not executed in classic.")
258 return
259
260 rect = pymupdf.Rect(100, 250, 300, 350)
261 text = """<span style="color:red;font-size:20px;">Just some text.</span>"""
262 doc = pymupdf.open()
263 page = doc.new_page()
264
265 # insert some text with opacity
266 page.insert_htmlbox(rect, text, opacity=0.5)
267
268 # lowlevel-extract inserted text to access opacity
269 span = page.get_texttrace()[0]
270 assert span["opacity"] == 0.5
271
272
273def test_3559():

Callers

nothing calls this directly

Calls 3

new_pageMethod · 0.80
insert_htmlboxMethod · 0.80
get_texttraceMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…