[test] Test hb_ot_color_has_{colr,cpal}_data
This commit is contained in:
parent
b8ee3a0ec8
commit
6795dcfc08
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright © 2018 Ebrahim Byagowi
|
||||
* Copyright © 2018 Khaled Hosny
|
||||
*
|
||||
* This is part of HarfBuzz, a text shaping library.
|
||||
*
|
||||
|
@ -140,7 +141,7 @@ colr_cpal_rendering (hb_face_t *face, cairo_font_face_t *cairo_face)
|
|||
hb_ot_color_get_palette_colors (face, palette, 0, &num_colors, colors);
|
||||
if (num_colors)
|
||||
{
|
||||
// If we have more than one palette, use a better namin
|
||||
// If we have more than one palette, use a simpler naming
|
||||
if (palette_count == 1)
|
||||
sprintf (output_path, "out/colr-%d.svg", gid);
|
||||
else
|
||||
|
|
|
@ -117,7 +117,7 @@ hb_ot_color_get_palette_name_id (hb_face_t *face, unsigned int palette)
|
|||
}
|
||||
|
||||
/**
|
||||
* hb_ot_color_get_palette_count:
|
||||
* hb_ot_color_get_palette_entry_count:
|
||||
* @face: a font face.
|
||||
*
|
||||
* Returns: Number of entries on each palette
|
||||
|
@ -206,7 +206,8 @@ hb_ot_color_get_palette_colors (hb_face_t *face,
|
|||
* @gid:
|
||||
* @start_offset:
|
||||
* @count: (inout) (optional):
|
||||
* @color_indices: (array length=color_count) (optional):
|
||||
* @gids: (array length=count) (optional):
|
||||
* @color_indices: (array length=count) (optional):
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
|
@ -250,7 +251,7 @@ hb_ot_color_get_color_layers (hb_face_t *face,
|
|||
* or if @palette is not between 0 and hb_ot_color_get_palette_count(),
|
||||
* the result is #HB_OT_COLOR_PALETTE_FLAG_DEFAULT.
|
||||
*
|
||||
* Since: DONTREPLACEME
|
||||
* Since: REPLACEME
|
||||
*/
|
||||
hb_ot_color_palette_flags_t
|
||||
hb_ot_color_get_palette_flags (hb_face_t *face, unsigned int palette)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright © 2016 Google, Inc.
|
||||
* Copyright © 2018 Ebrahim Byagowi
|
||||
*
|
||||
* This is part of HarfBuzz, a text shaping library.
|
||||
*
|
||||
|
@ -321,6 +322,13 @@ test_hb_ot_color_get_color_layers (void)
|
|||
unsigned int color_indices[1];
|
||||
unsigned int count = 1;
|
||||
|
||||
g_assert_cmpuint (hb_ot_color_get_color_layers (cpal_v1, 0, 0,
|
||||
NULL, NULL, NULL), ==, 0);
|
||||
g_assert_cmpuint (hb_ot_color_get_color_layers (cpal_v1, 1, 0,
|
||||
NULL, NULL, NULL), ==, 0);
|
||||
g_assert_cmpuint (hb_ot_color_get_color_layers (cpal_v1, 2, 0,
|
||||
NULL, NULL, NULL), ==, 2);
|
||||
|
||||
unsigned int num_layers;
|
||||
num_layers = hb_ot_color_get_color_layers (cpal_v1, 2, 0, &count, layer_gids,
|
||||
color_indices);
|
||||
|
@ -340,6 +348,20 @@ test_hb_ot_color_get_color_layers (void)
|
|||
g_assert_cmpuint (color_indices[0], ==, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
test_hb_ot_color_has_data (void)
|
||||
{
|
||||
hb_face_t *empty = hb_face_get_empty ();
|
||||
|
||||
g_assert (hb_ot_color_has_colr_data (empty) == FALSE);
|
||||
g_assert (hb_ot_color_has_colr_data (cpal_v0) == TRUE);
|
||||
g_assert (hb_ot_color_has_colr_data (cpal_v1) == TRUE);
|
||||
|
||||
g_assert (hb_ot_color_has_cpal_data (empty) == FALSE);
|
||||
g_assert (hb_ot_color_has_cpal_data (cpal_v0) == TRUE);
|
||||
g_assert (hb_ot_color_has_cpal_data (cpal_v1) == TRUE);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
|
@ -360,6 +382,7 @@ main (int argc, char **argv)
|
|||
hb_test_add (test_hb_ot_color_get_palette_colors_v1);
|
||||
hb_test_add (test_hb_ot_color_get_palette_entry);
|
||||
hb_test_add (test_hb_ot_color_get_color_layers);
|
||||
hb_test_add (test_hb_ot_color_has_data);
|
||||
status = hb_test_run();
|
||||
hb_face_destroy (cpal_v0);
|
||||
hb_face_destroy (cpal_v1);
|
||||
|
|
Loading…
Reference in New Issue