From: Ebrahim Byagowi Date: Wed, 26 Sep 2018 20:02:45 +0000 (+0330) Subject: Test freetype funcs on test-multithread (#1187) X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=39da1914b4fd1c58d61cb29c78a0904ff6b905c6;p=platform%2Fupstream%2FlibHarfBuzzSharp.git Test freetype funcs on test-multithread (#1187) --- diff --git a/test/api/Makefile.am b/test/api/Makefile.am index 1c0f92c..466d56f 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 4570da1..c87da3c 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);