[test/buffer] Add more tests for nil buffer
This commit is contained in:
parent
065fb38c9a
commit
92de53ea45
|
@ -711,11 +711,49 @@ test_buffer_utf16_conversion (void)
|
||||||
hb_buffer_destroy (b);
|
hb_buffer_destroy (b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_empty (hb_buffer_t *b)
|
||||||
|
{
|
||||||
|
g_assert_cmpint (hb_buffer_get_length (b), ==, 0);
|
||||||
|
g_assert (!hb_buffer_get_glyph_infos (b, NULL));
|
||||||
|
g_assert (!hb_buffer_get_glyph_positions (b, NULL));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_buffer_empty (void)
|
test_buffer_empty (void)
|
||||||
{
|
{
|
||||||
|
hb_buffer_t *b = hb_buffer_get_empty ();
|
||||||
|
|
||||||
g_assert (hb_buffer_get_empty ());
|
g_assert (hb_buffer_get_empty ());
|
||||||
|
g_assert (hb_buffer_get_empty () == b);
|
||||||
g_assert (hb_buffer_get_empty () == hb_buffer_create (-1));
|
g_assert (hb_buffer_get_empty () == hb_buffer_create (-1));
|
||||||
|
|
||||||
|
g_assert (!hb_buffer_allocation_successful (b));
|
||||||
|
|
||||||
|
test_empty (b);
|
||||||
|
|
||||||
|
hb_buffer_add_utf32 (b, utf32, G_N_ELEMENTS (utf32), 1, G_N_ELEMENTS (utf32) - 2);
|
||||||
|
|
||||||
|
test_empty (b);
|
||||||
|
|
||||||
|
hb_buffer_reverse (b);
|
||||||
|
hb_buffer_reverse_clusters (b);
|
||||||
|
|
||||||
|
g_assert (!hb_buffer_set_length (b, 10));
|
||||||
|
|
||||||
|
test_empty (b);
|
||||||
|
|
||||||
|
g_assert (hb_buffer_set_length (b, 0));
|
||||||
|
|
||||||
|
test_empty (b);
|
||||||
|
|
||||||
|
g_assert (!hb_buffer_allocation_successful (b));
|
||||||
|
|
||||||
|
hb_buffer_reset (b);
|
||||||
|
|
||||||
|
test_empty (b);
|
||||||
|
|
||||||
|
g_assert (!hb_buffer_allocation_successful (b));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in New Issue