{
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);
{
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);
}
{
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);
}
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,
}
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;