Skip to content

Commit

Permalink
maximum_color_test: reproduce #435 input file contains spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Nov 18, 2022
1 parent cefcacd commit b77f5ed
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/maximum_color_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ def _maximize_color(initial_font_file: Path, additional_flags: Tuple[str, ...])
return maxmium_font_file


@pytest.mark.parametrize(
"input_file",
[
"Font.ttf",
# test that we don't crash when filename contains spaces
"Color Font.ttf",
],
)
@pytest.mark.parametrize(
"color_format, expected_new_tables",
[
Expand All @@ -71,18 +79,21 @@ def _maximize_color(initial_font_file: Path, additional_flags: Tuple[str, ...])
],
)
@pytest.mark.parametrize("bitmaps", [True, False])
def test_build_maximum_font(color_format, expected_new_tables, bitmaps):
def test_build_maximum_font(color_format, expected_new_tables, bitmaps, input_file):
initial_font_file = _build_initial_font(color_format)

input_file = initial_font_file.parent / input_file
initial_font_file.rename(input_file)

bitmap_flag = "--nobitmaps"
if bitmaps:
bitmap_flag = "--bitmaps"
expected_new_tables = copy.copy(expected_new_tables)
expected_new_tables.update({"CBDT", "CBLC"})

maxmium_font_file = _maximize_color(initial_font_file, (bitmap_flag,))
maxmium_font_file = _maximize_color(input_file, (bitmap_flag,))

initial_font = ttLib.TTFont(initial_font_file)
initial_font = ttLib.TTFont(input_file)
maximum_font = ttLib.TTFont(maxmium_font_file)
assert set(maximum_font.keys()) - set(initial_font.keys()) == expected_new_tables

Expand Down

0 comments on commit b77f5ed

Please sign in to comment.