Skip to content

Commit

Permalink
added more specific tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MarekT0v committed Dec 5, 2023
1 parent f45a3f9 commit 3e5c15c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
Binary file added test/free_text_annotation_all_parameters.pdf
Binary file not shown.
Binary file added test/free_text_annotation_text_parameter.pdf
Binary file not shown.
Binary file added test/free_text_annotation_width_parameter.pdf
Binary file not shown.
24 changes: 22 additions & 2 deletions test/test_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_ink_annotation(tmp_path):
assert_pdf_equal(pdf, HERE / "ink_annotation.pdf", tmp_path)


def test_free_text_annotation(tmp_path):
def test_free_text_annotation_all_parameters(tmp_path):
pdf = FPDF()
pdf.add_page()
pdf.set_font("Helvetica", size=24)
Expand All @@ -169,4 +169,24 @@ def test_free_text_annotation(tmp_path):
w=150,
h=15,
)
assert_pdf_equal(pdf, HERE / "free_text_annotation.pdf", tmp_path)
assert_pdf_equal(pdf, HERE / "free_text_annotation_all_parameters.pdf", tmp_path)


def test_free_text_annotation_text_parameter(tmp_path):
pdf = FPDF()
pdf.add_page()
pdf.set_font("Helvetica", size=24)
pdf.text(x=50, y=50, text="Some text.")
pdf.set_font_size(12)
pdf.free_text_annotation(text="This is a free text annotation.")
assert_pdf_equal(pdf, HERE / "free_text_annotation_text_parameter.pdf", tmp_path)


def test_free_text_annotation_width_parameter(tmp_path):
pdf = FPDF()
pdf.add_page()
pdf.set_font("Helvetica", size=24)
pdf.text(x=50, y=50, text="Some text.")
pdf.set_font_size(12)
pdf.free_text_annotation(text="This is a free text annotation.", w=80)
assert_pdf_equal(pdf, HERE / "free_text_annotation_width_parameter.pdf", tmp_path)

0 comments on commit 3e5c15c

Please sign in to comment.