From 39da1914b4fd1c58d61cb29c78a0904ff6b905c6 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Wed, 26 Sep 2018 23:32:45 +0330 Subject: [PATCH] Test freetype funcs on test-multithread (#1187) --- test/api/Makefile.am | 6 ++++-- test/api/test-multithread.c | 25 +++++++++++++++++-------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/test/api/Makefile.am b/test/api/Makefile.am index 1c0f92c13..466d56f04 100644 --- a/test/api/Makefile.am +++ b/test/api/Makefile.am @@ -77,9 +77,11 @@ TEST_PROGS += \ $(NULL) if HAVE_PTHREAD +if HAVE_FREETYPE TEST_PROGS += test-multithread -test_multithread_CFLAGS = $(CFLAGS) $(PTHREAD_CFLAGS) -test_multithread_LDADD = $(LDADD) $(PTHREAD_LIBS) +test_multithread_CFLAGS = $(CFLAGS) $(PTHREAD_CFLAGS) $(FREETYPE_CFLAGS) +test_multithread_LDADD = $(LDADD) $(PTHREAD_LIBS) $(FREETYPE_LIBS) +endif endif if HAVE_FREETYPE diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index 4570da125..c87da3c0f 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -30,6 +30,7 @@ #include #include +#include #include const char *text = "طرح‌نَما"; @@ -74,8 +75,8 @@ thread_func (void *data) return 0; } -int -main (int argc, char **argv) +void +test_body () { int i; int num_threads = 30; @@ -84,11 +85,6 @@ main (int argc, char **argv) pthread_mutex_lock (&mutex); - hb_blob_t *blob = hb_blob_create_from_file (path); - hb_face_t *face = hb_face_create (blob, 0); - font = hb_font_create (face); - hb_ot_font_set_funcs (font); - for (i = 0; i < num_threads; i++) { hb_buffer_t *buffer = hb_buffer_create (); @@ -124,7 +120,7 @@ main (int argc, char **argv) HB_BUFFER_SERIALIZE_FLAG_DEFAULT); fprintf (stderr, "Expected: %s\n", out); - return 1; + exit (1); } hb_buffer_destroy (buffer); } @@ -133,6 +129,19 @@ main (int argc, char **argv) free (buffers); free (threads); +} + +int +main (int argc, char **argv) +{ + hb_blob_t *blob = hb_blob_create_from_file (path); + hb_face_t *face = hb_face_create (blob, 0); + font = hb_font_create (face); + + hb_ft_font_set_funcs (font); + test_body (); + hb_ot_font_set_funcs (font); + test_body (); hb_font_destroy (font); hb_face_destroy (face);