From f9420d9effcfb3464d4b99e54decb3d90e4a410d Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Thu, 8 Feb 2018 11:30:36 -0800 Subject: [PATCH] In the hb-subset to fontTools comparison, use ttx to compare the fonts. This allows for some binary differences such as re-ordered tables. --- test/subset/run-tests.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/test/subset/run-tests.py b/test/subset/run-tests.py index b0054802f..326951620 100755 --- a/test/subset/run-tests.py +++ b/test/subset/run-tests.py @@ -47,19 +47,26 @@ def run_test(test): if return_code: return fail_test(test, cli_args, "%s returned %d" % (' '.join(cli_args), return_code)) - expected = read_binary(os.path.join(test_suite.get_output_directory(), + expected_ttx, return_code = run_ttx(os.path.join(test_suite.get_output_directory(), test.get_font_name())) - actual = read_binary(out_file) + if return_code: + return fail_test(test, cli_args, "ttx (expected) returned %d" % (return_code)) - if len(actual) != len(expected): - return fail_test(test, cli_args, "expected %d bytes, actual %d: %s" % ( - len(expected), len(actual), ' '.join(cli_args))) + actual_ttx, return_code = run_ttx(out_file) + if return_code: + return fail_test(test, cli_args, "ttx (actual) returned %d" % (return_code)) - if not actual == expected: - return fail_test(test, cli_args, 'files are the same length but not the same bytes') + if not actual_ttx == expected_ttx: + return fail_test(test, cli_args, 'ttx for expected and actual does not match.') return 0 +def run_ttx(file): + cli_args = ["ttx", + "-o-", + file] + return cmd(cli_args) + args = sys.argv[1:] if not args or sys.argv[1].find('hb-subset') == -1 or not os.path.exists (sys.argv[1]):