Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tx tests] Invalid fonts to exercise errors in varread #954

Merged
merged 1 commit into from
Sep 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
27 changes: 27 additions & 0 deletions tests/tx_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,33 @@ def test_dump_flex_op(fext):
# CFF2 tests
# ----------

@pytest.mark.parametrize('filename, msg', [
('avar_invalid_table_version',
b'(cfr) invalid avar table version'),
('fvar_invalid_table_version',
b'(cfr) invalid fvar table version'),
('avar_invalid_table_size',
b'(cfr) invalid avar table size'),
('fvar_invalid_table_size',
b'(cfr) invalid fvar table size'),
('fvar_invalid_table_header',
b'(cfr) invalid values in fvar table header'),
('avar_invalid_axis-instance_count-size',
b'(cfr) invalid avar table size or axis/instance count/size'),
('fvar_invalid_axis-instance_count-size',
b'(cfr) invalid fvar table size or axis/instance count/size'),
('avar_axis_value_map_out_of_bounds',
b'(cfr) avar axis value map out of bounds'),
('avar_fvar_axis_mismatch',
b'(cfr) mismatching axis counts in fvar and avar'),
])
def test_varread_errors(filename, msg):
font_path = get_bad_input_path(f'vf_{filename}.otf')
output = subprocess.check_output([TOOL, '-dcf', '-0', font_path],
stderr=subprocess.STDOUT)
assert msg in output


@pytest.mark.parametrize('args, exp_filename', [
([], 'SourceCodeVar-Roman_CFF2'),
(['*S', '*b', 'std'], 'SourceCodeVar-Roman_CFF2_subr'), # subroutinize
Expand Down