From f69ecc9438236b671121f48332309486beecd0ab Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 5 Apr 2025 22:37:34 -0600 Subject: [PATCH 01/26] [test/api] Set protocol:tap --- test/api/hb-subset-test.h | 1 - test/api/hb-test.h | 1 - test/api/meson.build | 13 ++++++++----- test/api/test-set.c | 25 +++++++++++++------------ test/api/test-subset-nameids.c | 2 +- test/api/test-subset-repacker.c | 1 - 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/test/api/hb-subset-test.h b/test/api/hb-subset-test.h index 8f67a3c75..882e51dfd 100644 --- a/test/api/hb-subset-test.h +++ b/test/api/hb-subset-test.h @@ -87,7 +87,6 @@ hb_subset_test_check (hb_face_t *expected, hb_blob_t *expected_blob, *actual_blob; expected_blob = hb_face_reference_table (expected, table); actual_blob = hb_face_reference_table (actual, table); - fprintf(stderr, "comparing %c%c%c%c, expected %d bytes, actual %d bytes\n", HB_UNTAG(table), hb_blob_get_length(expected_blob), hb_blob_get_length (actual_blob)); if (hb_blob_get_length (expected_blob) != 0 || hb_blob_get_length (actual_blob) != 0) diff --git a/test/api/hb-test.h b/test/api/hb-test.h index 9e50eafc8..73232c704 100644 --- a/test/api/hb-test.h +++ b/test/api/hb-test.h @@ -166,7 +166,6 @@ static inline void hb_test_assert_blobs_equal (hb_blob_t *expected_blob, hb_blob int expected = *(raw_expected + i); int actual = *(raw_actual + i); if (expected != actual) fprintf(stderr, "+%u %02x != %02x\n", i, expected, actual); - else fprintf(stderr, "+%u %02x\n", i, expected); } } g_assert_cmpint(0, ==, memcmp(raw_expected, raw_actual, expected_length)); diff --git a/test/api/meson.build b/test/api/meson.build index 9881796dc..089b25e04 100644 --- a/test/api/meson.build +++ b/test/api/meson.build @@ -117,9 +117,12 @@ foreach source : tests endif test(test_name, executable(test_name, source, - cpp_args: cpp_args, - include_directories: [incconfig], - dependencies: deps, - install: false, - ), env: env, suite: suite) + cpp_args: cpp_args, + include_directories: [incconfig], + dependencies: deps, + install: false, + ), + protocol: 'tap', + env: env, + suite: suite) endforeach diff --git a/test/api/test-set.c b/test/api/test-set.c index 6ad11d331..1f1402142 100644 --- a/test/api/test-set.c +++ b/test/api/test-set.c @@ -1018,18 +1018,19 @@ check_set_operations(hb_bool_t a_has_x, break; } - printf ("%s%s%s%s %-9s %s%s%s%s == %s [%s]\n", - a_inverted ? "i" : " ", - a_has_page ? "p" : " ", - a_is_null ? "n" : " ", - a_has_x ? "{13}" : "{} ", - op_name, - b_inverted ? "i" : " ", - b_has_page ? "p" : " ", - b_is_null ? "n" : " ", - b_has_x ? "{13}" : "{} ", - should_have_x ? "{13}" : "{} ", - has_expected ? "succeeded" : "failed"); + if (FALSE) + printf ("%s%s%s%s %-9s %s%s%s%s == %s [%s]\n", + a_inverted ? "i" : " ", + a_has_page ? "p" : " ", + a_is_null ? "n" : " ", + a_has_x ? "{13}" : "{} ", + op_name, + b_inverted ? "i" : " ", + b_has_page ? "p" : " ", + b_is_null ? "n" : " ", + b_has_x ? "{13}" : "{} ", + should_have_x ? "{13}" : "{} ", + has_expected ? "succeeded" : "failed"); hb_set_destroy (a); hb_set_destroy (b); diff --git a/test/api/test-subset-nameids.c b/test/api/test-subset-nameids.c index 6d4f81c5c..7fd4f0fd3 100644 --- a/test/api/test-subset-nameids.c +++ b/test/api/test-subset-nameids.c @@ -80,7 +80,7 @@ test_subset_name_overrides (void) char str6[] = "Roboto-Bold"; char str12[] = "Non ascii test Ü"; char str16[] = "Roboto-test-inserting"; - + hb_set_t *name_ids = hb_set_create(); hb_face_t *face_subset; hb_set_add_range (name_ids, 0, 13); diff --git a/test/api/test-subset-repacker.c b/test/api/test-subset-repacker.c index 6eeae4ed2..8f478fa22 100644 --- a/test/api/test-subset-repacker.c +++ b/test/api/test-subset-repacker.c @@ -187,7 +187,6 @@ test_hb_repack_with_cy_struct (void) hb_face_t *face_expected = hb_test_open_font_file ("fonts/repacker_expected.otf"); hb_blob_t *expected_blob = hb_face_reference_table (face_expected, HB_TAG ('G','S','U','B')); - fprintf(stderr, "expected %d bytes, actual %d bytes\n", hb_blob_get_length(expected_blob), hb_blob_get_length (result)); if (hb_blob_get_length (expected_blob) != 0 || hb_blob_get_length (result) != 0) From c523f9ac13e02cdbd99ea18de0faba6d6fb9489e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 5 Apr 2025 23:41:51 -0600 Subject: [PATCH 02/26] [test/shape] Use TAP Checkpoint. --- test/shape/meson.build | 1 + test/shape/run-tests.py | 34 ++++++++++++++++------------------ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/test/shape/meson.build b/test/shape/meson.build index 0f620f6f0..2c8d03a51 100644 --- a/test/shape/meson.build +++ b/test/shape/meson.build @@ -20,6 +20,7 @@ foreach file_name : in_house_tests hb_shape, meson.current_source_dir() / 'data' / 'in-house' / 'tests' / file_name, ], + protocol: 'tap', env: env, workdir: meson.current_build_dir() / '..' / '..', suite: ['shape', 'in-house'], diff --git a/test/shape/run-tests.py b/test/shape/run-tests.py index 21b832773..79810de76 100755 --- a/test/shape/run-tests.py +++ b/test/shape/run-tests.py @@ -46,7 +46,7 @@ def shape_cmd(command, shape_process, verbose=False): shape_process = open_shape_batch_process() if verbose: - print(hb_shape + " " + " ".join(command)) + print("# " + hb_shape + " " + " ".join(command)) shape_process.stdin.write((";".join(command) + "\n").encode("utf-8")) shape_process.stdin.flush() return shape_process.stdout.readline().decode("utf-8").strip() @@ -102,17 +102,17 @@ for what in ["shaper", "face-loader", "font-funcs"]: whats = plural(what) var_name = supported_whats_var_name(what) globals()[var_name] = what_list - print(f"Supported {whats}: {what_list}") + print(f"# Supported {whats}: {what_list}") # If running under Wine and not native dlls, make the respective shapers unavailable. if os.environ.get("WINEPATH"): overrides = os.environ.get("WINEDLLOVERRIDES", "").lower() if "directwrite" in supported_shapers and overrides.find("dwrite") == -1: supported_shapers.remove("directwrite") - print("Skipping DirectWrite shaper under Wine.") + print("# Skipping DirectWrite shaper under Wine.") if "uniscribe" in supported_shapers and overrides.find("usp10") == -1: supported_shapers.remove("uniscribe") - print("Skipping Uniscribe shaper under Wine.") + print("# Skipping Uniscribe shaper under Wine.") passes = 0 @@ -124,9 +124,9 @@ if not len(args): for filename in args: if filename == "-": - print("Running tests from standard input") + print("# Running tests from standard input") else: - print("Running tests in " + filename) + print("# Running tests in " + filename) if filename == "-": f = sys.stdin @@ -178,11 +178,11 @@ for filename in args: values = [v for v in values if v in supported] var_name = all_whats_var_name(what) - print(f"Setting {whats} to test to {values}") + print(f"# Setting {whats} to test to {values}") globals()[var_name] = values consumed = True if consumed: - print(line) + print("#", line) continue else: print("Unrecognized directive: %s" % line, file=sys.stderr) @@ -202,13 +202,13 @@ for filename in args: actual_hash = hashlib.sha1(ff.read()).hexdigest().strip() if actual_hash != expected_hash: print( - "different version of %s found; Expected hash %s, got %s; skipping." + "# different version of %s found; Expected hash %s, got %s; skipping." % (fontfile, expected_hash, actual_hash) ) skips += 1 continue except IOError: - print("%s not found, skip." % fontfile) + print("# %s not found, skip." % fontfile) skips += 1 continue else: @@ -217,7 +217,7 @@ for filename in args: if comment: if verbose: - print('# %s "%s" --unicodes %s' % (hb_shape, fontfile, unicodes)) + print('# # %s "%s" --unicodes %s' % (hb_shape, fontfile, unicodes)) continue skip_test = False @@ -236,7 +236,7 @@ for filename in args: backend = next(it) if backend not in supported_whats(what): skips += 1 - print(f"Skipping test with {what}={backend}.") + print(f"# Skipping test with {what}={backend}.") skip_test = True break what = what.replace("-", "_") @@ -317,16 +317,14 @@ for filename in args: passes += 1 print( - "%d tests passed; %d failed; %d skipped." % (passes, fails, skips), file=sys.stderr + "# %d tests passed; %d failed; %d skipped." % (passes, fails, skips), file=sys.stderr ) if not (fails + passes): - print("No tests ran.") + print("# No tests ran.") elif not (fails + skips): - print("All tests passed.") + print("# All tests passed.") if fails: sys.exit(1) -elif passes: - sys.exit(0) else: - sys.exit(77) + sys.exit(0) From e4e4d66523f1530cbe4a047339b3faf871c042b1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 00:12:22 -0600 Subject: [PATCH 03/26] [test/api] Test remaining tests to TAP --- test/api/test-c.c | 22 +++++++++++++++------- test/api/test-cplusplus.cc | 17 ++++++++++++++--- test/api/test-multithread.c | 9 ++++++--- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/test/api/test-c.c b/test/api/test-c.c index d0bdc9d6d..9434853fb 100644 --- a/test/api/test-c.c +++ b/test/api/test-c.c @@ -26,10 +26,7 @@ /* This file tests that all headers can be included from C files */ - -#ifdef HAVE_CONFIG_H -#include -#endif +#include "hb-test.h" #include #include @@ -77,9 +74,20 @@ #endif #ifndef NO_MAIN -int -main (void) +static void +test_list_shapers (void) { - return !*hb_shape_list_shapers (); + const char *first = *hb_shape_list_shapers (); + g_assert (first); +} + +int +main (int argc, char **argv) +{ + hb_test_init (&argc, &argv); + + hb_test_add (test_list_shapers); + + return hb_test_run (); } #endif diff --git a/test/api/test-cplusplus.cc b/test/api/test-cplusplus.cc index 74e4fb265..50cae8a7f 100644 --- a/test/api/test-cplusplus.cc +++ b/test/api/test-cplusplus.cc @@ -45,8 +45,8 @@ #include #include -int -main () +static void +test_smart_ptrs (void) { hb_buffer_t *b = hb_buffer_create (); hb::shared_ptr pb {b}; @@ -100,5 +100,16 @@ main () assert (hash2 (pb4) == hash2 (pb2)); assert (hash (b) == hash3 (pb5)); - return pb == pb.get_empty () || pb == pb2; + g_assert (pb != pb.get_empty ()); + g_assert (pb != pb2); +} + +int +main (int argc, char **argv) +{ + hb_test_init (&argc, &argv); + + hb_test_add (test_smart_ptrs); + + return hb_test_run (); } diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index 90bde064e..728290598 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -91,8 +91,9 @@ thread_func (void *data) } static void -test_body (const char *backend) +test_body (gconstpointer data) { + const char *backend = (const char *) data; bool ret = hb_font_set_funcs_using (font, backend); g_assert (ret); @@ -147,12 +148,14 @@ main (int argc, char **argv) fill_the_buffer (ref_buffer); for (const char **font_funcs = hb_font_list_funcs (); *font_funcs; font_funcs++) - test_body (*font_funcs); + hb_test_add_data_flavor (*font_funcs, *font_funcs, test_body); + + int ret = hb_test_run (); hb_buffer_destroy (ref_buffer); hb_font_destroy (font); hb_face_destroy (face); - return 0; + return ret; } From 2834900d9274f10691ffde299d926877142b6e4f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 00:15:12 -0600 Subject: [PATCH 04/26] [test/shape] Run each test suite in one process --- test/shape/meson.build | 49 +++++++++++++---------------------------- test/shape/run-tests.py | 2 +- 2 files changed, 16 insertions(+), 35 deletions(-) diff --git a/test/shape/meson.build b/test/shape/meson.build index 2c8d03a51..a9aa1acd4 100644 --- a/test/shape/meson.build +++ b/test/shape/meson.build @@ -12,45 +12,26 @@ env.set('HAVE_CORETEXT', '@0@'.format(conf.get('HAVE_CORETEXT', 0))) env.set('HAVE_DIRECTWRITE', '@0@'.format(conf.get('HAVE_DIRECTWRITE', 0))) env.set('HAVE_UNISCRIBE', '@0@'.format(conf.get('HAVE_UNISCRIBE', 0))) -foreach file_name : in_house_tests - test_name = file_name.split('.')[0] - - test(test_name, shape_run_tests_py, +sets = ['in-house', 'aots', 'text-rendering-tests'] +foreach set : sets + # in-house -> in_house_tests, aots -> aots_tests, text-rendering-tests -> text_rendering_tests + varname = '@0@_tests'.format(set.replace('-', '_')) + varname = varname.replace('tests_tests', 'tests') + tests = get_variable(varname) + file_names = [] + foreach test : tests + file_name = meson.current_source_dir() / 'data' / set / 'tests' / test + file_names += [file_name] + endforeach + test(set, shape_run_tests_py, args: [ hb_shape, - meson.current_source_dir() / 'data' / 'in-house' / 'tests' / file_name, + file_names, ], protocol: 'tap', + verbose: true, env: env, workdir: meson.current_build_dir() / '..' / '..', - suite: ['shape', 'in-house'], - ) -endforeach - -foreach file_name : aots_tests - test_name = file_name.split('.')[0] - - test(test_name, shape_run_tests_py, - args: [ - hb_shape, - meson.current_source_dir() / 'data' / 'aots' / 'tests' / file_name, - ], - env: env, - workdir: meson.current_build_dir() / '..' / '..', - suite: ['shape', 'aots'], - ) -endforeach - -foreach file_name : text_rendering_tests - test_name = file_name.split('.')[0] - - test(test_name, shape_run_tests_py, - args: [ - hb_shape, - meson.current_source_dir() / 'data' / 'text-rendering-tests' / 'tests' / file_name, - ], - env: env, - workdir: meson.current_build_dir() / '..' / '..', - suite: ['shape', 'text-rendering-tests'], + suite: ['shape', set], ) endforeach diff --git a/test/shape/run-tests.py b/test/shape/run-tests.py index 79810de76..a18146b47 100755 --- a/test/shape/run-tests.py +++ b/test/shape/run-tests.py @@ -317,7 +317,7 @@ for filename in args: passes += 1 print( - "# %d tests passed; %d failed; %d skipped." % (passes, fails, skips), file=sys.stderr + "# %d tests passed; %d failed; %d skipped." % (passes, fails, skips) ) if not (fails + passes): print("# No tests ran.") From 69fd94901497798b9bc98833df197b6ef537d6d8 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 00:33:44 -0600 Subject: [PATCH 05/26] [test/shape] Run using TAP protocol Run all tests for a suite in one process. Saves runtime from 3s to 2s. --- test/shape/meson.build | 2 +- test/shape/run-tests.py | 38 +++++++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/test/shape/meson.build b/test/shape/meson.build index a9aa1acd4..708ae00ba 100644 --- a/test/shape/meson.build +++ b/test/shape/meson.build @@ -29,7 +29,7 @@ foreach set : sets file_names, ], protocol: 'tap', - verbose: true, + #verbose: true, env: env, workdir: meson.current_build_dir() / '..' / '..', suite: ['shape', set], diff --git a/test/shape/run-tests.py b/test/shape/run-tests.py index a18146b47..559748e17 100755 --- a/test/shape/run-tests.py +++ b/test/shape/run-tests.py @@ -2,6 +2,8 @@ import sys, os, subprocess, hashlib +print("TAP version 14") + args = sys.argv[1:] verbose = False @@ -115,6 +117,7 @@ if os.environ.get("WINEPATH"): print("# Skipping Uniscribe shaper under Wine.") +number = 0 passes = 0 fails = 0 skips = 0 @@ -201,15 +204,15 @@ for filename in args: if expected_hash: actual_hash = hashlib.sha1(ff.read()).hexdigest().strip() if actual_hash != expected_hash: + skips += 1 print( - "# different version of %s found; Expected hash %s, got %s; skipping." + "# Different version of %s found; Expected hash %s, got %s; skipping." % (fontfile, expected_hash, actual_hash) ) - skips += 1 continue except IOError: - print("# %s not found, skip." % fontfile) skips += 1 + print("# %s not found, skip." % fontfile) continue else: cwd = os.path.dirname(filename) @@ -236,6 +239,7 @@ for filename in args: backend = next(it) if backend not in supported_whats(what): skips += 1 + print(f"ok {number} - {fontfile} # skip {what}={backend} not supported") print(f"# Skipping test with {what}={backend}.") skip_test = True break @@ -253,6 +257,7 @@ for filename in args: for shaper in [shaper] if shaper else all_whats("shaper"): for font_funcs in [font_funcs] if font_funcs else all_whats("font-funcs"): + number += 1 extra_options = [] if shaper: @@ -276,6 +281,7 @@ for filename in args: if glyphs_expected == "*": passes += 1 + print(f"ok {number} - {fontfile}") continue final_glyphs = glyphs @@ -300,21 +306,23 @@ for filename in args: # If the removal of glyph_ids failed, fail the test. # https://github.com/harfbuzz/harfbuzz/issues/5169 if not final_glyphs_expected or final_glyphs != final_glyphs_expected: - print(hb_shape + " " + " ".join(cmd), file=sys.stderr) - print("Actual: " + glyphs, file=sys.stderr) - print("Expected: " + glyphs_expected, file=sys.stderr) - if final_glyphs != glyphs: - print( - "Actual (no glyph names): " + final_glyphs, - file=sys.stderr, - ) - print( - "Expected (no glyph names): " + final_glyphs_expected, - file=sys.stderr, - ) fails += 1 + cmd = hb_shape + " " + " ".join(cmd) + print(f"not ok {number} - {cmd}") + print(" ---", file=sys.stderr) + print(" test_file: \"" + filename + "\"", file=sys.stderr) + print(" cmd: \"" + cmd + "\"", file=sys.stderr) + print(" actual: \"" + glyphs + "\"", file=sys.stderr) + print(" expected: \"" + glyphs_expected + "\"", file=sys.stderr) + if final_glyphs != glyphs: + print(" actual_gids: \"" + final_glyphs + "\"", file=sys.stderr) + print(" expected_gids: \"" + final_glyphs_expected + "\"", file=sys.stderr) + print(" ...", file=sys.stderr) else: passes += 1 + print(f"ok {number} - {fontfile}") + +print("1..%d" % number) print( "# %d tests passed; %d failed; %d skipped." % (passes, fails, skips) From db953a43d06cdcbe17c7b58575e8a31744857f19 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 01:06:25 -0600 Subject: [PATCH 06/26] [meson.build] Cosmetic --- test/fuzzing/meson.build | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/fuzzing/meson.build b/test/fuzzing/meson.build index 65ce12ff1..c2441103b 100644 --- a/test/fuzzing/meson.build +++ b/test/fuzzing/meson.build @@ -6,6 +6,8 @@ tests = [ 'hb-repacker-fuzzer.cc', ] +run_fuzzer_tests = find_program('run-fuzzer-tests.py', required: true) + foreach file_name : tests test_name = file_name.split('.')[0] @@ -34,7 +36,7 @@ foreach file_name : tests set_variable('@0@_exe'.format(test_name.underscorify()), exe) endforeach -test('shape-fuzzer', find_program('run-fuzzer-tests.py'), +test('shape-fuzzer', run_fuzzer_tests, args: [ hb_shape_fuzzer_exe, meson.current_source_dir() / 'fonts', @@ -45,7 +47,7 @@ test('shape-fuzzer', find_program('run-fuzzer-tests.py'), suite: ['fuzzing'], ) -test('subset-fuzzer', find_program('run-fuzzer-tests.py'), +test('subset-fuzzer', run_fuzzer_tests, args: [ hb_subset_fuzzer_exe, meson.current_source_dir() / 'fonts', @@ -56,7 +58,7 @@ test('subset-fuzzer', find_program('run-fuzzer-tests.py'), suite: ['fuzzing'], ) -test('repacker-fuzzer', find_program('run-fuzzer-tests.py'), +test('repacker-fuzzer', run_fuzzer_tests, args: [ hb_repacker_fuzzer_exe, meson.current_source_dir() / 'graphs', @@ -66,7 +68,7 @@ test('repacker-fuzzer', find_program('run-fuzzer-tests.py'), suite: ['fuzzing'], ) -test('draw-fuzzer', find_program('run-fuzzer-tests.py'), +test('draw-fuzzer', run_fuzzer_tests, args: [ hb_draw_fuzzer_exe, meson.current_source_dir() / 'fonts', From ee50fad676d2cea4993fcf0db8f32662d6a8ca5f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 01:08:28 -0600 Subject: [PATCH 07/26] [run-tests] black --- test/shape/run-tests.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/test/shape/run-tests.py b/test/shape/run-tests.py index 559748e17..cb21a70fe 100755 --- a/test/shape/run-tests.py +++ b/test/shape/run-tests.py @@ -239,7 +239,9 @@ for filename in args: backend = next(it) if backend not in supported_whats(what): skips += 1 - print(f"ok {number} - {fontfile} # skip {what}={backend} not supported") + print( + f"ok {number} - {fontfile} # skip {what}={backend} not supported" + ) print(f"# Skipping test with {what}={backend}.") skip_test = True break @@ -310,13 +312,18 @@ for filename in args: cmd = hb_shape + " " + " ".join(cmd) print(f"not ok {number} - {cmd}") print(" ---", file=sys.stderr) - print(" test_file: \"" + filename + "\"", file=sys.stderr) - print(" cmd: \"" + cmd + "\"", file=sys.stderr) - print(" actual: \"" + glyphs + "\"", file=sys.stderr) - print(" expected: \"" + glyphs_expected + "\"", file=sys.stderr) + print(' test_file: "' + filename + '"', file=sys.stderr) + print(' cmd: "' + cmd + '"', file=sys.stderr) + print(' actual: "' + glyphs + '"', file=sys.stderr) + print(' expected: "' + glyphs_expected + '"', file=sys.stderr) if final_glyphs != glyphs: - print(" actual_gids: \"" + final_glyphs + "\"", file=sys.stderr) - print(" expected_gids: \"" + final_glyphs_expected + "\"", file=sys.stderr) + print( + ' actual_gids: "' + final_glyphs + '"', file=sys.stderr + ) + print( + ' expected_gids: "' + final_glyphs_expected + '"', + file=sys.stderr, + ) print(" ...", file=sys.stderr) else: passes += 1 @@ -324,9 +331,7 @@ for filename in args: print("1..%d" % number) -print( - "# %d tests passed; %d failed; %d skipped." % (passes, fails, skips) -) +print("# %d tests passed; %d failed; %d skipped." % (passes, fails, skips)) if not (fails + passes): print("# No tests ran.") elif not (fails + skips): From 1db93d2f6d0ae4672d93b53018848b2ac5eed40f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 01:46:23 -0600 Subject: [PATCH 08/26] [test/fuzzing/subset] Run chunks in parallel --- test/fuzzing/meson.build | 44 ++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/test/fuzzing/meson.build b/test/fuzzing/meson.build index c2441103b..bb3d48a1e 100644 --- a/test/fuzzing/meson.build +++ b/test/fuzzing/meson.build @@ -47,17 +47,6 @@ test('shape-fuzzer', run_fuzzer_tests, suite: ['fuzzing'], ) -test('subset-fuzzer', run_fuzzer_tests, - args: [ - hb_subset_fuzzer_exe, - meson.current_source_dir() / 'fonts', - meson.current_source_dir() / '..' / 'subset' / 'data' / 'fonts', - ], - workdir: meson.current_build_dir() / '..' / '..', - priority: 1, - suite: ['fuzzing'], -) - test('repacker-fuzzer', run_fuzzer_tests, args: [ hb_repacker_fuzzer_exe, @@ -76,3 +65,36 @@ test('draw-fuzzer', run_fuzzer_tests, workdir: meson.current_build_dir() / '..' / '..', suite: ['fuzzing'], ) + +# Subset fuzzer: feed the fuzzer directly, without run-fuzzer-tests.py +fs = import('fs') +glob = run_command('find', meson.current_source_dir() / 'fonts', '-type', 'f', check:true).stdout().strip().split('\n') +glob += run_command('find', meson.current_source_dir() / '..' / 'subset' / 'data' / 'fonts' , '-type', 'f', check:true).stdout().strip().split('\n') +# Chunk glob and call runner for each chunk +chunk_size = 64 +chunks = [] +num_chunks = (glob.length() + chunk_size - 1) / chunk_size +foreach i : range(0, num_chunks) + start = i * chunk_size + end = (i + 1) * chunk_size + if end > glob.length() + end = glob.length() + endif + chunk = [] + foreach j : range(start, end) + chunk += [glob[j]] + endforeach + chunks += [chunk] +endforeach + +foreach i : range(0, chunks.length() - 1) + chunk = chunks[i] + test('subset-fuzzer-chunk-@0@'.format(i), + hb_subset_fuzzer_exe, + args: chunk, + depends: [hb_shape_fuzzer_exe, libharfbuzz, libharfbuzz_subset], + workdir: meson.current_build_dir() / '..' / '..', + priority: 1, + suite: ['fuzzing'], + ) +endforeach From b01cea95e1ed362e2e9badec074aa53a6a4a6dc3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 01:48:35 -0600 Subject: [PATCH 09/26] [meson] Cosmetic --- test/shape/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/shape/meson.build b/test/shape/meson.build index 708ae00ba..6262f8b0b 100644 --- a/test/shape/meson.build +++ b/test/shape/meson.build @@ -15,7 +15,7 @@ env.set('HAVE_UNISCRIBE', '@0@'.format(conf.get('HAVE_UNISCRIBE', 0))) sets = ['in-house', 'aots', 'text-rendering-tests'] foreach set : sets # in-house -> in_house_tests, aots -> aots_tests, text-rendering-tests -> text_rendering_tests - varname = '@0@_tests'.format(set.replace('-', '_')) + varname = '@0@_tests'.format(set.underscorify()) varname = varname.replace('tests_tests', 'tests') tests = get_variable(varname) file_names = [] From da5a9fb860025734863b42a1f852e005c61f5f51 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 01:50:01 -0600 Subject: [PATCH 10/26] [meson.build] Remove unused fs module --- test/fuzzing/meson.build | 1 - 1 file changed, 1 deletion(-) diff --git a/test/fuzzing/meson.build b/test/fuzzing/meson.build index bb3d48a1e..c12ac3410 100644 --- a/test/fuzzing/meson.build +++ b/test/fuzzing/meson.build @@ -67,7 +67,6 @@ test('draw-fuzzer', run_fuzzer_tests, ) # Subset fuzzer: feed the fuzzer directly, without run-fuzzer-tests.py -fs = import('fs') glob = run_command('find', meson.current_source_dir() / 'fonts', '-type', 'f', check:true).stdout().strip().split('\n') glob += run_command('find', meson.current_source_dir() / '..' / 'subset' / 'data' / 'fonts' , '-type', 'f', check:true).stdout().strip().split('\n') # Chunk glob and call runner for each chunk From fbda749bdbd8406901fa5bb62760db32985d4a82 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 02:01:28 -0600 Subject: [PATCH 11/26] [meson.build] Try to bring down required version range() not found --- test/fuzzing/meson.build | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/test/fuzzing/meson.build b/test/fuzzing/meson.build index c12ac3410..c344566b6 100644 --- a/test/fuzzing/meson.build +++ b/test/fuzzing/meson.build @@ -72,22 +72,20 @@ glob += run_command('find', meson.current_source_dir() / '..' / 'subset' / 'data # Chunk glob and call runner for each chunk chunk_size = 64 chunks = [] -num_chunks = (glob.length() + chunk_size - 1) / chunk_size -foreach i : range(0, num_chunks) - start = i * chunk_size - end = (i + 1) * chunk_size - if end > glob.length() - end = glob.length() +chunk = [] +foreach item : glob + if chunk.length() >= chunk_size + chunks += [chunk] + chunk = [] endif - chunk = [] - foreach j : range(start, end) - chunk += [glob[j]] - endforeach - chunks += [chunk] + chunk += [item] endforeach +if chunk.length() > 0 + chunks += [chunk] +endif -foreach i : range(0, chunks.length() - 1) - chunk = chunks[i] +i = 0 +foreach chunk : chunks test('subset-fuzzer-chunk-@0@'.format(i), hb_subset_fuzzer_exe, args: chunk, @@ -96,4 +94,5 @@ foreach i : range(0, chunks.length() - 1) priority: 1, suite: ['fuzzing'], ) + i += 1 endforeach From 628a9ee28a280d3e57bb870f0c4bf5a6c5976b99 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 02:15:51 -0600 Subject: [PATCH 12/26] [check-static-inits] objdump all objects together We won't see which object has the bad initializers anymore. We can later adapt to objdump each object one by one if any error was found. Changes test runtime from 1s down to 0.15s. --- src/check-static-inits.py | 40 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/check-static-inits.py b/src/check-static-inits.py index c6e2db1ea..2acd04602 100755 --- a/src/check-static-inits.py +++ b/src/check-static-inits.py @@ -22,30 +22,30 @@ if not OBJS: stat = 0 tested = 0 -for obj in OBJS: - result = subprocess.run(objdump.split () + ['-t', obj], stdout=subprocess.PIPE, stderr=subprocess.PIPE) +result = subprocess.run(objdump.split () + ['-t'] + OBJS, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - if result.returncode: - if result.stderr.find (b'not recognized') != -1: - # https://github.com/harfbuzz/harfbuzz/issues/3019 - print ('objdump %s returned "not recognized", skipping' % obj) - continue - print ('objdump %s returned error:\n%s' % (obj, result.stderr.decode ('utf-8'))) - stat = 2 +if result.returncode: + if result.stderr.find (b'not recognized') != -1: + # https://github.com/harfbuzz/harfbuzz/issues/3019 + print ('objdump %s returned "not recognized", skipping') + else: + print ('objdump returned error:\n%s' % (result.stderr.decode ('utf-8'))) + stat = 2 +else: + tested = 1 - result = result.stdout.decode ('utf-8') +result = result.stdout.decode ('utf-8') - # Checking that no object file has static initializers - for l in re.findall (r'^.*\.[cd]tors.*$', result, re.MULTILINE): - if not re.match (r'.*\b0+\b', l): - print ('Ouch, %s has static initializers/finalizers' % obj) - stat = 1 +# Checking that no object file has static initializers +for l in re.findall (r'^.*\.[cd]tors.*$', result, re.MULTILINE): + if not re.match (r'.*\b0+\b', l): + print ('Ouch, library has static initializers/finalizers') + stat = 1 - # Checking that no object file has lazy static C++ constructors/destructors or other such stuff - if ('__cxa_' in result) and ('__ubsan_handle' not in result): - print ('Ouch, %s has lazy static C++ constructors/destructors or other such stuff' % obj) - stat = 1 +# Checking that no object file has lazy static C++ constructors/destructors or other such stuff +if ('__cxa_' in result) and ('__ubsan_handle' not in result): + print ('Ouch, library has lazy static C++ constructors/destructors or other such stuff') + stat = 1 - tested += 1 sys.exit (stat if tested else 77) From a530672f043001db6bd94590d7de57849861262b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 02:20:41 -0600 Subject: [PATCH 13/26] [meson.build] Don't use str.replace() method Too recent. --- test/shape/data/text-rendering-tests/meson.build | 4 ++-- test/shape/data/text-rendering-tests/update.py | 4 ++-- test/shape/meson.build | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/test/shape/data/text-rendering-tests/meson.build b/test/shape/data/text-rendering-tests/meson.build index c14c7b823..6f4b83d2b 100644 --- a/test/shape/data/text-rendering-tests/meson.build +++ b/test/shape/data/text-rendering-tests/meson.build @@ -1,4 +1,4 @@ -text_rendering_tests = [ +text_rendering_tests_tests = [ 'AVAR-1.tests', 'CFF-1.tests', 'CFF-2.tests', @@ -77,7 +77,7 @@ text_rendering_tests = [ 'SHKNDA-1.tests', ] -disabled_text_rendering_tests = [ +disabled_text_rendering_tests_tests = [ 'CMAP-3.tests', 'SHARAN-1.tests', 'SHBALI-1.tests', diff --git a/test/shape/data/text-rendering-tests/update.py b/test/shape/data/text-rendering-tests/update.py index 56524fa71..c84b66372 100755 --- a/test/shape/data/text-rendering-tests/update.py +++ b/test/shape/data/text-rendering-tests/update.py @@ -118,9 +118,9 @@ subprocess.run([git, "add", "tests"], check=True) with open("meson.build", "w") as f: f.write( "\n".join( - ["text_rendering_tests = ["] + ["text_rendering_tests_tests = ["] + [" '%s'," % x.split("tests/")[1] for x in tests] - + ["]", "", "disabled_text_rendering_tests = ["] + + ["]", "", "disabled_text_rendering_tests_tests = ["] + [" '%s'," % x.split("tests/")[1] for x in disabled_tests] + ["]", ""] ) diff --git a/test/shape/meson.build b/test/shape/meson.build index 6262f8b0b..80526b057 100644 --- a/test/shape/meson.build +++ b/test/shape/meson.build @@ -16,7 +16,6 @@ sets = ['in-house', 'aots', 'text-rendering-tests'] foreach set : sets # in-house -> in_house_tests, aots -> aots_tests, text-rendering-tests -> text_rendering_tests varname = '@0@_tests'.format(set.underscorify()) - varname = varname.replace('tests_tests', 'tests') tests = get_variable(varname) file_names = [] foreach test : tests From 740a103ba1fc83b1c4a2aa3471ef33e415a8bde6 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 02:26:17 -0600 Subject: [PATCH 14/26] [meson] See if this fixes bots --- test/fuzzing/meson.build | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/fuzzing/meson.build b/test/fuzzing/meson.build index c344566b6..24ba9d9d4 100644 --- a/test/fuzzing/meson.build +++ b/test/fuzzing/meson.build @@ -66,9 +66,10 @@ test('draw-fuzzer', run_fuzzer_tests, suite: ['fuzzing'], ) +find = find_program('find', required: true) # Subset fuzzer: feed the fuzzer directly, without run-fuzzer-tests.py -glob = run_command('find', meson.current_source_dir() / 'fonts', '-type', 'f', check:true).stdout().strip().split('\n') -glob += run_command('find', meson.current_source_dir() / '..' / 'subset' / 'data' / 'fonts' , '-type', 'f', check:true).stdout().strip().split('\n') +glob = run_command(find, meson.current_source_dir() / 'fonts', '-type', 'f', check:true).stdout().strip().split('\n') +glob += run_command(find, meson.current_source_dir() / '..' / 'subset' / 'data' / 'fonts' , '-type', 'f', check:true).stdout().strip().split('\n') # Chunk glob and call runner for each chunk chunk_size = 64 chunks = [] From e33277776363803c53bd1b456ffb9d4f653ab897 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 02:30:09 -0600 Subject: [PATCH 15/26] [fuzzing/subset] Make TAP protocol --- test/fuzzing/main.cc | 9 ++++++++- test/fuzzing/meson.build | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/test/fuzzing/main.cc b/test/fuzzing/main.cc index 3024eb574..b1716090d 100644 --- a/test/fuzzing/main.cc +++ b/test/fuzzing/main.cc @@ -5,6 +5,8 @@ int main (int argc, char **argv) { + printf ("TAP version 14\n"); + for (int i = 1; i < argc; i++) { hb_blob_t *blob = hb_blob_create_from_file_or_fail (argv[i]); @@ -12,11 +14,16 @@ int main (int argc, char **argv) unsigned len = 0; const char *font_data = hb_blob_get_data (blob, &len); - printf ("%s (%u bytes)\n", argv[i], len); + printf ("# %s (%u bytes)\n", argv[i], len); LLVMFuzzerTestOneInput ((const uint8_t *) font_data, len); + printf ("ok %d - %s\n", i, argv[i]); + hb_blob_destroy (blob); } + + printf ("1..%d\n", argc - 1); + return 0; } diff --git a/test/fuzzing/meson.build b/test/fuzzing/meson.build index 24ba9d9d4..bda2e4e93 100644 --- a/test/fuzzing/meson.build +++ b/test/fuzzing/meson.build @@ -92,7 +92,7 @@ foreach chunk : chunks args: chunk, depends: [hb_shape_fuzzer_exe, libharfbuzz, libharfbuzz_subset], workdir: meson.current_build_dir() / '..' / '..', - priority: 1, + protocol: 'tap', suite: ['fuzzing'], ) i += 1 From a777a9c53500f3b5ea3196464366f6a41838d3e0 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 02:47:06 -0600 Subject: [PATCH 16/26] [meson.build] Try fix using of `find` --- test/fuzzing/meson.build | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/test/fuzzing/meson.build b/test/fuzzing/meson.build index bda2e4e93..a4276ba3c 100644 --- a/test/fuzzing/meson.build +++ b/test/fuzzing/meson.build @@ -66,10 +66,23 @@ test('draw-fuzzer', run_fuzzer_tests, suite: ['fuzzing'], ) -find = find_program('find', required: true) +ls = find_program('ls') +if not ls.found() + ls = find_program('dir') +endif # Subset fuzzer: feed the fuzzer directly, without run-fuzzer-tests.py -glob = run_command(find, meson.current_source_dir() / 'fonts', '-type', 'f', check:true).stdout().strip().split('\n') -glob += run_command(find, meson.current_source_dir() / '..' / 'subset' / 'data' / 'fonts' , '-type', 'f', check:true).stdout().strip().split('\n') +font_dirs = [ + meson.current_source_dir() / 'fonts', + meson.current_source_dir() / '..' / 'subset' / 'data' / 'fonts', +] +glob = [] +foreach font_dir : font_dirs + dir = run_command(ls, font_dir, check:true).stdout().strip().split('\n') + foreach item : dir + glob += [font_dir / item] + endforeach +endforeach + # Chunk glob and call runner for each chunk chunk_size = 64 chunks = [] From b2179dcfcd16ac55e07d589ff1be7cb067b82737 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 02:56:20 -0600 Subject: [PATCH 17/26] [meson.build] Another try --- test/fuzzing/meson.build | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/fuzzing/meson.build b/test/fuzzing/meson.build index a4276ba3c..2cd80f6f0 100644 --- a/test/fuzzing/meson.build +++ b/test/fuzzing/meson.build @@ -68,7 +68,12 @@ test('draw-fuzzer', run_fuzzer_tests, ls = find_program('ls') if not ls.found() - ls = find_program('dir') + # On Windows, we need to use the 'dir' command to list files in a directory. + # The 'ls' command is not available by default. + find = [find_program('dir', required: true), '/b', '/a-d'] +else + # On other platforms, we can use the 'ls' command. + find = [find_program('ls', required: true)] endif # Subset fuzzer: feed the fuzzer directly, without run-fuzzer-tests.py font_dirs = [ @@ -77,7 +82,7 @@ font_dirs = [ ] glob = [] foreach font_dir : font_dirs - dir = run_command(ls, font_dir, check:true).stdout().strip().split('\n') + dir = run_command(find, font_dir, check:true).stdout().strip().split('\n') foreach item : dir glob += [font_dir / item] endforeach From 8132a6607f15599c6e4c7ef48ed5c5894a626f45 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 03:12:38 -0600 Subject: [PATCH 18/26] [shape/run-tests] Don't return non-zero TAP protocol. --- test/shape/run-tests.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/test/shape/run-tests.py b/test/shape/run-tests.py index cb21a70fe..15da3185d 100755 --- a/test/shape/run-tests.py +++ b/test/shape/run-tests.py @@ -336,8 +336,3 @@ if not (fails + passes): print("# No tests ran.") elif not (fails + skips): print("# All tests passed.") - -if fails: - sys.exit(1) -else: - sys.exit(0) From 5efdb884a5403580c86d6a107cecd304d23b0fb4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 03:21:15 -0600 Subject: [PATCH 19/26] [run-tests] Fix remaining bot fails, fingers crossed --- test/shape/run-tests.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/shape/run-tests.py b/test/shape/run-tests.py index 15da3185d..5a66de1b0 100755 --- a/test/shape/run-tests.py +++ b/test/shape/run-tests.py @@ -239,6 +239,7 @@ for filename in args: backend = next(it) if backend not in supported_whats(what): skips += 1 + number += 1 print( f"ok {number} - {fontfile} # skip {what}={backend} not supported" ) From f73039422e369274dab7b6c268da0d49e6fdee4e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 03:33:27 -0600 Subject: [PATCH 20/26] [CI] See if this fixes crossbuild 64 --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 495a6a9d9..1bed230e8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -149,8 +149,9 @@ jobs: executor: win64-executor steps: - checkout + - run: dpkg --add-architecture i386 - run: apt update - - run: DEBIAN_FRONTEND=noninteractive apt install -y ninja-build python3 python3-pip python3-venv git g++-mingw-w64-x86-64 zip wine wine64 + - run: DEBIAN_FRONTEND=noninteractive apt install -y ninja-build python3 python3-pip python3-venv git g++-mingw-w64-x86-64 zip wine wine64 wine32:i386 - run: | export LANG=en_US.UTF-8 python3 -m venv venv From 155e1e633b6ec540407931cab24b8abd8e10100f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 03:49:15 -0600 Subject: [PATCH 21/26] [test/api] Use g_assert_true instead of g_assert The latter terminates the program. The former marks the test as failing. --- test/api/hb-subset-test.h | 2 +- test/api/test-aat-layout.c | 4 +- test/api/test-base-minmax.c | 18 +- test/api/test-baseline.c | 24 +- test/api/test-blob.c | 70 ++--- test/api/test-buffer.c | 110 +++---- test/api/test-c.c | 2 +- test/api/test-collect-unicodes.c | 38 +-- test/api/test-common.c | 192 ++++++------- test/api/test-cplusplus.cc | 4 +- test/api/test-draw.c | 10 +- test/api/test-face.c | 2 +- test/api/test-font.c | 112 ++++---- test/api/test-instance-cff2.c | 4 +- test/api/test-map.c | 24 +- test/api/test-multithread.c | 2 +- test/api/test-object.c | 92 +++--- test/api/test-ot-collect-glyphs.c | 124 ++++---- test/api/test-ot-color.c | 102 +++---- test/api/test-ot-extents-cff.c | 50 ++-- test/api/test-ot-face.c | 2 +- test/api/test-ot-glyphname.c | 4 +- test/api/test-ot-layout.c | 12 +- test/api/test-ot-math.c | 164 +++++------ test/api/test-ot-metrics-tt-var.c | 40 +-- test/api/test-ot-metrics.c | 6 +- test/api/test-ot-tag.c | 8 +- test/api/test-set.c | 446 ++++++++++++++--------------- test/api/test-shape.c | 2 +- test/api/test-subset-drop-tables.c | 8 +- test/api/test-subset-glyf.c | 2 +- test/api/test-subset-hdmx.c | 2 +- test/api/test-subset-hmtx.c | 2 +- test/api/test-subset.c | 54 ++-- test/api/test-unicode.c | 138 ++++----- test/api/test-var-coords.c | 4 +- test/api/test-version.c | 34 +-- 37 files changed, 957 insertions(+), 957 deletions(-) diff --git a/test/api/hb-subset-test.h b/test/api/hb-subset-test.h index 882e51dfd..37a98ed30 100644 --- a/test/api/hb-subset-test.h +++ b/test/api/hb-subset-test.h @@ -73,7 +73,7 @@ hb_subset_test_create_subset (hb_face_t *source, hb_subset_input_t *input) { hb_face_t *subset = hb_subset_or_fail (source, input); - g_assert (subset); + g_assert_true (subset); hb_subset_input_destroy (input); return subset; diff --git a/test/api/test-aat-layout.c b/test/api/test-aat-layout.c index 287d9c236..e4e85001b 100644 --- a/test/api/test-aat-layout.c +++ b/test/api/test-aat-layout.c @@ -108,11 +108,11 @@ test_aat_has (void) { hb_face_t *morx = hb_test_open_font_file ("fonts/aat-morx.ttf"); hb_face_t *trak; - g_assert (hb_aat_layout_has_substitution (morx)); + g_assert_true (hb_aat_layout_has_substitution (morx)); hb_face_destroy (morx); trak = hb_test_open_font_file ("fonts/aat-trak.ttf"); - g_assert (hb_aat_layout_has_tracking (trak)); + g_assert_true (hb_aat_layout_has_tracking (trak)); hb_face_destroy (trak); } diff --git a/test/api/test-base-minmax.c b/test/api/test-base-minmax.c index 332c2668d..c5632ca73 100644 --- a/test/api/test-base-minmax.c +++ b/test/api/test-base-minmax.c @@ -36,19 +36,19 @@ test_ot_layout_font_extents (void) hb_font_extents_t extents; - g_assert (hb_ot_layout_get_font_extents2 (font, HB_DIRECTION_LTR, - HB_SCRIPT_LATIN, HB_LANGUAGE_INVALID, - &extents)); + g_assert_true (hb_ot_layout_get_font_extents2 (font, HB_DIRECTION_LTR, + HB_SCRIPT_LATIN, HB_LANGUAGE_INVALID, + &extents)); g_assert_cmpint (extents.ascender, ==, 2000); - g_assert (hb_ot_layout_get_font_extents2 (font, HB_DIRECTION_LTR, - HB_SCRIPT_LATIN, hb_language_from_string ("xx", -1), - &extents)); + g_assert_true (hb_ot_layout_get_font_extents2 (font, HB_DIRECTION_LTR, + HB_SCRIPT_LATIN, hb_language_from_string ("xx", -1), + &extents)); g_assert_cmpint (extents.ascender, ==, 2000); - g_assert (!hb_ot_layout_get_font_extents2 (font, HB_DIRECTION_LTR, - HB_SCRIPT_ARABIC, HB_LANGUAGE_INVALID, - &extents)); + g_assert_true (!hb_ot_layout_get_font_extents2 (font, HB_DIRECTION_LTR, + HB_SCRIPT_ARABIC, HB_LANGUAGE_INVALID, + &extents)); g_assert_cmpint (extents.ascender, ==, 3000); hb_font_destroy (font); diff --git a/test/api/test-baseline.c b/test/api/test-baseline.c index 4e02cd0e2..bff0e8aad 100644 --- a/test/api/test-baseline.c +++ b/test/api/test-baseline.c @@ -35,22 +35,22 @@ test_ot_layout_base (void) hb_font_t *font = hb_font_create (face); hb_position_t position; - g_assert (hb_ot_layout_get_baseline (font, HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_BOTTOM_OR_LEFT, HB_DIRECTION_TTB, - HB_TAG ('h','a','n','i'), - HB_TAG ('E','N','G',' '), - &position)); + g_assert_true (hb_ot_layout_get_baseline (font, HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_BOTTOM_OR_LEFT, HB_DIRECTION_TTB, + HB_TAG ('h','a','n','i'), + HB_TAG ('E','N','G',' '), + &position)); g_assert_cmpint (46, ==, position); - g_assert (hb_ot_layout_get_baseline2 (font, HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_BOTTOM_OR_LEFT, HB_DIRECTION_TTB, - HB_SCRIPT_HAN, - hb_language_from_string ("en", -1), - &position)); + g_assert_true (hb_ot_layout_get_baseline2 (font, HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_BOTTOM_OR_LEFT, HB_DIRECTION_TTB, + HB_SCRIPT_HAN, + hb_language_from_string ("en", -1), + &position)); g_assert_cmpint (46, ==, position); - g_assert (!hb_ot_layout_get_baseline (font, HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_TOP_OR_RIGHT, HB_DIRECTION_TTB, - HB_TAG ('h','a','n','i'), - HB_TAG ('E','N','G',' '), - &position)); + g_assert_true (!hb_ot_layout_get_baseline (font, HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_TOP_OR_RIGHT, HB_DIRECTION_TTB, + HB_TAG ('h','a','n','i'), + HB_TAG ('E','N','G',' '), + &position)); hb_font_destroy (font); hb_face_destroy (face); diff --git a/test/api/test-blob.c b/test/api/test-blob.c index 7914a26ce..0ea56abc7 100644 --- a/test/api/test-blob.c +++ b/test/api/test-blob.c @@ -50,31 +50,31 @@ test_blob_empty (void) const char *data; char *data_writable; - g_assert (hb_blob_is_immutable (hb_blob_get_empty ())); - g_assert (hb_blob_get_empty () != NULL); - g_assert (hb_blob_get_empty () == hb_blob_create (NULL, 0, HB_MEMORY_MODE_READONLY, NULL, NULL)); - g_assert (hb_blob_get_empty () == hb_blob_create ("asdf", 0, HB_MEMORY_MODE_READONLY, NULL, NULL)); - g_assert (hb_blob_get_empty () == hb_blob_create (NULL, -1, HB_MEMORY_MODE_READONLY, NULL, NULL)); - g_assert (hb_blob_get_empty () == hb_blob_create ("asdfg", -1, HB_MEMORY_MODE_READONLY, NULL, NULL)); + g_assert_true (hb_blob_is_immutable (hb_blob_get_empty ())); + g_assert_true (hb_blob_get_empty () != NULL); + g_assert_true (hb_blob_get_empty () == hb_blob_create (NULL, 0, HB_MEMORY_MODE_READONLY, NULL, NULL)); + g_assert_true (hb_blob_get_empty () == hb_blob_create ("asdf", 0, HB_MEMORY_MODE_READONLY, NULL, NULL)); + g_assert_true (hb_blob_get_empty () == hb_blob_create (NULL, -1, HB_MEMORY_MODE_READONLY, NULL, NULL)); + g_assert_true (hb_blob_get_empty () == hb_blob_create ("asdfg", -1, HB_MEMORY_MODE_READONLY, NULL, NULL)); blob = hb_blob_get_empty (); - g_assert (blob == hb_blob_get_empty ()); + g_assert_true (blob == hb_blob_get_empty ()); len = hb_blob_get_length (blob); g_assert_cmpint (len, ==, 0); data = hb_blob_get_data (blob, NULL); - g_assert (data == NULL); + g_assert_true (data == NULL); data = hb_blob_get_data (blob, &len); - g_assert (data == NULL); + g_assert_true (data == NULL); g_assert_cmpint (len, ==, 0); data_writable = hb_blob_get_data_writable (blob, NULL); - g_assert (data_writable == NULL); + g_assert_true (data_writable == NULL); data_writable = hb_blob_get_data_writable (blob, &len); - g_assert (data_writable == NULL); + g_assert_true (data_writable == NULL); g_assert_cmpint (len, ==, 0); } @@ -126,7 +126,7 @@ get_pagesize (void) pagesize = (uintptr_t) getpagesize (); #endif - g_assert (pagesize != (uintptr_t) -1); + g_assert_true (pagesize != (uintptr_t) -1); return pagesize; } @@ -175,7 +175,7 @@ fixture_init (fixture_t *fixture, gconstpointer user_data) uintptr_t pagesize = get_pagesize (); data = mmap (NULL, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); - g_assert (data != (char *) -1); + g_assert_true (data != (char *) -1); memcpy ((char *) data, test_data, sizeof (test_data)); mprotect ((char *) data, pagesize, PROT_READ); len = sizeof (test_data); @@ -212,7 +212,7 @@ test_blob (fixture_t *fixture, gconstpointer user_data) char *data_writable; unsigned int i; - g_assert (b); + g_assert_true (b); len = hb_blob_get_length (b); g_assert_cmpint (len, ==, fixture->len); @@ -220,45 +220,45 @@ test_blob (fixture_t *fixture, gconstpointer user_data) data = hb_blob_get_data (b, &len); g_assert_cmpint (len, ==, fixture->len); if (mm == HB_MEMORY_MODE_DUPLICATE) { - g_assert (data != fixture->data); + g_assert_true (data != fixture->data); g_assert_cmpint (fixture->freed, ==, 1); mm = HB_MEMORY_MODE_WRITABLE; } else { - g_assert (data == fixture->data); + g_assert_true (data == fixture->data); g_assert_cmpint (fixture->freed, ==, 0); } data_writable = hb_blob_get_data_writable (b, &len); g_assert_cmpint (len, ==, fixture->len); - g_assert (data_writable); - g_assert (0 == memcmp (data_writable, fixture->data, fixture->len)); + g_assert_true (data_writable); + g_assert_true (0 == memcmp (data_writable, fixture->data, fixture->len)); if (mm == HB_MEMORY_MODE_READONLY) { - g_assert (data_writable != data); + g_assert_true (data_writable != data); g_assert_cmpint (fixture->freed, ==, 1); } else { - g_assert (data_writable == data); + g_assert_true (data_writable == data); } data = hb_blob_get_data (b, &len); g_assert_cmpint (len, ==, fixture->len); - g_assert (data == data_writable); + g_assert_true (data == data_writable); memset (data_writable, 0, fixture->len); /* Now, make it immutable and watch get_data_writable() fail */ - g_assert (!hb_blob_is_immutable (b)); + g_assert_true (!hb_blob_is_immutable (b)); hb_blob_make_immutable (b); - g_assert (hb_blob_is_immutable (b)); + g_assert_true (hb_blob_is_immutable (b)); data_writable = hb_blob_get_data_writable (b, &len); - g_assert (!data_writable); + g_assert_true (!data_writable); g_assert_cmpint (len, ==, 0); data = hb_blob_get_data (b, &len); g_assert_cmpint (len, ==, fixture->len); for (i = 0; i < len; i++) - g_assert ('\0' == data[i]); + g_assert_true ('\0' == data[i]); } static void @@ -283,43 +283,43 @@ test_blob_subblob (fixture_t *fixture, gconstpointer user_data) /* A sub-blob is always created READONLY. */ - g_assert (b); + g_assert_true (b); len = hb_blob_get_length (b); g_assert_cmpint (len, ==, fixture->len - 2); data = hb_blob_get_data (b, &len); g_assert_cmpint (len, ==, fixture->len - 2); - g_assert (data == fixture->data + 1); + g_assert_true (data == fixture->data + 1); data_writable = hb_blob_get_data_writable (b, &len); g_assert_cmpint (len, ==, fixture->len - 2); - g_assert (data_writable); + g_assert_true (data_writable); if (mm == HB_MEMORY_MODE_READONLY) - g_assert (0 == memcmp (data_writable, fixture->data + 1, fixture->len - 2)); - g_assert (data_writable != data); + g_assert_true (0 == memcmp (data_writable, fixture->data + 1, fixture->len - 2)); + g_assert_true (data_writable != data); g_assert_cmpint (fixture->freed, ==, 1); data = hb_blob_get_data (b, &len); g_assert_cmpint (len, ==, fixture->len - 2); - g_assert (data == data_writable); + g_assert_true (data == data_writable); memset (data_writable, 0, fixture->len - 2); /* Now, make it immutable and watch get_data_writable() fail */ - g_assert (!hb_blob_is_immutable (b)); + g_assert_true (!hb_blob_is_immutable (b)); hb_blob_make_immutable (b); - g_assert (hb_blob_is_immutable (b)); + g_assert_true (hb_blob_is_immutable (b)); data_writable = hb_blob_get_data_writable (b, &len); - g_assert (!data_writable); + g_assert_true (!data_writable); g_assert_cmpint (len, ==, 0); data = hb_blob_get_data (b, &len); g_assert_cmpint (len, ==, fixture->len - 2); for (i = 0; i < len; i++) - g_assert ('\0' == data[i]); + g_assert_true ('\0' == data[i]); } diff --git a/test/api/test-buffer.c b/test/api/test-buffer.c index 59db49e28..8644e36bf 100644 --- a/test/api/test-buffer.c +++ b/test/api/test-buffer.c @@ -106,74 +106,74 @@ test_buffer_properties (fixture_t *fixture, gconstpointer user_data HB_UNUSED) /* test default properties */ - g_assert (hb_buffer_get_unicode_funcs (b) == hb_unicode_funcs_get_default ()); - g_assert (hb_buffer_get_direction (b) == HB_DIRECTION_INVALID); - g_assert (hb_buffer_get_script (b) == HB_SCRIPT_INVALID); - g_assert (hb_buffer_get_language (b) == NULL); + g_assert_true (hb_buffer_get_unicode_funcs (b) == hb_unicode_funcs_get_default ()); + g_assert_true (hb_buffer_get_direction (b) == HB_DIRECTION_INVALID); + g_assert_true (hb_buffer_get_script (b) == HB_SCRIPT_INVALID); + g_assert_true (hb_buffer_get_language (b) == NULL); /* test property changes are retained */ ufuncs = hb_unicode_funcs_create (NULL); hb_buffer_set_unicode_funcs (b, ufuncs); hb_unicode_funcs_destroy (ufuncs); - g_assert (hb_buffer_get_unicode_funcs (b) == ufuncs); + g_assert_true (hb_buffer_get_unicode_funcs (b) == ufuncs); hb_buffer_set_direction (b, HB_DIRECTION_RTL); - g_assert (hb_buffer_get_direction (b) == HB_DIRECTION_RTL); + g_assert_true (hb_buffer_get_direction (b) == HB_DIRECTION_RTL); hb_buffer_set_script (b, HB_SCRIPT_ARABIC); - g_assert (hb_buffer_get_script (b) == HB_SCRIPT_ARABIC); + g_assert_true (hb_buffer_get_script (b) == HB_SCRIPT_ARABIC); hb_buffer_set_language (b, hb_language_from_string ("fa", -1)); - g_assert (hb_buffer_get_language (b) == hb_language_from_string ("Fa", -1)); + g_assert_true (hb_buffer_get_language (b) == hb_language_from_string ("Fa", -1)); hb_buffer_set_flags (b, HB_BUFFER_FLAG_BOT); - g_assert (hb_buffer_get_flags (b) == HB_BUFFER_FLAG_BOT); + g_assert_true (hb_buffer_get_flags (b) == HB_BUFFER_FLAG_BOT); hb_buffer_set_replacement_codepoint (b, (unsigned int) -1); - g_assert (hb_buffer_get_replacement_codepoint (b) == (unsigned int) -1); + g_assert_true (hb_buffer_get_replacement_codepoint (b) == (unsigned int) -1); /* test clear_contents clears all these properties: */ hb_buffer_clear_contents (b); - g_assert (hb_buffer_get_unicode_funcs (b) == ufuncs); - g_assert (hb_buffer_get_direction (b) == HB_DIRECTION_INVALID); - g_assert (hb_buffer_get_script (b) == HB_SCRIPT_INVALID); - g_assert (hb_buffer_get_language (b) == NULL); + g_assert_true (hb_buffer_get_unicode_funcs (b) == ufuncs); + g_assert_true (hb_buffer_get_direction (b) == HB_DIRECTION_INVALID); + g_assert_true (hb_buffer_get_script (b) == HB_SCRIPT_INVALID); + g_assert_true (hb_buffer_get_language (b) == NULL); /* but not these: */ - g_assert (hb_buffer_get_flags (b) != HB_BUFFER_FLAG_DEFAULT); - g_assert (hb_buffer_get_replacement_codepoint (b) != HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT); + g_assert_true (hb_buffer_get_flags (b) != HB_BUFFER_FLAG_DEFAULT); + g_assert_true (hb_buffer_get_replacement_codepoint (b) != HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT); /* test reset clears all properties */ hb_buffer_set_direction (b, HB_DIRECTION_RTL); - g_assert (hb_buffer_get_direction (b) == HB_DIRECTION_RTL); + g_assert_true (hb_buffer_get_direction (b) == HB_DIRECTION_RTL); hb_buffer_set_script (b, HB_SCRIPT_ARABIC); - g_assert (hb_buffer_get_script (b) == HB_SCRIPT_ARABIC); + g_assert_true (hb_buffer_get_script (b) == HB_SCRIPT_ARABIC); hb_buffer_set_language (b, hb_language_from_string ("fa", -1)); - g_assert (hb_buffer_get_language (b) == hb_language_from_string ("Fa", -1)); + g_assert_true (hb_buffer_get_language (b) == hb_language_from_string ("Fa", -1)); hb_buffer_set_flags (b, HB_BUFFER_FLAG_BOT); - g_assert (hb_buffer_get_flags (b) == HB_BUFFER_FLAG_BOT); + g_assert_true (hb_buffer_get_flags (b) == HB_BUFFER_FLAG_BOT); hb_buffer_set_replacement_codepoint (b, (unsigned int) -1); - g_assert (hb_buffer_get_replacement_codepoint (b) == (unsigned int) -1); + g_assert_true (hb_buffer_get_replacement_codepoint (b) == (unsigned int) -1); hb_buffer_reset (b); - g_assert (hb_buffer_get_unicode_funcs (b) == hb_unicode_funcs_get_default ()); - g_assert (hb_buffer_get_direction (b) == HB_DIRECTION_INVALID); - g_assert (hb_buffer_get_script (b) == HB_SCRIPT_INVALID); - g_assert (hb_buffer_get_language (b) == NULL); - g_assert (hb_buffer_get_flags (b) == HB_BUFFER_FLAG_DEFAULT); - g_assert (hb_buffer_get_replacement_codepoint (b) == HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT); + g_assert_true (hb_buffer_get_unicode_funcs (b) == hb_unicode_funcs_get_default ()); + g_assert_true (hb_buffer_get_direction (b) == HB_DIRECTION_INVALID); + g_assert_true (hb_buffer_get_script (b) == HB_SCRIPT_INVALID); + g_assert_true (hb_buffer_get_language (b) == NULL); + g_assert_true (hb_buffer_get_flags (b) == HB_BUFFER_FLAG_DEFAULT); + g_assert_true (hb_buffer_get_replacement_codepoint (b) == HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT); } static void @@ -269,7 +269,7 @@ test_buffer_contents (fixture_t *fixture, gconstpointer user_data) /* test setting length */ /* enlarge */ - g_assert (hb_buffer_set_length (b, 10)); + g_assert_true (hb_buffer_set_length (b, 10)); glyphs = hb_buffer_get_glyph_infos (b, NULL); g_assert_cmpint (hb_buffer_get_length (b), ==, 10); for (i = 0; i < 5; i++) @@ -277,14 +277,14 @@ test_buffer_contents (fixture_t *fixture, gconstpointer user_data) for (i = 5; i < 10; i++) g_assert_cmphex (glyphs[i].codepoint, ==, 0); /* shrink */ - g_assert (hb_buffer_set_length (b, 3)); + g_assert_true (hb_buffer_set_length (b, 3)); glyphs = hb_buffer_get_glyph_infos (b, NULL); g_assert_cmpint (hb_buffer_get_length (b), ==, 3); for (i = 0; i < 3; i++) g_assert_cmphex (glyphs[i].codepoint, ==, utf32[1+i]); - g_assert (hb_buffer_allocation_successful (b)); + g_assert_true (hb_buffer_allocation_successful (b)); /* test reset clears content */ @@ -325,40 +325,40 @@ test_buffer_allocation (fixture_t *fixture, gconstpointer user_data HB_UNUSED) g_assert_cmpint (hb_buffer_get_length (b), ==, 0); - g_assert (hb_buffer_pre_allocate (b, 100)); + g_assert_true (hb_buffer_pre_allocate (b, 100)); g_assert_cmpint (hb_buffer_get_length (b), ==, 0); - g_assert (hb_buffer_allocation_successful (b)); + g_assert_true (hb_buffer_allocation_successful (b)); /* lets try a huge allocation, make sure it fails */ - g_assert (!hb_buffer_pre_allocate (b, (unsigned int) -1)); + g_assert_true (!hb_buffer_pre_allocate (b, (unsigned int) -1)); g_assert_cmpint (hb_buffer_get_length (b), ==, 0); - g_assert (!hb_buffer_allocation_successful (b)); + g_assert_true (!hb_buffer_allocation_successful (b)); /* small one again */ - g_assert (hb_buffer_pre_allocate (b, 50)); + g_assert_true (hb_buffer_pre_allocate (b, 50)); g_assert_cmpint (hb_buffer_get_length (b), ==, 0); - g_assert (!hb_buffer_allocation_successful (b)); + g_assert_true (!hb_buffer_allocation_successful (b)); hb_buffer_reset (b); - g_assert (hb_buffer_allocation_successful (b)); + g_assert_true (hb_buffer_allocation_successful (b)); /* all allocation and size */ - g_assert (!hb_buffer_pre_allocate (b, ((unsigned int) -1) / 20 + 1)); - g_assert (!hb_buffer_allocation_successful (b)); + g_assert_true (!hb_buffer_pre_allocate (b, ((unsigned int) -1) / 20 + 1)); + g_assert_true (!hb_buffer_allocation_successful (b)); hb_buffer_reset (b); - g_assert (hb_buffer_allocation_successful (b)); + g_assert_true (hb_buffer_allocation_successful (b)); /* technically, this one can actually pass on 64bit machines, but * I'm doubtful that any malloc allows 4GB allocations at a time. * But let's only enable it on a 32-bit machine. */ if (sizeof (long) == 4) { - g_assert (!hb_buffer_pre_allocate (b, ((unsigned int) -1) / 20 - 1)); - g_assert (!hb_buffer_allocation_successful (b)); + g_assert_true (!hb_buffer_pre_allocate (b, ((unsigned int) -1) / 20 - 1)); + g_assert_true (!hb_buffer_allocation_successful (b)); } hb_buffer_reset (b); - g_assert (hb_buffer_allocation_successful (b)); + g_assert_true (hb_buffer_allocation_successful (b)); } @@ -698,9 +698,9 @@ test_buffer_utf8_validity (void) if (glyphs[j].codepoint == (hb_codepoint_t) -1) break; - g_assert (test->valid ? j == len : j < len); + g_assert_true (test->valid ? j == len : j < len); if (!test->valid) - g_assert (glyphs[j].cluster == test->offset); + g_assert_true (glyphs[j].cluster == test->offset); } hb_buffer_destroy (b); @@ -816,8 +816,8 @@ static void test_empty (hb_buffer_t *b) { g_assert_cmpint (hb_buffer_get_length (b), ==, 0); - g_assert (!hb_buffer_get_glyph_infos (b, NULL)); - g_assert (!hb_buffer_get_glyph_positions (b, NULL)); + g_assert_true (!hb_buffer_get_glyph_infos (b, NULL)); + g_assert_true (!hb_buffer_get_glyph_positions (b, NULL)); } static void @@ -825,10 +825,10 @@ test_buffer_empty (void) { hb_buffer_t *b = hb_buffer_get_empty (); - g_assert (hb_buffer_get_empty ()); - g_assert (hb_buffer_get_empty () == b); + g_assert_true (hb_buffer_get_empty ()); + g_assert_true (hb_buffer_get_empty () == b); - g_assert (!hb_buffer_allocation_successful (b)); + g_assert_true (!hb_buffer_allocation_successful (b)); test_empty (b); @@ -839,21 +839,21 @@ test_buffer_empty (void) hb_buffer_reverse (b); hb_buffer_reverse_clusters (b); - g_assert (!hb_buffer_set_length (b, 10)); + g_assert_true (!hb_buffer_set_length (b, 10)); test_empty (b); - g_assert (hb_buffer_set_length (b, 0)); + g_assert_true (hb_buffer_set_length (b, 0)); test_empty (b); - g_assert (!hb_buffer_allocation_successful (b)); + g_assert_true (!hb_buffer_allocation_successful (b)); hb_buffer_reset (b); test_empty (b); - g_assert (!hb_buffer_allocation_successful (b)); + g_assert_true (!hb_buffer_allocation_successful (b)); } typedef struct { @@ -917,7 +917,7 @@ test_buffer_serialize_deserialize (void) } } else - g_assert (!ret); + g_assert_true (!ret); hb_buffer_destroy (b); diff --git a/test/api/test-c.c b/test/api/test-c.c index 9434853fb..3cc64fd4f 100644 --- a/test/api/test-c.c +++ b/test/api/test-c.c @@ -78,7 +78,7 @@ static void test_list_shapers (void) { const char *first = *hb_shape_list_shapers (); - g_assert (first); + g_assert_true (first); } int diff --git a/test/api/test-collect-unicodes.c b/test/api/test-collect-unicodes.c index b6c581496..ee1e938cc 100644 --- a/test/api/test-collect-unicodes.c +++ b/test/api/test-collect-unicodes.c @@ -37,13 +37,13 @@ test_collect_unicodes_format4 (void) hb_face_collect_unicodes (face, codepoints); cp = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (codepoints, &cp)); + g_assert_true (hb_set_next (codepoints, &cp)); g_assert_cmpuint (0x61, ==, cp); - g_assert (hb_set_next (codepoints, &cp)); + g_assert_true (hb_set_next (codepoints, &cp)); g_assert_cmpuint (0x62, ==, cp); - g_assert (hb_set_next (codepoints, &cp)); + g_assert_true (hb_set_next (codepoints, &cp)); g_assert_cmpuint (0x63, ==, cp); - g_assert (!hb_set_next (codepoints, &cp)); + g_assert_true (!hb_set_next (codepoints, &cp)); hb_set_destroy (codepoints); hb_face_destroy (face); @@ -59,11 +59,11 @@ test_collect_unicodes_format12_notdef (void) hb_face_collect_unicodes (face, codepoints); cp = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (codepoints, &cp)); + g_assert_true (hb_set_next (codepoints, &cp)); g_assert_cmpuint (0x20, ==, cp); - g_assert (hb_set_next (codepoints, &cp)); + g_assert_true (hb_set_next (codepoints, &cp)); g_assert_cmpuint (0x21, ==, cp); - g_assert (hb_set_next (codepoints, &cp)); + g_assert_true (hb_set_next (codepoints, &cp)); g_assert_cmpuint (0x22, ==, cp); hb_set_destroy (codepoints); @@ -80,13 +80,13 @@ test_collect_unicodes_format12 (void) hb_face_collect_unicodes (face, codepoints); cp = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (codepoints, &cp)); + g_assert_true (hb_set_next (codepoints, &cp)); g_assert_cmpuint (0x61, ==, cp); - g_assert (hb_set_next (codepoints, &cp)); + g_assert_true (hb_set_next (codepoints, &cp)); g_assert_cmpuint (0x62, ==, cp); - g_assert (hb_set_next (codepoints, &cp)); + g_assert_true (hb_set_next (codepoints, &cp)); g_assert_cmpuint (0x63, ==, cp); - g_assert (!hb_set_next (codepoints, &cp)); + g_assert_true (!hb_set_next (codepoints, &cp)); hb_set_destroy (codepoints); hb_face_destroy (face); @@ -104,21 +104,21 @@ test_collect_unicodes (void) hb_face_collect_unicodes (face, codepoints); hb_face_collect_nominal_glyph_mapping (face, mapping, codepoints2); - g_assert (hb_set_is_equal (codepoints, codepoints2)); + g_assert_true (hb_set_is_equal (codepoints, codepoints2)); g_assert_cmpuint (hb_set_get_population (codepoints), ==, 3); g_assert_cmpuint (hb_map_get_population (mapping), ==, 3); cp = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (codepoints, &cp)); - g_assert (hb_map_has (mapping, cp)); + g_assert_true (hb_set_next (codepoints, &cp)); + g_assert_true (hb_map_has (mapping, cp)); g_assert_cmpuint (0x61, ==, cp); - g_assert (hb_set_next (codepoints, &cp)); - g_assert (hb_map_has (mapping, cp)); + g_assert_true (hb_set_next (codepoints, &cp)); + g_assert_true (hb_map_has (mapping, cp)); g_assert_cmpuint (0x62, ==, cp); - g_assert (hb_set_next (codepoints, &cp)); - g_assert (hb_map_has (mapping, cp)); + g_assert_true (hb_set_next (codepoints, &cp)); + g_assert_true (hb_map_has (mapping, cp)); g_assert_cmpuint (0x63, ==, cp); - g_assert (!hb_set_next (codepoints, &cp)); + g_assert_true (!hb_set_next (codepoints, &cp)); hb_set_destroy (codepoints); hb_set_destroy (codepoints2); diff --git a/test/api/test-common.c b/test/api/test-common.c index f2ca82faa..bad86aefc 100644 --- a/test/api/test-common.c +++ b/test/api/test-common.c @@ -53,36 +53,36 @@ test_types_direction (void) g_assert_cmpint ((signed) HB_DIRECTION_INVALID, ==, 0); g_assert_cmpint (HB_DIRECTION_LTR, !=, 0); - g_assert (HB_DIRECTION_IS_HORIZONTAL (HB_DIRECTION_LTR)); - g_assert (HB_DIRECTION_IS_HORIZONTAL (HB_DIRECTION_RTL)); - g_assert (!HB_DIRECTION_IS_HORIZONTAL (HB_DIRECTION_TTB)); - g_assert (!HB_DIRECTION_IS_HORIZONTAL (HB_DIRECTION_BTT)); - g_assert (!HB_DIRECTION_IS_HORIZONTAL (HB_DIRECTION_INVALID)); + g_assert_true (HB_DIRECTION_IS_HORIZONTAL (HB_DIRECTION_LTR)); + g_assert_true (HB_DIRECTION_IS_HORIZONTAL (HB_DIRECTION_RTL)); + g_assert_true (!HB_DIRECTION_IS_HORIZONTAL (HB_DIRECTION_TTB)); + g_assert_true (!HB_DIRECTION_IS_HORIZONTAL (HB_DIRECTION_BTT)); + g_assert_true (!HB_DIRECTION_IS_HORIZONTAL (HB_DIRECTION_INVALID)); - g_assert (!HB_DIRECTION_IS_VERTICAL (HB_DIRECTION_LTR)); - g_assert (!HB_DIRECTION_IS_VERTICAL (HB_DIRECTION_RTL)); - g_assert (HB_DIRECTION_IS_VERTICAL (HB_DIRECTION_TTB)); - g_assert (HB_DIRECTION_IS_VERTICAL (HB_DIRECTION_BTT)); - g_assert (!HB_DIRECTION_IS_VERTICAL (HB_DIRECTION_INVALID)); + g_assert_true (!HB_DIRECTION_IS_VERTICAL (HB_DIRECTION_LTR)); + g_assert_true (!HB_DIRECTION_IS_VERTICAL (HB_DIRECTION_RTL)); + g_assert_true (HB_DIRECTION_IS_VERTICAL (HB_DIRECTION_TTB)); + g_assert_true (HB_DIRECTION_IS_VERTICAL (HB_DIRECTION_BTT)); + g_assert_true (!HB_DIRECTION_IS_VERTICAL (HB_DIRECTION_INVALID)); - g_assert (HB_DIRECTION_IS_FORWARD (HB_DIRECTION_LTR)); - g_assert (HB_DIRECTION_IS_FORWARD (HB_DIRECTION_TTB)); - g_assert (!HB_DIRECTION_IS_FORWARD (HB_DIRECTION_RTL)); - g_assert (!HB_DIRECTION_IS_FORWARD (HB_DIRECTION_BTT)); - g_assert (!HB_DIRECTION_IS_FORWARD (HB_DIRECTION_INVALID)); + g_assert_true (HB_DIRECTION_IS_FORWARD (HB_DIRECTION_LTR)); + g_assert_true (HB_DIRECTION_IS_FORWARD (HB_DIRECTION_TTB)); + g_assert_true (!HB_DIRECTION_IS_FORWARD (HB_DIRECTION_RTL)); + g_assert_true (!HB_DIRECTION_IS_FORWARD (HB_DIRECTION_BTT)); + g_assert_true (!HB_DIRECTION_IS_FORWARD (HB_DIRECTION_INVALID)); - g_assert (!HB_DIRECTION_IS_BACKWARD (HB_DIRECTION_LTR)); - g_assert (!HB_DIRECTION_IS_BACKWARD (HB_DIRECTION_TTB)); - g_assert (HB_DIRECTION_IS_BACKWARD (HB_DIRECTION_RTL)); - g_assert (HB_DIRECTION_IS_BACKWARD (HB_DIRECTION_BTT)); - g_assert (!HB_DIRECTION_IS_BACKWARD (HB_DIRECTION_INVALID)); + g_assert_true (!HB_DIRECTION_IS_BACKWARD (HB_DIRECTION_LTR)); + g_assert_true (!HB_DIRECTION_IS_BACKWARD (HB_DIRECTION_TTB)); + g_assert_true (HB_DIRECTION_IS_BACKWARD (HB_DIRECTION_RTL)); + g_assert_true (HB_DIRECTION_IS_BACKWARD (HB_DIRECTION_BTT)); + g_assert_true (!HB_DIRECTION_IS_BACKWARD (HB_DIRECTION_INVALID)); - g_assert (HB_DIRECTION_IS_VALID (HB_DIRECTION_LTR)); - g_assert (HB_DIRECTION_IS_VALID (HB_DIRECTION_TTB)); - g_assert (HB_DIRECTION_IS_VALID (HB_DIRECTION_RTL)); - g_assert (HB_DIRECTION_IS_VALID (HB_DIRECTION_BTT)); - g_assert (!HB_DIRECTION_IS_VALID (HB_DIRECTION_INVALID)); - g_assert (!HB_DIRECTION_IS_VALID ((hb_direction_t) 0x12345678)); + g_assert_true (HB_DIRECTION_IS_VALID (HB_DIRECTION_LTR)); + g_assert_true (HB_DIRECTION_IS_VALID (HB_DIRECTION_TTB)); + g_assert_true (HB_DIRECTION_IS_VALID (HB_DIRECTION_RTL)); + g_assert_true (HB_DIRECTION_IS_VALID (HB_DIRECTION_BTT)); + g_assert_true (!HB_DIRECTION_IS_VALID (HB_DIRECTION_INVALID)); + g_assert_true (!HB_DIRECTION_IS_VALID ((hb_direction_t) 0x12345678)); g_assert_cmpint (HB_DIRECTION_REVERSE (HB_DIRECTION_LTR), ==, HB_DIRECTION_RTL); g_assert_cmpint (HB_DIRECTION_REVERSE (HB_DIRECTION_RTL), ==, HB_DIRECTION_LTR); @@ -100,11 +100,11 @@ test_types_direction (void) g_assert_cmpint (HB_DIRECTION_RTL, ==, hb_direction_from_string ("right-to-left", -1)); g_assert_cmpint (HB_DIRECTION_TTB, ==, hb_direction_from_string ("ttb", -1)); - g_assert (0 == strcmp ("ltr", hb_direction_to_string (HB_DIRECTION_LTR))); - g_assert (0 == strcmp ("rtl", hb_direction_to_string (HB_DIRECTION_RTL))); - g_assert (0 == strcmp ("ttb", hb_direction_to_string (HB_DIRECTION_TTB))); - g_assert (0 == strcmp ("btt", hb_direction_to_string (HB_DIRECTION_BTT))); - g_assert (0 == strcmp ("invalid", hb_direction_to_string (HB_DIRECTION_INVALID))); + g_assert_true (0 == strcmp ("ltr", hb_direction_to_string (HB_DIRECTION_LTR))); + g_assert_true (0 == strcmp ("rtl", hb_direction_to_string (HB_DIRECTION_RTL))); + g_assert_true (0 == strcmp ("ttb", hb_direction_to_string (HB_DIRECTION_TTB))); + g_assert_true (0 == strcmp ("btt", hb_direction_to_string (HB_DIRECTION_BTT))); + g_assert_true (0 == strcmp ("invalid", hb_direction_to_string (HB_DIRECTION_INVALID))); } static void @@ -184,30 +184,30 @@ test_types_language (void) hb_language_t fa_ir = hb_language_from_string ("fa-ir", -1); hb_language_t en = hb_language_from_string ("en", -1); - g_assert (HB_LANGUAGE_INVALID == NULL); + g_assert_true (HB_LANGUAGE_INVALID == NULL); - g_assert (fa != NULL); - g_assert (fa_IR != NULL); - g_assert (fa_IR == fa_ir); + g_assert_true (fa != NULL); + g_assert_true (fa_IR != NULL); + g_assert_true (fa_IR == fa_ir); - g_assert (en != NULL); - g_assert (en != fa); + g_assert_true (en != NULL); + g_assert_true (en != fa); /* Test recall */ - g_assert (en == hb_language_from_string ("en", -1)); - g_assert (en == hb_language_from_string ("eN", -1)); - g_assert (en == hb_language_from_string ("Enx", 2)); + g_assert_true (en == hb_language_from_string ("en", -1)); + g_assert_true (en == hb_language_from_string ("eN", -1)); + g_assert_true (en == hb_language_from_string ("Enx", 2)); - g_assert (HB_LANGUAGE_INVALID == hb_language_from_string (NULL, -1)); - g_assert (HB_LANGUAGE_INVALID == hb_language_from_string ("", -1)); - g_assert (HB_LANGUAGE_INVALID == hb_language_from_string ("en", 0)); - g_assert (HB_LANGUAGE_INVALID != hb_language_from_string ("en", 1)); - g_assert (NULL == hb_language_to_string (HB_LANGUAGE_INVALID)); + g_assert_true (HB_LANGUAGE_INVALID == hb_language_from_string (NULL, -1)); + g_assert_true (HB_LANGUAGE_INVALID == hb_language_from_string ("", -1)); + g_assert_true (HB_LANGUAGE_INVALID == hb_language_from_string ("en", 0)); + g_assert_true (HB_LANGUAGE_INVALID != hb_language_from_string ("en", 1)); + g_assert_true (NULL == hb_language_to_string (HB_LANGUAGE_INVALID)); /* Not sure how to test this better. Setting env vars * here doesn't sound like the right approach, and I'm * not sure that it even works. */ - g_assert (HB_LANGUAGE_INVALID != hb_language_get_default ()); + g_assert_true (HB_LANGUAGE_INVALID != hb_language_get_default ()); } static void @@ -216,105 +216,105 @@ test_types_feature (void) hb_feature_t feature; char buf[100]; - g_assert (hb_feature_from_string ("abcd", -1, &feature)); + g_assert_true (hb_feature_from_string ("abcd", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd", buf)); + g_assert_true (0 == strcmp ("abcd", buf)); - g_assert (hb_feature_from_string ("abcd=1", -1, &feature)); + g_assert_true (hb_feature_from_string ("abcd=1", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd", buf)); + g_assert_true (0 == strcmp ("abcd", buf)); - g_assert (hb_feature_from_string ("+abcd", -1, &feature)); + g_assert_true (hb_feature_from_string ("+abcd", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd", buf)); + g_assert_true (0 == strcmp ("abcd", buf)); - g_assert (hb_feature_from_string ("abcd=0", -1, &feature)); + g_assert_true (hb_feature_from_string ("abcd=0", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("-abcd", buf)); + g_assert_true (0 == strcmp ("-abcd", buf)); - g_assert (hb_feature_from_string ("-abcd", -1, &feature)); + g_assert_true (hb_feature_from_string ("-abcd", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("-abcd", buf)); + g_assert_true (0 == strcmp ("-abcd", buf)); - g_assert (hb_feature_from_string ("abcd=2", -1, &feature)); + g_assert_true (hb_feature_from_string ("abcd=2", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd=2", buf)); + g_assert_true (0 == strcmp ("abcd=2", buf)); - g_assert (hb_feature_from_string ("+abcd=2", -1, &feature)); + g_assert_true (hb_feature_from_string ("+abcd=2", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd=2", buf)); + g_assert_true (0 == strcmp ("abcd=2", buf)); - g_assert (hb_feature_from_string ("-abcd=2", -1, &feature)); + g_assert_true (hb_feature_from_string ("-abcd=2", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd=2", buf)); + g_assert_true (0 == strcmp ("abcd=2", buf)); - g_assert (hb_feature_from_string ("\"abcd\" on", -1, &feature)); + g_assert_true (hb_feature_from_string ("\"abcd\" on", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd", buf)); + g_assert_true (0 == strcmp ("abcd", buf)); - g_assert (hb_feature_from_string ("\"abcd\" off", -1, &feature)); + g_assert_true (hb_feature_from_string ("\"abcd\" off", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("-abcd", buf)); + g_assert_true (0 == strcmp ("-abcd", buf)); - g_assert (hb_feature_from_string ("\"abcd\" 1", -1, &feature)); + g_assert_true (hb_feature_from_string ("\"abcd\" 1", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd", buf)); + g_assert_true (0 == strcmp ("abcd", buf)); - g_assert (hb_feature_from_string ("\"abcd\" 0", -1, &feature)); + g_assert_true (hb_feature_from_string ("\"abcd\" 0", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("-abcd", buf)); + g_assert_true (0 == strcmp ("-abcd", buf)); - g_assert (hb_feature_from_string ("\"abcd\" 2", -1, &feature)); + g_assert_true (hb_feature_from_string ("\"abcd\" 2", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd=2", buf)); + g_assert_true (0 == strcmp ("abcd=2", buf)); - g_assert (hb_feature_from_string ("abcd[0]", -1, &feature)); + g_assert_true (hb_feature_from_string ("abcd[0]", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd[]", buf)); + g_assert_true (0 == strcmp ("abcd[]", buf)); - g_assert (hb_feature_from_string ("abcd[1]", -1, &feature)); + g_assert_true (hb_feature_from_string ("abcd[1]", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd[1]", buf)); + g_assert_true (0 == strcmp ("abcd[1]", buf)); - g_assert (hb_feature_from_string ("abcd[1]=1", -1, &feature)); + g_assert_true (hb_feature_from_string ("abcd[1]=1", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd[1]", buf)); + g_assert_true (0 == strcmp ("abcd[1]", buf)); - g_assert (hb_feature_from_string ("abcd[1]=2", -1, &feature)); + g_assert_true (hb_feature_from_string ("abcd[1]=2", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd[1]=2", buf)); + g_assert_true (0 == strcmp ("abcd[1]=2", buf)); - g_assert (hb_feature_from_string ("abcd[1]=0", -1, &feature)); + g_assert_true (hb_feature_from_string ("abcd[1]=0", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("-abcd[1]", buf)); + g_assert_true (0 == strcmp ("-abcd[1]", buf)); - g_assert (hb_feature_from_string ("abcd[]", -1, &feature)); + g_assert_true (hb_feature_from_string ("abcd[]", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd", buf)); + g_assert_true (0 == strcmp ("abcd", buf)); - g_assert (hb_feature_from_string ("abcd[:]", -1, &feature)); + g_assert_true (hb_feature_from_string ("abcd[:]", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd", buf)); + g_assert_true (0 == strcmp ("abcd", buf)); - g_assert (hb_feature_from_string ("abcd[1:]", -1, &feature)); + g_assert_true (hb_feature_from_string ("abcd[1:]", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd[1:]", buf)); + g_assert_true (0 == strcmp ("abcd[1:]", buf)); - g_assert (hb_feature_from_string ("abcd[:1]", -1, &feature)); + g_assert_true (hb_feature_from_string ("abcd[:1]", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd[]", buf)); + g_assert_true (0 == strcmp ("abcd[]", buf)); - g_assert (hb_feature_from_string ("abcd[1:3]", -1, &feature)); + g_assert_true (hb_feature_from_string ("abcd[1:3]", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd[1:3]", buf)); + g_assert_true (0 == strcmp ("abcd[1:3]", buf)); - g_assert (hb_feature_from_string ("abcd[1:2]=1", -1, &feature)); + g_assert_true (hb_feature_from_string ("abcd[1:2]=1", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd[1]", buf)); + g_assert_true (0 == strcmp ("abcd[1]", buf)); - g_assert (hb_feature_from_string ("abcd[1:4]=2", -1, &feature)); + g_assert_true (hb_feature_from_string ("abcd[1:4]=2", -1, &feature)); hb_feature_to_string (&feature, buf, 100); - g_assert (0 == strcmp ("abcd[1:4]=2", buf)); + g_assert_true (0 == strcmp ("abcd[1:4]=2", buf)); } int diff --git a/test/api/test-cplusplus.cc b/test/api/test-cplusplus.cc index 50cae8a7f..b2561886e 100644 --- a/test/api/test-cplusplus.cc +++ b/test/api/test-cplusplus.cc @@ -100,8 +100,8 @@ test_smart_ptrs (void) assert (hash2 (pb4) == hash2 (pb2)); assert (hash (b) == hash3 (pb5)); - g_assert (pb != pb.get_empty ()); - g_assert (pb != pb2); + g_assert_true (pb != pb.get_empty ()); + g_assert_true (pb != pb2); } int diff --git a/test/api/test-draw.c b/test/api/test-draw.c index f8ec18ca3..baec19a73 100644 --- a/test/api/test-draw.c +++ b/test/api/test-draw.c @@ -1065,9 +1065,9 @@ static void test_hb_draw_immutable (void) { hb_draw_funcs_t *draw_funcs = hb_draw_funcs_create (); - g_assert (!hb_draw_funcs_is_immutable (draw_funcs)); + g_assert_true (!hb_draw_funcs_is_immutable (draw_funcs)); hb_draw_funcs_make_immutable (draw_funcs); - g_assert (hb_draw_funcs_is_immutable (draw_funcs)); + g_assert_true (hb_draw_funcs_is_immutable (draw_funcs)); hb_draw_funcs_destroy (draw_funcs); } @@ -1084,7 +1084,7 @@ test_hb_draw_funcs (const void* user_data) hb_face_t *face = hb_test_open_font_file ("fonts/glyphs.ttf"); hb_font_t *font = hb_font_create (face); hb_bool_t ret = hb_font_set_funcs_using (font, font_funcs_name); - g_assert (ret); + g_assert_true (ret); hb_face_destroy (face); { draw_data.consumed = 0; @@ -1098,7 +1098,7 @@ test_hb_draw_funcs (const void* user_data) hb_face_t *face = hb_test_open_font_file ("fonts/cff1_flex.otf"); hb_font_t *font = hb_font_create (face); hb_bool_t ret = hb_font_set_funcs_using (font, font_funcs_name); - g_assert (ret); + g_assert_true (ret); hb_face_destroy (face); draw_data.consumed = 0; @@ -1141,7 +1141,7 @@ test_hb_draw_compare_ot_funcs (const void *user_data) draw_data.str[draw_data.consumed] = '\0'; hb_bool_t ret = hb_font_set_funcs_using (font, font_funcs_name); - g_assert (ret); + g_assert_true (ret); hb_font_draw_glyph (font, 1, funcs, &draw_data2); draw_data2.str[draw_data2.consumed] = '\0'; diff --git a/test/api/test-face.c b/test/api/test-face.c index de73b7b90..0567c21d3 100644 --- a/test/api/test-face.c +++ b/test/api/test-face.c @@ -88,7 +88,7 @@ main (int argc, char **argv) master_face = hb_test_open_font_file_with_index (font_file, face_index); master_head = hb_face_reference_table (master_face, HEAD_TAG); - g_assert (hb_blob_get_length (master_head) > 0); + g_assert_true (hb_blob_get_length (master_head) > 0); font_file = hb_test_resolve_path (font_file); diff --git a/test/api/test-font.c b/test/api/test-font.c index a07bb56bf..2a04939fb 100644 --- a/test/api/test-font.c +++ b/test/api/test-font.c @@ -38,15 +38,15 @@ test_face_empty (void) hb_face_t *created_from_empty; hb_face_t *created_from_null; - g_assert (hb_face_get_empty ()); + g_assert_true (hb_face_get_empty ()); created_from_empty = hb_face_create (hb_blob_get_empty (), 0); - g_assert (hb_face_get_empty () != created_from_empty); + g_assert_true (hb_face_get_empty () != created_from_empty); created_from_null = hb_face_create (NULL, 0); - g_assert (hb_face_get_empty () != created_from_null); + g_assert_true (hb_face_get_empty () != created_from_null); - g_assert (hb_face_reference_table (hb_face_get_empty (), HB_TAG ('h','e','a','d')) == hb_blob_get_empty ()); + g_assert_true (hb_face_reference_table (hb_face_get_empty (), HB_TAG ('h','e','a','d')) == hb_blob_get_empty ()); g_assert_cmpint (hb_face_get_upem (hb_face_get_empty ()), ==, 1000); @@ -64,7 +64,7 @@ test_face_create (void) face = hb_face_create (blob, 0); hb_blob_destroy (blob); - g_assert (hb_face_reference_table (face, HB_TAG ('h','e','a','d')) == hb_blob_get_empty ()); + g_assert_true (hb_face_reference_table (face, HB_TAG ('h','e','a','d')) == hb_blob_get_empty ()); g_assert_cmpint (hb_face_get_upem (face), ==, 1000); @@ -77,7 +77,7 @@ free_up (void *user_data) { int *freed = (int *) user_data; - g_assert (!*freed); + g_assert_true (!*freed); (*freed)++; } @@ -109,22 +109,22 @@ test_face_createfortables (void) int freed = 0; face = hb_face_create_for_tables (get_table, &freed, free_up); - g_assert (!freed); + g_assert_true (!freed); - g_assert (hb_face_reference_table (face, HB_TAG ('h','e','a','d')) == hb_blob_get_empty ()); + g_assert_true (hb_face_reference_table (face, HB_TAG ('h','e','a','d')) == hb_blob_get_empty ()); blob = hb_face_reference_table (face, HB_TAG ('a','b','c','d')); - g_assert (blob != hb_blob_get_empty ()); + g_assert_true (blob != hb_blob_get_empty ()); data = hb_blob_get_data (blob, &len); g_assert_cmpint (len, ==, sizeof (test_data)); - g_assert (0 == memcmp (data, test_data, sizeof (test_data))); + g_assert_true (0 == memcmp (data, test_data, sizeof (test_data))); hb_blob_destroy (blob); g_assert_cmpint (hb_face_get_upem (face), ==, 1000); hb_face_destroy (face); - g_assert (freed); + g_assert_true (freed); } static unsigned int @@ -176,17 +176,17 @@ test_face_referenceblob (void) blob = hb_face_reference_blob (face); hb_face_destroy (face); - g_assert (blob != hb_blob_get_empty ()); + g_assert_true (blob != hb_blob_get_empty ()); face = hb_face_create (blob, 0); hb_blob_destroy (blob); - g_assert (face != hb_face_get_empty ()); + g_assert_true (face != hb_face_get_empty ()); g_assert_cmpuint (hb_face_get_table_tags (face, 0, NULL, NULL), ==, sizeof (test_tags) / sizeof (test_tags[0])); for (unsigned i = 0; i < sizeof (test_tags) / sizeof (test_tags[0]); i++) { hb_blob_t* table = hb_face_reference_table (face, test_tags[i]); - g_assert (table != hb_blob_get_empty ()); + g_assert_true (table != hb_blob_get_empty ()); hb_blob_destroy (table); } @@ -202,7 +202,7 @@ _test_font_nil_funcs (hb_font_t *font) unsigned int upem = hb_face_get_upem (hb_font_get_face (font)); x = y = 13; - g_assert (!hb_font_get_glyph_contour_point (font, 17, 2, &x, &y)); + g_assert_true (!hb_font_get_glyph_contour_point (font, 17, 2, &x, &y)); g_assert_cmpint (x, ==, 0); g_assert_cmpint (y, ==, 0); @@ -218,7 +218,7 @@ _test_font_nil_funcs (hb_font_t *font) g_assert_cmpint (extents.height, ==, 0); glyph = 3; - g_assert (!hb_font_get_glyph (font, 17, 2, &glyph)); + g_assert_true (!hb_font_get_glyph (font, 17, 2, &glyph)); g_assert_cmpint (glyph, ==, 0); } @@ -234,10 +234,10 @@ _test_fontfuncs_nil (hb_font_funcs_t *ffuncs) blob = hb_blob_create (test_data, sizeof (test_data), HB_MEMORY_MODE_READONLY, NULL, NULL); face = hb_face_create (blob, 0); hb_blob_destroy (blob); - g_assert (!hb_face_is_immutable (face)); + g_assert_true (!hb_face_is_immutable (face)); font = hb_font_create (face); - g_assert (font); - g_assert (hb_face_is_immutable (face)); + g_assert_true (font); + g_assert_true (hb_face_is_immutable (face)); hb_face_destroy (face); @@ -247,7 +247,7 @@ _test_fontfuncs_nil (hb_font_funcs_t *ffuncs) _test_font_nil_funcs (font); subfont = hb_font_create_sub_font (font); - g_assert (subfont); + g_assert_true (subfont); g_assert_cmpint (freed, ==, 0); hb_font_destroy (font); @@ -262,8 +262,8 @@ _test_fontfuncs_nil (hb_font_funcs_t *ffuncs) static void test_fontfuncs_empty (void) { - g_assert (hb_font_funcs_get_empty ()); - g_assert (hb_font_funcs_is_immutable (hb_font_funcs_get_empty ())); + g_assert_true (hb_font_funcs_get_empty ()); + g_assert_true (hb_font_funcs_is_immutable (hb_font_funcs_get_empty ())); _test_fontfuncs_nil (hb_font_funcs_get_empty ()); } @@ -274,7 +274,7 @@ test_fontfuncs_nil (void) ffuncs = hb_font_funcs_create (); - g_assert (!hb_font_funcs_is_immutable (ffuncs)); + g_assert_true (!hb_font_funcs_is_immutable (ffuncs)); _test_fontfuncs_nil (hb_font_funcs_get_empty ()); hb_font_funcs_destroy (ffuncs); @@ -358,13 +358,13 @@ test_fontfuncs_subclassing (void) hb_font_funcs_destroy (ffuncs1); x = y = 1; - g_assert (hb_font_get_glyph_contour_point_for_origin (font1, 1, 2, HB_DIRECTION_LTR, &x, &y)); + g_assert_true (hb_font_get_glyph_contour_point_for_origin (font1, 1, 2, HB_DIRECTION_LTR, &x, &y)); g_assert_cmpint (x, ==, 2); g_assert_cmpint (y, ==, 3); - g_assert (hb_font_get_glyph_contour_point_for_origin (font1, 2, 5, HB_DIRECTION_LTR, &x, &y)); + g_assert_true (hb_font_get_glyph_contour_point_for_origin (font1, 2, 5, HB_DIRECTION_LTR, &x, &y)); g_assert_cmpint (x, ==, 4); g_assert_cmpint (y, ==, 5); - g_assert (!hb_font_get_glyph_contour_point_for_origin (font1, 3, 7, HB_DIRECTION_RTL, &x, &y)); + g_assert_true (!hb_font_get_glyph_contour_point_for_origin (font1, 3, 7, HB_DIRECTION_RTL, &x, &y)); g_assert_cmpint (x, ==, 0); g_assert_cmpint (y, ==, 0); x = hb_font_get_glyph_h_advance (font1, 1); @@ -377,13 +377,13 @@ test_fontfuncs_subclassing (void) */ font2 = hb_font_create_sub_font (font1); font3 = hb_font_create_sub_font (font2); - g_assert (!hb_font_is_immutable (font1)); - g_assert (!hb_font_is_immutable (font2)); - g_assert (!hb_font_is_immutable (font3)); + g_assert_true (!hb_font_is_immutable (font1)); + g_assert_true (!hb_font_is_immutable (font2)); + g_assert_true (!hb_font_is_immutable (font3)); hb_font_make_immutable (font3); - g_assert (hb_font_is_immutable (font1)); - g_assert (hb_font_is_immutable (font2)); - g_assert (hb_font_is_immutable (font3)); + g_assert_true (hb_font_is_immutable (font1)); + g_assert_true (hb_font_is_immutable (font2)); + g_assert_true (hb_font_is_immutable (font3)); hb_font_destroy (font2); hb_font_destroy (font3); @@ -397,13 +397,13 @@ test_fontfuncs_subclassing (void) hb_font_funcs_destroy (ffuncs2); x = y = 1; - g_assert (hb_font_get_glyph_contour_point_for_origin (font2, 1, 2, HB_DIRECTION_LTR, &x, &y)); + g_assert_true (hb_font_get_glyph_contour_point_for_origin (font2, 1, 2, HB_DIRECTION_LTR, &x, &y)); g_assert_cmpint (x, ==, 6); g_assert_cmpint (y, ==, 7); - g_assert (hb_font_get_glyph_contour_point_for_origin (font2, 2, 5, HB_DIRECTION_RTL, &x, &y)); + g_assert_true (hb_font_get_glyph_contour_point_for_origin (font2, 2, 5, HB_DIRECTION_RTL, &x, &y)); g_assert_cmpint (x, ==, 4); g_assert_cmpint (y, ==, 5); - g_assert (!hb_font_get_glyph_contour_point_for_origin (font2, 3, 7, HB_DIRECTION_LTR, &x, &y)); + g_assert_true (!hb_font_get_glyph_contour_point_for_origin (font2, 3, 7, HB_DIRECTION_LTR, &x, &y)); g_assert_cmpint (x, ==, 0); g_assert_cmpint (y, ==, 0); x = hb_font_get_glyph_h_advance (font2, 1); @@ -416,13 +416,13 @@ test_fontfuncs_subclassing (void) hb_font_set_scale (font3, 20, 30); x = y = 1; - g_assert (hb_font_get_glyph_contour_point_for_origin (font3, 1, 2, HB_DIRECTION_RTL, &x, &y)); + g_assert_true (hb_font_get_glyph_contour_point_for_origin (font3, 1, 2, HB_DIRECTION_RTL, &x, &y)); g_assert_cmpint (x, ==, 6*2); g_assert_cmpint (y, ==, 7*3); - g_assert (hb_font_get_glyph_contour_point_for_origin (font3, 2, 5, HB_DIRECTION_LTR, &x, &y)); + g_assert_true (hb_font_get_glyph_contour_point_for_origin (font3, 2, 5, HB_DIRECTION_LTR, &x, &y)); g_assert_cmpint (x, ==, 4*2); g_assert_cmpint (y, ==, 5*3); - g_assert (!hb_font_get_glyph_contour_point_for_origin (font3, 3, 7, HB_DIRECTION_LTR, &x, &y)); + g_assert_true (!hb_font_get_glyph_contour_point_for_origin (font3, 3, 7, HB_DIRECTION_LTR, &x, &y)); g_assert_cmpint (x, ==, 0*2); g_assert_cmpint (y, ==, 0*3); x = hb_font_get_glyph_h_advance (font3, 1); @@ -508,21 +508,21 @@ test_font_empty (void) hb_font_t *created_from_null; hb_font_t *created_sub_from_null; - g_assert (hb_font_get_empty ()); + g_assert_true (hb_font_get_empty ()); created_from_empty = hb_font_create (hb_face_get_empty ()); - g_assert (hb_font_get_empty () != created_from_empty); + g_assert_true (hb_font_get_empty () != created_from_empty); created_from_null = hb_font_create (NULL); - g_assert (hb_font_get_empty () != created_from_null); + g_assert_true (hb_font_get_empty () != created_from_null); created_sub_from_null = hb_font_create_sub_font (NULL); - g_assert (hb_font_get_empty () != created_sub_from_null); + g_assert_true (hb_font_get_empty () != created_sub_from_null); - g_assert (hb_font_is_immutable (hb_font_get_empty ())); + g_assert_true (hb_font_is_immutable (hb_font_get_empty ())); - g_assert (hb_font_get_face (hb_font_get_empty ()) == hb_face_get_empty ()); - g_assert (hb_font_get_parent (hb_font_get_empty ()) == NULL); + g_assert_true (hb_font_get_face (hb_font_get_empty ()) == hb_face_get_empty ()); + g_assert_true (hb_font_get_parent (hb_font_get_empty ()) == NULL); hb_font_destroy (created_sub_from_null); hb_font_destroy (created_from_null); @@ -547,19 +547,19 @@ test_font_properties (void) hb_face_destroy (face); - g_assert (hb_font_get_face (font) == face); - g_assert (hb_font_get_parent (font) == hb_font_get_empty ()); + g_assert_true (hb_font_get_face (font) == face); + g_assert_true (hb_font_get_parent (font) == hb_font_get_empty ()); subfont = hb_font_create_sub_font (font); - g_assert (hb_font_get_parent (subfont) == font); + g_assert_true (hb_font_get_parent (subfont) == font); hb_font_set_parent(subfont, NULL); - g_assert (hb_font_get_parent (subfont) == hb_font_get_empty()); + g_assert_true (hb_font_get_parent (subfont) == hb_font_get_empty()); hb_font_set_parent(subfont, font); - g_assert (hb_font_get_parent (subfont) == font); + g_assert_true (hb_font_get_parent (subfont) == font); hb_font_set_parent(subfont, NULL); hb_font_make_immutable (subfont); - g_assert (hb_font_get_parent (subfont) == hb_font_get_empty()); + g_assert_true (hb_font_get_parent (subfont) == hb_font_get_empty()); hb_font_set_parent(subfont, font); - g_assert (hb_font_get_parent (subfont) == hb_font_get_empty()); + g_assert_true (hb_font_get_parent (subfont) == hb_font_get_empty()); hb_font_destroy (subfont); @@ -615,9 +615,9 @@ test_font_properties (void) /* Check immutable */ - g_assert (!hb_font_is_immutable (font)); + g_assert_true (!hb_font_is_immutable (font)); hb_font_make_immutable (font); - g_assert (hb_font_is_immutable (font)); + g_assert_true (hb_font_is_immutable (font)); hb_font_set_scale (font, 10, 12); x_scale = y_scale = 13; @@ -636,8 +636,8 @@ test_font_properties (void) subfont = hb_font_create_sub_font (font); hb_font_destroy (font); - g_assert (hb_font_get_parent (subfont) == font); - g_assert (hb_font_get_face (subfont) == face); + g_assert_true (hb_font_get_parent (subfont) == font); + g_assert_true (hb_font_get_face (subfont) == face); /* scale */ x_scale = y_scale = 13; diff --git a/test/api/test-instance-cff2.c b/test/api/test-instance-cff2.c index 32b7f13f8..3bf7d6c4e 100644 --- a/test/api/test-instance-cff2.c +++ b/test/api/test-instance-cff2.c @@ -54,8 +54,8 @@ test_instance_cff2 (void) hb_set_destroy (codepoints); hb_subset_test_check (expected, face_abc_subset, HB_TAG ('C','F','F', '2')); - g_assert (hb_face_reference_table (face_abc_subset, HB_TAG ('f', 'v', 'a', 'r')) - == hb_blob_get_empty ()); + g_assert_true (hb_face_reference_table (face_abc_subset, HB_TAG ('f', 'v', 'a', 'r')) + == hb_blob_get_empty ()); hb_face_destroy (face_abc_subset); hb_face_destroy (face_abc); diff --git a/test/api/test-map.c b/test/api/test-map.c index 02df8b987..617f7096f 100644 --- a/test/api/test-map.c +++ b/test/api/test-map.c @@ -32,31 +32,31 @@ test_map_basic (void) { hb_map_t *empty = hb_map_get_empty (); hb_map_t *m; - g_assert (hb_map_is_empty (empty)); - g_assert (!hb_map_allocation_successful (empty)); + g_assert_true (hb_map_is_empty (empty)); + g_assert_true (!hb_map_allocation_successful (empty)); hb_map_destroy (empty); m = hb_map_create (); - g_assert (hb_map_allocation_successful (m)); - g_assert (hb_map_is_empty (m)); + g_assert_true (hb_map_allocation_successful (m)); + g_assert_true (hb_map_is_empty (m)); hb_map_set (m, 213, 223); hb_map_set (m, 643, 675); g_assert_cmpint (hb_map_get_population (m), ==, 2); g_assert_cmpint (hb_map_get (m, 213), ==, 223); - g_assert (!hb_map_has (m, 123)); - g_assert (hb_map_has (m, 213)); + g_assert_true (!hb_map_has (m, 123)); + g_assert_true (hb_map_has (m, 213)); hb_map_del (m, 213); - g_assert (!hb_map_has (m, 213)); + g_assert_true (!hb_map_has (m, 213)); g_assert_cmpint (hb_map_get (m, 643), ==, 675); hb_map_set (m, 237, 673); - g_assert (hb_map_has (m, 237)); + g_assert_true (hb_map_has (m, 237)); hb_map_clear (m); - g_assert (!hb_map_has (m, 237)); - g_assert (!hb_map_has (m, 643)); + g_assert_true (!hb_map_has (m, 237)); + g_assert_true (!hb_map_has (m, 643)); g_assert_cmpint (hb_map_get_population (m), ==, 0); hb_map_destroy (m); @@ -96,8 +96,8 @@ test_map_refcount (void) hb_map_destroy (m); /* We copied its reference so it is still usable after one destroy */ - g_assert (hb_map_has (m, 213)); - g_assert (hb_map_has (m2, 213)); + g_assert_true (hb_map_has (m, 213)); + g_assert_true (hb_map_has (m2, 213)); hb_map_destroy (m2); diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index 728290598..23132f458 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -95,7 +95,7 @@ test_body (gconstpointer data) { const char *backend = (const char *) data; bool ret = hb_font_set_funcs_using (font, backend); - g_assert (ret); + g_assert_true (ret); int i; pthread_t *threads = calloc (num_threads, sizeof (pthread_t)); diff --git a/test/api/test-object.c b/test/api/test-object.c index 5154621e9..0da1c5a3c 100644 --- a/test/api/test-object.c +++ b/test/api/test-object.c @@ -195,7 +195,7 @@ static void free_up0 (void *p) data_t *data = (data_t *) p; g_assert_cmphex (data->value, ==, MAGIC0); - g_assert (!data->freed); + g_assert_true (!data->freed); data->freed = TRUE; } @@ -204,7 +204,7 @@ static void free_up1 (void *p) data_t *data = (data_t *) p; g_assert_cmphex (data->value, ==, MAGIC1); - g_assert (!data->freed); + g_assert_true (!data->freed); data->freed = TRUE; } @@ -219,7 +219,7 @@ static void free_deadlock_test (void *p) { deadlock_test_t *t = (deadlock_test_t *) p; - g_assert (NULL == t->klass->get_user_data (t->object, &t->key)); + g_assert_true (NULL == t->klass->get_user_data (t->object, &t->key)); } @@ -242,73 +242,73 @@ test_object (void) g_test_message ("->create()"); obj = o->create (); - g_assert (obj); + g_assert_true (obj); - g_assert (obj == o->reference (obj)); + g_assert_true (obj == o->reference (obj)); o->destroy (obj); if (o->is_immutable) - g_assert (!o->is_immutable (obj)); + g_assert_true (!o->is_immutable (obj)); - g_assert (o->set_user_data (obj, &key[0], &data[0], free_up0, TRUE)); - g_assert (o->get_user_data (obj, &key[0]) == &data[0]); + g_assert_true (o->set_user_data (obj, &key[0], &data[0], free_up0, TRUE)); + g_assert_true (o->get_user_data (obj, &key[0]) == &data[0]); if (o->is_immutable) { o->make_immutable (obj); - g_assert (o->is_immutable (obj)); + g_assert_true (o->is_immutable (obj)); } /* Should still work even if object is made immutable */ - g_assert (o->set_user_data (obj, &key[1], &data[1], free_up1, TRUE)); - g_assert (o->get_user_data (obj, &key[1]) == &data[1]); + g_assert_true (o->set_user_data (obj, &key[1], &data[1], free_up1, TRUE)); + g_assert_true (o->get_user_data (obj, &key[1]) == &data[1]); - g_assert (!o->set_user_data (obj, NULL, &data[0], free_up0, TRUE)); - g_assert (o->get_user_data (obj, &key[0]) == &data[0]); - g_assert (o->set_user_data (obj, &key[0], &data[1], NULL, TRUE)); - g_assert (data[0].freed); - g_assert (o->get_user_data (obj, &key[0]) == &data[1]); - g_assert (!data[1].freed); + g_assert_true (!o->set_user_data (obj, NULL, &data[0], free_up0, TRUE)); + g_assert_true (o->get_user_data (obj, &key[0]) == &data[0]); + g_assert_true (o->set_user_data (obj, &key[0], &data[1], NULL, TRUE)); + g_assert_true (data[0].freed); + g_assert_true (o->get_user_data (obj, &key[0]) == &data[1]); + g_assert_true (!data[1].freed); data[0].freed = FALSE; - g_assert (o->set_user_data (obj, &key[0], &data[0], free_up0, TRUE)); - g_assert (!data[0].freed); - g_assert (o->set_user_data (obj, &key[0], NULL, NULL, TRUE)); - g_assert (data[0].freed); + g_assert_true (o->set_user_data (obj, &key[0], &data[0], free_up0, TRUE)); + g_assert_true (!data[0].freed); + g_assert_true (o->set_user_data (obj, &key[0], NULL, NULL, TRUE)); + g_assert_true (data[0].freed); data[0].freed = FALSE; global_data = 0; - g_assert (o->set_user_data (obj, &key[0], &data[0], free_up0, TRUE)); - g_assert (!o->set_user_data (obj, &key[0], &data[0], free_up0, FALSE)); + g_assert_true (o->set_user_data (obj, &key[0], &data[0], free_up0, TRUE)); + g_assert_true (!o->set_user_data (obj, &key[0], &data[0], free_up0, FALSE)); g_assert_cmpuint (global_data, ==, 0); - g_assert (o->set_user_data (obj, &key[0], NULL, global_free_up, TRUE)); + g_assert_true (o->set_user_data (obj, &key[0], NULL, global_free_up, TRUE)); g_assert_cmpuint (global_data, ==, 0); - g_assert (o->set_user_data (obj, &key[0], NULL, NULL, TRUE)); + g_assert_true (o->set_user_data (obj, &key[0], NULL, NULL, TRUE)); g_assert_cmpuint (global_data, ==, 1); global_data = 0; for (j = 2; j < 1000; j++) - g_assert (o->set_user_data (obj, &key[j], &data[j], global_free_up, TRUE)); + g_assert_true (o->set_user_data (obj, &key[j], &data[j], global_free_up, TRUE)); for (j = 2; j < 1000; j++) - g_assert (o->get_user_data (obj, &key[j]) == &data[j]); + g_assert_true (o->get_user_data (obj, &key[j]) == &data[j]); for (j = 100; j < 1000; j++) - g_assert (o->set_user_data (obj, &key[j], NULL, NULL, TRUE)); + g_assert_true (o->set_user_data (obj, &key[j], NULL, NULL, TRUE)); for (j = 2; j < 100; j++) - g_assert (o->get_user_data (obj, &key[j]) == &data[j]); + g_assert_true (o->get_user_data (obj, &key[j]) == &data[j]); for (j = 100; j < 1000; j++) - g_assert (!o->get_user_data (obj, &key[j])); + g_assert_true (!o->get_user_data (obj, &key[j])); g_assert_cmpuint (global_data, ==, 900); /* Test set_user_data where the destroy() func calls user_data functions. * Make sure it doesn't deadlock or corrupt memory. */ deadlock_test.klass = o; deadlock_test.object = obj; - g_assert (o->set_user_data (obj, &deadlock_test.key, &deadlock_test, free_deadlock_test, TRUE)); - g_assert (o->set_user_data (obj, &deadlock_test.key, NULL, NULL, TRUE)); + g_assert_true (o->set_user_data (obj, &deadlock_test.key, &deadlock_test, free_deadlock_test, TRUE)); + g_assert_true (o->set_user_data (obj, &deadlock_test.key, NULL, NULL, TRUE)); - g_assert (!data[1].freed); + g_assert_true (!data[1].freed); o->destroy (obj); - g_assert (data[0].freed); - g_assert (data[1].freed); + g_assert_true (data[0].freed); + g_assert_true (data[1].freed); g_assert_cmpuint (global_data, ==, 1000-2); } @@ -317,16 +317,16 @@ test_object (void) g_test_message ("->get_empty()"); obj = o->get_empty (); - g_assert (obj); + g_assert_true (obj); - g_assert (obj == o->reference (obj)); + g_assert_true (obj == o->reference (obj)); o->destroy (obj); if (o->is_immutable) - g_assert (o->is_immutable (obj)); + g_assert_true (o->is_immutable (obj)); - g_assert (!o->set_user_data (obj, &key[0], &data[0], free_up0, TRUE)); - g_assert (!o->get_user_data (obj, &key[0])); + g_assert_true (!o->set_user_data (obj, &key[0], &data[0], free_up0, TRUE)); + g_assert_true (!o->get_user_data (obj, &key[0])); o->destroy (obj); o->destroy (obj); @@ -334,7 +334,7 @@ test_object (void) o->destroy (obj); o->destroy (obj); - g_assert (!data[0].freed); + g_assert_true (!data[0].freed); } { @@ -347,18 +347,18 @@ test_object (void) if (obj == o->get_empty ()) continue; /* Tested already */ - g_assert (obj == o->reference (obj)); + g_assert_true (obj == o->reference (obj)); o->destroy (obj); if (o->is_immutable) - g_assert (!o->is_immutable (obj)); + g_assert_true (!o->is_immutable (obj)); - g_assert (o->set_user_data (obj, &key[0], &data[0], free_up0, TRUE)); - g_assert (o->get_user_data (obj, &key[0])); + g_assert_true (o->set_user_data (obj, &key[0], &data[0], free_up0, TRUE)); + g_assert_true (o->get_user_data (obj, &key[0])); o->destroy (obj); - g_assert (data[0].freed); + g_assert_true (data[0].freed); } } } diff --git a/test/api/test-ot-collect-glyphs.c b/test/api/test-ot-collect-glyphs.c index 3b3b64316..41f61807b 100644 --- a/test/api/test-ot-collect-glyphs.c +++ b/test/api/test-ot-collect-glyphs.c @@ -52,12 +52,12 @@ test_ot_layout_lookup_collect_glyphs_source_sans (void) g_assert_cmpuint (0, ==, hb_set_get_population (before)); g_assert_cmpuint (684, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (54, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); g_assert_cmpuint (372, ==, hb_set_get_population (output)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (574, ==, g); END(); @@ -67,14 +67,14 @@ test_ot_layout_lookup_collect_glyphs_source_sans (void) g_assert_cmpuint (143, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (2, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); g_assert_cmpuint (319, ==, hb_set_get_population (output)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (519, ==, g); END(); @@ -84,14 +84,14 @@ test_ot_layout_lookup_collect_glyphs_source_sans (void) g_assert_cmpuint (10, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (92, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); g_assert_cmpuint (9, ==, hb_set_get_population (output)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (6, ==, g); END(); @@ -101,14 +101,14 @@ test_ot_layout_lookup_collect_glyphs_source_sans (void) g_assert_cmpuint (14, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (1823, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); g_assert_cmpuint (22, ==, hb_set_get_population (output)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (1897, ==, g); END(); @@ -118,19 +118,19 @@ test_ot_layout_lookup_collect_glyphs_source_sans (void) g_assert_cmpuint (10, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (92, ==, g); g_assert_cmpuint (2, ==, hb_set_get_population (after)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (after, &g)); + g_assert_true (hb_set_next (after, &g)); g_assert_cmpuint (1826, ==, g); - g_assert (hb_set_next (after, &g)); + g_assert_true (hb_set_next (after, &g)); g_assert_cmpuint (1837, ==, g); g_assert_cmpuint (9, ==, hb_set_get_population (output)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (6, ==, g); END(); @@ -138,19 +138,19 @@ test_ot_layout_lookup_collect_glyphs_source_sans (void) BEGIN(HB_OT_TAG_GSUB, 13); g_assert_cmpuint (771, ==, hb_set_get_population (before)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (before, &g)); + g_assert_true (hb_set_next (before, &g)); g_assert_cmpuint (2, ==, g); g_assert_cmpuint (28, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (1823, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); g_assert_cmpuint (48, ==, hb_set_get_population (output)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (325, ==, g); END(); @@ -160,7 +160,7 @@ test_ot_layout_lookup_collect_glyphs_source_sans (void) g_assert_cmpuint (179, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (28, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); @@ -173,7 +173,7 @@ test_ot_layout_lookup_collect_glyphs_source_sans (void) g_assert_cmpuint (48, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (1823, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); @@ -186,7 +186,7 @@ test_ot_layout_lookup_collect_glyphs_source_sans (void) g_assert_cmpuint (1426, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (2, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); @@ -202,7 +202,7 @@ test_ot_layout_lookup_collect_glyphs_source_sans (void) g_assert_cmpuint (1, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (4, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); @@ -233,22 +233,22 @@ test_ot_layout_lookup_collect_glyphs_noto_nastaliq (void) g_assert_cmpuint (3, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (228, ==, g); - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (416, ==, g); - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (441, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); g_assert_cmpuint (3, ==, hb_set_get_population (output)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (267, ==, g); - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (268, ==, g); - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (279, ==, g); END(); @@ -258,22 +258,22 @@ test_ot_layout_lookup_collect_glyphs_noto_nastaliq (void) g_assert_cmpuint (3, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (228, ==, g); - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (416, ==, g); - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (441, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); g_assert_cmpuint (3, ==, hb_set_get_population (output)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (267, ==, g); - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (268, ==, g); - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (279, ==, g); END(); @@ -281,22 +281,22 @@ test_ot_layout_lookup_collect_glyphs_noto_nastaliq (void) BEGIN(HB_OT_TAG_GSUB, 16); g_assert_cmpuint (16, ==, hb_set_get_population (before)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (before, &g)); + g_assert_true (hb_set_next (before, &g)); g_assert_cmpuint (74, ==, g); g_assert_cmpuint (27, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (276, ==, g); g_assert_cmpuint (14, ==, hb_set_get_population (after)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (after, &g)); + g_assert_true (hb_set_next (after, &g)); g_assert_cmpuint (252, ==, g); g_assert_cmpuint (43, ==, hb_set_get_population (output)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (74, ==, g); END(); @@ -306,14 +306,14 @@ test_ot_layout_lookup_collect_glyphs_noto_nastaliq (void) g_assert_cmpuint (246, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (252, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); g_assert_cmpuint (258, ==, hb_set_get_population (output)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (74, ==, g); END(); @@ -324,7 +324,7 @@ test_ot_layout_lookup_collect_glyphs_noto_nastaliq (void) g_assert_cmpuint (616, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (228, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); @@ -337,7 +337,7 @@ test_ot_layout_lookup_collect_glyphs_noto_nastaliq (void) g_assert_cmpuint (46, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (1004, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); @@ -350,7 +350,7 @@ test_ot_layout_lookup_collect_glyphs_noto_nastaliq (void) g_assert_cmpuint (242, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (257, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); @@ -381,26 +381,26 @@ test_ot_layout_lookup_collect_glyphs_qahiri (void) g_assert_cmpuint (4, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (52, ==, g); - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (60, ==, g); - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (62, ==, g); - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (159, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); g_assert_cmpuint (4, ==, hb_set_get_population (output)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (53, ==, g); - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (61, ==, g); - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (63, ==, g); - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (160, ==, g); END(); @@ -408,26 +408,26 @@ test_ot_layout_lookup_collect_glyphs_qahiri (void) BEGIN(HB_OT_TAG_GSUB, 11); g_assert_cmpuint (1, ==, hb_set_get_population (before)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (before, &g)); + g_assert_true (hb_set_next (before, &g)); g_assert_cmpuint (39, ==, g); g_assert_cmpuint (2, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (154, ==, g); - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (159, ==, g); g_assert_cmpuint (1, ==, hb_set_get_population (after)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (after, &g)); + g_assert_true (hb_set_next (after, &g)); g_assert_cmpuint (179, ==, g); g_assert_cmpuint (2, ==, hb_set_get_population (output)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (155, ==, g); - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (162, ==, g); END(); @@ -437,20 +437,20 @@ test_ot_layout_lookup_collect_glyphs_qahiri (void) g_assert_cmpuint (4, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (53, ==, g); g_assert_cmpuint (0, ==, hb_set_get_population (after)); g_assert_cmpuint (4, ==, hb_set_get_population (output)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (52, ==, g); - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (60, ==, g); - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (62, ==, g); - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (159, ==, g); END(); @@ -460,17 +460,17 @@ test_ot_layout_lookup_collect_glyphs_qahiri (void) g_assert_cmpuint (42, ==, hb_set_get_population (input)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (input, &g)); + g_assert_true (hb_set_next (input, &g)); g_assert_cmpuint (47, ==, g); g_assert_cmpuint (46, ==, hb_set_get_population (after)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (after, &g)); + g_assert_true (hb_set_next (after, &g)); g_assert_cmpuint (61, ==, g); g_assert_cmpuint (42, ==, hb_set_get_population (output)); g = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (output, &g)); + g_assert_true (hb_set_next (output, &g)); g_assert_cmpuint (463, ==, g); END(); diff --git a/test/api/test-ot-color.c b/test/api/test-ot-color.c index b5440ef82..fe1e36399 100644 --- a/test/api/test-ot-color.c +++ b/test/api/test-ot-color.c @@ -348,58 +348,58 @@ test_hb_ot_color_glyph_get_layers (void) static void test_hb_ot_color_has_data (void) { - g_assert (hb_ot_color_has_layers (empty) == FALSE); - g_assert (hb_ot_color_has_layers (cpal_v0) == TRUE); - g_assert (hb_ot_color_has_layers (cpal_v1) == TRUE); - g_assert (hb_ot_color_has_layers (cpal) == TRUE); - g_assert (hb_ot_color_has_layers (cbdt) == FALSE); - g_assert (hb_ot_color_has_layers (sbix) == FALSE); - g_assert (hb_ot_color_has_layers (svg) == FALSE); - g_assert (hb_ot_color_has_layers (colrv1) == FALSE); + g_assert_true (hb_ot_color_has_layers (empty) == FALSE); + g_assert_true (hb_ot_color_has_layers (cpal_v0) == TRUE); + g_assert_true (hb_ot_color_has_layers (cpal_v1) == TRUE); + g_assert_true (hb_ot_color_has_layers (cpal) == TRUE); + g_assert_true (hb_ot_color_has_layers (cbdt) == FALSE); + g_assert_true (hb_ot_color_has_layers (sbix) == FALSE); + g_assert_true (hb_ot_color_has_layers (svg) == FALSE); + g_assert_true (hb_ot_color_has_layers (colrv1) == FALSE); - g_assert (hb_ot_color_has_palettes (empty) == FALSE); - g_assert (hb_ot_color_has_palettes (cpal_v0) == TRUE); - g_assert (hb_ot_color_has_palettes (cpal_v1) == TRUE); - g_assert (hb_ot_color_has_palettes (cpal) == TRUE); - g_assert (hb_ot_color_has_palettes (cbdt) == FALSE); - g_assert (hb_ot_color_has_palettes (sbix) == FALSE); - g_assert (hb_ot_color_has_palettes (svg) == FALSE); - g_assert (hb_ot_color_has_palettes (colrv1) == TRUE); + g_assert_true (hb_ot_color_has_palettes (empty) == FALSE); + g_assert_true (hb_ot_color_has_palettes (cpal_v0) == TRUE); + g_assert_true (hb_ot_color_has_palettes (cpal_v1) == TRUE); + g_assert_true (hb_ot_color_has_palettes (cpal) == TRUE); + g_assert_true (hb_ot_color_has_palettes (cbdt) == FALSE); + g_assert_true (hb_ot_color_has_palettes (sbix) == FALSE); + g_assert_true (hb_ot_color_has_palettes (svg) == FALSE); + g_assert_true (hb_ot_color_has_palettes (colrv1) == TRUE); - g_assert (hb_ot_color_has_svg (empty) == FALSE); - g_assert (hb_ot_color_has_svg (cpal_v0) == FALSE); - g_assert (hb_ot_color_has_svg (cpal_v1) == FALSE); - g_assert (hb_ot_color_has_svg (cpal) == FALSE); - g_assert (hb_ot_color_has_svg (cbdt) == FALSE); - g_assert (hb_ot_color_has_svg (sbix) == FALSE); - g_assert (hb_ot_color_has_svg (svg) == TRUE); - g_assert (hb_ot_color_has_svg (colrv1) == FALSE); + g_assert_true (hb_ot_color_has_svg (empty) == FALSE); + g_assert_true (hb_ot_color_has_svg (cpal_v0) == FALSE); + g_assert_true (hb_ot_color_has_svg (cpal_v1) == FALSE); + g_assert_true (hb_ot_color_has_svg (cpal) == FALSE); + g_assert_true (hb_ot_color_has_svg (cbdt) == FALSE); + g_assert_true (hb_ot_color_has_svg (sbix) == FALSE); + g_assert_true (hb_ot_color_has_svg (svg) == TRUE); + g_assert_true (hb_ot_color_has_svg (colrv1) == FALSE); - g_assert (hb_ot_color_has_png (empty) == FALSE); - g_assert (hb_ot_color_has_png (cpal_v0) == FALSE); - g_assert (hb_ot_color_has_png (cpal_v1) == FALSE); - g_assert (hb_ot_color_has_png (cpal) == FALSE); - g_assert (hb_ot_color_has_png (cbdt) == TRUE); - g_assert (hb_ot_color_has_png (sbix) == TRUE); - g_assert (hb_ot_color_has_png (svg) == FALSE); - g_assert (hb_ot_color_has_png (colrv1) == FALSE); + g_assert_true (hb_ot_color_has_png (empty) == FALSE); + g_assert_true (hb_ot_color_has_png (cpal_v0) == FALSE); + g_assert_true (hb_ot_color_has_png (cpal_v1) == FALSE); + g_assert_true (hb_ot_color_has_png (cpal) == FALSE); + g_assert_true (hb_ot_color_has_png (cbdt) == TRUE); + g_assert_true (hb_ot_color_has_png (sbix) == TRUE); + g_assert_true (hb_ot_color_has_png (svg) == FALSE); + g_assert_true (hb_ot_color_has_png (colrv1) == FALSE); - g_assert (hb_ot_color_has_paint (empty) == FALSE); - g_assert (hb_ot_color_has_paint (cpal_v0) == FALSE); - g_assert (hb_ot_color_has_paint (cpal_v1) == FALSE); - g_assert (hb_ot_color_has_paint (cpal) == FALSE); - g_assert (hb_ot_color_has_paint (cbdt) == FALSE); - g_assert (hb_ot_color_has_paint (sbix) == FALSE); - g_assert (hb_ot_color_has_paint (svg) == FALSE); - g_assert (hb_ot_color_has_paint (colrv1) == TRUE); + g_assert_true (hb_ot_color_has_paint (empty) == FALSE); + g_assert_true (hb_ot_color_has_paint (cpal_v0) == FALSE); + g_assert_true (hb_ot_color_has_paint (cpal_v1) == FALSE); + g_assert_true (hb_ot_color_has_paint (cpal) == FALSE); + g_assert_true (hb_ot_color_has_paint (cbdt) == FALSE); + g_assert_true (hb_ot_color_has_paint (sbix) == FALSE); + g_assert_true (hb_ot_color_has_paint (svg) == FALSE); + g_assert_true (hb_ot_color_has_paint (colrv1) == TRUE); } static void test_hb_ot_color_glyph_has_paint (void) { - g_assert (hb_ot_color_has_paint (colrv1)); - g_assert (hb_ot_color_glyph_has_paint (colrv1, 10)); - g_assert (!hb_ot_color_glyph_has_paint (colrv1, 20)); + g_assert_true (hb_ot_color_has_paint (colrv1)); + g_assert_true (hb_ot_color_glyph_has_paint (colrv1, 10)); + g_assert_true (!hb_ot_color_glyph_has_paint (colrv1, 20)); } static void @@ -410,17 +410,17 @@ test_hb_ot_color_svg (void) const char *data; blob = hb_ot_color_glyph_reference_svg (svg, 0); - g_assert (hb_blob_get_length (blob) == 0); + g_assert_true (hb_blob_get_length (blob) == 0); blob = hb_ot_color_glyph_reference_svg (svg, 1); data = hb_blob_get_data (blob, &length); g_assert_cmpuint (length, ==, 146); - g_assert (strncmp (data, "", 5) == 0); + g_assert_true (strncmp (data, "", 5) == 0); hb_blob_destroy (blob); blob = hb_ot_color_glyph_reference_svg (empty, 0); - g_assert (hb_blob_get_length (blob) == 0); + g_assert_true (hb_blob_get_length (blob) == 0); } @@ -442,12 +442,12 @@ test_hb_ot_color_png (void) g_assert_cmpint (extents.y_bearing, ==, 0); g_assert_cmpint (extents.width, ==, 0); g_assert_cmpint (extents.height, ==, 0); - g_assert (hb_blob_get_length (blob) == 0); + g_assert_true (hb_blob_get_length (blob) == 0); blob = hb_ot_color_glyph_reference_png (sbix_font, 1); data = hb_blob_get_data (blob, &length); g_assert_cmpuint (length, ==, 224); - g_assert (strncmp (data + 1, "PNG", 3) == 0); + g_assert_true (strncmp (data + 1, "PNG", 3) == 0); hb_font_get_glyph_extents (sbix_font, 1, &extents); g_assert_cmpint (extents.x_bearing, ==, 0); g_assert_cmpint (extents.y_bearing, ==, 800); @@ -459,12 +459,12 @@ test_hb_ot_color_png (void) /* cbdt */ cbdt_font = hb_font_create (cbdt); blob = hb_ot_color_glyph_reference_png (cbdt_font, 0); - g_assert (hb_blob_get_length (blob) == 0); + g_assert_true (hb_blob_get_length (blob) == 0); blob = hb_ot_color_glyph_reference_png (cbdt_font, 1); data = hb_blob_get_data (blob, &length); g_assert_cmpuint (length, ==, 88); - g_assert (strncmp (data + 1, "PNG", 3) == 0); + g_assert_true (strncmp (data + 1, "PNG", 3) == 0); hb_font_get_glyph_extents (cbdt_font, 1, &extents); g_assert_cmpint (extents.x_bearing, ==, 0); g_assert_cmpint (extents.y_bearing, ==, 1024); diff --git a/test/api/test-ot-extents-cff.c b/test/api/test-ot-extents-cff.c index ecebcf96b..c867e66de 100644 --- a/test/api/test-ot-extents-cff.c +++ b/test/api/test-ot-extents-cff.c @@ -33,14 +33,14 @@ static void test_extents_cff1 (void) { hb_face_t *face = hb_test_open_font_file ("fonts/SourceSansPro-Regular.abc.otf"); - g_assert (face); + g_assert_true (face); hb_font_t *font = hb_font_create (face); hb_face_destroy (face); - g_assert (font); + g_assert_true (font); hb_glyph_extents_t extents; hb_bool_t result = hb_font_get_glyph_extents (font, 1, &extents); - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, 52); g_assert_cmpint (extents.y_bearing, ==, 498); @@ -50,13 +50,13 @@ test_extents_cff1 (void) hb_font_destroy (font); hb_face_t *face_j = hb_test_open_font_file ("fonts/SourceHanSans-Regular.41,3041,4C2E.otf"); - g_assert (face_j); + g_assert_true (face_j); hb_font_t *font_j = hb_font_create (face_j); hb_face_destroy (face_j); - g_assert (font_j); + g_assert_true (font_j); hb_bool_t result_j = hb_font_get_glyph_extents (font_j, 3, &extents); - g_assert (result_j); + g_assert_true (result_j); g_assert_cmpint (extents.x_bearing, ==, 34); g_assert_cmpint (extents.y_bearing, ==, 840); @@ -70,14 +70,14 @@ static void test_extents_cff1_flex (void) { hb_face_t *face = hb_test_open_font_file ("fonts/cff1_flex.otf"); - g_assert (face); + g_assert_true (face); hb_font_t *font = hb_font_create (face); hb_face_destroy (face); - g_assert (font); + g_assert_true (font); hb_glyph_extents_t extents; hb_bool_t result = hb_font_get_glyph_extents (font, 1, &extents); - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, -20); g_assert_cmpint (extents.y_bearing, ==, 520); @@ -91,14 +91,14 @@ static void test_extents_cff1_seac (void) { hb_face_t *face = hb_test_open_font_file ("fonts/cff1_seac.otf"); - g_assert (face); + g_assert_true (face); hb_font_t *font = hb_font_create (face); hb_face_destroy (face); - g_assert (font); + g_assert_true (font); hb_glyph_extents_t extents; hb_bool_t result = hb_font_get_glyph_extents (font, 3, &extents); /* Agrave */ - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, 3); g_assert_cmpint (extents.y_bearing, ==, 861); @@ -106,7 +106,7 @@ test_extents_cff1_seac (void) g_assert_cmpint (extents.height, ==, -861); result = hb_font_get_glyph_extents (font, 4, &extents); /* Udieresis */ - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, 87); g_assert_cmpint (extents.y_bearing, ==, 827); @@ -120,14 +120,14 @@ static void test_extents_cff2 (void) { hb_face_t *face = hb_test_open_font_file ("fonts/AdobeVFPrototype.abc.otf"); - g_assert (face); + g_assert_true (face); hb_font_t *font = hb_font_create (face); hb_face_destroy (face); - g_assert (font); + g_assert_true (font); hb_glyph_extents_t extents; hb_bool_t result = hb_font_get_glyph_extents (font, 1, &extents); - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, 46); g_assert_cmpint (extents.y_bearing, ==, 487); @@ -137,7 +137,7 @@ test_extents_cff2 (void) float coords[2] = { 600.0f, 50.0f }; hb_font_set_var_coords_design (font, coords, 2); result = hb_font_get_glyph_extents (font, 1, &extents); - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, 38); g_assert_cmpint (extents.y_bearing, ==, 493); @@ -151,16 +151,16 @@ static void test_extents_cff2_vsindex (void) { hb_face_t *face = hb_test_open_font_file ("fonts/AdobeVFPrototype_vsindex.otf"); - g_assert (face); + g_assert_true (face); hb_font_t *font = hb_font_create (face); hb_face_destroy (face); - g_assert (font); + g_assert_true (font); hb_glyph_extents_t extents; float coords[2] = { 800.0f, 50.0f }; hb_font_set_var_coords_design (font, coords, 2); hb_bool_t result = hb_font_get_glyph_extents (font, 1, &extents); - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, 12); g_assert_cmpint (extents.y_bearing, ==, 655); @@ -168,7 +168,7 @@ test_extents_cff2_vsindex (void) g_assert_cmpint (extents.height, ==, -655); result = hb_font_get_glyph_extents (font, 2, &extents); - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, 8); g_assert_cmpint (extents.y_bearing, ==, 669); @@ -182,15 +182,15 @@ static void test_extents_cff2_vsindex_named_instance (void) { hb_face_t *face = hb_test_open_font_file ("fonts/AdobeVFPrototype_vsindex.otf"); - g_assert (face); + g_assert_true (face); hb_font_t *font = hb_font_create (face); hb_face_destroy (face); - g_assert (font); + g_assert_true (font); hb_font_set_var_named_instance (font, 6); // 6 (BlackMediumContrast): 900, 50 hb_glyph_extents_t extents; hb_bool_t result = hb_font_get_glyph_extents (font, 1, &extents); - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, 13); g_assert_cmpint (extents.y_bearing, ==, 652); @@ -198,7 +198,7 @@ test_extents_cff2_vsindex_named_instance (void) g_assert_cmpint (extents.height, ==, -652); result = hb_font_get_glyph_extents (font, 2, &extents); - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, 6); g_assert_cmpint (extents.y_bearing, ==, 675); diff --git a/test/api/test-ot-face.c b/test/api/test-ot-face.c index 7e02bd901..b461526c7 100644 --- a/test/api/test-ot-face.c +++ b/test/api/test-ot-face.c @@ -209,7 +209,7 @@ static void test_ot_var_axis_on_zero_named_instance (void) { hb_face_t *face = hb_test_open_font_file ("fonts/Zycon.ttf"); - g_assert (hb_ot_var_get_axis_count (face)); + g_assert_true (hb_ot_var_get_axis_count (face)); hb_face_destroy (face); } diff --git a/test/api/test-ot-glyphname.c b/test/api/test-ot-glyphname.c index 635da9f18..ffbb01333 100644 --- a/test/api/test-ot-glyphname.c +++ b/test/api/test-ot-glyphname.c @@ -33,9 +33,9 @@ test_one_glyph (hb_font_t *font, hb_codepoint_t gid, const char *name) char buf[64]; hb_codepoint_t glyph; - g_assert(hb_font_get_glyph_name (font, gid, buf, sizeof (buf))); + g_assert_true(hb_font_get_glyph_name (font, gid, buf, sizeof (buf))); g_assert_cmpstr(buf, ==, name); - g_assert(hb_font_get_glyph_from_name (font, name, -1, &glyph)); + g_assert_true(hb_font_get_glyph_from_name (font, name, -1, &glyph)); g_assert_cmpint(glyph, ==, gid); } diff --git a/test/api/test-ot-layout.c b/test/api/test-ot-layout.c index 5c6ccce4d..c3fe0ce74 100644 --- a/test/api/test-ot-layout.c +++ b/test/api/test-ot-layout.c @@ -74,18 +74,18 @@ test_ot_layout_table_find_script (void) hb_face_t *face = hb_test_open_font_file ("fonts/NotoNastaliqUrdu-Regular.ttf"); unsigned int index; - g_assert (hb_ot_layout_table_find_script (face, HB_OT_TAG_GSUB, HB_TAG ('a','r','a','b'), &index)); + g_assert_true (hb_ot_layout_table_find_script (face, HB_OT_TAG_GSUB, HB_TAG ('a','r','a','b'), &index)); g_assert_cmpuint (0, ==, index); - g_assert (hb_ot_layout_table_find_script (face, HB_OT_TAG_GSUB, HB_TAG ('d','f','l','t'), &index)); + g_assert_true (hb_ot_layout_table_find_script (face, HB_OT_TAG_GSUB, HB_TAG ('d','f','l','t'), &index)); g_assert_cmpuint (1, ==, index); - g_assert (hb_ot_layout_table_find_script (face, HB_OT_TAG_GSUB, HB_TAG ('l','a','t','n'), &index)); + g_assert_true (hb_ot_layout_table_find_script (face, HB_OT_TAG_GSUB, HB_TAG ('l','a','t','n'), &index)); g_assert_cmpuint (2, ==, index); - g_assert (hb_ot_layout_table_find_script (face, HB_OT_TAG_GPOS, HB_TAG ('a','r','a','b'), &index)); + g_assert_true (hb_ot_layout_table_find_script (face, HB_OT_TAG_GPOS, HB_TAG ('a','r','a','b'), &index)); g_assert_cmpuint (0, ==, index); - g_assert (!hb_ot_layout_table_find_script (face, HB_OT_TAG_GPOS, HB_TAG ('d','f','l','t'), &index)); + g_assert_true (!hb_ot_layout_table_find_script (face, HB_OT_TAG_GPOS, HB_TAG ('d','f','l','t'), &index)); g_assert_cmpuint (0xFFFF, ==, index); - g_assert (!hb_ot_layout_table_find_script (face, HB_OT_TAG_GPOS, HB_TAG ('l','a','t','n'), &index)); + g_assert_true (!hb_ot_layout_table_find_script (face, HB_OT_TAG_GPOS, HB_TAG ('l','a','t','n'), &index)); g_assert_cmpuint (0xFFFF, ==, index); hb_face_destroy (face); diff --git a/test/api/test-ot-math.c b/test/api/test-ot-math.c index cdeae0556..37de4ea83 100644 --- a/test/api/test-ot-math.c +++ b/test/api/test-ot-math.c @@ -38,22 +38,22 @@ test_has_data (void) hb_font_t *font; face = hb_test_open_font_file ("fonts/MathTestFontNone.otf"); - g_assert (!hb_ot_math_has_data (face)); // MATH table not available + g_assert_true (!hb_ot_math_has_data (face)); // MATH table not available hb_face_destroy (face); face = hb_test_open_font_file ("fonts/MathTestFontEmpty.otf"); - g_assert (hb_ot_math_has_data (face)); // MATH table available + g_assert_true (hb_ot_math_has_data (face)); // MATH table available hb_face_destroy (face); face = hb_face_get_empty (); font = hb_font_create (face); - g_assert (!hb_ot_math_has_data (face)); // MATH table not available + g_assert_true (!hb_ot_math_has_data (face)); // MATH table not available hb_font_destroy (font); hb_face_destroy (face); font = hb_font_get_empty (); face = hb_font_get_face (font); - g_assert (!hb_ot_math_has_data (face)); // MATH table not available + g_assert_true (!hb_ot_math_has_data (face)); // MATH table not available hb_font_destroy (font); hb_face_destroy (face); } @@ -155,21 +155,21 @@ test_get_glyph_italics_correction (void) face = hb_test_open_font_file ("fonts/MathTestFontEmpty.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_italics_correction (font, glyph), ==, 0); // MathGlyphInfo not available hb_font_destroy (font); hb_face_destroy (face); face = hb_test_open_font_file ("fonts/MathTestFontPartial1.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_italics_correction (font, glyph), ==, 0); // MathGlyphInfo empty hb_font_destroy (font); hb_face_destroy (face); face = hb_test_open_font_file ("fonts/MathTestFontPartial2.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_italics_correction (font, glyph), ==, 0); // MathItalicsCorrectionInfo empty hb_font_destroy (font); hb_face_destroy (face); @@ -177,13 +177,13 @@ test_get_glyph_italics_correction (void) face = hb_test_open_font_file ("fonts/MathTestFontFull.otf"); font = hb_font_create (face); hb_font_set_scale (font, 2000, 1000); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_italics_correction (font, glyph), ==, 0); // Glyph without italic correction. - g_assert (hb_font_get_glyph_from_name (font, "A", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "A", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_italics_correction (font, glyph), ==, 394); - g_assert (hb_font_get_glyph_from_name (font, "B", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "B", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_italics_correction (font, glyph), ==, 300); - g_assert (hb_font_get_glyph_from_name (font, "C", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "C", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_italics_correction (font, glyph), ==, 904); hb_font_destroy (font); hb_face_destroy (face); @@ -199,7 +199,7 @@ test_get_glyph_top_accent_attachment (void) face = hb_test_open_font_file ("fonts/MathTestFontEmpty.otf"); font = hb_font_create (face); hb_font_set_scale (font, 2000, 1000); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_top_accent_attachment (font, glyph), ==, 1000); // MathGlyphInfo not available hb_font_destroy (font); hb_face_destroy (face); @@ -207,7 +207,7 @@ test_get_glyph_top_accent_attachment (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial1.otf"); font = hb_font_create (face); hb_font_set_scale (font, 2000, 1000); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_top_accent_attachment (font, glyph), ==, 1000); // MathGlyphInfo empty hb_font_destroy (font); hb_face_destroy (face); @@ -215,7 +215,7 @@ test_get_glyph_top_accent_attachment (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial2.otf"); font = hb_font_create (face); hb_font_set_scale (font, 2000, 1000); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_top_accent_attachment (font, glyph), ==, 1000); // MathTopAccentAttachment empty hb_font_destroy (font); hb_face_destroy (face); @@ -223,13 +223,13 @@ test_get_glyph_top_accent_attachment (void) face = hb_test_open_font_file ("fonts/MathTestFontFull.otf"); font = hb_font_create (face); hb_font_set_scale (font, 2000, 1000); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_top_accent_attachment (font, glyph), ==, 1000); // Glyph without top accent attachment. - g_assert (hb_font_get_glyph_from_name (font, "D", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "D", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_top_accent_attachment (font, glyph), ==, 748); - g_assert (hb_font_get_glyph_from_name (font, "E", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "E", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_top_accent_attachment (font, glyph), ==, 692); - g_assert (hb_font_get_glyph_from_name (font, "F", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "F", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_top_accent_attachment (font, glyph), ==, 636); hb_font_destroy (font); hb_face_destroy (face); @@ -244,24 +244,24 @@ test_is_glyph_extended_shape (void) face = hb_test_open_font_file ("fonts/MathTestFontEmpty.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); - g_assert (!hb_ot_math_is_glyph_extended_shape (face, glyph)); // MathGlyphInfo not available + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (!hb_ot_math_is_glyph_extended_shape (face, glyph)); // MathGlyphInfo not available hb_font_destroy (font); hb_face_destroy (face); face = hb_test_open_font_file ("fonts/MathTestFontPartial1.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); - g_assert (!hb_ot_math_is_glyph_extended_shape (face, glyph)); // MathGlyphInfo empty + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (!hb_ot_math_is_glyph_extended_shape (face, glyph)); // MathGlyphInfo empty hb_font_destroy (font); hb_face_destroy (face); face = hb_test_open_font_file ("fonts/MathTestFontFull.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "G", -1, &glyph)); - g_assert (!hb_ot_math_is_glyph_extended_shape (face, glyph)); - g_assert (hb_font_get_glyph_from_name (font, "H", -1, &glyph)); - g_assert (hb_ot_math_is_glyph_extended_shape (face, glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "G", -1, &glyph)); + g_assert_true (!hb_ot_math_is_glyph_extended_shape (face, glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "H", -1, &glyph)); + g_assert_true (hb_ot_math_is_glyph_extended_shape (face, glyph)); hb_font_destroy (font); hb_face_destroy (face); } @@ -275,7 +275,7 @@ test_get_glyph_kerning (void) face = hb_test_open_font_file ("fonts/MathTestFontEmpty.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_kerning (font, glyph, HB_OT_MATH_KERN_TOP_RIGHT, 0), ==, 0); // MathGlyphInfo not available g_assert_cmpint (hb_ot_math_get_glyph_kerning (font, glyph, HB_OT_MATH_KERN_TOP_LEFT, 0), ==, 0); // MathGlyphInfo not available g_assert_cmpint (hb_ot_math_get_glyph_kerning (font, glyph, HB_OT_MATH_KERN_BOTTOM_RIGHT, 0), ==, 0); // MathGlyphInfo not available @@ -285,7 +285,7 @@ test_get_glyph_kerning (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial2.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_kerning (font, glyph, HB_OT_MATH_KERN_TOP_RIGHT, 0), ==, 0); // MathKernInfo empty g_assert_cmpint (hb_ot_math_get_glyph_kerning (font, glyph, HB_OT_MATH_KERN_TOP_LEFT, 0), ==, 0); // MathKernInfo empty g_assert_cmpint (hb_ot_math_get_glyph_kerning (font, glyph, HB_OT_MATH_KERN_BOTTOM_RIGHT, 0), ==, 0); // MathKernInfo empty @@ -295,7 +295,7 @@ test_get_glyph_kerning (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial3.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_kerning (font, glyph, HB_OT_MATH_KERN_TOP_RIGHT, 0), ==, 0); // MathKernInfoRecords empty g_assert_cmpint (hb_ot_math_get_glyph_kerning (font, glyph, HB_OT_MATH_KERN_TOP_LEFT, 0), ==, 0); // MathKernInfoRecords empty g_assert_cmpint (hb_ot_math_get_glyph_kerning (font, glyph, HB_OT_MATH_KERN_BOTTOM_RIGHT, 0), ==, 0); // MathKernInfoRecords empty @@ -306,7 +306,7 @@ test_get_glyph_kerning (void) face = hb_test_open_font_file ("fonts/MathTestFontFull.otf"); font = hb_font_create (face); hb_font_set_scale (font, 2000, 1000); - g_assert (hb_font_get_glyph_from_name (font, "I", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "I", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_kerning (font, glyph, HB_OT_MATH_KERN_TOP_RIGHT, 7), ==, 62); // lower than min height g_assert_cmpint (hb_ot_math_get_glyph_kerning (font, glyph, HB_OT_MATH_KERN_TOP_RIGHT, 14), ==, 104); // equal to min height @@ -339,7 +339,7 @@ test_get_glyph_kernings (void) face = hb_test_open_font_file ("fonts/MathTestFontEmpty.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_kernings (font, glyph, HB_OT_MATH_KERN_TOP_RIGHT, 0, NULL, NULL), ==, 0); // MathGlyphInfo not available g_assert_cmpint (hb_ot_math_get_glyph_kernings (font, glyph, HB_OT_MATH_KERN_TOP_LEFT, 0, NULL, NULL), ==, 0); // MathGlyphInfo not available g_assert_cmpint (hb_ot_math_get_glyph_kernings (font, glyph, HB_OT_MATH_KERN_BOTTOM_RIGHT, 0, NULL, NULL), ==, 0); // MathGlyphInfo not available @@ -349,7 +349,7 @@ test_get_glyph_kernings (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial2.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_kernings (font, glyph, HB_OT_MATH_KERN_TOP_RIGHT, 0, NULL, NULL), ==, 0); // MathKernInfo empty g_assert_cmpint (hb_ot_math_get_glyph_kernings (font, glyph, HB_OT_MATH_KERN_TOP_LEFT, 0, NULL, NULL), ==, 0); // MathKernInfo empty g_assert_cmpint (hb_ot_math_get_glyph_kernings (font, glyph, HB_OT_MATH_KERN_BOTTOM_RIGHT, 0, NULL, NULL), ==, 0); // MathKernInfo empty @@ -359,7 +359,7 @@ test_get_glyph_kernings (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial3.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_kernings (font, glyph, HB_OT_MATH_KERN_TOP_RIGHT, 0, NULL, NULL), ==, 0); // MathKernInfoRecords empty g_assert_cmpint (hb_ot_math_get_glyph_kernings (font, glyph, HB_OT_MATH_KERN_TOP_LEFT, 0, NULL, NULL), ==, 0); // MathKernInfoRecords empty g_assert_cmpint (hb_ot_math_get_glyph_kernings (font, glyph, HB_OT_MATH_KERN_BOTTOM_RIGHT, 0, NULL, NULL), ==, 0); // MathKernInfoRecords empty @@ -370,7 +370,7 @@ test_get_glyph_kernings (void) face = hb_test_open_font_file ("fonts/MathTestFontFull.otf"); font = hb_font_create (face); hb_font_set_scale (font, 2000, 1000); - g_assert (hb_font_get_glyph_from_name (font, "I", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "I", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_kernings (font, glyph, HB_OT_MATH_KERN_TOP_RIGHT, 0, NULL, NULL), ==, 10); g_assert_cmpint (hb_ot_math_get_glyph_kernings (font, glyph, HB_OT_MATH_KERN_TOP_LEFT, 0, NULL, NULL), ==, 3); @@ -438,7 +438,7 @@ test_get_glyph_assembly_italics_correction (void) face = hb_test_open_font_file ("fonts/MathTestFontEmpty.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (get_glyph_assembly_italics_correction (font, glyph, TRUE), ==, 0); // MathVariants not available g_assert_cmpint (get_glyph_assembly_italics_correction (font, glyph, FALSE), ==, 0); // MathVariants not available hb_font_destroy (font); @@ -446,7 +446,7 @@ test_get_glyph_assembly_italics_correction (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial1.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (get_glyph_assembly_italics_correction (font, glyph, TRUE), ==, 0); // VertGlyphCoverage and HorizGlyphCoverage absent g_assert_cmpint (get_glyph_assembly_italics_correction (font, glyph, FALSE), ==, 0); // VertGlyphCoverage and HorizGlyphCoverage absent hb_font_destroy (font); @@ -454,7 +454,7 @@ test_get_glyph_assembly_italics_correction (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial2.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (get_glyph_assembly_italics_correction (font, glyph, TRUE), ==, 0); // VertGlyphCoverage and HorizGlyphCoverage empty g_assert_cmpint (get_glyph_assembly_italics_correction (font, glyph, FALSE), ==, 0); // VertGlyphCoverage and HorizGlyphCoverage empty hb_font_destroy (font); @@ -462,7 +462,7 @@ test_get_glyph_assembly_italics_correction (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial3.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (get_glyph_assembly_italics_correction (font, glyph, TRUE), ==, 0); // HorizGlyphConstruction and VertGlyphConstruction empty g_assert_cmpint (get_glyph_assembly_italics_correction (font, glyph, FALSE), ==, 0); // HorizGlyphConstruction and VertGlyphConstruction empty hb_font_destroy (font); @@ -470,7 +470,7 @@ test_get_glyph_assembly_italics_correction (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial4.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (get_glyph_assembly_italics_correction (font, glyph, TRUE), ==, 0); g_assert_cmpint (get_glyph_assembly_italics_correction (font, glyph, FALSE), ==, 0); hb_font_destroy (font); @@ -479,10 +479,10 @@ test_get_glyph_assembly_italics_correction (void) face = hb_test_open_font_file ("fonts/MathTestFontFull.otf"); font = hb_font_create (face); hb_font_set_scale (font, 2000, 1000); - g_assert (hb_font_get_glyph_from_name (font, "arrowleft", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "arrowleft", -1, &glyph)); g_assert_cmpint (get_glyph_assembly_italics_correction (font, glyph, TRUE), ==, 248); g_assert_cmpint (get_glyph_assembly_italics_correction (font, glyph, FALSE), ==, 0); - g_assert (hb_font_get_glyph_from_name (font, "arrowup", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "arrowup", -1, &glyph)); g_assert_cmpint (get_glyph_assembly_italics_correction (font, glyph, TRUE), ==, 0); g_assert_cmpint (get_glyph_assembly_italics_correction (font, glyph, FALSE), ==, 662); hb_font_destroy (font); @@ -524,7 +524,7 @@ test_get_glyph_variants (void) face = hb_test_open_font_file ("fonts/MathTestFontEmpty.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_variants (font, glyph, HB_DIRECTION_RTL, 0, NULL, NULL), ==, 0); g_assert_cmpint (hb_ot_math_get_glyph_variants (font, glyph, HB_DIRECTION_BTT, 0, NULL, NULL), ==, 0); hb_font_destroy (font); @@ -532,7 +532,7 @@ test_get_glyph_variants (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial1.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_variants (font, glyph, HB_DIRECTION_RTL, 0, NULL, NULL), ==, 0); g_assert_cmpint (hb_ot_math_get_glyph_variants (font, glyph, HB_DIRECTION_BTT, 0, NULL, NULL), ==, 0); hb_font_destroy (font); @@ -540,7 +540,7 @@ test_get_glyph_variants (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial2.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_variants (font, glyph, HB_DIRECTION_RTL, 0, NULL, NULL), ==, 0); g_assert_cmpint (hb_ot_math_get_glyph_variants (font, glyph, HB_DIRECTION_BTT, 0, NULL, NULL), ==, 0); hb_font_destroy (font); @@ -548,7 +548,7 @@ test_get_glyph_variants (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial3.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_variants (font, glyph, HB_DIRECTION_RTL, 0, NULL, NULL), ==, 0); g_assert_cmpint (hb_ot_math_get_glyph_variants (font, glyph, HB_DIRECTION_BTT, 0, NULL, NULL), ==, 0); hb_font_destroy (font); @@ -556,7 +556,7 @@ test_get_glyph_variants (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial4.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_variants (font, glyph, HB_DIRECTION_RTL, 0, NULL, NULL), ==, 0); g_assert_cmpint (hb_ot_math_get_glyph_variants (font, glyph, HB_DIRECTION_BTT, 0, NULL, NULL), ==, 0); hb_font_destroy (font); @@ -566,7 +566,7 @@ test_get_glyph_variants (void) font = hb_font_create (face); hb_font_set_scale (font, 2000, 1000); - g_assert (hb_font_get_glyph_from_name (font, "arrowleft", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "arrowleft", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_variants (font, glyph, HB_DIRECTION_BTT, @@ -580,7 +580,7 @@ test_get_glyph_variants (void) NULL, NULL), ==, 3); - g_assert (hb_font_get_glyph_from_name (font, "arrowup", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "arrowup", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_variants (font, glyph, HB_DIRECTION_BTT, @@ -594,7 +594,7 @@ test_get_glyph_variants (void) NULL, NULL), ==, 0); - g_assert (hb_font_get_glyph_from_name (font, "arrowleft", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "arrowleft", -1, &glyph)); do { count = variantsSize; hb_ot_math_get_glyph_variants (font, @@ -606,17 +606,17 @@ test_get_glyph_variants (void) offset += count; } while (count == variantsSize); g_assert_cmpint (offset, ==, 3); - g_assert (hb_font_get_glyph_from_name (font, "uni2190_size2", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "uni2190_size2", -1, &glyph)); g_assert_cmpint (variants[0].glyph, ==, glyph); g_assert_cmpint (variants[0].advance, ==, 4302); - g_assert (hb_font_get_glyph_from_name (font, "uni2190_size3", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "uni2190_size3", -1, &glyph)); g_assert_cmpint (variants[1].glyph, ==, glyph); g_assert_cmpint (variants[1].advance, ==, 4802); - g_assert (hb_font_get_glyph_from_name (font, "uni2190_size4", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "uni2190_size4", -1, &glyph)); g_assert_cmpint (variants[2].glyph, ==, glyph); g_assert_cmpint (variants[2].advance, ==, 5802); - g_assert (hb_font_get_glyph_from_name (font, "arrowup", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "arrowup", -1, &glyph)); offset = 0; do { count = variantsSize; @@ -629,16 +629,16 @@ test_get_glyph_variants (void) offset += count; } while (count == variantsSize); g_assert_cmpint (offset, ==, 4); - g_assert (hb_font_get_glyph_from_name (font, "uni2191_size2", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "uni2191_size2", -1, &glyph)); g_assert_cmpint (variants[0].glyph, ==, glyph); g_assert_cmpint (variants[0].advance, ==, 2251); - g_assert (hb_font_get_glyph_from_name (font, "uni2191_size3", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "uni2191_size3", -1, &glyph)); g_assert_cmpint (variants[1].glyph, ==, glyph); g_assert_cmpint (variants[1].advance, ==, 2501); - g_assert (hb_font_get_glyph_from_name (font, "uni2191_size4", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "uni2191_size4", -1, &glyph)); g_assert_cmpint (variants[2].glyph, ==, glyph); g_assert_cmpint (variants[2].advance, ==, 3001); - g_assert (hb_font_get_glyph_from_name (font, "uni2191_size5", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "uni2191_size5", -1, &glyph)); g_assert_cmpint (variants[3].glyph, ==, glyph); g_assert_cmpint (variants[3].advance, ==, 3751); @@ -659,7 +659,7 @@ test_get_glyph_assembly (void) face = hb_test_open_font_file ("fonts/MathTestFontEmpty.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_assembly (font, glyph, HB_DIRECTION_RTL, 0, NULL, NULL, NULL), ==, 0); g_assert_cmpint (hb_ot_math_get_glyph_assembly (font, glyph, HB_DIRECTION_BTT, 0, NULL, NULL, NULL), ==, 0); hb_font_destroy (font); @@ -667,7 +667,7 @@ test_get_glyph_assembly (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial1.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_assembly (font, glyph, HB_DIRECTION_RTL, 0, NULL, NULL, NULL), ==, 0); g_assert_cmpint (hb_ot_math_get_glyph_assembly (font, glyph, HB_DIRECTION_BTT, 0, NULL, NULL, NULL), ==, 0); hb_font_destroy (font); @@ -675,7 +675,7 @@ test_get_glyph_assembly (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial2.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_assembly (font, glyph, HB_DIRECTION_RTL, 0, NULL, NULL, NULL), ==, 0); g_assert_cmpint (hb_ot_math_get_glyph_assembly (font, glyph, HB_DIRECTION_BTT, 0, NULL, NULL, NULL), ==, 0); hb_font_destroy (font); @@ -683,7 +683,7 @@ test_get_glyph_assembly (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial3.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_assembly (font, glyph, HB_DIRECTION_RTL, 0, NULL, NULL, NULL), ==, 0); g_assert_cmpint (hb_ot_math_get_glyph_assembly (font, glyph, HB_DIRECTION_BTT, 0, NULL, NULL, NULL), ==, 0); hb_font_destroy (font); @@ -691,7 +691,7 @@ test_get_glyph_assembly (void) face = hb_test_open_font_file ("fonts/MathTestFontPartial4.otf"); font = hb_font_create (face); - g_assert (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "space", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_assembly (font, glyph, HB_DIRECTION_RTL, 0, NULL, NULL, NULL), ==, 0); g_assert_cmpint (hb_ot_math_get_glyph_assembly (font, glyph, HB_DIRECTION_BTT, 0, NULL, NULL, NULL), ==, 0); hb_font_destroy (font); @@ -701,7 +701,7 @@ test_get_glyph_assembly (void) font = hb_font_create (face); hb_font_set_scale (font, 2000, 1000); - g_assert (hb_font_get_glyph_from_name (font, "arrowright", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "arrowright", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_assembly (font, glyph, HB_DIRECTION_BTT, @@ -717,7 +717,7 @@ test_get_glyph_assembly (void) NULL, NULL), ==, 3); - g_assert (hb_font_get_glyph_from_name (font, "arrowdown", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "arrowdown", -1, &glyph)); g_assert_cmpint (hb_ot_math_get_glyph_assembly (font, glyph, HB_DIRECTION_BTT, @@ -733,7 +733,7 @@ test_get_glyph_assembly (void) NULL, NULL), ==, 0); - g_assert (hb_font_get_glyph_from_name (font, "arrowright", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "arrowright", -1, &glyph)); do { count = partsSize; hb_ot_math_get_glyph_assembly (font, @@ -746,26 +746,26 @@ test_get_glyph_assembly (void) offset += count; } while (count == partsSize); g_assert_cmpint (offset, ==, 3); - g_assert (hb_font_get_glyph_from_name (font, "left", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "left", -1, &glyph)); g_assert_cmpint (parts[0].glyph, ==, glyph); g_assert_cmpint (parts[0].start_connector_length, ==, 800); g_assert_cmpint (parts[0].end_connector_length, ==, 384); g_assert_cmpint (parts[0].full_advance, ==, 2000); - g_assert (!(parts[0].flags & HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER)); - g_assert (hb_font_get_glyph_from_name (font, "horizontal", -1, &glyph)); + g_assert_true (!(parts[0].flags & HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER)); + g_assert_true (hb_font_get_glyph_from_name (font, "horizontal", -1, &glyph)); g_assert_cmpint (parts[1].glyph, ==, glyph); g_assert_cmpint (parts[1].start_connector_length, ==, 524); g_assert_cmpint (parts[1].end_connector_length, ==, 800); g_assert_cmpint (parts[1].full_advance, ==, 2000); - g_assert (parts[1].flags & HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER); - g_assert (hb_font_get_glyph_from_name (font, "right", -1, &glyph)); + g_assert_true (parts[1].flags & HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER); + g_assert_true (hb_font_get_glyph_from_name (font, "right", -1, &glyph)); g_assert_cmpint (parts[2].glyph, ==, glyph); g_assert_cmpint (parts[2].start_connector_length, ==, 316); g_assert_cmpint (parts[2].end_connector_length, ==, 454); g_assert_cmpint (parts[2].full_advance, ==, 2000); - g_assert (!(parts[2].flags & HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER)); + g_assert_true (!(parts[2].flags & HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER)); - g_assert (hb_font_get_glyph_from_name (font, "arrowdown", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "arrowdown", -1, &glyph)); offset = 0; do { count = partsSize; @@ -779,36 +779,36 @@ test_get_glyph_assembly (void) offset += count; } while (count == partsSize); g_assert_cmpint (offset, ==, 5); - g_assert (hb_font_get_glyph_from_name (font, "bottom", -1, &glyph)); + g_assert_true (hb_font_get_glyph_from_name (font, "bottom", -1, &glyph)); g_assert_cmpint (parts[0].glyph, ==, glyph); g_assert_cmpint (parts[0].start_connector_length, ==, 365); g_assert_cmpint (parts[0].end_connector_length, ==, 158); g_assert_cmpint (parts[0].full_advance, ==, 1000); - g_assert (!(parts[0].flags & HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER)); - g_assert (hb_font_get_glyph_from_name (font, "vertical", -1, &glyph)); + g_assert_true (!(parts[0].flags & HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER)); + g_assert_true (hb_font_get_glyph_from_name (font, "vertical", -1, &glyph)); g_assert_cmpint (parts[1].glyph, ==, glyph); g_assert_cmpint (parts[1].start_connector_length, ==, 227); g_assert_cmpint (parts[1].end_connector_length, ==, 365); g_assert_cmpint (parts[1].full_advance, ==, 1000); - g_assert (parts[1].flags & HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER); - g_assert (hb_font_get_glyph_from_name (font, "center", -1, &glyph)); + g_assert_true (parts[1].flags & HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER); + g_assert_true (hb_font_get_glyph_from_name (font, "center", -1, &glyph)); g_assert_cmpint (parts[2].glyph, ==, glyph); g_assert_cmpint (parts[2].start_connector_length, ==, 54); g_assert_cmpint (parts[2].end_connector_length, ==, 158); g_assert_cmpint (parts[2].full_advance, ==, 1000); - g_assert (!(parts[2].flags & HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER)); - g_assert (hb_font_get_glyph_from_name (font, "vertical", -1, &glyph)); + g_assert_true (!(parts[2].flags & HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER)); + g_assert_true (hb_font_get_glyph_from_name (font, "vertical", -1, &glyph)); g_assert_cmpint (parts[3].glyph, ==, glyph); g_assert_cmpint (parts[3].start_connector_length, ==, 400); g_assert_cmpint (parts[3].end_connector_length, ==, 296); g_assert_cmpint (parts[3].full_advance, ==, 1000); - g_assert (parts[1].flags & HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER); - g_assert (hb_font_get_glyph_from_name (font, "top", -1, &glyph)); + g_assert_true (parts[1].flags & HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER); + g_assert_true (hb_font_get_glyph_from_name (font, "top", -1, &glyph)); g_assert_cmpint (parts[4].glyph, ==, glyph); g_assert_cmpint (parts[4].start_connector_length, ==, 123); g_assert_cmpint (parts[4].end_connector_length, ==, 192); g_assert_cmpint (parts[4].full_advance, ==, 1000); - g_assert (!(parts[4].flags & HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER)); + g_assert_true (!(parts[4].flags & HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER)); hb_font_destroy (font); hb_face_destroy (face); diff --git a/test/api/test-ot-metrics-tt-var.c b/test/api/test-ot-metrics-tt-var.c index 43f77a97b..cc0031470 100644 --- a/test/api/test-ot-metrics-tt-var.c +++ b/test/api/test-ot-metrics-tt-var.c @@ -33,14 +33,14 @@ static void test_extents_tt_var (void) { hb_face_t *face = hb_test_open_font_file ("fonts/SourceSansVariable-Roman-nohvar-41,C1.ttf"); - g_assert (face); + g_assert_true (face); hb_font_t *font = hb_font_create (face); hb_face_destroy (face); - g_assert (font); + g_assert_true (font); hb_glyph_extents_t extents; hb_bool_t result = hb_font_get_glyph_extents (font, 2, &extents); - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, 10); g_assert_cmpint (extents.y_bearing, ==, 846); @@ -50,7 +50,7 @@ test_extents_tt_var (void) float coords[1] = { 500.0f }; hb_font_set_var_coords_design (font, coords, 1); result = hb_font_get_glyph_extents (font, 2, &extents); - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, 0); g_assert_cmpint (extents.y_bearing, ==, 874); @@ -64,10 +64,10 @@ static void test_advance_tt_var_nohvar (void) { hb_face_t *face = hb_test_open_font_file ("fonts/SourceSansVariable-Roman-nohvar-41,C1.ttf"); - g_assert (face); + g_assert_true (face); hb_font_t *font = hb_font_create (face); hb_face_destroy (face); - g_assert (font); + g_assert_true (font); hb_position_t x, y; hb_font_get_glyph_advance_for_direction(font, 2, HB_DIRECTION_LTR, &x, &y); @@ -99,10 +99,10 @@ static void test_advance_tt_var_hvarvvar (void) { hb_face_t *face = hb_test_open_font_file ("fonts/SourceSerifVariable-Roman-VVAR.abc.ttf"); - g_assert (face); + g_assert_true (face); hb_font_t *font = hb_font_create (face); hb_face_destroy (face); - g_assert (font); + g_assert_true (font); hb_position_t x, y; hb_font_get_glyph_advance_for_direction(font, 1, HB_DIRECTION_LTR, &x, &y); @@ -134,14 +134,14 @@ static void test_advance_tt_var_anchor (void) { hb_face_t *face = hb_test_open_font_file ("fonts/SourceSansVariable-Roman.anchor.ttf"); - g_assert (face); + g_assert_true (face); hb_font_t *font = hb_font_create (face); hb_face_destroy (face); - g_assert (font); + g_assert_true (font); hb_glyph_extents_t extents; hb_bool_t result = hb_font_get_glyph_extents (font, 2, &extents); - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, 56); g_assert_cmpint (extents.y_bearing, ==, 672); @@ -151,7 +151,7 @@ test_advance_tt_var_anchor (void) float coords[1] = { 500.0f }; hb_font_set_var_coords_design (font, coords, 1); result = hb_font_get_glyph_extents (font, 2, &extents); - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, 50); g_assert_cmpint (extents.y_bearing, ==, 667); @@ -165,10 +165,10 @@ static void test_extents_tt_var_comp (void) { hb_face_t *face = hb_test_open_font_file ("fonts/SourceSansVariable-Roman.modcomp.ttf"); - g_assert (face); + g_assert_true (face); hb_font_t *font = hb_font_create (face); hb_face_destroy (face); - g_assert (font); + g_assert_true (font); hb_glyph_extents_t extents; float coords[1] = { 800.0f }; @@ -176,7 +176,7 @@ test_extents_tt_var_comp (void) hb_bool_t result; result = hb_font_get_glyph_extents (font, 2, &extents); /* Ccedilla, cedilla y-scaled by 0.8, with unscaled component offset */ - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, 19); g_assert_cmpint (extents.y_bearing, ==, 663); @@ -184,7 +184,7 @@ test_extents_tt_var_comp (void) g_assert_cmpint (extents.height, ==, -895); result = hb_font_get_glyph_extents (font, 3, &extents); /* Cacute, acute y-scaled by 0.8, with unscaled component offset (default) */ - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, 19); g_assert_cmpint (extents.y_bearing, ==, 909); @@ -192,7 +192,7 @@ test_extents_tt_var_comp (void) g_assert_cmpint (extents.height, ==, -921); result = hb_font_get_glyph_extents (font, 4, &extents); /* Ccaron, caron y-scaled by 0.8, with scaled component offset */ - g_assert (result); + g_assert_true (result); g_assert_cmpint (extents.x_bearing, ==, 19); g_assert_cmpint (extents.y_bearing, ==, 866); @@ -206,10 +206,10 @@ static void test_advance_tt_var_comp_v (void) { hb_face_t *face = hb_test_open_font_file ("fonts/SourceSansVariable-Roman.modcomp.ttf"); - g_assert (face); + g_assert_true (face); hb_font_t *font = hb_font_create (face); hb_face_destroy (face); - g_assert (font); + g_assert_true (font); float coords[1] = { 800.0f }; hb_font_set_var_coords_design (font, coords, 1); @@ -239,7 +239,7 @@ test_advance_tt_var_gvar_infer (void) hb_font_set_var_coords_normalized (font, coords, 6); hb_glyph_extents_t extents = {0}; - g_assert (hb_font_get_glyph_extents (font, 4, &extents)); + g_assert_true (hb_font_get_glyph_extents (font, 4, &extents)); hb_font_destroy (font); } diff --git a/test/api/test-ot-metrics.c b/test/api/test-ot-metrics.c index 34f9196d8..2c57d7b82 100644 --- a/test/api/test-ot-metrics.c +++ b/test/api/test-ot-metrics.c @@ -36,7 +36,7 @@ test_ot_metrics_get_no_var (void) hb_face_t *face = hb_test_open_font_file ("fonts/cpal-v0.ttf"); hb_font_t *font = hb_font_create (face); hb_position_t value; - g_assert (hb_ot_metrics_get_position (font, HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER, &value)); + g_assert_true (hb_ot_metrics_get_position (font, HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER, &value)); g_assert_cmpint (value, ==, 1000); g_assert_cmpint (hb_ot_metrics_get_x_variation (font, HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER), ==, 0); g_assert_cmpint (hb_ot_metrics_get_y_variation (font, HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER), ==, 0); @@ -52,14 +52,14 @@ test_ot_metrics_get_var (void) hb_face_t *face = hb_test_open_font_file ("fonts/TestCFF2VF.otf"); hb_font_t *font = hb_font_create (face); hb_position_t value; - g_assert (hb_ot_metrics_get_position (font, HB_OT_METRICS_TAG_X_HEIGHT, &value)); + g_assert_true (hb_ot_metrics_get_position (font, HB_OT_METRICS_TAG_X_HEIGHT, &value)); g_assert_cmpint (value, ==, 486); g_assert_cmpint (hb_ot_metrics_get_x_variation (font, HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER), ==, 0); g_assert_cmpint (hb_ot_metrics_get_y_variation (font, HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER), ==, 0); g_assert_cmpint (hb_ot_metrics_get_x_variation (font, HB_OT_METRICS_TAG_X_HEIGHT), ==, 0); float coords[] = {100.f}; hb_font_set_var_coords_design (font, coords, 1); - g_assert (hb_ot_metrics_get_position (font, HB_OT_METRICS_TAG_X_HEIGHT, &value)); + g_assert_true (hb_ot_metrics_get_position (font, HB_OT_METRICS_TAG_X_HEIGHT, &value)); g_assert_cmpint (value, ==, 478); g_assert_cmpint (hb_ot_metrics_get_x_variation (font, HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER), ==, 0); g_assert_cmpint (hb_ot_metrics_get_y_variation (font, HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER), ==, 0); diff --git a/test/api/test-ot-tag.c b/test/api/test-ot-tag.c index 291049003..87961804b 100644 --- a/test/api/test-ot-tag.c +++ b/test/api/test-ot-tag.c @@ -223,7 +223,7 @@ test_language_two_way (const char *tag_s, const char *lang_s) g_assert_cmphex (tag, ==, tag2); else g_assert_cmphex (tag, ==, HB_TAG_CHAR4 ("dflt")); - g_assert (lang == hb_ot_tag_to_language (tag)); + g_assert_true (lang == hb_ot_tag_to_language (tag)); } static void @@ -254,7 +254,7 @@ test_tag_to_language (const char *tag_s, const char *lang_s) g_test_message ("Testing tag %s -> language %s", tag_s, lang_s); - g_assert (lang == hb_ot_tag_to_language (tag)); + g_assert_true (lang == hb_ot_tag_to_language (tag)); } static void @@ -511,8 +511,8 @@ test_tags (hb_script_t script, hb_tag_t *script_tags = malloc (script_count * sizeof (hb_tag_t)); hb_tag_t *language_tags = malloc (language_count * sizeof (hb_tag_t)); hb_language_t lang; - g_assert (script_tags); - g_assert (language_tags); + g_assert_true (script_tags); + g_assert_true (language_tags); lang = hb_language_from_string (lang_s, -1); va_start (expected_tags, expected_language_count); diff --git a/test/api/test-set.c b/test/api/test-set.c index 1f1402142..b83cc55b9 100644 --- a/test/api/test-set.c +++ b/test/api/test-set.c @@ -36,14 +36,14 @@ test_empty (hb_set_t *s) g_assert_cmpint (hb_set_get_population (s), ==, 0); g_assert_cmpint (hb_set_get_min (s), ==, HB_SET_VALUE_INVALID); g_assert_cmpint (hb_set_get_max (s), ==, HB_SET_VALUE_INVALID); - g_assert (!hb_set_has (s, 13)); + g_assert_true (!hb_set_has (s, 13)); next = 53043; - g_assert (!hb_set_next (s, &next)); + g_assert_true (!hb_set_next (s, &next)); g_assert_cmpint (next, ==, HB_SET_VALUE_INVALID); next = 07734; - g_assert (!hb_set_previous (s, &next)); + g_assert_true (!hb_set_previous (s, &next)); g_assert_cmpint (next, ==, HB_SET_VALUE_INVALID); - g_assert (hb_set_is_empty (s)); + g_assert_true (hb_set_is_empty (s)); } static void @@ -54,10 +54,10 @@ test_not_empty (hb_set_t *s) g_assert_cmpint (hb_set_get_min (s), !=, HB_SET_VALUE_INVALID); g_assert_cmpint (hb_set_get_max (s), !=, HB_SET_VALUE_INVALID); next = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (s, &next)); + g_assert_true (hb_set_next (s, &next)); g_assert_cmpint (next, !=, HB_SET_VALUE_INVALID); next = HB_SET_VALUE_INVALID; - g_assert (hb_set_previous (s, &next)); + g_assert_true (hb_set_previous (s, &next)); g_assert_cmpint (next, !=, HB_SET_VALUE_INVALID); } @@ -79,47 +79,47 @@ test_set_basic (void) hb_set_add_range (s, 10, 29); test_not_empty (s); - g_assert (hb_set_has (s, 13)); + g_assert_true (hb_set_has (s, 13)); g_assert_cmpint (hb_set_get_population (s), ==, 20); g_assert_cmpint (hb_set_get_min (s), ==, 10); g_assert_cmpint (hb_set_get_max (s), ==, 29); test_not_empty (s); - g_assert (hb_set_has (s, 13)); + g_assert_true (hb_set_has (s, 13)); g_assert_cmpint (hb_set_get_population (s), ==, 20); g_assert_cmpint (hb_set_get_min (s), ==, 10); g_assert_cmpint (hb_set_get_max (s), ==, 29); hb_set_del_range (s, 10, 18); test_not_empty (s); - g_assert (!hb_set_has (s, 13)); + g_assert_true (!hb_set_has (s, 13)); hb_set_add_range (s, 200, 800); test_not_empty (s); - g_assert (!hb_set_has (s, 100)); - g_assert (!hb_set_has (s, 199)); - g_assert (hb_set_has (s, 200)); - g_assert (hb_set_has (s, 201)); - g_assert (hb_set_has (s, 243)); - g_assert (hb_set_has (s, 254)); - g_assert (hb_set_has (s, 255)); - g_assert (hb_set_has (s, 256)); - g_assert (hb_set_has (s, 257)); - g_assert (hb_set_has (s, 511)); - g_assert (hb_set_has (s, 512)); - g_assert (hb_set_has (s, 600)); - g_assert (hb_set_has (s, 767)); - g_assert (hb_set_has (s, 768)); - g_assert (hb_set_has (s, 769)); - g_assert (hb_set_has (s, 782)); - g_assert (hb_set_has (s, 798)); - g_assert (hb_set_has (s, 799)); - g_assert (hb_set_has (s, 800)); - g_assert (!hb_set_has (s, 801)); - g_assert (!hb_set_has (s, 802)); + g_assert_true (!hb_set_has (s, 100)); + g_assert_true (!hb_set_has (s, 199)); + g_assert_true (hb_set_has (s, 200)); + g_assert_true (hb_set_has (s, 201)); + g_assert_true (hb_set_has (s, 243)); + g_assert_true (hb_set_has (s, 254)); + g_assert_true (hb_set_has (s, 255)); + g_assert_true (hb_set_has (s, 256)); + g_assert_true (hb_set_has (s, 257)); + g_assert_true (hb_set_has (s, 511)); + g_assert_true (hb_set_has (s, 512)); + g_assert_true (hb_set_has (s, 600)); + g_assert_true (hb_set_has (s, 767)); + g_assert_true (hb_set_has (s, 768)); + g_assert_true (hb_set_has (s, 769)); + g_assert_true (hb_set_has (s, 782)); + g_assert_true (hb_set_has (s, 798)); + g_assert_true (hb_set_has (s, 799)); + g_assert_true (hb_set_has (s, 800)); + g_assert_true (!hb_set_has (s, 801)); + g_assert_true (!hb_set_has (s, 802)); hb_set_del (s, 800); - g_assert (!hb_set_has (s, 800)); + g_assert_true (!hb_set_has (s, 800)); g_assert_cmpint (hb_set_get_max (s), ==, 799); @@ -152,7 +152,7 @@ static void test_set_intersect_empty (void) hb_set_add (b, 24064); hb_set_intersect (a, b); - g_assert (hb_set_is_empty (a)); + g_assert_true (hb_set_is_empty (a)); hb_set_destroy (a); hb_set_destroy (b); @@ -165,7 +165,7 @@ static void test_set_intersect_empty (void) hb_set_add (b, 0); hb_set_intersect (a, b); - g_assert (hb_set_is_empty (a)); + g_assert_true (hb_set_is_empty (a)); hb_set_destroy (a); hb_set_destroy (b); @@ -183,7 +183,7 @@ static void test_set_intersect_page_reduction (void) hb_set_add (b, 24405); hb_set_intersect(a, b); - g_assert (hb_set_is_equal (a, b)); + g_assert_true (hb_set_is_equal (a, b)); hb_set_destroy (a); hb_set_destroy (b); @@ -208,7 +208,7 @@ static void test_set_union (void) hb_set_add (u, 24405); hb_set_union(b, a); - g_assert (hb_set_is_equal (u, b)); + g_assert_true (hb_set_is_equal (u, b)); hb_set_destroy (a); hb_set_destroy (b); @@ -223,24 +223,24 @@ test_set_subsets (void) hb_set_add (l, 0x0FFFF); hb_set_add (s, 0x1FFFF); - g_assert (!hb_set_is_subset (s, l)); + g_assert_true (!hb_set_is_subset (s, l)); hb_set_clear (s); hb_set_add (s, 0x0FFF0); - g_assert (!hb_set_is_subset (s, l)); + g_assert_true (!hb_set_is_subset (s, l)); hb_set_clear (s); hb_set_add (s, 0x0AFFF); - g_assert (!hb_set_is_subset (s, l)); + g_assert_true (!hb_set_is_subset (s, l)); hb_set_clear (s); - g_assert (hb_set_is_subset (s, l)); + g_assert_true (hb_set_is_subset (s, l)); hb_set_clear (l); - g_assert (hb_set_is_subset (s, l)); + g_assert_true (hb_set_is_subset (s, l)); hb_set_add (s, 0x1FFFF); - g_assert (!hb_set_is_subset (s, l)); + g_assert_true (!hb_set_is_subset (s, l)); hb_set_clear (s); hb_set_add (s, 0xFF); @@ -251,17 +251,17 @@ test_set_subsets (void) hb_set_add (l, 0x1FFFF); hb_set_add (l, 0x2FFFF); - g_assert (hb_set_is_subset (s, l)); + g_assert_true (hb_set_is_subset (s, l)); hb_set_del (l, 0xFF); - g_assert (!hb_set_is_subset (s, l)); + g_assert_true (!hb_set_is_subset (s, l)); hb_set_add (l, 0xFF); hb_set_del (l, 0x2FFFF); - g_assert (!hb_set_is_subset (s, l)); + g_assert_true (!hb_set_is_subset (s, l)); hb_set_add (l, 0x2FFFF); hb_set_del (l, 0x1FFFF); - g_assert (!hb_set_is_subset (s, l)); + g_assert_true (!hb_set_is_subset (s, l)); hb_set_destroy (s); hb_set_destroy (l); @@ -280,13 +280,13 @@ test_set_algebra (void) hb_set_add (o2, 0x660E); test_empty (s); - g_assert (!hb_set_is_equal (s, o)); - g_assert (hb_set_is_subset (s, o)); - g_assert (!hb_set_is_subset (o, s)); + g_assert_true (!hb_set_is_equal (s, o)); + g_assert_true (hb_set_is_subset (s, o)); + g_assert_true (!hb_set_is_subset (o, s)); hb_set_set (s, o); - g_assert (hb_set_is_equal (s, o)); - g_assert (hb_set_is_subset (s, o)); - g_assert (hb_set_is_subset (o, s)); + g_assert_true (hb_set_is_equal (s, o)); + g_assert_true (hb_set_is_subset (s, o)); + g_assert_true (hb_set_is_subset (o, s)); test_not_empty (s); g_assert_cmpint (hb_set_get_population (s), ==, 2); @@ -296,50 +296,50 @@ test_set_algebra (void) g_assert_cmpint (hb_set_get_population (s), ==, 1); hb_set_union (s, o); g_assert_cmpint (hb_set_get_population (s), ==, 3); - g_assert (hb_set_has (s, 10)); - g_assert (hb_set_has (s, 13)); + g_assert_true (hb_set_has (s, 10)); + g_assert_true (hb_set_has (s, 13)); hb_set_clear (s); test_empty (s); g_assert_cmpint (hb_set_get_population (s), ==, 0); hb_set_union (s, o2); g_assert_cmpint (hb_set_get_population (s), ==, 1); - g_assert (hb_set_has (s, 0x660E)); + g_assert_true (hb_set_has (s, 0x660E)); hb_set_clear (s); test_empty (s); hb_set_add_range (s, 10, 17); - g_assert (!hb_set_is_equal (s, o)); + g_assert_true (!hb_set_is_equal (s, o)); hb_set_intersect (s, o); - g_assert (!hb_set_is_equal (s, o)); + g_assert_true (!hb_set_is_equal (s, o)); test_not_empty (s); g_assert_cmpint (hb_set_get_population (s), ==, 1); - g_assert (!hb_set_has (s, 10)); - g_assert (hb_set_has (s, 13)); + g_assert_true (!hb_set_has (s, 10)); + g_assert_true (hb_set_has (s, 13)); hb_set_clear (s); test_empty (s); hb_set_add_range (s, 10, 17); - g_assert (!hb_set_is_equal (s, o)); + g_assert_true (!hb_set_is_equal (s, o)); hb_set_subtract (s, o); - g_assert (!hb_set_is_equal (s, o)); + g_assert_true (!hb_set_is_equal (s, o)); test_not_empty (s); g_assert_cmpint (hb_set_get_population (s), ==, 7); - g_assert (hb_set_has (s, 12)); - g_assert (!hb_set_has (s, 13)); - g_assert (!hb_set_has (s, 19)); + g_assert_true (hb_set_has (s, 12)); + g_assert_true (!hb_set_has (s, 13)); + g_assert_true (!hb_set_has (s, 19)); hb_set_clear (s); test_empty (s); hb_set_add_range (s, 10, 17); - g_assert (!hb_set_is_equal (s, o)); + g_assert_true (!hb_set_is_equal (s, o)); hb_set_symmetric_difference (s, o); - g_assert (!hb_set_is_equal (s, o)); + g_assert_true (!hb_set_is_equal (s, o)); test_not_empty (s); g_assert_cmpint (hb_set_get_population (s), ==, 8); - g_assert (hb_set_has (s, 12)); - g_assert (!hb_set_has (s, 13)); - g_assert (hb_set_has (s, 19)); + g_assert_true (hb_set_has (s, 12)); + g_assert_true (!hb_set_has (s, 13)); + g_assert_true (hb_set_has (s, 19)); /* https://github.com/harfbuzz/harfbuzz/issues/579 */ hb_set_clear (s); @@ -351,25 +351,25 @@ test_set_algebra (void) test_empty (o); hb_set_add (o, 889); hb_set_add (o, 1024); - g_assert (!hb_set_is_equal (s, o)); + g_assert_true (!hb_set_is_equal (s, o)); hb_set_intersect (o, s); test_not_empty (o); - g_assert (!hb_set_is_equal (s, o)); + g_assert_true (!hb_set_is_equal (s, o)); g_assert_cmpint (hb_set_get_population (o), ==, 2); - g_assert (hb_set_has (o, 889)); - g_assert (hb_set_has (o, 1024)); + g_assert_true (hb_set_has (o, 889)); + g_assert_true (hb_set_has (o, 1024)); hb_set_clear (o); test_empty (o); hb_set_add_range (o, 887, 889); hb_set_add (o, 1121); - g_assert (!hb_set_is_equal (s, o)); + g_assert_true (!hb_set_is_equal (s, o)); hb_set_intersect (o, s); test_not_empty (o); - g_assert (!hb_set_is_equal (s, o)); + g_assert_true (!hb_set_is_equal (s, o)); g_assert_cmpint (hb_set_get_population (o), ==, 3); - g_assert (hb_set_has (o, 887)); - g_assert (hb_set_has (o, 888)); - g_assert (hb_set_has (o, 889)); + g_assert_true (hb_set_has (o, 887)); + g_assert_true (hb_set_has (o, 888)); + g_assert_true (hb_set_has (o, 889)); hb_set_clear (s); test_empty (s); @@ -387,13 +387,13 @@ test_set_algebra (void) g_assert_cmpint (hb_set_get_population (o), ==, 1); hb_set_intersect (o, s); g_assert_cmpint (hb_set_get_population (o), ==, 1); - g_assert (hb_set_has (o, 889)); + g_assert_true (hb_set_has (o, 889)); hb_set_add (o, 511); g_assert_cmpint (hb_set_get_population (o), ==, 2); hb_set_intersect (o, s); g_assert_cmpint (hb_set_get_population (o), ==, 1); - g_assert (hb_set_has (o, 889)); + g_assert_true (hb_set_has (o, 889)); hb_set_destroy (s); hb_set_destroy (o); @@ -416,84 +416,84 @@ test_set_iter (void) test_not_empty (s); next = HB_SET_VALUE_INVALID; - g_assert (hb_set_next (s, &next)); + g_assert_true (hb_set_next (s, &next)); g_assert_cmpint (next, ==, 6); - g_assert (hb_set_next (s, &next)); + g_assert_true (hb_set_next (s, &next)); g_assert_cmpint (next, ==, 10); - g_assert (hb_set_next (s, &next)); - g_assert (hb_set_next (s, &next)); - g_assert (hb_set_next (s, &next)); + g_assert_true (hb_set_next (s, &next)); + g_assert_true (hb_set_next (s, &next)); + g_assert_true (hb_set_next (s, &next)); g_assert_cmpint (next, ==, 13); - g_assert (hb_set_next (s, &next)); - g_assert (hb_set_next (s, &next)); + g_assert_true (hb_set_next (s, &next)); + g_assert_true (hb_set_next (s, &next)); g_assert_cmpint (next, ==, 15); - g_assert (hb_set_next (s, &next)); + g_assert_true (hb_set_next (s, &next)); g_assert_cmpint (next, ==, 1100); - g_assert (hb_set_next (s, &next)); + g_assert_true (hb_set_next (s, &next)); g_assert_cmpint (next, ==, 1200); - g_assert (hb_set_next (s, &next)); + g_assert_true (hb_set_next (s, &next)); g_assert_cmpint (next, ==, 20005); - g_assert (!hb_set_next (s, &next)); + g_assert_true (!hb_set_next (s, &next)); g_assert_cmpint (next, ==, HB_SET_VALUE_INVALID); next = HB_SET_VALUE_INVALID; - g_assert (hb_set_previous (s, &next)); + g_assert_true (hb_set_previous (s, &next)); g_assert_cmpint (next, ==, 20005); - g_assert (hb_set_previous (s, &next)); + g_assert_true (hb_set_previous (s, &next)); g_assert_cmpint (next, ==, 1200); - g_assert (hb_set_previous (s, &next)); + g_assert_true (hb_set_previous (s, &next)); g_assert_cmpint (next, ==, 1100); - g_assert (hb_set_previous (s, &next)); + g_assert_true (hb_set_previous (s, &next)); g_assert_cmpint (next, ==, 15); - g_assert (hb_set_previous (s, &next)); - g_assert (hb_set_previous (s, &next)); + g_assert_true (hb_set_previous (s, &next)); + g_assert_true (hb_set_previous (s, &next)); g_assert_cmpint (next, ==, 13); - g_assert (hb_set_previous (s, &next)); - g_assert (hb_set_previous (s, &next)); - g_assert (hb_set_previous (s, &next)); + g_assert_true (hb_set_previous (s, &next)); + g_assert_true (hb_set_previous (s, &next)); + g_assert_true (hb_set_previous (s, &next)); g_assert_cmpint (next, ==, 10); - g_assert (hb_set_previous (s, &next)); + g_assert_true (hb_set_previous (s, &next)); g_assert_cmpint (next, ==, 6); - g_assert (!hb_set_previous (s, &next)); + g_assert_true (!hb_set_previous (s, &next)); g_assert_cmpint (next, ==, HB_SET_VALUE_INVALID); first = last = HB_SET_VALUE_INVALID; - g_assert (hb_set_next_range (s, &first, &last)); + g_assert_true (hb_set_next_range (s, &first, &last)); g_assert_cmpint (first, ==, 6); g_assert_cmpint (last, ==, 6); - g_assert (hb_set_next_range (s, &first, &last)); + g_assert_true (hb_set_next_range (s, &first, &last)); g_assert_cmpint (first, ==, 10); g_assert_cmpint (last, ==, 15); - g_assert (hb_set_next_range (s, &first, &last)); + g_assert_true (hb_set_next_range (s, &first, &last)); g_assert_cmpint (first, ==, 1100); g_assert_cmpint (last, ==, 1100); - g_assert (hb_set_next_range (s, &first, &last)); + g_assert_true (hb_set_next_range (s, &first, &last)); g_assert_cmpint (first, ==, 1200); g_assert_cmpint (last, ==, 1200); - g_assert (hb_set_next_range (s, &first, &last)); + g_assert_true (hb_set_next_range (s, &first, &last)); g_assert_cmpint (first, ==, 20005); g_assert_cmpint (last, ==, 20005); - g_assert (!hb_set_next_range (s, &first, &last)); + g_assert_true (!hb_set_next_range (s, &first, &last)); g_assert_cmpint (first, ==, HB_SET_VALUE_INVALID); g_assert_cmpint (last, ==, HB_SET_VALUE_INVALID); first = last = HB_SET_VALUE_INVALID; - g_assert (hb_set_previous_range (s, &first, &last)); + g_assert_true (hb_set_previous_range (s, &first, &last)); g_assert_cmpint (first, ==, 20005); g_assert_cmpint (last, ==, 20005); - g_assert (hb_set_previous_range (s, &first, &last)); + g_assert_true (hb_set_previous_range (s, &first, &last)); g_assert_cmpint (first, ==, 1200); g_assert_cmpint (last, ==, 1200); - g_assert (hb_set_previous_range (s, &first, &last)); + g_assert_true (hb_set_previous_range (s, &first, &last)); g_assert_cmpint (first, ==, 1100); g_assert_cmpint (last, ==, 1100); - g_assert (hb_set_previous_range (s, &first, &last)); + g_assert_true (hb_set_previous_range (s, &first, &last)); g_assert_cmpint (first, ==, 10); g_assert_cmpint (last, ==, 15); - g_assert (hb_set_previous_range (s, &first, &last)); + g_assert_true (hb_set_previous_range (s, &first, &last)); g_assert_cmpint (first, ==, 6); g_assert_cmpint (last, ==, 6); - g_assert (!hb_set_previous_range (s, &first, &last)); + g_assert_true (!hb_set_previous_range (s, &first, &last)); g_assert_cmpint (first, ==, HB_SET_VALUE_INVALID); g_assert_cmpint (last, ==, HB_SET_VALUE_INVALID); @@ -505,10 +505,10 @@ test_set_empty (void) { hb_set_t *b = hb_set_get_empty (); - g_assert (hb_set_get_empty ()); - g_assert (hb_set_get_empty () == b); + g_assert_true (hb_set_get_empty ()); + g_assert_true (hb_set_get_empty () == b); - g_assert (!hb_set_allocation_successful (b)); + g_assert_true (!hb_set_allocation_successful (b)); test_empty (b); @@ -516,13 +516,13 @@ test_set_empty (void) test_empty (b); - g_assert (!hb_set_allocation_successful (b)); + g_assert_true (!hb_set_allocation_successful (b)); hb_set_clear (b); test_empty (b); - g_assert (!hb_set_allocation_successful (b)); + g_assert_true (!hb_set_allocation_successful (b)); hb_set_destroy (b); } @@ -565,10 +565,10 @@ test_set_delrange (void) { unsigned b = ranges[i].b; unsigned e = ranges[i].e; - g_assert (hb_set_has (s, (b-2)&~1)); + g_assert_true (hb_set_has (s, (b-2)&~1)); while (b <= e) - g_assert (!hb_set_has (s, b++)); - g_assert (hb_set_has (s, (e+2)&~1)); + g_assert_true (!hb_set_has (s, b++)); + g_assert_true (hb_set_has (s, (e+2)&~1)); } hb_set_destroy (s); @@ -586,29 +586,29 @@ test_set_inverted_basics (void) hb_set_invert (s); g_assert_cmpint (hb_set_get_population (s), ==, max_set_elements); - g_assert (hb_set_has (s, 0)); - g_assert (hb_set_has (s, 13)); - g_assert (hb_set_has (s, max_set_elements - 1)); - g_assert (!hb_set_is_empty (s)); + g_assert_true (hb_set_has (s, 0)); + g_assert_true (hb_set_has (s, 13)); + g_assert_true (hb_set_has (s, max_set_elements - 1)); + g_assert_true (!hb_set_is_empty (s)); g_assert_cmpint (hb_set_get_min (s), ==, 0); g_assert_cmpint (hb_set_get_max (s), ==, max_set_elements - 1); hb_set_del (s, 13); - g_assert (!hb_set_has (s, 13)); + g_assert_true (!hb_set_has (s, 13)); g_assert_cmpint (hb_set_get_population (s), ==, max_set_elements - 1); g_assert_cmpint (hb_set_get_min (s), ==, 0); g_assert_cmpint (hb_set_get_max (s), ==, max_set_elements - 1); hb_set_add (s, 13); - g_assert (hb_set_has (s, 13)); + g_assert_true (hb_set_has (s, 13)); g_assert_cmpint (hb_set_get_population (s), ==, max_set_elements); hb_set_del (s, 0); hb_set_del (s, max_set_elements - 1); - g_assert (!hb_set_has (s, 0)); - g_assert (hb_set_has (s, 13)); - g_assert (!hb_set_has (s, max_set_elements - 1)); - g_assert (!hb_set_is_empty (s)); + g_assert_true (!hb_set_has (s, 0)); + g_assert_true (hb_set_has (s, 13)); + g_assert_true (!hb_set_has (s, max_set_elements - 1)); + g_assert_true (!hb_set_is_empty (s)); g_assert_cmpint (hb_set_get_population (s), ==, max_set_elements - 2); g_assert_cmpint (hb_set_get_min (s), ==, 1); g_assert_cmpint (hb_set_get_max (s), ==, max_set_elements - 2); @@ -628,39 +628,39 @@ test_set_inverted_ranges (void) hb_set_del_range (s, 41, 4000); hb_set_add_range (s, 78, 601); - g_assert (hb_set_has (s, 40)); - g_assert (!hb_set_has (s, 41)); - g_assert (!hb_set_has (s, 64)); - g_assert (!hb_set_has (s, 77)); - g_assert (hb_set_has (s, 78)); - g_assert (hb_set_has (s, 300)); - g_assert (hb_set_has (s, 601)); - g_assert (!hb_set_has (s, 602)); - g_assert (!hb_set_has (s, 3000)); - g_assert (!hb_set_has (s, 4000)); - g_assert (hb_set_has (s, 4001)); + g_assert_true (hb_set_has (s, 40)); + g_assert_true (!hb_set_has (s, 41)); + g_assert_true (!hb_set_has (s, 64)); + g_assert_true (!hb_set_has (s, 77)); + g_assert_true (hb_set_has (s, 78)); + g_assert_true (hb_set_has (s, 300)); + g_assert_true (hb_set_has (s, 601)); + g_assert_true (!hb_set_has (s, 602)); + g_assert_true (!hb_set_has (s, 3000)); + g_assert_true (!hb_set_has (s, 4000)); + g_assert_true (hb_set_has (s, 4001)); - g_assert (!hb_set_is_empty (s)); + g_assert_true (!hb_set_is_empty (s)); g_assert_cmpint (hb_set_get_population (s), ==, max_set_elements - 3436); g_assert_cmpint (hb_set_get_min (s), ==, 0); g_assert_cmpint (hb_set_get_max (s), ==, max_set_elements - 1); hb_set_del_range (s, 0, 37); - g_assert (!hb_set_has (s, 0)); - g_assert (!hb_set_has (s, 37)); - g_assert (hb_set_has (s, 38)); - g_assert (!hb_set_is_empty (s)); + g_assert_true (!hb_set_has (s, 0)); + g_assert_true (!hb_set_has (s, 37)); + g_assert_true (hb_set_has (s, 38)); + g_assert_true (!hb_set_is_empty (s)); g_assert_cmpint (hb_set_get_population (s), ==, max_set_elements - 3436 - 38); g_assert_cmpint (hb_set_get_min (s), ==, 38); g_assert_cmpint (hb_set_get_max (s), ==, max_set_elements - 1); hb_set_del_range (s, max_set_elements - 13, max_set_elements - 1); - g_assert (!hb_set_has (s, max_set_elements - 1)); - g_assert (!hb_set_has (s, max_set_elements - 13)); - g_assert (hb_set_has (s, max_set_elements - 14)); + g_assert_true (!hb_set_has (s, max_set_elements - 1)); + g_assert_true (!hb_set_has (s, max_set_elements - 13)); + g_assert_true (hb_set_has (s, max_set_elements - 14)); - g_assert (!hb_set_is_empty (s)); + g_assert_true (!hb_set_is_empty (s)); g_assert_cmpint (hb_set_get_population (s), ==, max_set_elements - 3436 - 38 - 13); g_assert_cmpint (hb_set_get_min (s), ==, 38); @@ -683,90 +683,90 @@ test_set_inverted_iteration_next (void) hb_codepoint_t cp = HB_SET_VALUE_INVALID; hb_codepoint_t start = 0; hb_codepoint_t end = 0; - g_assert (hb_set_next (s, &cp)); + g_assert_true (hb_set_next (s, &cp)); g_assert_cmpint (cp, ==, 0); - g_assert (hb_set_next (s, &cp)); + g_assert_true (hb_set_next (s, &cp)); g_assert_cmpint (cp, ==, 1); - g_assert (hb_set_next_range (s, &start, &end)); + g_assert_true (hb_set_next_range (s, &start, &end)); g_assert_cmpint (start, ==, 1); g_assert_cmpint (end, ==, 40); start = 40; end = 40; - g_assert (hb_set_next_range (s, &start, &end)); + g_assert_true (hb_set_next_range (s, &start, &end)); g_assert_cmpint (start, ==, 78); g_assert_cmpint (end, ==, 601); start = 40; end = 57; - g_assert (hb_set_next_range (s, &start, &end)); + g_assert_true (hb_set_next_range (s, &start, &end)); g_assert_cmpint (start, ==, 78); g_assert_cmpint (end, ==, 601); cp = 39; - g_assert (hb_set_next (s, &cp)); + g_assert_true (hb_set_next (s, &cp)); g_assert_cmpint (cp, ==, 40); - g_assert (hb_set_next (s, &cp)); + g_assert_true (hb_set_next (s, &cp)); g_assert_cmpint (cp, ==, 78); cp = 56; - g_assert (hb_set_next (s, &cp)); + g_assert_true (hb_set_next (s, &cp)); g_assert_cmpint (cp, ==, 78); cp = 78; - g_assert (hb_set_next (s, &cp)); + g_assert_true (hb_set_next (s, &cp)); g_assert_cmpint (cp, ==, 79); cp = 601; - g_assert (hb_set_next (s, &cp)); + g_assert_true (hb_set_next (s, &cp)); g_assert_cmpint (cp, ==, 4001); cp = HB_SET_VALUE_INVALID; hb_set_del (s, 0); - g_assert (hb_set_next (s, &cp)); + g_assert_true (hb_set_next (s, &cp)); g_assert_cmpint (cp, ==, 1); start = 0; end = 0; - g_assert (hb_set_next_range (s, &start, &end)); + g_assert_true (hb_set_next_range (s, &start, &end)); g_assert_cmpint (start, ==, 1); g_assert_cmpint (end, ==, 40); cp = max_set_elements - 1; - g_assert (!hb_set_next (s, &cp)); + g_assert_true (!hb_set_next (s, &cp)); g_assert_cmpint (cp, ==, HB_SET_VALUE_INVALID); start = 4000; end = 4000; - g_assert (hb_set_next_range (s, &start, &end)); + g_assert_true (hb_set_next_range (s, &start, &end)); g_assert_cmpint (start, ==, 4001); g_assert_cmpint (end, ==, max_set_elements - 1); start = max_set_elements - 1; end = max_set_elements - 1; - g_assert (!hb_set_next_range (s, &start, &end)); + g_assert_true (!hb_set_next_range (s, &start, &end)); g_assert_cmpint (start, ==, HB_SET_VALUE_INVALID); g_assert_cmpint (end, ==, HB_SET_VALUE_INVALID); cp = max_set_elements - 3; hb_set_del (s, max_set_elements - 1); - g_assert (hb_set_next (s, &cp)); + g_assert_true (hb_set_next (s, &cp)); g_assert_cmpint (cp, ==, max_set_elements - 2); - g_assert (!hb_set_next (s, &cp)); + g_assert_true (!hb_set_next (s, &cp)); g_assert_cmpint (cp, ==, HB_SET_VALUE_INVALID); start = max_set_elements - 2; end = max_set_elements - 2; - g_assert (!hb_set_next_range (s, &start, &end)); + g_assert_true (!hb_set_next_range (s, &start, &end)); g_assert_cmpint (start, ==, HB_SET_VALUE_INVALID); g_assert_cmpint (end, ==, HB_SET_VALUE_INVALID); start = max_set_elements - 3; end = max_set_elements - 3; - g_assert (hb_set_next_range (s, &start, &end)); + g_assert_true (hb_set_next_range (s, &start, &end)); g_assert_cmpint (start, ==, max_set_elements - 2); g_assert_cmpint (end, ==, max_set_elements - 2); @@ -787,94 +787,94 @@ test_set_inverted_iteration_prev (void) hb_codepoint_t cp = HB_SET_VALUE_INVALID; hb_codepoint_t start = max_set_elements - 1; hb_codepoint_t end = max_set_elements - 1; - g_assert (hb_set_previous (s, &cp)); + g_assert_true (hb_set_previous (s, &cp)); g_assert_cmpint (cp, ==, max_set_elements - 1); - g_assert (hb_set_previous (s, &cp)); + g_assert_true (hb_set_previous (s, &cp)); g_assert_cmpint (cp, ==, max_set_elements - 2); - g_assert (hb_set_previous_range (s, &start, &end)); + g_assert_true (hb_set_previous_range (s, &start, &end)); g_assert_cmpint (start, ==, 4001); g_assert_cmpint (end, ==, max_set_elements - 2); start = 4001; end = 4001; - g_assert (hb_set_previous_range (s, &start, &end)); + g_assert_true (hb_set_previous_range (s, &start, &end)); g_assert_cmpint (start, ==, 78); g_assert_cmpint (end, ==, 601); start = 2500; end = 3000; - g_assert (hb_set_previous_range (s, &start, &end)); + g_assert_true (hb_set_previous_range (s, &start, &end)); g_assert_cmpint (start, ==, 78); g_assert_cmpint (end, ==, 601); cp = 4002; - g_assert (hb_set_previous (s, &cp)); + g_assert_true (hb_set_previous (s, &cp)); g_assert_cmpint (cp, ==, 4001); - g_assert (hb_set_previous (s, &cp)); + g_assert_true (hb_set_previous (s, &cp)); g_assert_cmpint (cp, ==, 601); cp = 3500; - g_assert (hb_set_previous (s, &cp)); + g_assert_true (hb_set_previous (s, &cp)); g_assert_cmpint (cp, ==, 601); cp = 601; - g_assert (hb_set_previous (s, &cp)); + g_assert_true (hb_set_previous (s, &cp)); g_assert_cmpint (cp, ==, 600); cp = 78; - g_assert (hb_set_previous (s, &cp)); + g_assert_true (hb_set_previous (s, &cp)); g_assert_cmpint (cp, ==, 40); cp = HB_SET_VALUE_INVALID; hb_set_del (s, max_set_elements - 1); - g_assert (hb_set_previous (s, &cp)); + g_assert_true (hb_set_previous (s, &cp)); g_assert_cmpint (cp, ==, max_set_elements - 2); start = max_set_elements - 1; end = max_set_elements - 1; - g_assert (hb_set_previous_range (s, &start, &end)); + g_assert_true (hb_set_previous_range (s, &start, &end)); g_assert_cmpint (start, ==, 4001); g_assert_cmpint (end, ==, max_set_elements - 2); cp = 0; - g_assert (!hb_set_previous (s, &cp)); + g_assert_true (!hb_set_previous (s, &cp)); g_assert_cmpint (cp, ==, HB_SET_VALUE_INVALID); cp = 40; - g_assert (hb_set_previous (s, &cp)); + g_assert_true (hb_set_previous (s, &cp)); g_assert_cmpint (cp, ==, 39); start = 40; end = 40; - g_assert (hb_set_previous_range (s, &start, &end)); + g_assert_true (hb_set_previous_range (s, &start, &end)); g_assert_cmpint (start, ==, 0); g_assert_cmpint (end, ==, 39); start = 0; end = 0; - g_assert (!hb_set_previous_range (s, &start, &end)); + g_assert_true (!hb_set_previous_range (s, &start, &end)); g_assert_cmpint (start, ==, HB_SET_VALUE_INVALID); g_assert_cmpint (end, ==, HB_SET_VALUE_INVALID); cp = 2; hb_set_del (s, 0); - g_assert (hb_set_previous (s, &cp)); + g_assert_true (hb_set_previous (s, &cp)); g_assert_cmpint (cp, ==, 1); - g_assert (!hb_set_previous (s, &cp)); + g_assert_true (!hb_set_previous (s, &cp)); g_assert_cmpint (cp, ==, HB_SET_VALUE_INVALID); start = 1; end = 1; - g_assert (!hb_set_previous_range (s, &start, &end)); + g_assert_true (!hb_set_previous_range (s, &start, &end)); g_assert_cmpint (start, ==, HB_SET_VALUE_INVALID); g_assert_cmpint (end, ==, HB_SET_VALUE_INVALID); start = 2; end = 2; - g_assert (hb_set_previous_range (s, &start, &end)); + g_assert_true (hb_set_previous_range (s, &start, &end)); g_assert_cmpint (start, ==, 1); g_assert_cmpint (end, ==, 1); @@ -890,50 +890,50 @@ test_set_inverted_equality (void) hb_set_invert (a); hb_set_invert (b); - g_assert (hb_set_is_equal (a, b)); - g_assert (hb_set_is_equal (b, a)); + g_assert_true (hb_set_is_equal (a, b)); + g_assert_true (hb_set_is_equal (b, a)); hb_set_add (a, 10); - g_assert (hb_set_is_equal (a, b)); - g_assert (hb_set_is_equal (b, a)); + g_assert_true (hb_set_is_equal (a, b)); + g_assert_true (hb_set_is_equal (b, a)); hb_set_del (a, 42); - g_assert (!hb_set_is_equal (a, b)); - g_assert (!hb_set_is_equal (b, a)); + g_assert_true (!hb_set_is_equal (a, b)); + g_assert_true (!hb_set_is_equal (b, a)); hb_set_del (b, 42); - g_assert (hb_set_is_equal (a, b)); - g_assert (hb_set_is_equal (b, a)); + g_assert_true (hb_set_is_equal (a, b)); + g_assert_true (hb_set_is_equal (b, a)); hb_set_del_range (a, 43, 50); hb_set_del_range (a, 51, 76); hb_set_del_range (b, 43, 76); - g_assert (hb_set_is_equal (a, b)); - g_assert (hb_set_is_equal (b, a)); + g_assert_true (hb_set_is_equal (a, b)); + g_assert_true (hb_set_is_equal (b, a)); hb_set_del (a, 0); - g_assert (!hb_set_is_equal (a, b)); - g_assert (!hb_set_is_equal (b, a)); + g_assert_true (!hb_set_is_equal (a, b)); + g_assert_true (!hb_set_is_equal (b, a)); hb_set_del (b, 0); - g_assert (hb_set_is_equal (a, b)); - g_assert (hb_set_is_equal (b, a)); + g_assert_true (hb_set_is_equal (a, b)); + g_assert_true (hb_set_is_equal (b, a)); hb_set_del (a, max_set_elements - 1); - g_assert (!hb_set_is_equal (a, b)); - g_assert (!hb_set_is_equal (b, a)); + g_assert_true (!hb_set_is_equal (a, b)); + g_assert_true (!hb_set_is_equal (b, a)); hb_set_del (b, max_set_elements - 1); - g_assert (hb_set_is_equal (a, b)); - g_assert (hb_set_is_equal (b, a)); + g_assert_true (hb_set_is_equal (a, b)); + g_assert_true (hb_set_is_equal (b, a)); hb_set_invert (a); - g_assert (!hb_set_is_equal (a, b)); - g_assert (!hb_set_is_equal (b, a)); + g_assert_true (!hb_set_is_equal (a, b)); + g_assert_true (!hb_set_is_equal (b, a)); hb_set_invert (b); - g_assert (hb_set_is_equal (a, b)); - g_assert (hb_set_is_equal (b, a)); + g_assert_true (hb_set_is_equal (a, b)); + g_assert_true (hb_set_is_equal (b, a)); hb_set_destroy (a); hb_set_destroy (b); @@ -1065,7 +1065,7 @@ test_set_inverted_operations (void) } } - g_assert (all_succeeded); + g_assert_true (all_succeeded); } static void @@ -1075,13 +1075,13 @@ test_hb_set_add_sorted_array (void) hb_codepoint_t array[7] = {1, 2, 3, 1000, 2000, 2001, 2002}; hb_set_add_sorted_array (set, array, 7); g_assert_cmpint (hb_set_get_population (set), ==, 7); - g_assert (hb_set_has (set, 1)); - g_assert (hb_set_has (set, 2)); - g_assert (hb_set_has (set, 3)); - g_assert (hb_set_has (set, 1000)); - g_assert (hb_set_has (set, 2000)); - g_assert (hb_set_has (set, 2001)); - g_assert (hb_set_has (set, 2002)); + g_assert_true (hb_set_has (set, 1)); + g_assert_true (hb_set_has (set, 2)); + g_assert_true (hb_set_has (set, 3)); + g_assert_true (hb_set_has (set, 1000)); + g_assert_true (hb_set_has (set, 2000)); + g_assert_true (hb_set_has (set, 2001)); + g_assert_true (hb_set_has (set, 2002)); hb_set_destroy (set); } @@ -1093,7 +1093,7 @@ test_set_next_many (void) hb_set_add (set, i); for (unsigned i=6000; i<6100; i++) hb_set_add (set, i); - g_assert (hb_set_get_population (set) == 700); + g_assert_true (hb_set_get_population (set) == 700); hb_codepoint_t array[700]; unsigned int n = hb_set_next_many (set, HB_SET_VALUE_INVALID, array, 700); @@ -1102,7 +1102,7 @@ test_set_next_many (void) for (unsigned i=0; i<600; i++) g_assert_cmpint (array[i], ==, i); for (unsigned i=0; i<100; i++) - g_assert (array[600 + i] == 6000u + i); + g_assert_true (array[600 + i] == 6000u + i); // Try skipping initial values. for (unsigned i = 0; i < 700; i++) @@ -1125,7 +1125,7 @@ test_set_next_many_restricted (void) hb_set_add (set, i); for (int i=6000; i<6100; i++) hb_set_add (set, i); - g_assert (hb_set_get_population (set) == 700); + g_assert_true (hb_set_get_population (set) == 700); hb_codepoint_t array[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; hb_set_next_many (set, HB_SET_VALUE_INVALID, array, 9); diff --git a/test/api/test-shape.c b/test/api/test-shape.c index fd7acecbb..bcb17fc09 100644 --- a/test/api/test-shape.c +++ b/test/api/test-shape.c @@ -190,7 +190,7 @@ test_shape_list (void) ; g_assert_cmpint (i, >, 1); - g_assert (!strcmp (shapers[i - 1], "fallback")); + g_assert_true (!strcmp (shapers[i - 1], "fallback")); } int diff --git a/test/api/test-subset-drop-tables.c b/test/api/test-subset-drop-tables.c index 327b17b33..af2ac0462 100644 --- a/test/api/test-subset-drop-tables.c +++ b/test/api/test-subset-drop-tables.c @@ -43,14 +43,14 @@ test_subset_drop_tables (void) hb_set_destroy (codepoints); hb_face_t* subset = hb_subset_or_fail (face, input); - g_assert (subset); + g_assert_true (subset); hb_blob_t *hdmx = hb_face_reference_table (subset, HB_TAG ('h', 'd', 'm', 'x')); hb_blob_t *hmtx = hb_face_reference_table (subset, HB_TAG ('h', 'm', 't', 'x')); hb_blob_t *cmap = hb_face_reference_table (subset, HB_TAG ('c', 'm', 'a', 'p')); - g_assert (!hb_blob_get_length (hdmx)); - g_assert (!hb_blob_get_length (hmtx)); - g_assert ( hb_blob_get_length (cmap)); + g_assert_true (!hb_blob_get_length (hdmx)); + g_assert_true (!hb_blob_get_length (hmtx)); + g_assert_true ( hb_blob_get_length (cmap)); hb_blob_destroy (hdmx); hb_blob_destroy (hmtx); hb_blob_destroy (cmap); diff --git a/test/api/test-subset-glyf.c b/test/api/test-subset-glyf.c index aeead7260..d617cee58 100644 --- a/test/api/test-subset-glyf.c +++ b/test/api/test-subset-glyf.c @@ -302,7 +302,7 @@ test_subset_glyf_strip_hints_invalid (void) hb_set_destroy (codepoints); face_subset = hb_subset_or_fail (face, input); - g_assert (!face_subset); + g_assert_true (!face_subset); hb_subset_input_destroy (input); hb_face_destroy (face); diff --git a/test/api/test-subset-hdmx.c b/test/api/test-subset-hdmx.c index c41a12114..93258de5a 100644 --- a/test/api/test-subset-hdmx.c +++ b/test/api/test-subset-hdmx.c @@ -83,7 +83,7 @@ test_subset_hdmx_invalid (void) hb_set_add (codepoints, 'c'); subset = hb_subset_or_fail (face, input); - g_assert (!subset); + g_assert_true (!subset); hb_subset_input_destroy (input); hb_face_destroy (subset); diff --git a/test/api/test-subset-hmtx.c b/test/api/test-subset-hmtx.c index 28cca0084..e59c0b87d 100644 --- a/test/api/test-subset-hmtx.c +++ b/test/api/test-subset-hmtx.c @@ -163,7 +163,7 @@ test_subset_invalid_hmtx (void) hb_set_add (codepoints, 'c'); subset = hb_subset_or_fail (face, input); - g_assert (!subset); + g_assert_true (!subset); hb_subset_input_destroy (input); hb_face_destroy (subset); diff --git a/test/api/test-subset.c b/test/api/test-subset.c index 8dd990dd6..ad78260d0 100644 --- a/test/api/test-subset.c +++ b/test/api/test-subset.c @@ -43,7 +43,7 @@ test_subset_32_tables (void) hb_set_add (codepoints, 'c'); subset = hb_subset_or_fail (face, input); - g_assert (!subset); + g_assert_true (!subset); hb_subset_input_destroy (input); hb_face_destroy (subset); @@ -64,7 +64,7 @@ test_subset_no_inf_loop (void) hb_set_add (codepoints, 'c'); subset = hb_subset_or_fail (face, input); - g_assert (!subset); + g_assert_true (!subset); hb_subset_input_destroy (input); hb_face_destroy (subset); @@ -85,7 +85,7 @@ test_subset_crash (void) hb_set_add (codepoints, 'c'); subset = hb_subset_or_fail (face, input); - g_assert (!subset); + g_assert_true (!subset); hb_subset_input_destroy (input); hb_face_destroy (subset); @@ -97,14 +97,14 @@ test_subset_set_flags (void) { hb_subset_input_t *input = hb_subset_input_create_or_fail (); - g_assert (hb_subset_input_get_flags (input) == HB_SUBSET_FLAGS_DEFAULT); + g_assert_true (hb_subset_input_get_flags (input) == HB_SUBSET_FLAGS_DEFAULT); hb_subset_input_set_flags (input, HB_SUBSET_FLAGS_NAME_LEGACY | HB_SUBSET_FLAGS_NOTDEF_OUTLINE | HB_SUBSET_FLAGS_GLYPH_NAMES); - g_assert (hb_subset_input_get_flags (input) == + g_assert_true (hb_subset_input_get_flags (input) == (hb_subset_flags_t) ( HB_SUBSET_FLAGS_NAME_LEGACY | HB_SUBSET_FLAGS_NOTDEF_OUTLINE | @@ -115,7 +115,7 @@ test_subset_set_flags (void) HB_SUBSET_FLAGS_NOTDEF_OUTLINE | HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES); - g_assert (hb_subset_input_get_flags (input) == + g_assert_true (hb_subset_input_get_flags (input) == (hb_subset_flags_t) ( HB_SUBSET_FLAGS_NAME_LEGACY | HB_SUBSET_FLAGS_NOTDEF_OUTLINE | @@ -139,15 +139,15 @@ test_subset_sets (void) hb_set_add (hb_subset_input_set (input, HB_SUBSET_SETS_LAYOUT_FEATURE_TAG), 87); hb_set_add (set, 83); - g_assert (hb_set_is_equal (hb_subset_input_glyph_set (input), set)); + g_assert_true (hb_set_is_equal (hb_subset_input_glyph_set (input), set)); hb_set_clear (set); hb_set_add (set, 85); - g_assert (hb_set_is_equal (hb_subset_input_unicode_set (input), set)); + g_assert_true (hb_set_is_equal (hb_subset_input_unicode_set (input), set)); hb_set_clear (set); hb_set_add (set, 87); - g_assert (hb_set_is_equal (hb_subset_input_set (input, HB_SUBSET_SETS_LAYOUT_FEATURE_TAG), set)); + g_assert_true (hb_set_is_equal (hb_subset_input_set (input, HB_SUBSET_SETS_LAYOUT_FEATURE_TAG), set)); hb_set_clear (set); hb_set_destroy (set); @@ -167,18 +167,18 @@ test_subset_plan (void) hb_set_destroy (codepoints); hb_subset_plan_t* plan = hb_subset_plan_create_or_fail (face_abc, input); - g_assert (plan); + g_assert_true (plan); const hb_map_t* mapping = hb_subset_plan_old_to_new_glyph_mapping (plan); - g_assert (hb_map_get (mapping, 1) == 1); - g_assert (hb_map_get (mapping, 3) == 2); + g_assert_true (hb_map_get (mapping, 1) == 1); + g_assert_true (hb_map_get (mapping, 3) == 2); mapping = hb_subset_plan_new_to_old_glyph_mapping (plan); - g_assert (hb_map_get (mapping, 1) == 1); - g_assert (hb_map_get (mapping, 2) == 3); + g_assert_true (hb_map_get (mapping, 1) == 1); + g_assert_true (hb_map_get (mapping, 2) == 3); mapping = hb_subset_plan_unicode_to_old_glyph_mapping (plan); - g_assert (hb_map_get (mapping, 0x63) == 3); + g_assert_true (hb_map_get (mapping, 0x63) == 3); hb_face_t* face_abc_subset = hb_subset_plan_execute_or_fail (plan); @@ -272,19 +272,19 @@ test_subset_cff2_get_charstring_data (void) hb_blob_t* cs0 = hb_subset_cff2_get_charstring_data (face, 0); unsigned int length; const uint8_t* data = (const uint8_t*) hb_blob_get_data (cs0, &length); - g_assert (length == 2); - g_assert (data[0] == 0x20); - g_assert (data[1] == 0x0A); + g_assert_true (length == 2); + g_assert_true (data[0] == 0x20); + g_assert_true (data[1] == 0x0A); hb_blob_t* cs1 = hb_subset_cff2_get_charstring_data (face, 1); data = (const uint8_t*) hb_blob_get_data (cs1, &length); - g_assert (length == 2); - g_assert (data[0] == 0x20); - g_assert (data[1] == 0x0A); + g_assert_true (length == 2); + g_assert_true (data[0] == 0x20); + g_assert_true (data[1] == 0x0A); hb_blob_t* cs2 = hb_subset_cff2_get_charstring_data (face, 2); data = (const uint8_t*) hb_blob_get_data (cs2, &length); - g_assert (length == 0); + g_assert_true (length == 0); hb_blob_destroy (cff2); hb_blob_destroy (maxp); @@ -337,7 +337,7 @@ test_subset_cff2_get_charstring_data_no_cff (void) hb_face_t* face = hb_face_create (face_blob, 0); hb_blob_t* cs0 = hb_subset_cff2_get_charstring_data (face, 0); - g_assert (hb_blob_get_length (cs0) == 0); + g_assert_true (hb_blob_get_length (cs0) == 0); hb_face_destroy (builder); hb_blob_destroy (face_blob); @@ -357,7 +357,7 @@ test_subset_cff2_get_charstring_data_invalid_cff2 (void) hb_face_t* face = hb_face_create (face_blob, 0); hb_blob_t* cs0 = hb_subset_cff2_get_charstring_data (face, 0); - g_assert (hb_blob_get_length (cs0) == 0); + g_assert_true (hb_blob_get_length (cs0) == 0); hb_blob_destroy (cff2); hb_face_destroy (builder); @@ -394,9 +394,9 @@ test_subset_cff2_get_charstring_data_lifetime (void) unsigned int length; const uint8_t* data = (const uint8_t*) hb_blob_get_data (cs0, &length); - g_assert (length == 2); - g_assert (data[0] == 0x20); - g_assert (data[1] == 0x0A); + g_assert_true (length == 2); + g_assert_true (data[0] == 0x20); + g_assert_true (data[1] == 0x0A); hb_blob_destroy (cs0); } diff --git a/test/api/test-unicode.c b/test/api/test-unicode.c index 07a08f56b..afe5182ef 100644 --- a/test/api/test-unicode.c +++ b/test/api/test-unicode.c @@ -55,8 +55,8 @@ static void free_up (void *p) { data_t *data = (data_t *) p; - g_assert (data->value == MAGIC0 || data->value == MAGIC1); - g_assert (!data->freed); + g_assert_true (data->value == MAGIC0 || data->value == MAGIC1); + g_assert_true (!data->freed); data->freed = TRUE; } @@ -67,9 +67,9 @@ simple_get_script (hb_unicode_funcs_t *ufuncs, { data_t *data = (data_t *) user_data; - g_assert (hb_unicode_funcs_get_parent (ufuncs) != NULL); + g_assert_true (hb_unicode_funcs_get_parent (ufuncs) != NULL); g_assert_cmphex (data->value, ==, MAGIC0); - g_assert (!data->freed); + g_assert_true (!data->freed); if ('a' <= codepoint && codepoint <= 'z') return HB_SCRIPT_LATIN; @@ -84,9 +84,9 @@ a_is_for_arabic_get_script (hb_unicode_funcs_t *ufuncs, { data_t *data = (data_t *) user_data; - g_assert (hb_unicode_funcs_get_parent (ufuncs) != NULL); + g_assert_true (hb_unicode_funcs_get_parent (ufuncs) != NULL); g_assert_cmphex (data->value, ==, MAGIC1); - g_assert (!data->freed); + g_assert_true (!data->freed); if (codepoint == 'a') { return HB_SCRIPT_ARABIC; @@ -609,8 +609,8 @@ test_unicode_properties (gconstpointer user_data, hb_bool_t lenient) unsigned int i, j; gboolean failed = TRUE; - g_assert (hb_unicode_funcs_is_immutable (uf)); - g_assert (hb_unicode_funcs_get_parent (uf)); + g_assert_true (hb_unicode_funcs_is_immutable (uf)); + g_assert_true (hb_unicode_funcs_get_parent (uf)); for (i = 0; i < G_N_ELEMENTS (properties); i++) { const property_t *p = &properties[i]; @@ -686,7 +686,7 @@ test_unicode_properties_nil (void) { hb_unicode_funcs_t *uf = hb_unicode_funcs_create (NULL); - g_assert (!hb_unicode_funcs_is_immutable (uf)); + g_assert_true (!hb_unicode_funcs_is_immutable (uf)); _test_unicode_properties_nil (uf); hb_unicode_funcs_destroy (uf); @@ -697,8 +697,8 @@ test_unicode_properties_empty (void) { hb_unicode_funcs_t *uf = hb_unicode_funcs_get_empty (); - g_assert (uf); - g_assert (hb_unicode_funcs_is_immutable (uf)); + g_assert_true (uf); + g_assert_true (hb_unicode_funcs_is_immutable (uf)); _test_unicode_properties_nil (uf); } @@ -711,13 +711,13 @@ test_unicode_chainup (void) /* Chain-up to nil */ uf = hb_unicode_funcs_create (NULL); - g_assert (!hb_unicode_funcs_is_immutable (uf)); + g_assert_true (!hb_unicode_funcs_is_immutable (uf)); uf2 = hb_unicode_funcs_create (uf); - g_assert (hb_unicode_funcs_is_immutable (uf)); + g_assert_true (hb_unicode_funcs_is_immutable (uf)); hb_unicode_funcs_destroy (uf); - g_assert (!hb_unicode_funcs_is_immutable (uf2)); + g_assert_true (!hb_unicode_funcs_is_immutable (uf2)); _test_unicode_properties_nil (uf2); hb_unicode_funcs_destroy (uf2); @@ -725,13 +725,13 @@ test_unicode_chainup (void) /* Chain-up to default */ uf = hb_unicode_funcs_create (hb_unicode_funcs_get_default ()); - g_assert (!hb_unicode_funcs_is_immutable (uf)); + g_assert_true (!hb_unicode_funcs_is_immutable (uf)); uf2 = hb_unicode_funcs_create (uf); - g_assert (hb_unicode_funcs_is_immutable (uf)); + g_assert_true (hb_unicode_funcs_is_immutable (uf)); hb_unicode_funcs_destroy (uf); - g_assert (!hb_unicode_funcs_is_immutable (uf2)); + g_assert_true (!hb_unicode_funcs_is_immutable (uf2)); hb_unicode_funcs_make_immutable (uf2); test_unicode_properties_strict (uf2); @@ -755,7 +755,7 @@ test_unicode_setters (void) g_test_message ("Testing property %s", p->name); uf = hb_unicode_funcs_create (NULL); - g_assert (!hb_unicode_funcs_is_immutable (uf)); + g_assert_true (!hb_unicode_funcs_is_immutable (uf)); p->func_setter (uf, (get_func_t) simple_get_script, &data[0], free_up); @@ -763,18 +763,18 @@ test_unicode_setters (void) g_assert_cmphex (p->getter (uf, '0'), ==, HB_SCRIPT_UNKNOWN); p->func_setter (uf, (get_func_t) NULL, NULL, NULL); - g_assert (data[0].freed && !data[1].freed); + g_assert_true (data[0].freed && !data[1].freed); - g_assert (!hb_unicode_funcs_is_immutable (uf)); + g_assert_true (!hb_unicode_funcs_is_immutable (uf)); hb_unicode_funcs_make_immutable (uf); - g_assert (hb_unicode_funcs_is_immutable (uf)); + g_assert_true (hb_unicode_funcs_is_immutable (uf)); /* Since uf is immutable now, the following setter should do nothing. */ p->func_setter (uf, (get_func_t) a_is_for_arabic_get_script, &data[1], free_up); - g_assert (data[0].freed && data[1].freed); + g_assert_true (data[0].freed && data[1].freed); hb_unicode_funcs_destroy (uf); - g_assert (data[0].freed && data[1].freed); + g_assert_true (data[0].freed && data[1].freed); } } @@ -812,9 +812,9 @@ test_unicode_subclassing_nil (data_fixture_t *f, gconstpointer user_data HB_UNUS g_assert_cmphex (hb_unicode_script (aa, 'a'), ==, HB_SCRIPT_ARABIC); g_assert_cmphex (hb_unicode_script (aa, 'b'), ==, HB_SCRIPT_UNKNOWN); - g_assert (!f->data[0].freed && !f->data[1].freed); + g_assert_true (!f->data[0].freed && !f->data[1].freed); hb_unicode_funcs_destroy (aa); - g_assert (!f->data[0].freed && f->data[1].freed); + g_assert_true (!f->data[0].freed && f->data[1].freed); } static void @@ -831,9 +831,9 @@ test_unicode_subclassing_default (data_fixture_t *f, gconstpointer user_data HB_ g_assert_cmphex (hb_unicode_script (aa, 'a'), ==, HB_SCRIPT_ARABIC); g_assert_cmphex (hb_unicode_script (aa, 'b'), ==, HB_SCRIPT_LATIN); - g_assert (!f->data[0].freed && !f->data[1].freed); + g_assert_true (!f->data[0].freed && !f->data[1].freed); hb_unicode_funcs_destroy (aa); - g_assert (!f->data[0].freed && f->data[1].freed); + g_assert_true (!f->data[0].freed && f->data[1].freed); } static void @@ -851,7 +851,7 @@ test_unicode_subclassing_deep (data_fixture_t *f, gconstpointer user_data HB_UNU hb_unicode_funcs_destroy (uf); /* make sure the 'uf' didn't get freed, since 'aa' holds a ref */ - g_assert (!f->data[0].freed); + g_assert_true (!f->data[0].freed); hb_unicode_funcs_set_script_func (aa, a_is_for_arabic_get_script, &f->data[1], free_up); @@ -860,9 +860,9 @@ test_unicode_subclassing_deep (data_fixture_t *f, gconstpointer user_data HB_UNU g_assert_cmphex (hb_unicode_script (aa, 'b'), ==, HB_SCRIPT_LATIN); g_assert_cmphex (hb_unicode_script (aa, '0'), ==, HB_SCRIPT_UNKNOWN); - g_assert (!f->data[0].freed && !f->data[1].freed); + g_assert_true (!f->data[0].freed && !f->data[1].freed); hb_unicode_funcs_destroy (aa); - g_assert (f->data[0].freed && f->data[1].freed); + g_assert_true (f->data[0].freed && f->data[1].freed); } @@ -931,67 +931,67 @@ test_unicode_normalization (gconstpointer user_data) /* Test compose() */ /* Not composable */ - g_assert (!hb_unicode_compose (uf, 0x0041, 0x0042, &ab) && ab == 0); - g_assert (!hb_unicode_compose (uf, 0x0041, 0, &ab) && ab == 0); - g_assert (!hb_unicode_compose (uf, 0x0066, 0x0069, &ab) && ab == 0); + g_assert_true (!hb_unicode_compose (uf, 0x0041, 0x0042, &ab) && ab == 0); + g_assert_true (!hb_unicode_compose (uf, 0x0041, 0, &ab) && ab == 0); + g_assert_true (!hb_unicode_compose (uf, 0x0066, 0x0069, &ab) && ab == 0); /* Singletons should not compose */ - g_assert (!hb_unicode_compose (uf, 0x212B, 0, &ab) && ab == 0); - g_assert (!hb_unicode_compose (uf, 0x00C5, 0, &ab) && ab == 0); - g_assert (!hb_unicode_compose (uf, 0x2126, 0, &ab) && ab == 0); - g_assert (!hb_unicode_compose (uf, 0x03A9, 0, &ab) && ab == 0); + g_assert_true (!hb_unicode_compose (uf, 0x212B, 0, &ab) && ab == 0); + g_assert_true (!hb_unicode_compose (uf, 0x00C5, 0, &ab) && ab == 0); + g_assert_true (!hb_unicode_compose (uf, 0x2126, 0, &ab) && ab == 0); + g_assert_true (!hb_unicode_compose (uf, 0x03A9, 0, &ab) && ab == 0); /* Non-starter pairs should not compose */ - g_assert (!hb_unicode_compose (uf, 0x0308, 0x0301, &ab) && ab == 0); /* !0x0344 */ - g_assert (!hb_unicode_compose (uf, 0x0F71, 0x0F72, &ab) && ab == 0); /* !0x0F73 */ + g_assert_true (!hb_unicode_compose (uf, 0x0308, 0x0301, &ab) && ab == 0); /* !0x0344 */ + g_assert_true (!hb_unicode_compose (uf, 0x0F71, 0x0F72, &ab) && ab == 0); /* !0x0F73 */ /* Pairs */ - g_assert (hb_unicode_compose (uf, 0x0041, 0x030A, &ab) && ab == 0x00C5); - g_assert (hb_unicode_compose (uf, 0x006F, 0x0302, &ab) && ab == 0x00F4); - g_assert (hb_unicode_compose (uf, 0x1E63, 0x0307, &ab) && ab == 0x1E69); - g_assert (hb_unicode_compose (uf, 0x0073, 0x0323, &ab) && ab == 0x1E63); - g_assert (hb_unicode_compose (uf, 0x0064, 0x0307, &ab) && ab == 0x1E0B); - g_assert (hb_unicode_compose (uf, 0x0064, 0x0323, &ab) && ab == 0x1E0D); + g_assert_true (hb_unicode_compose (uf, 0x0041, 0x030A, &ab) && ab == 0x00C5); + g_assert_true (hb_unicode_compose (uf, 0x006F, 0x0302, &ab) && ab == 0x00F4); + g_assert_true (hb_unicode_compose (uf, 0x1E63, 0x0307, &ab) && ab == 0x1E69); + g_assert_true (hb_unicode_compose (uf, 0x0073, 0x0323, &ab) && ab == 0x1E63); + g_assert_true (hb_unicode_compose (uf, 0x0064, 0x0307, &ab) && ab == 0x1E0B); + g_assert_true (hb_unicode_compose (uf, 0x0064, 0x0323, &ab) && ab == 0x1E0D); /* Hangul */ - g_assert (hb_unicode_compose (uf, 0xD4CC, 0x11B6, &ab) && ab == 0xD4DB); - g_assert (hb_unicode_compose (uf, 0x1111, 0x1171, &ab) && ab == 0xD4CC); - g_assert (hb_unicode_compose (uf, 0xCE20, 0x11B8, &ab) && ab == 0xCE31); - g_assert (hb_unicode_compose (uf, 0x110E, 0x1173, &ab) && ab == 0xCE20); + g_assert_true (hb_unicode_compose (uf, 0xD4CC, 0x11B6, &ab) && ab == 0xD4DB); + g_assert_true (hb_unicode_compose (uf, 0x1111, 0x1171, &ab) && ab == 0xD4CC); + g_assert_true (hb_unicode_compose (uf, 0xCE20, 0x11B8, &ab) && ab == 0xCE31); + g_assert_true (hb_unicode_compose (uf, 0x110E, 0x1173, &ab) && ab == 0xCE20); - g_assert (!hb_unicode_compose (uf, 0xAC00, 0x11A7, &ab)); - g_assert (hb_unicode_compose (uf, 0xAC00, 0x11A8, &ab) && ab == 0xAC01); - g_assert (!hb_unicode_compose (uf, 0xAC01, 0x11A8, &ab)); + g_assert_true (!hb_unicode_compose (uf, 0xAC00, 0x11A7, &ab)); + g_assert_true (hb_unicode_compose (uf, 0xAC00, 0x11A8, &ab) && ab == 0xAC01); + g_assert_true (!hb_unicode_compose (uf, 0xAC01, 0x11A8, &ab)); /* Test decompose() */ /* Not decomposable */ - g_assert (!hb_unicode_decompose (uf, 0x0041, &a, &b) && a == 0x0041 && b == 0); - g_assert (!hb_unicode_decompose (uf, 0xFB01, &a, &b) && a == 0xFB01 && b == 0); - g_assert (!hb_unicode_decompose (uf, 0x1F1EF, &a, &b) && a == 0x1F1EF && b == 0); + g_assert_true (!hb_unicode_decompose (uf, 0x0041, &a, &b) && a == 0x0041 && b == 0); + g_assert_true (!hb_unicode_decompose (uf, 0xFB01, &a, &b) && a == 0xFB01 && b == 0); + g_assert_true (!hb_unicode_decompose (uf, 0x1F1EF, &a, &b) && a == 0x1F1EF && b == 0); /* Singletons */ - g_assert (hb_unicode_decompose (uf, 0x212B, &a, &b) && a == 0x00C5 && b == 0); - g_assert (hb_unicode_decompose (uf, 0x2126, &a, &b) && a == 0x03A9 && b == 0); + g_assert_true (hb_unicode_decompose (uf, 0x212B, &a, &b) && a == 0x00C5 && b == 0); + g_assert_true (hb_unicode_decompose (uf, 0x2126, &a, &b) && a == 0x03A9 && b == 0); /* Non-starter pairs decompose, but not compose */ - g_assert (hb_unicode_decompose (uf, 0x0344, &a, &b) && a == 0x0308 && b == 0x0301); - g_assert (hb_unicode_decompose (uf, 0x0F73, &a, &b) && a == 0x0F71 && b == 0x0F72); + g_assert_true (hb_unicode_decompose (uf, 0x0344, &a, &b) && a == 0x0308 && b == 0x0301); + g_assert_true (hb_unicode_decompose (uf, 0x0F73, &a, &b) && a == 0x0F71 && b == 0x0F72); /* Pairs */ - g_assert (hb_unicode_decompose (uf, 0x00C5, &a, &b) && a == 0x0041 && b == 0x030A); - g_assert (hb_unicode_decompose (uf, 0x00F4, &a, &b) && a == 0x006F && b == 0x0302); - g_assert (hb_unicode_decompose (uf, 0x1E69, &a, &b) && a == 0x1E63 && b == 0x0307); - g_assert (hb_unicode_decompose (uf, 0x1E63, &a, &b) && a == 0x0073 && b == 0x0323); - g_assert (hb_unicode_decompose (uf, 0x1E0B, &a, &b) && a == 0x0064 && b == 0x0307); - g_assert (hb_unicode_decompose (uf, 0x1E0D, &a, &b) && a == 0x0064 && b == 0x0323); + g_assert_true (hb_unicode_decompose (uf, 0x00C5, &a, &b) && a == 0x0041 && b == 0x030A); + g_assert_true (hb_unicode_decompose (uf, 0x00F4, &a, &b) && a == 0x006F && b == 0x0302); + g_assert_true (hb_unicode_decompose (uf, 0x1E69, &a, &b) && a == 0x1E63 && b == 0x0307); + g_assert_true (hb_unicode_decompose (uf, 0x1E63, &a, &b) && a == 0x0073 && b == 0x0323); + g_assert_true (hb_unicode_decompose (uf, 0x1E0B, &a, &b) && a == 0x0064 && b == 0x0307); + g_assert_true (hb_unicode_decompose (uf, 0x1E0D, &a, &b) && a == 0x0064 && b == 0x0323); /* Hangul */ - g_assert (hb_unicode_decompose (uf, 0xD4DB, &a, &b) && a == 0xD4CC && b == 0x11B6); - g_assert (hb_unicode_decompose (uf, 0xD4CC, &a, &b) && a == 0x1111 && b == 0x1171); - g_assert (hb_unicode_decompose (uf, 0xCE31, &a, &b) && a == 0xCE20 && b == 0x11B8); - g_assert (hb_unicode_decompose (uf, 0xCE20, &a, &b) && a == 0x110E && b == 0x1173); + g_assert_true (hb_unicode_decompose (uf, 0xD4DB, &a, &b) && a == 0xD4CC && b == 0x11B6); + g_assert_true (hb_unicode_decompose (uf, 0xD4CC, &a, &b) && a == 0x1111 && b == 0x1171); + g_assert_true (hb_unicode_decompose (uf, 0xCE31, &a, &b) && a == 0xCE20 && b == 0x11B8); + g_assert_true (hb_unicode_decompose (uf, 0xCE20, &a, &b) && a == 0x110E && b == 0x1173); } diff --git a/test/api/test-var-coords.c b/test/api/test-var-coords.c index 490e5fc06..fe3ba8c4f 100644 --- a/test/api/test-var-coords.c +++ b/test/api/test-var-coords.c @@ -78,11 +78,11 @@ test_get_var_get_axis_infos (void) unsigned c = 1; g_assert_cmpint (hb_ot_var_get_axis_infos (face, 0, &c, &info), ==, 2); - g_assert (info.tag == HB_TAG ('w','g','h','t')); + g_assert_true (info.tag == HB_TAG ('w','g','h','t')); g_assert_cmpint (c, ==, 1); hb_ot_var_get_axis_infos (face, 1, &c, &info); - g_assert (info.tag == HB_TAG ('w','d','t','h')); + g_assert_true (info.tag == HB_TAG ('w','d','t','h')); g_assert_cmpint (c, ==, 1); hb_ot_var_get_axis_infos (face, 2, &c, &info); diff --git a/test/api/test-version.c b/test/api/test-version.c index e6378b61c..622580778 100644 --- a/test/api/test-version.c +++ b/test/api/test-version.c @@ -42,32 +42,32 @@ test_version (void) g_assert_cmpint (micro, ==, HB_VERSION_MICRO); s = g_strdup_printf ("%u.%u.%u", major, minor, micro); - g_assert (0 == strcmp (HB_VERSION_STRING, s)); + g_assert_true (0 == strcmp (HB_VERSION_STRING, s)); g_free (s); - g_assert (0 == strcmp (HB_VERSION_STRING, hb_version_string ())); + g_assert_true (0 == strcmp (HB_VERSION_STRING, hb_version_string ())); - g_assert (HB_VERSION_ATLEAST (major, minor, micro)); + g_assert_true (HB_VERSION_ATLEAST (major, minor, micro)); if (major) - g_assert (HB_VERSION_ATLEAST (major-1, minor, micro)); + g_assert_true (HB_VERSION_ATLEAST (major-1, minor, micro)); if (minor) - g_assert (HB_VERSION_ATLEAST (major, minor-1, micro)); + g_assert_true (HB_VERSION_ATLEAST (major, minor-1, micro)); if (micro) - g_assert (HB_VERSION_ATLEAST (major, minor, micro-1)); - g_assert (!HB_VERSION_ATLEAST (major+1, minor, micro)); - g_assert (!HB_VERSION_ATLEAST (major, minor+1, micro)); - g_assert (!HB_VERSION_ATLEAST (major, minor, micro+1)); - g_assert (!HB_VERSION_ATLEAST (major, minor, micro+1)); + g_assert_true (HB_VERSION_ATLEAST (major, minor, micro-1)); + g_assert_true (!HB_VERSION_ATLEAST (major+1, minor, micro)); + g_assert_true (!HB_VERSION_ATLEAST (major, minor+1, micro)); + g_assert_true (!HB_VERSION_ATLEAST (major, minor, micro+1)); + g_assert_true (!HB_VERSION_ATLEAST (major, minor, micro+1)); - g_assert (hb_version_atleast (major, minor, micro)); + g_assert_true (hb_version_atleast (major, minor, micro)); if (major) - g_assert (hb_version_atleast (major-1, minor, micro)); + g_assert_true (hb_version_atleast (major-1, minor, micro)); if (minor) - g_assert (hb_version_atleast (major, minor-1, micro)); + g_assert_true (hb_version_atleast (major, minor-1, micro)); if (micro) - g_assert (hb_version_atleast (major, minor, micro-1)); - g_assert (!hb_version_atleast (major+1, minor, micro)); - g_assert (!hb_version_atleast (major, minor+1, micro)); - g_assert (!hb_version_atleast (major, minor, micro+1)); + g_assert_true (hb_version_atleast (major, minor, micro-1)); + g_assert_true (!hb_version_atleast (major+1, minor, micro)); + g_assert_true (!hb_version_atleast (major, minor+1, micro)); + g_assert_true (!hb_version_atleast (major, minor, micro+1)); } int From 2b5ae9dec34a1570081e1b44fae1cc23f9a0f35a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 12:46:43 -0600 Subject: [PATCH 22/26] [meson] Use a glob.py instead of ls / dir --- .circleci/config.yml | 3 +-- test/fuzzing/glob.py | 16 ++++++++++++++++ test/fuzzing/meson.build | 18 ++---------------- 3 files changed, 19 insertions(+), 18 deletions(-) create mode 100755 test/fuzzing/glob.py diff --git a/.circleci/config.yml b/.circleci/config.yml index 1bed230e8..495a6a9d9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -149,9 +149,8 @@ jobs: executor: win64-executor steps: - checkout - - run: dpkg --add-architecture i386 - run: apt update - - run: DEBIAN_FRONTEND=noninteractive apt install -y ninja-build python3 python3-pip python3-venv git g++-mingw-w64-x86-64 zip wine wine64 wine32:i386 + - run: DEBIAN_FRONTEND=noninteractive apt install -y ninja-build python3 python3-pip python3-venv git g++-mingw-w64-x86-64 zip wine wine64 - run: | export LANG=en_US.UTF-8 python3 -m venv venv diff --git a/test/fuzzing/glob.py b/test/fuzzing/glob.py new file mode 100755 index 000000000..606ac77e3 --- /dev/null +++ b/test/fuzzing/glob.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +import sys +import os + +if len(sys.argv) < 2: + print("Usage: python glob.py [DIR]...") + sys.exit(1) + +for arg in sys.argv[1:]: + if os.path.isdir(arg): + for dirpath, dirnames, filenames in os.walk(arg): + for filename in filenames: + print(os.path.join(dirpath, filename)) + elif os.path.isfile(arg): + print(arg) diff --git a/test/fuzzing/meson.build b/test/fuzzing/meson.build index 2cd80f6f0..488d978cc 100644 --- a/test/fuzzing/meson.build +++ b/test/fuzzing/meson.build @@ -66,27 +66,13 @@ test('draw-fuzzer', run_fuzzer_tests, suite: ['fuzzing'], ) -ls = find_program('ls') -if not ls.found() - # On Windows, we need to use the 'dir' command to list files in a directory. - # The 'ls' command is not available by default. - find = [find_program('dir', required: true), '/b', '/a-d'] -else - # On other platforms, we can use the 'ls' command. - find = [find_program('ls', required: true)] -endif +glob_cmd = find_program('glob.py', required: true) # Subset fuzzer: feed the fuzzer directly, without run-fuzzer-tests.py font_dirs = [ meson.current_source_dir() / 'fonts', meson.current_source_dir() / '..' / 'subset' / 'data' / 'fonts', ] -glob = [] -foreach font_dir : font_dirs - dir = run_command(find, font_dir, check:true).stdout().strip().split('\n') - foreach item : dir - glob += [font_dir / item] - endforeach -endforeach +glob = run_command(glob_cmd, font_dirs, check:true).stdout().strip().split('\n') # Chunk glob and call runner for each chunk chunk_size = 64 From 328509ef66eaea3212fdd004005a2a15753b887f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 13:34:04 -0600 Subject: [PATCH 23/26] [tap] Try to fix cross64 build --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 495a6a9d9..1bed230e8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -149,8 +149,9 @@ jobs: executor: win64-executor steps: - checkout + - run: dpkg --add-architecture i386 - run: apt update - - run: DEBIAN_FRONTEND=noninteractive apt install -y ninja-build python3 python3-pip python3-venv git g++-mingw-w64-x86-64 zip wine wine64 + - run: DEBIAN_FRONTEND=noninteractive apt install -y ninja-build python3 python3-pip python3-venv git g++-mingw-w64-x86-64 zip wine wine64 wine32:i386 - run: | export LANG=en_US.UTF-8 python3 -m venv venv From 58d7ab2d596eaa6178c90080050c7b03e2099941 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 13:42:13 -0600 Subject: [PATCH 24/26] [meson] Remove unneeded dependencies --- test/fuzzing/meson.build | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/fuzzing/meson.build b/test/fuzzing/meson.build index 488d978cc..2ce9725db 100644 --- a/test/fuzzing/meson.build +++ b/test/fuzzing/meson.build @@ -41,7 +41,6 @@ test('shape-fuzzer', run_fuzzer_tests, hb_shape_fuzzer_exe, meson.current_source_dir() / 'fonts', ], - depends: [hb_shape_fuzzer_exe, libharfbuzz, libharfbuzz_subset], workdir: meson.current_build_dir() / '..' / '..', priority: 1, suite: ['fuzzing'], @@ -94,7 +93,6 @@ foreach chunk : chunks test('subset-fuzzer-chunk-@0@'.format(i), hb_subset_fuzzer_exe, args: chunk, - depends: [hb_shape_fuzzer_exe, libharfbuzz, libharfbuzz_subset], workdir: meson.current_build_dir() / '..' / '..', protocol: 'tap', suite: ['fuzzing'], From ba309a182608e6dcbab4151fbfc3bdfb2347d26d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 13:54:47 -0600 Subject: [PATCH 25/26] [test/fuzzing] Port all to TAP --- test/fuzzing/meson.build | 119 ++++++++++++++++++------------- test/fuzzing/run-fuzzer-tests.py | 79 -------------------- 2 files changed, 71 insertions(+), 127 deletions(-) delete mode 100755 test/fuzzing/run-fuzzer-tests.py diff --git a/test/fuzzing/meson.build b/test/fuzzing/meson.build index 2ce9725db..5bd48fb9a 100644 --- a/test/fuzzing/meson.build +++ b/test/fuzzing/meson.build @@ -6,8 +6,7 @@ tests = [ 'hb-repacker-fuzzer.cc', ] -run_fuzzer_tests = find_program('run-fuzzer-tests.py', required: true) - +# Build the binaries foreach file_name : tests test_name = file_name.split('.')[0] @@ -36,60 +35,60 @@ foreach file_name : tests set_variable('@0@_exe'.format(test_name.underscorify()), exe) endforeach -test('shape-fuzzer', run_fuzzer_tests, - args: [ - hb_shape_fuzzer_exe, - meson.current_source_dir() / 'fonts', - ], - workdir: meson.current_build_dir() / '..' / '..', - priority: 1, - suite: ['fuzzing'], -) - -test('repacker-fuzzer', run_fuzzer_tests, - args: [ - hb_repacker_fuzzer_exe, - meson.current_source_dir() / 'graphs', - ], - workdir: meson.current_build_dir() / '..' / '..', - priority: 1, - suite: ['fuzzing'], -) - -test('draw-fuzzer', run_fuzzer_tests, - args: [ - hb_draw_fuzzer_exe, - meson.current_source_dir() / 'fonts', - ], - workdir: meson.current_build_dir() / '..' / '..', - suite: ['fuzzing'], -) - glob_cmd = find_program('glob.py', required: true) -# Subset fuzzer: feed the fuzzer directly, without run-fuzzer-tests.py -font_dirs = [ - meson.current_source_dir() / 'fonts', - meson.current_source_dir() / '..' / 'subset' / 'data' / 'fonts', -] -glob = run_command(glob_cmd, font_dirs, check:true).stdout().strip().split('\n') -# Chunk glob and call runner for each chunk +fonts_glob = run_command(glob_cmd, meson.current_source_dir() / 'fonts', check:true).stdout().strip().split('\n') +subset_fonts_glob = run_command(glob_cmd, meson.current_source_dir() / '..' / 'subset' / 'data' / 'fonts', check:true).stdout().strip().split('\n') +graphs_glob = run_command(glob_cmd, meson.current_source_dir() / 'graphs', check:true).stdout().strip().split('\n') +sets_glob = run_command(glob_cmd, meson.current_source_dir() / 'sets', check:true).stdout().strip().split('\n') + +# Chunk the glob lists to avoid command line length limits, and for parallelization chunk_size = 64 -chunks = [] -chunk = [] -foreach item : glob - if chunk.length() >= chunk_size +foreach glob_name : ['fonts_glob', 'subset_fonts_glob', 'graphs_glob', 'sets_glob'] + glob = get_variable(glob_name) + chunks = [] + chunk = [] + foreach item : glob + if chunk.length() >= chunk_size + chunks += [chunk] + chunk = [] + endif + chunk += [item] + endforeach + if chunk.length() > 0 chunks += [chunk] - chunk = [] endif - chunk += [item] + set_variable('@0@_chunks'.format(glob_name), chunks) endforeach -if chunk.length() > 0 - chunks += [chunk] -endif + +# Run fuzzers i = 0 -foreach chunk : chunks +foreach chunk : fonts_glob_chunks + test('shape-fuzzer-chunk-@0@'.format(i), + hb_shape_fuzzer_exe, + args: chunk, + workdir: meson.current_build_dir() / '..' / '..', + protocol: 'tap', + suite: ['fuzzing'], + ) + i += 1 +endforeach + +i = 0 +foreach chunk : fonts_glob_chunks + test('draw-fuzzer-chunk-@0@'.format(i), + hb_draw_fuzzer_exe, + args: chunk, + workdir: meson.current_build_dir() / '..' / '..', + protocol: 'tap', + suite: ['fuzzing'], + ) + i += 1 +endforeach + +i = 0 +foreach chunk : fonts_glob_chunks + subset_fonts_glob_chunks test('subset-fuzzer-chunk-@0@'.format(i), hb_subset_fuzzer_exe, args: chunk, @@ -99,3 +98,27 @@ foreach chunk : chunks ) i += 1 endforeach + +i = 0 +foreach chunk : graphs_glob_chunks + test('repacker-fuzzer-chunk-@0@'.format(i), + hb_repacker_fuzzer_exe, + args: chunk, + workdir: meson.current_build_dir() / '..' / '..', + protocol: 'tap', + suite: ['fuzzing'], + ) + i += 1 +endforeach + +i = 0 +foreach chunk : sets_glob_chunks + test('set-fuzzer-chunk-@0@'.format(i), + hb_set_fuzzer_exe, + args: chunk, + workdir: meson.current_build_dir() / '..' / '..', + protocol: 'tap', + suite: ['fuzzing'], + ) + i += 1 +endforeach diff --git a/test/fuzzing/run-fuzzer-tests.py b/test/fuzzing/run-fuzzer-tests.py deleted file mode 100755 index 04b0612a3..000000000 --- a/test/fuzzing/run-fuzzer-tests.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python3 - -import pathlib -import subprocess -import os -import sys -import tempfile - -EXE_WRAPPER = os.environ.get("MESON_EXE_WRAPPER") - - -def run_command(command): - """ - Run a command, capturing potentially large output in a temp file. - Returns (output_string, exit_code). - """ - global EXE_WRAPPER - if EXE_WRAPPER: - command = [EXE_WRAPPER] + command - - with tempfile.TemporaryFile() as tempf: - p = subprocess.Popen(command, stdout=tempf, stderr=tempf) - p.wait() - tempf.seek(0) - output = tempf.read().decode("utf-8", errors="replace").strip() - return output, p.returncode - - -def chunkify(lst, chunk_size=64): - """ - Yield successive chunk_size-sized slices from lst. - """ - for i in range(0, len(lst), chunk_size): - yield lst[i : i + chunk_size] - - -def main(): - assert len(sys.argv) > 2, "Please provide fuzzer binary and fonts directory paths." - - fuzzer = pathlib.Path(sys.argv[1]) - assert fuzzer.is_file(), f"Fuzzer binary not found: {fuzzer}" - print("Using fuzzer:", fuzzer) - - # Gather all test files - files_to_test = [] - for fonts_dir in sys.argv[2:]: - fonts_dir = pathlib.Path(fonts_dir) - assert fonts_dir.is_dir(), f"Fonts directory not found: {fonts_dir}" - test_files = [str(f) for f in fonts_dir.iterdir() if f.is_file()] - assert test_files, f"No files found in {fonts_dir}" - files_to_test += test_files - - if not files_to_test: - print("No test files found") - sys.exit(0) - - fails = 0 - batch_index = 0 - - for chunk in chunkify(files_to_test): - batch_index += 1 - cmd_line = [fuzzer] + chunk - output, returncode = run_command(cmd_line) - - if output: - print(output) - - if returncode != 0: - print(f"Failure in batch #{batch_index}") - fails += 1 - - if fails > 0: - sys.exit(f"{fails} fuzzer batch(es) failed.") - - print("All fuzzer tests passed successfully.") - - -if __name__ == "__main__": - main() From aa6a37de618ccc689ab483c9ef2dbe9d6acbf6ed Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 6 Apr 2025 14:13:18 -0600 Subject: [PATCH 26/26] [test/subset] Port to TAP --- test/subset/meson.build | 2 ++ test/subset/run-repack-tests.py | 43 ++++++++++++++++++--------- test/subset/run-tests.py | 51 +++++++++++++++++++++------------ 3 files changed, 64 insertions(+), 32 deletions(-) diff --git a/test/subset/meson.build b/test/subset/meson.build index 7bbdc5c90..7037223c7 100644 --- a/test/subset/meson.build +++ b/test/subset/meson.build @@ -111,6 +111,7 @@ foreach t : tests # ideally better to break and let meson handles them in parallel timeout: 500, workdir: meson.current_build_dir() / '..' / '..', + protocol: 'tap', suite: 'subset', ) endforeach @@ -126,6 +127,7 @@ foreach t : repack_tests meson.current_source_dir() / 'data' / 'repack_tests' / fname, ], workdir: meson.current_build_dir() / '..' / '..', + protocol: 'tap', suite: ['subset', 'repack'], ) endforeach diff --git a/test/subset/run-repack-tests.py b/test/subset/run-repack-tests.py index a0389e5aa..8003e7163 100755 --- a/test/subset/run-repack-tests.py +++ b/test/subset/run-repack-tests.py @@ -17,8 +17,8 @@ from repack_test import RepackTest try: from fontTools.ttLib import TTFont except ImportError: - print("fonttools is not present, skipping test.") - sys.exit(77) + print("# fonttools is not present, skipping test.") + sys.exit() ots_sanitize = shutil.which("ots-sanitize") @@ -27,7 +27,7 @@ EXE_WRAPPER = os.environ.get("MESON_EXE_WRAPPER") def subset_cmd(command): global hb_subset, process - print(hb_subset + " " + " ".join(command)) + print("# " + hb_subset + " " + " ".join(command)) process.stdin.write((";".join(command) + "\n").encode("utf-8")) process.stdin.flush() return process.stdout.readline().decode("utf-8").strip() @@ -43,11 +43,20 @@ def cmd(command): def fail_test(test, cli_args, message): + global fails + fails += 1 + print("ERROR: %s" % message) print("Test State:") print(" test.font_name %s" % test.font_name) print(" test.test_path %s" % os.path.abspath(test.test_path)) - return 1 + print("not ok -", test) + print(" ---", file=sys.stderr) + print(" message: \"%s\"" % message, file=sys.stderr) + print(" test.font_name: \"%s\"" % test.font_name) + print(" test.test_path: \"%s\"" % os.path.abspath(test.test_path)) + print(" ...", file=sys.stderr) + return False def run_test(test, should_check_ots): @@ -58,7 +67,7 @@ def run_test(test, should_check_ots): "--unicodes=%s" % test.codepoints_string(), "--drop-tables-=GPOS,GSUB,GDEF", ] - print(" ".join(cli_args)) + print("#", " ".join(cli_args)) ret = subset_cmd(cli_args) if ret != "success": @@ -72,16 +81,16 @@ def run_test(test, should_check_ots): return fail_test(test, cli_args, "ttx failed to parse the result") if should_check_ots: - print("Checking output with ots-sanitize.") + print("# Checking output with ots-sanitize.") if not check_ots(out_file): return fail_test(test, cli_args, "ots for subsetted file fails.") - return 0 + return True def has_ots(): if not ots_sanitize: - print("OTS is not present, skipping all ots checks.") + print("# OTS is not present, skipping all ots checks.") return False return True @@ -89,7 +98,7 @@ def has_ots(): def check_ots(path): ots_report, returncode = cmd([ots_sanitize, path]) if returncode: - print("OTS Failure: %s" % ots_report) + print("# OTS Failure: %s" % ots_report) return False return True @@ -102,8 +111,6 @@ hb_subset, args = args[0], args[1:] if len(args) != 1: sys.exit("No tests supplied.") -has_ots = has_ots() - batch_cmd = [hb_subset, "--batch"] if EXE_WRAPPER: batch_cmd = [EXE_WRAPPER] + batch_cmd @@ -111,6 +118,10 @@ process = subprocess.Popen( batch_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=sys.stdout ) +print("TAP version 14") + +has_ots = has_ots() + fails = 0 path = args[0] @@ -119,13 +130,17 @@ if not path.endswith(".tests"): out_dir = tempfile.mkdtemp() +number = 0 with open(path, mode="r", encoding="utf-8") as f: # TODO(garretrieger): re-enable OTS checking. - fails += run_test(RepackTest(path, f.read()), False) + if run_test(RepackTest(path, f.read()), False): + number += 1 + print("ok %d - %s" % (number, os.path.basename(path))) +print("1..%d" % number) if fails != 0: - sys.exit("%d test(s) failed; output left in %s" % (fails, out_dir)) + print("# %d test(s) failed; output left in %s" % (fails, out_dir)) else: - print("All tests passed.") + print("# All tests passed.") shutil.rmtree(out_dir) diff --git a/test/subset/run-tests.py b/test/subset/run-tests.py index b403bfab9..96dda6ed5 100755 --- a/test/subset/run-tests.py +++ b/test/subset/run-tests.py @@ -29,7 +29,7 @@ def subset_cmd(command): if subset_process.poll() is not None: subset_process = open_subset_batch_process() - print(hb_subset + " " + " ".join(command)) + print("# " + hb_subset + " " + " ".join(command)) subset_process.stdin.write((";".join(command) + "\n").encode("utf-8")) subset_process.stdin.flush() return subset_process.stdout.readline().decode("utf-8").strip() @@ -45,19 +45,28 @@ def cmd(command): def fail_test(test, cli_args, message): - print("ERROR: %s" % message) - print("Test State:") - print(" test.font_path %s" % os.path.abspath(test.font_path)) - print(" test.profile_path %s" % os.path.abspath(test.profile_path)) - print(" test.unicodes %s" % test.unicodes()) + global fails + fails += 1 + expected_file = os.path.join( test_suite.get_output_directory(), test.get_font_name() ) - print(" expected_file %s" % os.path.abspath(expected_file)) - return 1 + + print("not ok -", test) + print(" ---", file=sys.stderr) + print(" message: \"%s\"" % message, file=sys.stderr) + print(" test.font_path: \"%s\"" % os.path.abspath(test.font_path), file=sys.stderr) + print(" test.profile_path: \"%s\"" % os.path.abspath(test.profile_path), file=sys.stderr) + print(" test.unicodes: \"%s\"" % test.unicodes(), file=sys.stderr) + print(" expected_file: \"%s\"" % os.path.abspath(expected_file), file=sys.stderr) + print(" ...", file=sys.stderr) + return False def run_test(test, should_check_ots, preprocess): + global number + number += 1 + out_file = os.path.join( out_dir, test.get_font_name() + "-subset" + test.get_font_extension() ) @@ -99,13 +108,13 @@ def run_test(test, should_check_ots, preprocess): if expected_contents == actual_contents: if should_check_ots: - print("Checking output with ots-sanitize.") + print("# Checking output with ots-sanitize.") if not check_ots(out_file): return fail_test(test, cli_args, "ots for subsetted file fails.") - return 0 + return True if TTFont is None: - print("fonttools is not present, skipping TTX diff.") + print("# fonttools is not present, skipping TTX diff.") return fail_test(test, cli_args, "hash for expected and actual does not match.") with io.StringIO() as fp: @@ -142,7 +151,7 @@ def run_test(test, should_check_ots, preprocess): def has_ots(): if not ots_sanitize: - print("OTS is not present, skipping all ots checks.") + print("# OTS is not present, skipping all ots checks.") return False return True @@ -150,7 +159,7 @@ def has_ots(): def check_ots(path): ots_report, returncode = cmd([ots_sanitize, path]) if returncode: - print("OTS Failure: %s" % ots_report) + print("# OTS Failure: %s" % ots_report) return False return True @@ -163,6 +172,8 @@ hb_subset, args = args[0], args[1:] if not len(args): sys.exit("No tests supplied.") +print("TAP version 14") + has_ots = has_ots() env = os.environ.copy() @@ -189,19 +200,23 @@ def open_subset_batch_process(): subset_process = open_subset_batch_process() out_dir = tempfile.mkdtemp() +number = 0 fails = 0 for path in args: with open(path, mode="r", encoding="utf-8") as f: - print("Running tests in " + path) + print("# Running tests in " + path) test_suite = SubsetTestSuite(path, f.read()) for test in test_suite.tests(): # Tests are run with and without preprocessing, results should be the # same between them. - fails += run_test(test, has_ots, False) - fails += run_test(test, has_ots, True) + for preprocess in [False, True]: + if run_test(test, has_ots, preprocess): + print("ok %d - %s" % (number, test)) + +print("1..%d" % number) if fails != 0: - sys.exit("%d test(s) failed; output left in %s" % (fails, out_dir)) + print("# %d test(s) failed; output left in %s" % (fails, out_dir), file=sys.stderr) else: - print("All tests passed.") + print("# All tests passed.") shutil.rmtree(out_dir)