[test/unicode] Test is/make_immutable()
diff --git a/test/test-unicode.c b/test/test-unicode.c
index 40bb03d..19d921b 100644
--- a/test/test-unicode.c
+++ b/test/test-unicode.c
@@ -36,6 +36,8 @@
{
hb_unicode_funcs_t *uf = hb_unicode_funcs_create (NULL);
+ g_assert (!hb_unicode_funcs_is_immutable (uf));
+
g_assert_cmpint (hb_unicode_get_script (uf, 'd'), ==, HB_SCRIPT_UNKNOWN);
hb_unicode_funcs_destroy (uf);
@@ -46,6 +48,8 @@
{
hb_unicode_funcs_t *uf = hb_glib_get_unicode_funcs ();
+ g_assert (hb_unicode_funcs_is_immutable (uf));
+
g_assert_cmpint (hb_unicode_get_script (uf, 'd'), ==, HB_SCRIPT_LATIN);
}
@@ -54,6 +58,8 @@
{
hb_unicode_funcs_t *uf = hb_unicode_funcs_get_default ();
+ g_assert (hb_unicode_funcs_is_immutable (uf));
+
g_assert_cmpint (hb_unicode_get_script (uf, 'd'), ==, HB_SCRIPT_LATIN);
}
@@ -106,22 +112,6 @@
return HB_SCRIPT_UNKNOWN;
}
-static void
-test_unicode_custom (data_fixture_t *f, gconstpointer user_data)
-{
- hb_unicode_funcs_t *uf = hb_unicode_funcs_create (NULL);
-
- hb_unicode_funcs_set_script_func (uf, simple_get_script,
- &f->data[0], free_up);
-
- g_assert_cmpint (hb_unicode_get_script (uf, 'a'), ==, HB_SCRIPT_LATIN);
- g_assert_cmpint (hb_unicode_get_script (uf, '0'), ==, HB_SCRIPT_UNKNOWN);
-
- g_assert (!f->data[0].freed && !f->data[1].freed);
- hb_unicode_funcs_destroy (uf);
- g_assert (f->data[0].freed && !f->data[1].freed);
-}
-
static hb_script_t
a_is_for_arabic_get_script (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t codepoint,
@@ -143,6 +133,30 @@
}
static void
+test_unicode_custom (data_fixture_t *f, gconstpointer user_data)
+{
+ hb_unicode_funcs_t *uf = hb_unicode_funcs_create (NULL);
+
+ hb_unicode_funcs_set_script_func (uf, simple_get_script,
+ &f->data[0], free_up);
+
+ g_assert_cmpint (hb_unicode_get_script (uf, 'a'), ==, HB_SCRIPT_LATIN);
+ g_assert_cmpint (hb_unicode_get_script (uf, '0'), ==, HB_SCRIPT_UNKNOWN);
+
+ g_assert (!hb_unicode_funcs_is_immutable (uf));
+ hb_unicode_funcs_make_immutable (uf);
+ g_assert (hb_unicode_funcs_is_immutable (uf));
+
+ /* Since uf is immutable now, the following setter should do nothing. */
+ hb_unicode_funcs_set_script_func (uf, a_is_for_arabic_get_script,
+ &f->data[1], free_up);
+
+ g_assert (!f->data[0].freed && !f->data[1].freed);
+ hb_unicode_funcs_destroy (uf);
+ g_assert (f->data[0].freed && !f->data[1].freed);
+}
+
+static void
test_unicode_subclassing_nil (data_fixture_t *f, gconstpointer user_data)
{
hb_unicode_funcs_t *uf, *aa;