2 * Copyright © 2018 Google, Inc.
4 * This is part of HarfBuzz, a text shaping library.
6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software.
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24 * Google Author(s): Garret Rieger
28 #include "hb-subset-test.h"
30 /* Unit tests for hb-subset-glyf.h */
33 test_subset_32_tables (void)
35 hb_face_t *face = hb_subset_test_open_font("fonts/oom-6ef8c96d3710262511bcc730dce9c00e722cb653");
37 hb_subset_input_t *input = hb_subset_input_create_or_fail ();
38 hb_set_t *codepoints = hb_subset_input_unicode_set (input);
39 hb_set_add (codepoints, 'a');
40 hb_set_add (codepoints, 'b');
41 hb_set_add (codepoints, 'c');
43 hb_subset_profile_t *profile = hb_subset_profile_create();
44 hb_face_t *subset = hb_subset (face, profile, input);
46 g_assert (subset != hb_face_get_empty ());
48 hb_subset_input_destroy (input);
49 hb_subset_profile_destroy (profile);
50 hb_face_destroy (subset);
51 hb_face_destroy (face);
55 test_subset_no_inf_loop (void)
57 hb_face_t *face = hb_subset_test_open_font("fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5521982557782016");
59 hb_subset_input_t *input = hb_subset_input_create_or_fail ();
60 hb_set_t *codepoints = hb_subset_input_unicode_set (input);
61 hb_set_add (codepoints, 'a');
62 hb_set_add (codepoints, 'b');
63 hb_set_add (codepoints, 'c');
65 hb_subset_profile_t *profile = hb_subset_profile_create();
66 hb_face_t *subset = hb_subset (face, profile, input);
68 g_assert (subset == hb_face_get_empty ());
70 hb_subset_input_destroy (input);
71 hb_subset_profile_destroy (profile);
72 hb_face_destroy (subset);
73 hb_face_destroy (face);
77 test_subset_crash (void)
79 hb_face_t *face = hb_subset_test_open_font("fonts/crash-4b60576767ee4d9fe1cc10959d89baf73d4e8249");
81 hb_subset_input_t *input = hb_subset_input_create_or_fail ();
82 hb_set_t *codepoints = hb_subset_input_unicode_set (input);
83 hb_set_add (codepoints, 'a');
84 hb_set_add (codepoints, 'b');
85 hb_set_add (codepoints, 'c');
87 hb_subset_profile_t *profile = hb_subset_profile_create();
88 hb_face_t *subset = hb_subset (face, profile, input);
90 g_assert (subset == hb_face_get_empty ());
92 hb_subset_input_destroy (input);
93 hb_subset_profile_destroy (profile);
94 hb_face_destroy (subset);
95 hb_face_destroy (face);
99 main (int argc, char **argv)
101 hb_test_init (&argc, &argv);
103 hb_test_add (test_subset_32_tables);
104 hb_test_add (test_subset_no_inf_loop);
105 hb_test_add (test_subset_crash);
107 return hb_test_run();