forked from thinkle/gourmet
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for locale-agnostic PDF preferences
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""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.gglobals import gourmetdir | ||
from gourmet.plugins.import_export.pdf_plugin.pdf_exporter import PdfPrefGetter # noqa: import not at top of file | ||
|
||
def test_get_args_from_opts(tmp_path): | ||
gourmetdir = tmp_path | ||
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 |