From 9c10e3a73d7e2971a3ffe0393d6edbaf7d6101ef Mon Sep 17 00:00:00 2001 From: Lucas Cimon <925560+Lucas-C@users.noreply.github.com> Date: Fri, 11 Jun 2021 18:11:48 +0200 Subject: [PATCH] Fixing tests --- fpdf/fpdf.py | 5 +++-- ...zoom-fullwidth.pdf => layout-continuous.pdf} | Bin ...alog-zoom-default.pdf => layout-default.pdf} | Bin 924 -> 930 bytes ...alog-layout-single.pdf => layout-single.pdf} | Bin 925 -> 931 bytes test/{catalog-layout-two.pdf => layout-two.pdf} | Bin 928 -> 934 bytes test/test_display_mode.py | 16 ++++++++-------- ...talog-zoom-fullpage.pdf => zoom-default.pdf} | Bin 924 -> 930 bytes ...-layout-continuous.pdf => zoom-fullpage.pdf} | Bin test/zoom-fullwidth.pdf | Bin 0 -> 930 bytes test/{catalog-zoom-real.pdf => zoom-real.pdf} | Bin 10 files changed, 11 insertions(+), 10 deletions(-) rename test/{catalog-zoom-fullwidth.pdf => layout-continuous.pdf} (100%) rename test/{catalog-zoom-default.pdf => layout-default.pdf} (96%) rename test/{catalog-layout-single.pdf => layout-single.pdf} (96%) rename test/{catalog-layout-two.pdf => layout-two.pdf} (96%) rename test/{catalog-zoom-fullpage.pdf => zoom-default.pdf} (96%) rename test/{catalog-layout-continuous.pdf => zoom-fullpage.pdf} (100%) create mode 100644 test/zoom-fullwidth.pdf rename test/{catalog-zoom-real.pdf => zoom-real.pdf} (100%) diff --git a/fpdf/fpdf.py b/fpdf/fpdf.py index 0071ad5f0..3892204a2 100644 --- a/fpdf/fpdf.py +++ b/fpdf/fpdf.py @@ -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 diff --git a/test/catalog-zoom-fullwidth.pdf b/test/layout-continuous.pdf similarity index 100% rename from test/catalog-zoom-fullwidth.pdf rename to test/layout-continuous.pdf diff --git a/test/catalog-zoom-default.pdf b/test/layout-default.pdf similarity index 96% rename from test/catalog-zoom-default.pdf rename to test/layout-default.pdf index ac7510f2016dbcf8888ac6c4a79b840ea9d808a1..083d6ff991bfe2924f6b8d39951965eb5fc44462 100644 GIT binary patch delta 29 kcmbQkzKDH89}}C0LSAW3&gMQQRz^-sQ!Z6iSARDy0EJu!t^fc4 delta 22 dcmZ3)K8JlnAJgV3OstHY7M5J9s;>TSTmVeG1&#m! diff --git a/test/catalog-layout-single.pdf b/test/layout-single.pdf similarity index 96% rename from test/catalog-layout-single.pdf rename to test/layout-single.pdf index b6fb0c0a8ff93d0fddc63431fbfe7d5658b1416a..080df9f03b56b8b3a33fb2e290700e888e8a1c9b 100644 GIT binary patch delta 28 jcmbQszL%@me>W}weVzw- delta 21 ccmZ3?K9_w%AJgV3Ozeyt23)GDuKsRZ07lFOPyhe` diff --git a/test/catalog-layout-two.pdf b/test/layout-two.pdf similarity index 96% rename from test/catalog-layout-two.pdf rename to test/layout-two.pdf index c2953aaa7b44355de8b8ca4ca81a1dc18bc4bdff..68609c85405ed0f62764586010990ecb8636c221 100644 GIT binary patch delta 28 jcmZ3$zKnfC9}}C0LSAW3&gMQQE=CSZE>%@me>W}wet8Fl delta 21 ccmZ3+zJPs0AJgV3Ok9i{#$2kZuKsRZ07rcVTmS$7 diff --git a/test/test_display_mode.py b/test/test_display_mode.py index 961bcf798..b5804c15f 100644 --- a/test/test_display_mode.py +++ b/test/test_display_mode.py @@ -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) diff --git a/test/catalog-zoom-fullpage.pdf b/test/zoom-default.pdf similarity index 96% rename from test/catalog-zoom-fullpage.pdf rename to test/zoom-default.pdf index ac7510f2016dbcf8888ac6c4a79b840ea9d808a1..083d6ff991bfe2924f6b8d39951965eb5fc44462 100644 GIT binary patch delta 29 kcmbQkzKDH89}}C0LSAW3&gMQQRz^-sQ!Z6iSARDy0EJu!t^fc4 delta 22 dcmZ3)K8JlnAJgV3OstHY7M5J9s;>TSTmVeG1&#m! diff --git a/test/catalog-layout-continuous.pdf b/test/zoom-fullpage.pdf similarity index 100% rename from test/catalog-layout-continuous.pdf rename to test/zoom-fullpage.pdf diff --git a/test/zoom-fullwidth.pdf b/test/zoom-fullwidth.pdf new file mode 100644 index 0000000000000000000000000000000000000000..083d6ff991bfe2924f6b8d39951965eb5fc44462 GIT binary patch literal 930 zcmZuwL1+^}6tz@}4#iW{>pwJL5i`5lY|Lt?Hc68PD=BGFA>=SgCUMJVrtVHO@g#zv z2ny1Jhv= za`@!-_Q%KH=dZkr6w)F-`|#q{Q+B=?JbPc5`x%+un!Yjf=XZbS#}u7A`oQ{p==9e| zySw-H-c-J^y$ijmnU^PS>D0ndVUk+ZgyewGOKu~8iZ-NNB{VBL+5kc?^M=bZvI`Xh zw`|9b#Z!<oB?r>&an?L~L}-QuT+e_mbMGcsZk-Xj)~Tt1+1hdpu_VwQSG0g$ zb;Y6x+%5En#Wq$h6aKT|zlcf(;nQiHn4q&PYgT%# zRNLTn1-OCB10BhcI9aTaa;3;&3E@=koarPTGj5rtW8jz{xpj8r*07JVOfgTkbSt&6 zal%e2ZE~?#*PNl#*dVT22GQ|6OjVylD_^hzn?rn}K)3THb ev{Cq?ilQk&TRkX7pqQ@)+LDe