提交 e74b5b33 编写于 作者: B Behdad Esfahbod

[test/unicode] Test Unicode 5.2+ but don't fail

上级 c763aa42
...@@ -419,6 +419,7 @@ test_unicode_properties (gconstpointer user_data) ...@@ -419,6 +419,7 @@ test_unicode_properties (gconstpointer user_data)
{ {
hb_unicode_funcs_t *uf = (hb_unicode_funcs_t *) user_data; hb_unicode_funcs_t *uf = (hb_unicode_funcs_t *) user_data;
unsigned int i, j; unsigned int i, j;
gboolean failed = TRUE;
g_assert (hb_unicode_funcs_is_immutable (uf)); g_assert (hb_unicode_funcs_is_immutable (uf));
...@@ -432,7 +433,20 @@ test_unicode_properties (gconstpointer user_data) ...@@ -432,7 +433,20 @@ test_unicode_properties (gconstpointer user_data)
g_test_message ("Test %s #%d: U+%04X", p->name, j, tests[j].unicode); g_test_message ("Test %s #%d: U+%04X", p->name, j, tests[j].unicode);
g_assert_cmphex (p->getter (uf, tests[j].unicode), ==, tests[j].value); g_assert_cmphex (p->getter (uf, tests[j].unicode), ==, tests[j].value);
} }
/* These tests are from Unicode 5.2 onward and older glib/ICU
* don't get them right. Just warn instead of assert. */
tests = p->tests_more;
for (j = 0; j < p->num_tests_more; j++) {
g_test_message ("Test %s more #%d: U+%04X", p->name, j, tests[j].unicode);
if (p->getter (uf, tests[j].unicode) != tests[j].value) {
g_test_message ("Soft fail: Received %x, expected %x", p->getter (uf, tests[j].unicode), tests[j].value);
failed = TRUE;
}
}
} }
if (failed)
g_message ("Some property tests failed. You probably have an old version of one of the libraries used. Rerun with --verbose for details");
} }
static hb_codepoint_t static hb_codepoint_t
...@@ -459,6 +473,11 @@ test_unicode_properties_nil (void) ...@@ -459,6 +473,11 @@ test_unicode_properties_nil (void)
g_test_message ("Test %s #%d: U+%04X", p->name, j, tests[j].unicode); g_test_message ("Test %s #%d: U+%04X", p->name, j, tests[j].unicode);
g_assert_cmphex (p->getter (uf, tests[j].unicode), ==, default_value (p->default_value, tests[j].unicode)); g_assert_cmphex (p->getter (uf, tests[j].unicode), ==, default_value (p->default_value, tests[j].unicode));
} }
tests = p->tests_more;
for (j = 0; j < p->num_tests_more; j++) {
g_test_message ("Test %s more #%d: U+%04X", p->name, j, tests[j].unicode);
g_assert_cmphex (p->getter (uf, tests[j].unicode), ==, default_value (p->default_value, tests[j].unicode));
}
} }
hb_unicode_funcs_destroy (uf); hb_unicode_funcs_destroy (uf);
...@@ -647,8 +666,6 @@ main (int argc, char **argv) ...@@ -647,8 +666,6 @@ main (int argc, char **argv)
hb_test_add_fixture (data_fixture, NULL, test_unicode_subclassing_default); hb_test_add_fixture (data_fixture, NULL, test_unicode_subclassing_default);
hb_test_add_fixture (data_fixture, NULL, test_unicode_subclassing_deep); hb_test_add_fixture (data_fixture, NULL, test_unicode_subclassing_deep);
/* XXX test icu ufuncs */
/* XXX test _more tests (warn?) */
/* XXX test chainup */ /* XXX test chainup */
/* XXX test glib & icu two-way script conversion */ /* XXX test glib & icu two-way script conversion */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册