Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas-C committed Jun 11, 2021
1 parent 8c150e3 commit 9c10e3a
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions fpdf/fpdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,11 @@ def set_display_mode(self, zoom, layout="continuous"):
Args:
zoom: either "fullpage", "fullwidth", "real", "default",
or a number indicating the zooming factor to use, interpreted as a percentage.
The default value is "default".
The zoom level set by default is "default".
layout (str): either "single", "continuous", "two" or "default",
meaning to use the viewer default mode.
The default value is "default".
The layout set by default is "default",
and this method default value is "continuous".
"""
if zoom in ZOOM_CONFIGS or not isinstance(zoom, str):
self.zoom_mode = zoom
Expand Down
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file renamed test/catalog-layout-two.pdf → test/layout-two.pdf
Binary file not shown.
16 changes: 8 additions & 8 deletions test/test_display_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
HERE = Path(__file__).resolve().parent


@pytest.mark.parametrize("zoom_input", ["fullpage", "fullwidth", "real", "default"])
def test_setting_all_zoom(zoom_input, tmp_path):
@pytest.mark.parametrize("zoom", ["fullpage", "fullwidth", "real", "default"])
def test_setting_all_zoom(zoom, tmp_path):
"""This test executes some possible inputs to FPDF#set_display_mode."""
doc = fpdf.FPDF()
doc.add_page()
doc.set_font("helvetica", size=12)
doc.cell(w=72, h=0, border=1, ln=2, txt="hello world", fill=False, link="")
doc.set_display_mode(zoom=zoom_input, layout="continuous")
assert_pdf_equal(doc, HERE / f"catalog-zoom-{zoom_input}.pdf", tmp_path)
doc.set_display_mode(zoom=zoom, layout="continuous")
assert_pdf_equal(doc, HERE / f"zoom-{zoom}.pdf", tmp_path)


@pytest.mark.parametrize("layout_input", ["single", "continuous", "two"])
def test_setting_all_layout(layout_input, tmp_path):
@pytest.mark.parametrize("layout", ["single", "continuous", "two", "default"])
def test_setting_all_layout(layout, tmp_path):
"""This test executes some possible inputs to FPDF#set_display_mode."""
doc = fpdf.FPDF()
doc.add_page()
doc.set_font("helvetica", size=12)
doc.cell(w=72, h=0, border=1, ln=2, txt="hello world", fill=False, link="")
doc.set_display_mode(zoom="default", layout=layout_input)
assert_pdf_equal(doc, HERE / f"catalog-layout-{layout_input}.pdf", tmp_path)
doc.set_display_mode(zoom="default", layout=layout)
assert_pdf_equal(doc, HERE / f"layout-{layout}.pdf", tmp_path)
Binary file not shown.
File renamed without changes.
Binary file added test/zoom-fullwidth.pdf
Binary file not shown.
File renamed without changes.

0 comments on commit 9c10e3a

Please sign in to comment.