Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
fa0f1674
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
fa0f1674
编写于
7月 10, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 10, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9218 字体联调
Merge pull request !9218 from huangzejia/texgine0705
上级
20f260d6
91d172b1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
47 addition
and
46 deletion
+47
-46
graphic/graphicnapidrawingtest/BUILD.gn
graphic/graphicnapidrawingtest/BUILD.gn
+1
-0
graphic/graphicnapidrawingtest/OH_Drawing_TypographyTest.cpp
graphic/graphicnapidrawingtest/OH_Drawing_TypographyTest.cpp
+46
-46
未找到文件。
graphic/graphicnapidrawingtest/BUILD.gn
浏览文件 @
fa0f1674
...
...
@@ -41,6 +41,7 @@ ohos_moduletest_suite("ActsGraphicNapiDrawingTest") {
include_dirs = [
"$comPath/rosen/modules/2d_engine",
"$comPath/rosen/modules/2d_engine/rosen_text/export",
"//third_party/googletest/googletest/include",
]
...
...
graphic/graphicnapidrawingtest/OH_Drawing_TypographyTest.cpp
浏览文件 @
fa0f1674
...
...
@@ -20,10 +20,10 @@
#include "c/drawing_font_collection.h"
#include "c/drawing_text_declaration.h"
#include "c/drawing_text_typography.h"
#include "rosen_text/
ui/
typography.h"
#include "rosen_text/
ui/
typography_create.h"
#include "rosen_text/typography.h"
#include "rosen_text/typography_create.h"
using
namespace
r
osen
;
using
namespace
OHOS
::
R
osen
;
using
namespace
testing
;
using
namespace
testing
::
ext
;
...
...
@@ -62,11 +62,11 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest002, TestSize.Level
{
OH_Drawing_TypographyStyle
*
typoStyle
=
OH_Drawing_CreateTypographyStyle
();
OH_Drawing_SetTypographyTextDirection
(
typoStyle
,
TEXT_DIRECTION_LTR
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textDirection
_
,
TextDirection
::
LTR
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textDirection
,
TextDirection
::
LTR
);
OH_Drawing_SetTypographyTextDirection
(
typoStyle
,
TEXT_DIRECTION_RTL
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textDirection
_
,
TextDirection
::
RTL
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textDirection
,
TextDirection
::
RTL
);
OH_Drawing_SetTypographyTextDirection
(
typoStyle
,
-
1
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textDirection
_
,
TextDirection
::
LTR
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textDirection
,
TextDirection
::
LTR
);
}
/*
...
...
@@ -78,19 +78,19 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest003, TestSize.Level
{
OH_Drawing_TypographyStyle
*
typoStyle
=
OH_Drawing_CreateTypographyStyle
();
OH_Drawing_SetTypographyTextAlign
(
typoStyle
,
TEXT_ALIGN_LEFT
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign
_
,
TextAlign
::
LEFT
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign
,
TextAlign
::
LEFT
);
OH_Drawing_SetTypographyTextAlign
(
typoStyle
,
TEXT_ALIGN_RIGHT
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign
_
,
TextAlign
::
RIGHT
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign
,
TextAlign
::
RIGHT
);
OH_Drawing_SetTypographyTextAlign
(
typoStyle
,
TEXT_ALIGN_CENTER
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign
_
,
TextAlign
::
CENTER
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign
,
TextAlign
::
CENTER
);
OH_Drawing_SetTypographyTextAlign
(
typoStyle
,
TEXT_ALIGN_JUSTIFY
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign
_
,
TextAlign
::
JUSTIFY
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign
,
TextAlign
::
JUSTIFY
);
OH_Drawing_SetTypographyTextAlign
(
typoStyle
,
TEXT_ALIGN_START
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign
_
,
TextAlign
::
START
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign
,
TextAlign
::
START
);
OH_Drawing_SetTypographyTextAlign
(
typoStyle
,
TEXT_ALIGN_END
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign
_
,
TextAlign
::
END
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign
,
TextAlign
::
END
);
OH_Drawing_SetTypographyTextAlign
(
typoStyle
,
-
1
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign
_
,
TextAlign
::
LEFT
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign
,
TextAlign
::
LEFT
);
}
/*
...
...
@@ -102,9 +102,9 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest004, TestSize.Level
{
OH_Drawing_TypographyStyle
*
typoStyle
=
OH_Drawing_CreateTypographyStyle
();
OH_Drawing_SetTypographyTextMaxLines
(
typoStyle
,
100
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
maxLines
_
,
100
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
maxLines
,
100
);
OH_Drawing_SetTypographyTextMaxLines
(
typoStyle
,
200
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
maxLines
_
,
200
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
maxLines
,
200
);
}
/*
...
...
@@ -129,13 +129,13 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest006, TestSize.Level
OH_Drawing_TextStyle
*
txtStyle
=
OH_Drawing_CreateTextStyle
();
// black
OH_Drawing_SetTextStyleColor
(
txtStyle
,
OH_Drawing_ColorSetArgb
(
0xFF
,
0x00
,
0x00
,
0x00
));
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
color
_
,
0xFF000000
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
color
,
0xFF000000
);
// red
OH_Drawing_SetTextStyleColor
(
txtStyle
,
OH_Drawing_ColorSetArgb
(
0xFF
,
0xFF
,
0x00
,
0x00
));
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
color
_
,
0xFFFF0000
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
color
,
0xFFFF0000
);
// blue
OH_Drawing_SetTextStyleColor
(
txtStyle
,
OH_Drawing_ColorSetArgb
(
0xFF
,
0x00
,
0x00
,
0xFF
));
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
color
_
,
0xFF0000FF
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
color
,
0xFF0000FF
);
}
/*
...
...
@@ -147,9 +147,9 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest007, TestSize.Level
{
OH_Drawing_TextStyle
*
txtStyle
=
OH_Drawing_CreateTextStyle
();
OH_Drawing_SetTextStyleFontSize
(
txtStyle
,
80
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontSize
_
,
80
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontSize
,
80
);
OH_Drawing_SetTextStyleFontSize
(
txtStyle
,
40
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontSize
_
,
40
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontSize
,
40
);
}
/*
...
...
@@ -161,25 +161,25 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest008, TestSize.Level
{
OH_Drawing_TextStyle
*
txtStyle
=
OH_Drawing_CreateTextStyle
();
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_100
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
_
,
FontWeight
::
W100
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
,
FontWeight
::
W100
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_200
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
_
,
FontWeight
::
W200
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
,
FontWeight
::
W200
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_300
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
_
,
FontWeight
::
W300
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
,
FontWeight
::
W300
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_400
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
_
,
FontWeight
::
W400
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
,
FontWeight
::
W400
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_500
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
_
,
FontWeight
::
W500
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
,
FontWeight
::
W500
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_600
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
_
,
FontWeight
::
W600
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
,
FontWeight
::
W600
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_700
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
_
,
FontWeight
::
W700
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
,
FontWeight
::
W700
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_800
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
_
,
FontWeight
::
W800
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
,
FontWeight
::
W800
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_900
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
_
,
FontWeight
::
W900
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
,
FontWeight
::
W900
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
-
1
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
_
,
FontWeight
::
W400
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight
,
FontWeight
::
W400
);
}
/*
...
...
@@ -191,11 +191,11 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest009, TestSize.Level
{
OH_Drawing_TextStyle
*
txtStyle
=
OH_Drawing_CreateTextStyle
();
OH_Drawing_SetTextStyleBaseLine
(
txtStyle
,
TEXT_BASELINE_ALPHABETIC
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
textBaseline_
,
TextBaseline
::
ALPHABETIC
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
baseline
,
TextBaseline
::
ALPHABETIC
);
OH_Drawing_SetTextStyleBaseLine
(
txtStyle
,
TEXT_BASELINE_IDEOGRAPHIC
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
textBaseline_
,
TextBaseline
::
IDEOGRAPHIC
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
baseline
,
TextBaseline
::
IDEOGRAPHIC
);
OH_Drawing_SetTextStyleBaseLine
(
txtStyle
,
-
1
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
textBaseline_
,
TextBaseline
::
ALPHABETIC
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
baseline
,
TextBaseline
::
ALPHABETIC
);
}
/*
...
...
@@ -207,15 +207,15 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest010, TestSize.Level
{
OH_Drawing_TextStyle
*
txtStyle
=
OH_Drawing_CreateTextStyle
();
OH_Drawing_SetTextStyleDecoration
(
txtStyle
,
TEXT_DECORATION_NONE
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decoration
_
,
TextDecoration
::
NONE
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decoration
,
TextDecoration
::
NONE
);
OH_Drawing_SetTextStyleDecoration
(
txtStyle
,
TEXT_DECORATION_UNDERLINE
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decoration
_
,
TextDecoration
::
UNDERLINE
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decoration
,
TextDecoration
::
UNDERLINE
);
OH_Drawing_SetTextStyleDecoration
(
txtStyle
,
TEXT_DECORATION_OVERLINE
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decoration
_
,
TextDecoration
::
OVERLINE
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decoration
,
TextDecoration
::
OVERLINE
);
OH_Drawing_SetTextStyleDecoration
(
txtStyle
,
TEXT_DECORATION_LINE_THROUGH
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decoration
_
,
TextDecoration
::
LINE
THROUGH
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decoration
,
TextDecoration
::
LINE_
THROUGH
);
OH_Drawing_SetTextStyleDecoration
(
txtStyle
,
-
1
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decoration
_
,
TextDecoration
::
NONE
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decoration
,
TextDecoration
::
NONE
);
}
/*
...
...
@@ -227,9 +227,9 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest011, TestSize.Level
{
OH_Drawing_TextStyle
*
txtStyle
=
OH_Drawing_CreateTextStyle
();
OH_Drawing_SetTextStyleDecorationColor
(
txtStyle
,
OH_Drawing_ColorSetArgb
(
0xFF
,
0x00
,
0x00
,
0x00
));
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decorationColor
_
,
0xFF000000
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decorationColor
,
0xFF000000
);
OH_Drawing_SetTextStyleDecorationColor
(
txtStyle
,
OH_Drawing_ColorSetArgb
(
0xFF
,
0xFF
,
0x00
,
0x00
));
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decorationColor
_
,
0xFFFF0000
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decorationColor
,
0xFFFF0000
);
}
/*
...
...
@@ -241,7 +241,7 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest012, TestSize.Level
{
OH_Drawing_TextStyle
*
txtStyle
=
OH_Drawing_CreateTextStyle
();
OH_Drawing_SetTextStyleFontHeight
(
txtStyle
,
0.0
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
height
_
,
0.0
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
height
Scale
,
0.0
);
}
/*
...
...
@@ -255,7 +255,7 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest013, TestSize.Level
const
char
*
fontFamilies
[]
=
{
"Roboto"
};
OH_Drawing_SetTextStyleFontFamilies
(
txtStyle
,
1
,
fontFamilies
);
std
::
vector
<
std
::
string
>
fontFamiliesResult
=
{
"Roboto"
};
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontFamilies
_
,
fontFamiliesResult
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontFamilies
,
fontFamiliesResult
);
}
/*
...
...
@@ -267,11 +267,11 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest014, TestSize.Level
{
OH_Drawing_TextStyle
*
txtStyle
=
OH_Drawing_CreateTextStyle
();
OH_Drawing_SetTextStyleFontStyle
(
txtStyle
,
FONT_STYLE_NORMAL
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontStyle
_
,
FontStyle
::
NORMAL
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontStyle
,
FontStyle
::
NORMAL
);
OH_Drawing_SetTextStyleFontStyle
(
txtStyle
,
FONT_STYLE_ITALIC
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontStyle
_
,
FontStyle
::
ITALIC
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontStyle
,
FontStyle
::
ITALIC
);
OH_Drawing_SetTextStyleFontStyle
(
txtStyle
,
-
1
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontStyle
_
,
FontStyle
::
NORMAL
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontStyle
,
FontStyle
::
NORMAL
);
}
/*
...
...
@@ -283,7 +283,7 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest015, TestSize.Level
{
OH_Drawing_TextStyle
*
txtStyle
=
OH_Drawing_CreateTextStyle
();
OH_Drawing_SetTextStyleLocale
(
txtStyle
,
"en"
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
locale
_
,
"en"
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
locale
,
"en"
);
}
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录