Skip to content

Commit

Permalink
Add test for locale-agnostic PDF preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
cydanil committed Jul 12, 2021
1 parent 57c4e7b commit be77884
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/test_pdf_exporter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""This test may leave marks in the user preferences file."""
import os
os.environ['LANGUAGE'] = 'de_DE.utf-8' # must happend before Gourmet import

from gourmet.plugins.import_export.pdf_plugin.pdf_exporter import PdfPrefGetter # noqa: import not at top of file

def test_get_args_from_opts():
pref_getter = PdfPrefGetter()

options = (['Papiergröße:', 'Letter'],
['_Ausrichtung:', 'Hochformat'],
['_Schriftgröße:', 10],
['Seiten-Layout', 'Eben'],
['Linker Rand:', 70.86614173228347],
['Rechter Rand:', 70.86614173228347],
['Oberer Rand:', 70.86614173228347],
['Unterer Rand:', 70.86614173228347])

expected = {'pagesize': 'letter',
'pagemode': 'portrait',
'base_font_size': 10,
'mode': ('column', 1),
'left_margin': 70.86614173228347,
'right_margin': 70.86614173228347,
'top_margin': 70.86614173228347,
'bottom_margin': 70.86614173228347}

ret = pref_getter.get_args_from_opts(options)

assert ret == expected

0 comments on commit be77884

Please sign in to comment.