Skip to content

Commit

Permalink
Update test to cover both cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Nifury committed May 4, 2024
1 parent b3ae07c commit a5f4dfd
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion tests/test_generic.py
Expand Up @@ -883,10 +883,37 @@ def test_annotation_builder_highlight(pdf_file_path):
FloatObject(705.4493),
]
),
printing=True,
printing=False
)
writer.add_annotation(0, highlight_annotation)
for annot in writer.pages[0]["/Annots"]:
obj = annot.get_object()
subtype = obj["/Subtype"]
if subtype == "/Highlight":
assert "/F" not in obj or obj["/F"] == NumberObject(0)

writer.add_page(page)
# Act
with pytest.warns(DeprecationWarning):
highlight_annotation = AnnotationBuilder.highlight(
rect=(95.79332, 704.31777, 138.55779, 724.6855),
highlight_color="ff0000",
quad_points=ArrayObject(
[
FloatObject(100.060779),
FloatObject(723.55398),
FloatObject(134.29033),
FloatObject(723.55398),
FloatObject(100.060779),
FloatObject(705.4493),
FloatObject(134.29033),
FloatObject(705.4493),
]
),
printing=True
)
writer.add_annotation(1, highlight_annotation)
for annot in writer.pages[1]["/Annots"]:
obj = annot.get_object()
subtype = obj["/Subtype"]
if subtype == "/Highlight":
Expand Down

0 comments on commit a5f4dfd

Please sign in to comment.