From a55b007144a35267a46fda62e035d80e341db30d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 6 Aug 2024 14:39:10 -0600 Subject: [PATCH] [test] Add get_table_tags test for hb-coretext --- test/api/test-get-table-tags.c | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/api/test-get-table-tags.c b/test/api/test-get-table-tags.c index d1823075b..69995009e 100644 --- a/test/api/test-get-table-tags.c +++ b/test/api/test-get-table-tags.c @@ -26,9 +26,13 @@ #include "hb-test.h" +#include #ifdef HAVE_FREETYPE #include #endif +#ifdef HAVE_CORETEXT +#include "hb-coretext.h" +#endif static void _test_get_table_tags (hb_face_t *face) @@ -118,6 +122,34 @@ test_get_table_tags_ft (void) } #endif +#ifdef HAVE_CORETEXT +static void +test_get_table_tags_ct (void) +{ + hb_face_t *source = hb_test_open_font_file ("fonts/Roboto-Regular.abc.ttf"); + hb_blob_t *blob = hb_face_reference_blob (source); + hb_face_destroy (source); + + CGDataProviderRef provider = CGDataProviderCreateWithData (blob, + hb_blob_get_data (blob, NULL), + hb_blob_get_length (blob), + NULL); + assert (provider); + + CGFontRef cg_font = CGFontCreateWithDataProvider (provider); + assert (cg_font); + CGDataProviderRelease (provider); + + hb_face_t *face = hb_coretext_face_create (cg_font); + + _test_get_table_tags (face); + + hb_face_destroy (face); + CGFontRelease (cg_font); + hb_blob_destroy (blob); +} +#endif + int main (int argc, char **argv) { @@ -128,6 +160,9 @@ main (int argc, char **argv) #ifdef HAVE_FREETYPE hb_test_add (test_get_table_tags_ft); #endif +#ifdef HAVE_CORETEXT + hb_test_add (test_get_table_tags_ct); +#endif return hb_test_run(); }