Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
07e22779
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
大约 1 年 前同步成功
通知
0
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Harfbuzz
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
07e22779
编写于
5月 02, 2011
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[test/unicode] Add script roundtrip tests for glib and ICU
上级
7cda6593
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
64 addition
and
6 deletion
+64
-6
test/test-unicode.c
test/test-unicode.c
+64
-6
未找到文件。
test/test-unicode.c
浏览文件 @
07e22779
...
...
@@ -29,6 +29,8 @@
#include "hb-test.h"
/* Unit tests for hb-unicode.h */
/* Unit tests for hb-glib.h */
/* Unit tests for hb-icu.h */
#ifdef HAVE_GLIB
...
...
@@ -504,7 +506,7 @@ test_unicode_properties (gconstpointer user_data)
}
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
"
);
g_
test_message
(
"Some property tests failed. You probably have an old version of one of the libraries used.
"
);
}
static
hb_codepoint_t
...
...
@@ -710,6 +712,61 @@ test_unicode_subclassing_deep (data_fixture_t *f, gconstpointer user_data)
}
static
hb_script_t
script_roundtrip_default
(
hb_script_t
script
)
{
return
hb_script_from_iso15924_tag
(
hb_script_to_iso15924_tag
(
script
));
}
#ifdef HAVE_GLIB
static
hb_script_t
script_roundtrip_glib
(
hb_script_t
script
)
{
return
hb_glib_script_to_script
(
hb_glib_script_from_script
(
script
));
}
#endif
#ifdef HAVE_ICU
static
hb_script_t
script_roundtrip_icu
(
hb_script_t
script
)
{
return
hb_icu_script_to_script
(
hb_icu_script_from_script
(
script
));
}
#endif
static
void
test_unicode_script_roundtrip
(
gconstpointer
user_data
)
{
typedef
hb_script_t
(
*
roundtrip_func_t
)
(
hb_script_t
);
roundtrip_func_t
roundtrip_func
=
(
roundtrip_func_t
)
user_data
;
unsigned
int
i
;
gboolean
failed
=
FALSE
;
for
(
i
=
0
;
i
<
G_N_ELEMENTS
(
script_tests
);
i
++
)
{
const
test_pair_t
*
test
=
&
script_tests
[
i
];
hb_script_t
script
=
test
->
value
;
g_test_message
(
"Test script roundtrip #%d: %x"
,
i
,
script
);
g_assert_cmphex
(
script
,
==
,
roundtrip_func
(
script
));
}
for
(
i
=
0
;
i
<
G_N_ELEMENTS
(
script_tests_more
);
i
++
)
{
const
test_pair_t
*
test
=
&
script_tests_more
[
i
];
hb_script_t
script
=
test
->
value
;
g_test_message
(
"Test script roundtrip more #%d: %x"
,
i
,
script
);
if
(
script
!=
roundtrip_func
(
script
))
{
g_test_message
(
"Soft fail: Received %x, expected %x"
,
roundtrip_func
(
script
),
script
);
failed
=
TRUE
;
}
}
g_assert_cmphex
(
HB_SCRIPT_INVALID
,
==
,
roundtrip_func
(
HB_SCRIPT_INVALID
));
if
(
failed
)
g_test_message
(
"Some script roundtrip tests failed. You probably have an old version of one of the libraries used."
);
}
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -717,12 +774,15 @@ main (int argc, char **argv)
hb_test_add
(
test_unicode_properties_nil
);
hb_test_add_data_flavor
(
hb_unicode_funcs_get_default
(),
"default"
,
test_unicode_properties
);
hb_test_add_data_flavor
(
hb_unicode_funcs_get_default
(),
"default"
,
test_unicode_properties
);
hb_test_add_data_flavor
((
gconstpointer
)
script_roundtrip_default
,
"default"
,
test_unicode_script_roundtrip
);
#ifdef HAVE_GLIB
hb_test_add_data_flavor
(
hb_glib_get_unicode_funcs
(),
"glib"
,
test_unicode_properties
);
hb_test_add_data_flavor
(
hb_glib_get_unicode_funcs
(),
"glib"
,
test_unicode_properties
);
hb_test_add_data_flavor
((
gconstpointer
)
script_roundtrip_glib
,
"glib"
,
test_unicode_script_roundtrip
);
#endif
#ifdef HAVE_ICU
hb_test_add_data_flavor
(
hb_icu_get_unicode_funcs
(),
"icu"
,
test_unicode_properties
);
hb_test_add_data_flavor
(
hb_icu_get_unicode_funcs
(),
"icu"
,
test_unicode_properties
);
hb_test_add_data_flavor
((
gconstpointer
)
script_roundtrip_icu
,
"icu"
,
test_unicode_script_roundtrip
);
#endif
hb_test_add
(
test_unicode_chainup
);
...
...
@@ -733,7 +793,5 @@ 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_deep
);
/* XXX test glib & icu two-way script conversion */
return
hb_test_run
();
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录