def test_read_short_charstring_bug895(option, font_name): input_path = get_bad_input_path(font_name) output_path = runner(CMD + ['-s', '-e', '-a', '-o', option, '-f', input_path]) expected_path = get_expected_path(font_name + '.' + option) skip = ['-s', 'tx: ---'] # skip line with filename assert differ([expected_path, output_path] + skip)
def test_drop_defaultwidthx_when_writing_cff2_bug897(option): input_path = get_bad_input_path('bug897.otf') output_path = get_temp_file_path() runner(CMD + ['-a', '-o', option, '-f', input_path, output_path]) dcf_path = get_temp_file_path() runner(CMD + ['-a', '-o', 'dcf', '-f', output_path, dcf_path]) expected_path = get_expected_path('bug897.' + option + '.dcf') assert differ([expected_path, dcf_path])
def test_dcf_with_infinite_recursion_bug775(): font_path = get_bad_input_path('subr_test_font_infinite_recursion.otf') dcf_path = get_temp_file_path() with pytest.raises(subprocess.CalledProcessError) as err: runner(CMD + ['-a', '-o', 'dcf', '-f', font_path, dcf_path]) assert(err.value.returncode == 1) # exit code of 1, not segfault of -11 expected_path = get_expected_path( 'subr_test_font_infinite_recursion.dcf.txt') assert differ([expected_path, dcf_path])
def test_missing_glyph_names_pr905(option): input_path = get_bad_input_path('pr905.otf') output_path = get_temp_file_path() runner(CMD + ['-a', '-o', option, '-f', input_path, output_path]) expected_path = get_expected_path('pr905' + '.' + option) if option == 'afm': skip = [ '-s', 'Comment Creation Date:' + SPLIT_MARKER + 'Comment Copyright' ] else: skip = [] assert differ([expected_path, output_path] + skip)
def test_too_many_glyphs_pr955(): input_path = get_bad_input_path('TooManyGlyphsCFF2.otf') output_path = get_temp_file_path() with pytest.raises(subprocess.CalledProcessError) as err: runner(CMD + ['-a', '-o', 'cff', '-f', input_path, output_path]) assert(err.value.returncode > 0) # error code, not hang or success
def test_bug_940(): input_path = get_bad_input_path('bug940_private_blend.otf') output_path = get_temp_file_path() with pytest.raises(subprocess.CalledProcessError) as err: runner(CMD + ['-a', '-o', 'cff2', '-f', input_path, output_path]) assert(err.value.returncode > 0) # error code, not segfault or success
def test_bad_charset(): font_path = get_bad_input_path('bad_charset.otf') save_path = get_temp_file_path() runner(CMD + ['-a', '-f', font_path, save_path]) expected_path = get_expected_path('bad_charset.txt') assert differ([expected_path, save_path, '-s', '## Filename'])
def test_missing_glyph_names_pr905_cef(): input_path = get_bad_input_path('pr905.otf') output_path = get_temp_file_path() with pytest.raises(subprocess.CalledProcessError) as err: runner(CMD + ['-a', '-o', 'cef', '-f', input_path, output_path]) assert(err.value.returncode > 0) # error code, not segfault of -11
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