mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-25 08:51:07 +01:00
[test/buffer] Add more tests for nil buffer
This commit is contained in:
1 parent
065fb38c9a
commit
92de53ea45
1 file changed
+38
@@ -711,11 +711,49 @@ test_buffer_utf16_conversion (void)
|
||||
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
|
||||
test_buffer_empty (void)
|
||||
{
|
||||
hb_buffer_t *b = 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_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
|
||||
|
||||
Reference in new issue
Block a user