Test insertion with opacity
()
| 252 | |
| 253 | |
| 254 | def 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 | |
| 273 | def test_3559(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…