未验证 提交 61510b63 编写于 作者: E Ebrahim Byagowi 提交者: GitHub

[test] Minor cleanup in test-multithread and test-ot-name (#1256)

上级 42b75dc3
...@@ -4,7 +4,7 @@ if (HB_HAVE_GLIB) ...@@ -4,7 +4,7 @@ if (HB_HAVE_GLIB)
list (APPEND TEST_PROGS list (APPEND TEST_PROGS
test-ot-color test-ot-color
test-ot-nameid test-ot-name
test-ot-tag test-ot-tag
test-c test-c
test-cplusplus test-cplusplus
......
...@@ -71,7 +71,7 @@ endif ...@@ -71,7 +71,7 @@ endif
TEST_PROGS += \ TEST_PROGS += \
test-ot-color \ test-ot-color \
test-ot-nameid \ test-ot-name \
test-ot-tag \ test-ot-tag \
$(NULL) $(NULL)
......
...@@ -154,13 +154,15 @@ main (int argc, char **argv) ...@@ -154,13 +154,15 @@ main (int argc, char **argv)
hb_face_t *face = hb_face_create (blob, 0); hb_face_t *face = hb_face_create (blob, 0);
font = hb_font_create (face); font = hb_font_create (face);
hb_ot_font_set_funcs (font); /* Fill the reference */
ref_buffer = hb_buffer_create (); ref_buffer = hb_buffer_create ();
fill_the_buffer (ref_buffer); fill_the_buffer (ref_buffer);
/* Unnecessary, since version 2 it is ot-font by default */
hb_ot_font_set_funcs (font);
test_body (); test_body ();
/* Test hb-ft in multithread */
hb_ft_font_set_funcs (font); hb_ft_font_set_funcs (font);
test_body (); test_body ();
......
...@@ -23,35 +23,16 @@ ...@@ -23,35 +23,16 @@
* *
*/ */
#include <hb.h> #include "hb-test.h"
#include <hb-ot.h> #include <hb-ot.h>
#include <glib.h>
static const char *font_path = "fonts/cv01.otf"; static const char *font_path = "fonts/cv01.otf";
static hb_face_t *face;
int static void
main (int argc, char **argv) test_ot_layout_feature_get_name_ids_and_characters ()
{ {
g_test_init (&argc, &argv, NULL);
#if GLIB_CHECK_VERSION(2,37,2)
gchar *default_path = g_test_build_filename (G_TEST_DIST, font_path, NULL);
#else
gchar *default_path = g_strdup (font_path);
#endif
hb_blob_t *blob;
hb_face_t *face;
hb_font_t *font;
char *path = argc > 1 && *argv[1] ? argv[1] : (char *) default_path;
blob = hb_blob_create_from_file (path);
if (hb_blob_get_length (blob) == 0)
g_error ("Font not found.");
face = hb_face_create (blob, 0);
font = hb_font_create (face);
hb_tag_t cv01 = HB_TAG ('c','v','0','1'); hb_tag_t cv01 = HB_TAG ('c','v','0','1');
unsigned int feature_index; unsigned int feature_index;
if (!hb_ot_layout_language_find_feature (face, if (!hb_ot_layout_language_find_feature (face,
...@@ -89,12 +70,33 @@ main (int argc, char **argv) ...@@ -89,12 +70,33 @@ main (int argc, char **argv)
g_assert (char_count == 2); g_assert (char_count == 2);
g_assert (characters[0] == 10); g_assert (characters[0] == 10);
g_assert (characters[1] == 24030); g_assert (characters[1] == 24030);
}
int
main (int argc, char **argv)
{
g_test_init (&argc, &argv, NULL);
#if GLIB_CHECK_VERSION(2,37,2)
gchar *default_path = g_test_build_filename (G_TEST_DIST, font_path, NULL);
#else
gchar *default_path = g_strdup (font_path);
#endif
hb_blob_t *blob;
char *path = argc > 1 && *argv[1] ? argv[1] : (char *) default_path;
blob = hb_blob_create_from_file (path);
if (hb_blob_get_length (blob) == 0)
g_error ("Font not found.");
hb_font_destroy (font); face = hb_face_create (blob, 0);
hb_test_add (test_ot_layout_feature_get_name_ids_and_characters);
unsigned int result = hb_test_run ();
hb_face_destroy (face); hb_face_destroy (face);
hb_blob_destroy (blob); hb_blob_destroy (blob);
g_free (default_path); g_free (default_path);
return result;
return 0;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册