[test/api] Test remaining tests to TAP

This commit is contained in:
Behdad Esfahbod 2025-04-06 00:12:22 -06:00
parent c523f9ac13
commit e4e4d66523
3 changed files with 35 additions and 13 deletions

View file

@ -26,10 +26,7 @@
/* This file tests that all headers can be included from C files */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "hb-test.h"
#include <hb.h>
#include <hb-subset.h>
@ -77,9 +74,20 @@
#endif
#ifndef NO_MAIN
int
main (void)
static void
test_list_shapers (void)
{
return !*hb_shape_list_shapers ();
const char *first = *hb_shape_list_shapers ();
g_assert (first);
}
int
main (int argc, char **argv)
{
hb_test_init (&argc, &argv);
hb_test_add (test_list_shapers);
return hb_test_run ();
}
#endif

View file

@ -45,8 +45,8 @@
#include <functional>
#include <utility>
int
main ()
static void
test_smart_ptrs (void)
{
hb_buffer_t *b = hb_buffer_create ();
hb::shared_ptr<hb_buffer_t> pb {b};
@ -100,5 +100,16 @@ main ()
assert (hash2 (pb4) == hash2 (pb2));
assert (hash (b) == hash3 (pb5));
return pb == pb.get_empty () || pb == pb2;
g_assert (pb != pb.get_empty ());
g_assert (pb != pb2);
}
int
main (int argc, char **argv)
{
hb_test_init (&argc, &argv);
hb_test_add (test_smart_ptrs);
return hb_test_run ();
}

View file

@ -91,8 +91,9 @@ thread_func (void *data)
}
static void
test_body (const char *backend)
test_body (gconstpointer data)
{
const char *backend = (const char *) data;
bool ret = hb_font_set_funcs_using (font, backend);
g_assert (ret);
@ -147,12 +148,14 @@ main (int argc, char **argv)
fill_the_buffer (ref_buffer);
for (const char **font_funcs = hb_font_list_funcs (); *font_funcs; font_funcs++)
test_body (*font_funcs);
hb_test_add_data_flavor (*font_funcs, *font_funcs, test_body);
int ret = hb_test_run ();
hb_buffer_destroy (ref_buffer);
hb_font_destroy (font);
hb_face_destroy (face);
return 0;
return ret;
}