Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
4874a26c
G
Graphic Ui
项目概览
OpenHarmony
/
Graphic Ui
大约 1 年 前同步成功
通知
13
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Graphic Ui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
4874a26c
编写于
4月 07, 2023
作者:
O
openharmony_ci
提交者:
Gitee
4月 07, 2023
浏览文件
操作
浏览文件
下载
差异文件
!928 JS文本控件支持设定行高
Merge pull request !928 from Zhouyj/setLineHeight
上级
451d06c7
9d85315a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
1 deletion
+21
-1
frameworks/common/text.cpp
frameworks/common/text.cpp
+1
-1
test/uitest/test_label/ui_test_label.cpp
test/uitest/test_label/ui_test_label.cpp
+17
-0
test/uitest/test_label/ui_test_label.h
test/uitest/test_label/ui_test_label.h
+3
-0
未找到文件。
frameworks/common/text.cpp
浏览文件 @
4874a26c
...
@@ -299,7 +299,7 @@ void Text::Draw(BufferInfo& gfxDstBuffer,
...
@@ -299,7 +299,7 @@ void Text::Draw(BufferInfo& gfxDstBuffer,
uint16_t
lineCount
=
GetLine
(
lineMaxWidth
,
style
.
letterSpace_
,
ellipsisIndex
,
maxLineBytes
);
uint16_t
lineCount
=
GetLine
(
lineMaxWidth
,
style
.
letterSpace_
,
ellipsisIndex
,
maxLineBytes
);
int16_t
lineHeight
=
style
.
lineHeight_
;
int16_t
lineHeight
=
style
.
lineHeight_
;
int16_t
curLineHeight
;
int16_t
curLineHeight
;
if
(
lineHeight
=
=
0
)
{
if
(
lineHeight
<
=
0
)
{
lineHeight
=
UIFont
::
GetInstance
()
->
GetHeight
(
fontId_
,
fontSize_
);
lineHeight
=
UIFont
::
GetInstance
()
->
GetHeight
(
fontId_
,
fontSize_
);
lineHeight
+=
style
.
lineSpace_
;
lineHeight
+=
style
.
lineSpace_
;
}
}
...
...
test/uitest/test_label/ui_test_label.cpp
浏览文件 @
4874a26c
...
@@ -60,6 +60,9 @@ void UITestLabel::TearDown()
...
@@ -60,6 +60,9 @@ void UITestLabel::TearDown()
labelDirectionBtn2_
=
nullptr
;
labelDirectionBtn2_
=
nullptr
;
labelSizeBtn1_
=
nullptr
;
labelSizeBtn1_
=
nullptr
;
labelSizeBtn2_
=
nullptr
;
labelSizeBtn2_
=
nullptr
;
labelLineHeightBtn1_
=
nullptr
;
labelLineHeightBtn2_
=
nullptr
;
labelLineHeightBtn3_
=
nullptr
;
}
}
const
UIView
*
UITestLabel
::
GetTestView
()
const
UIView
*
UITestLabel
::
GetTestView
()
...
@@ -179,6 +182,14 @@ void UITestLabel::UIKitUILabeTestDisplay002()
...
@@ -179,6 +182,14 @@ void UITestLabel::UIKitUILabeTestDisplay002()
label3
->
SetFont
(
DEFAULT_VECTOR_FONT_FILENAME
,
FONT_DEFAULT_SIZE
);
label3
->
SetFont
(
DEFAULT_VECTOR_FONT_FILENAME
,
FONT_DEFAULT_SIZE
);
labelDirectionBtn1_
=
SetUpButton
(
"左往右 "
,
24
,
240
,
uiViewGroup
);
// 24: x-coordinate; 240: y-coordinate
labelDirectionBtn1_
=
SetUpButton
(
"左往右 "
,
24
,
240
,
uiViewGroup
);
// 24: x-coordinate; 240: y-coordinate
labelDirectionBtn2_
=
SetUpButton
(
"右往左 "
,
116
,
240
,
uiViewGroup
);
// 116: x-coordinate; 240: y-coordinate
labelDirectionBtn2_
=
SetUpButton
(
"右往左 "
,
116
,
240
,
uiViewGroup
);
// 116: x-coordinate; 240: y-coordinate
UILabel
*
label4
=
new
UILabel
();
uiViewGroup
->
Add
(
label4
);
label4
->
SetPosition
(
24
,
299
,
288
,
48
);
// 24: x-coordinate, 299: y-coordinate, 288: width; 48: height
label4
->
SetText
(
"行高"
);
label4
->
SetFont
(
DEFAULT_VECTOR_FONT_FILENAME
,
FONT_DEFAULT_SIZE
);
labelLineHeightBtn1_
=
SetUpButton
(
"行高20 "
,
24
,
336
,
uiViewGroup
);
// 24: x-coordinate; 336: y-coordinate
labelLineHeightBtn2_
=
SetUpButton
(
"行高35 "
,
116
,
336
,
uiViewGroup
);
// 116: x-coordinate; 336: y-coordinate
labelLineHeightBtn3_
=
SetUpButton
(
"行高50 "
,
208
,
336
,
uiViewGroup
);
// 208: x-coordinate; 336: y-coordinate
positionY_
+=
384
;
// 384: increase x-coordinate
positionY_
+=
384
;
// 384: increase x-coordinate
positionX_
-=
312
;
// 312: increase y-coordinate
positionX_
-=
312
;
// 312: increase y-coordinate
}
}
...
@@ -270,6 +281,12 @@ void UITestLabel::ExpandClick(UIView& view, const ClickEvent& event) const
...
@@ -270,6 +281,12 @@ void UITestLabel::ExpandClick(UIView& view, const ClickEvent& event) const
}
else
if
(
&
view
==
labelSizeBtn2_
)
{
}
else
if
(
&
view
==
labelSizeBtn2_
)
{
uiLabel
->
SetText
(
"Test of 图形子系统,Test of 图形子系统 "
);
uiLabel
->
SetText
(
"Test of 图形子系统,Test of 图形子系统 "
);
uiLabel
->
SetLineBreakMode
(
UILabel
::
LINE_BREAK_WRAP
);
uiLabel
->
SetLineBreakMode
(
UILabel
::
LINE_BREAK_WRAP
);
}
else
if
(
&
view
==
labelLineHeightBtn1_
)
{
uiLabel
->
SetStyle
(
STYLE_LINE_HEIGHT
,
20
);
// 20: lineHeight
}
else
if
(
&
view
==
labelLineHeightBtn2_
)
{
uiLabel
->
SetStyle
(
STYLE_LINE_HEIGHT
,
35
);
// 35: lineHeight
}
else
if
(
&
view
==
labelLineHeightBtn3_
)
{
uiLabel
->
SetStyle
(
STYLE_LINE_HEIGHT
,
50
);
// 50: lineHeight
}
}
}
}
}
// namespace OHOS
}
// namespace OHOS
test/uitest/test_label/ui_test_label.h
浏览文件 @
4874a26c
...
@@ -65,6 +65,9 @@ private:
...
@@ -65,6 +65,9 @@ private:
UILabelButton
*
labelDirectionBtn2_
=
nullptr
;
UILabelButton
*
labelDirectionBtn2_
=
nullptr
;
UILabelButton
*
labelSizeBtn1_
=
nullptr
;
UILabelButton
*
labelSizeBtn1_
=
nullptr
;
UILabelButton
*
labelSizeBtn2_
=
nullptr
;
UILabelButton
*
labelSizeBtn2_
=
nullptr
;
UILabelButton
*
labelLineHeightBtn1_
=
nullptr
;
UILabelButton
*
labelLineHeightBtn2_
=
nullptr
;
UILabelButton
*
labelLineHeightBtn3_
=
nullptr
;
void
InnerTestTitle
(
const
char
*
title
);
void
InnerTestTitle
(
const
char
*
title
);
UILabelButton
*
SetUpButton
(
const
char
*
title
,
int16_t
x
,
int16_t
y
,
UIViewGroup
*
uiViewGroup
,
UILabelButton
*
SetUpButton
(
const
char
*
title
,
int16_t
x
,
int16_t
y
,
UIViewGroup
*
uiViewGroup
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录