Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
df211f3e
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看板
提交
df211f3e
编写于
1月 09, 2023
作者:
S
stella-ren
提交者:
stella.ren
1月 09, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed
4d04d940
from
https://gitee.com/stella-ren/xts_acts/pulls/7148
add drawing test Signed-off-by:
N
stella-ren
<
rencongyaxu@huawei.com
>
上级
5b2698a9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
39 addition
and
1 deletion
+39
-1
graphic/graphicnapidrawingtest/OH_Drawing_TypographyTest.cpp
graphic/graphicnapidrawingtest/OH_Drawing_TypographyTest.cpp
+39
-1
未找到文件。
graphic/graphicnapidrawingtest/OH_Drawing_TypographyTest.cpp
浏览文件 @
df211f3e
...
...
@@ -65,6 +65,8 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest002, TestSize.Level
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textDirection_
,
TextDirection
::
LTR
);
OH_Drawing_SetTypographyTextDirection
(
typoStyle
,
TEXT_DIRECTION_RTL
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textDirection_
,
TextDirection
::
RTL
);
OH_Drawing_SetTypographyTextDirection
(
typoStyle
,
-
1
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textDirection_
,
TextDirection
::
LTR
);
}
/*
...
...
@@ -87,6 +89,8 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest003, TestSize.Level
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign_
,
TextAlign
::
START
);
OH_Drawing_SetTypographyTextAlign
(
typoStyle
,
TEXT_ALIGN_END
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign_
,
TextAlign
::
END
);
OH_Drawing_SetTypographyTextAlign
(
typoStyle
,
-
1
);
EXPECT_EQ
(
ConvertToOriginalText
(
typoStyle
)
->
textAlign_
,
TextAlign
::
LEFT
);
}
/*
...
...
@@ -156,10 +160,26 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest007, TestSize.Level
HWTEST_F
(
OH_Drawing_TypographyTest
,
OH_Drawing_TypographyTest008
,
TestSize
.
Level1
)
{
OH_Drawing_TextStyle
*
txtStyle
=
OH_Drawing_CreateTextStyle
();
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_100
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight_
,
FontWeight
::
W100
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_200
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight_
,
FontWeight
::
W200
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_300
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight_
,
FontWeight
::
W300
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_400
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight_
,
FontWeight
::
W400
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_500
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight_
,
FontWeight
::
W500
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_600
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight_
,
FontWeight
::
W600
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_700
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight_
,
FontWeight
::
W700
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_800
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight_
,
FontWeight
::
W800
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
FONT_WEIGHT_900
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight_
,
FontWeight
::
W900
);
OH_Drawing_SetTextStyleFontWeight
(
txtStyle
,
-
1
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontWeight_
,
FontWeight
::
W400
);
}
/*
...
...
@@ -174,6 +194,8 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest009, TestSize.Level
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
textBaseline_
,
TextBaseline
::
ALPHABETIC
);
OH_Drawing_SetTextStyleBaseLine
(
txtStyle
,
TEXT_BASELINE_IDEOGRAPHIC
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
textBaseline_
,
TextBaseline
::
IDEOGRAPHIC
);
OH_Drawing_SetTextStyleBaseLine
(
txtStyle
,
-
1
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
textBaseline_
,
TextBaseline
::
ALPHABETIC
);
}
/*
...
...
@@ -192,6 +214,8 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest010, TestSize.Level
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decoration_
,
TextDecoration
::
OVERLINE
);
OH_Drawing_SetTextStyleDecoration
(
txtStyle
,
TEXT_DECORATION_LINE_THROUGH
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decoration_
,
TextDecoration
::
LINETHROUGH
);
OH_Drawing_SetTextStyleDecoration
(
txtStyle
,
-
1
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
decoration_
,
TextDecoration
::
NONE
);
}
/*
...
...
@@ -246,6 +270,8 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest014, TestSize.Level
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontStyle_
,
FontStyle
::
NORMAL
);
OH_Drawing_SetTextStyleFontStyle
(
txtStyle
,
FONT_STYLE_ITALIC
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontStyle_
,
FontStyle
::
ITALIC
);
OH_Drawing_SetTextStyleFontStyle
(
txtStyle
,
-
1
);
EXPECT_EQ
(
ConvertToOriginalText
(
txtStyle
)
->
fontStyle_
,
FontStyle
::
NORMAL
);
}
/*
...
...
@@ -289,16 +315,28 @@ HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest016, TestSize.Level
OH_Drawing_Typography
*
typography
=
OH_Drawing_CreateTypography
(
handler
);
double
maxWidth
=
800.0
;
OH_Drawing_TypographyLayout
(
typography
,
maxWidth
);
EXPECT_EQ
(
maxWidth
,
OH_Drawing_TypographyGetMaxWidth
(
typography
));
double
position
[
2
]
=
{
10.0
,
15.0
};
OH_Drawing_Bitmap
*
cBitmap
=
OH_Drawing_BitmapCreate
();
OH_Drawing_BitmapFormat
cFormat
{
COLOR_FORMAT_RGBA_8888
,
ALPHA_FORMAT_OPAQUE
};
uint32_t
width
=
20
;
uint32_t
height
=
40
;
OH_Drawing_BitmapBuild
(
cBitmap
,
width
,
height
,
&
cFormat
);
EXPECT_EQ
(
width
,
OH_Drawing_BitmapGetWidth
(
cBitmap
));
EXPECT_EQ
(
height
,
OH_Drawing_BitmapGetHeight
(
cBitmap
));
OH_Drawing_Canvas
*
cCanvas
=
OH_Drawing_CanvasCreate
();
OH_Drawing_CanvasBind
(
cCanvas
,
cBitmap
);
OH_Drawing_CanvasClear
(
cCanvas
,
OH_Drawing_ColorSetArgb
(
0xFF
,
0xFF
,
0xFF
,
0xFF
));
EXPECT_EQ
(
OH_Drawing_TypographyGetHeight
(
typography
)
!=
0.0
,
true
);
EXPECT_EQ
(
OH_Drawing_TypographyGetLongestLine
(
typography
)
!=
0.0
,
true
);
EXPECT_EQ
(
OH_Drawing_TypographyGetMinIntrinsicWidth
(
typography
)
<=
OH_Drawing_TypographyGetMaxIntrinsicWidth
(
typography
),
true
);
EXPECT_EQ
(
OH_Drawing_TypographyGetAlphabeticBaseline
(
typography
)
!=
0.0
,
true
);
EXPECT_EQ
(
OH_Drawing_TypographyGetIdeographicBaseline
(
typography
)
!=
0.0
,
true
);
OH_Drawing_TypographyPaint
(
typography
,
cCanvas
,
position
[
0
],
position
[
1
]);
OH_Drawing_DestroyTypography
(
typography
);
OH_Drawing_DestroyTypographyHandler
(
handler
);
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录