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

Function test_4447

tests/test_annots.py:616–676  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

614
615
616def test_4447():
617 document = pymupdf.open()
618
619 page = document.new_page()
620
621 text_color = (1, 0, 0)
622 fill_color = (0, 1, 0)
623 border_color = (0, 0, 1)
624
625 annot_rect = pymupdf.Rect(90.1, 486.73, 139.26, 499.46)
626
627 try:
628 annot = page.add_freetext_annot(
629 annot_rect,
630 "AETERM",
631 fontname="Arial",
632 fontsize=10,
633 text_color=text_color,
634 fill_color=fill_color,
635 border_color=border_color,
636 border_width=1,
637 )
638 except ValueError as e:
639 assert 'cannot set border_color if rich_text is False' in str(e), str(e)
640 else:
641 assert 0
642
643 try:
644 annot = page.add_freetext_annot(
645 (30, 400, 100, 450),
646 "Two",
647 fontname="Arial",
648 fontsize=10,
649 text_color=text_color,
650 fill_color=fill_color,
651 border_color=border_color,
652 border_width=1,
653 )
654 except ValueError as e:
655 assert 'cannot set border_color if rich_text is False' in str(e), str(e)
656 else:
657 assert 0
658
659 annot = page.add_freetext_annot(
660 (30, 500, 100, 550),
661 "Three",
662 fontname="Arial",
663 fontsize=10,
664 text_color=text_color,
665 border_width=1,
666 )
667 annot.update(text_color=text_color, fill_color=fill_color)
668 try:
669 annot.update(border_color=border_color)
670 except ValueError as e:
671 assert 'cannot set border_color if rich_text is False' in str(e), str(e)
672 else:
673 assert 0

Callers

nothing calls this directly

Calls 4

new_pageMethod · 0.80
add_freetext_annotMethod · 0.80
updateMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…