Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
63564dca
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,发现更多精彩内容 >>
提交
63564dca
编写于
7月 20, 2021
作者:
O
openharmony_ci
提交者:
Gitee
7月 20, 2021
浏览文件
操作
浏览文件
下载
差异文件
!288 修复swipeview在仅包含两个元素时无法循环滚动问题
Merge pull request !288 from JayLeeHW/OpenHarmony-v2.2-Beta
上级
2bd11d65
84323da3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
8 deletion
+45
-8
frameworks/components/ui_swipe_view.cpp
frameworks/components/ui_swipe_view.cpp
+2
-2
test/uitest/test_ui_swipe_view/ui_test_ui_swipe_view.cpp
test/uitest/test_ui_swipe_view/ui_test_ui_swipe_view.cpp
+42
-6
test/uitest/test_ui_swipe_view/ui_test_ui_swipe_view.h
test/uitest/test_ui_swipe_view/ui_test_ui_swipe_view.h
+1
-0
未找到文件。
frameworks/components/ui_swipe_view.cpp
浏览文件 @
63564dca
...
...
@@ -302,9 +302,9 @@ void UISwipeView::SortChild()
while
(
next
!=
nullptr
)
{
if
(
direction_
==
HORIZONTAL
)
{
next
->
SetX
(
pre
->
GetRelativeRect
().
GetRight
()
+
pre
->
GetStyle
(
STYLE_MARGIN_RIGHT
));
next
->
SetX
(
pre
->
GetRelativeRect
().
GetRight
()
+
pre
->
GetStyle
(
STYLE_MARGIN_RIGHT
)
+
1
);
}
else
{
next
->
SetY
(
pre
->
GetRelativeRect
().
GetBottom
()
+
pre
->
GetStyle
(
STYLE_MARGIN_BOTTOM
));
next
->
SetY
(
pre
->
GetRelativeRect
().
GetBottom
()
+
pre
->
GetStyle
(
STYLE_MARGIN_BOTTOM
)
+
1
);
}
pre
=
next
;
next
->
SetViewIndex
(
index
);
...
...
test/uitest/test_ui_swipe_view/ui_test_ui_swipe_view.cpp
浏览文件 @
63564dca
...
...
@@ -24,10 +24,11 @@
namespace
OHOS
{
namespace
{
static
int16_t
g_buttonH
=
80
;
static
int16_t
g_buttonW
=
3
00
;
static
int16_t
g_buttonW
=
4
00
;
static
int16_t
g_blank
=
20
;
static
int16_t
g_swipeH
=
200
;
static
int16_t
g_swipeW
=
400
;
static
int16_t
g_swipeHorH
=
110
;
static
int16_t
g_deltaCoordinateY
=
19
;
static
int16_t
g_deltaCoordinateY2
=
37
;
}
// namespace
...
...
@@ -60,6 +61,7 @@ const UIView* UITestUISwipeView::GetTestView()
{
UIKit_Swipe_View_Test_Horizontal_001
();
UIKit_Swipe_View_Test_Horizontal_002
();
UIKit_Swipe_View_Test_Horizontal_003
();
UIKit_Swipe_View_Test_Align_001
(
UISwipeView
::
ALIGN_LEFT
);
UIKit_Swipe_View_Test_Align_001
(
UISwipeView
::
ALIGN_CENTER
);
UIKit_Swipe_View_Test_Align_001
(
UISwipeView
::
ALIGN_RIGHT
);
...
...
@@ -76,7 +78,7 @@ void UITestUISwipeView::UIKit_Swipe_View_Test_Horizontal_001()
if
(
container_
==
nullptr
)
{
return
;
}
UILabel
*
label
=
GetTitleLabel
(
"
UISwipeView
水平滑动"
);
UILabel
*
label
=
GetTitleLabel
(
"
两个子元素UISwipeView循环
水平滑动"
);
container_
->
Add
(
label
);
positionX_
=
TEXT_DISTANCE_TO_LEFT_SIDE
;
positionY_
=
TEXT_DISTANCE_TO_TOP_SIDE
;
...
...
@@ -85,8 +87,9 @@ void UITestUISwipeView::UIKit_Swipe_View_Test_Horizontal_001()
UISwipeView
*
swipe
=
new
UISwipeView
(
UISwipeView
::
HORIZONTAL
);
swipe
->
SetIntercept
(
true
);
swipe
->
SetLoopState
(
true
);
swipe
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
swipe
->
SetPosition
(
positionX_
,
positionY_
,
g_swipeW
,
g_swipeH
);
swipe
->
SetPosition
(
positionX_
,
positionY_
,
g_swipeW
,
g_swipeH
orH
);
swipe
->
SetBlankSize
(
100
);
// 100: is blank size
container_
->
Add
(
swipe
);
UILabelButton
*
button1
=
new
UILabelButton
();
...
...
@@ -98,10 +101,43 @@ void UITestUISwipeView::UIKit_Swipe_View_Test_Horizontal_001()
button2
->
SetText
(
"button2"
);
swipe
->
Add
(
button2
);
SetLastPos
(
swipe
);
positionY_
+=
g_swipeH
;
positionY_
+=
g_swipeH
orH
;
}
void
UITestUISwipeView
::
UIKit_Swipe_View_Test_Horizontal_002
()
{
if
(
container_
==
nullptr
)
{
return
;
}
UILabel
*
label
=
GetTitleLabel
(
"UISwipeView水平滑动"
);
container_
->
Add
(
label
);
positionY_
+=
g_deltaCoordinateY
;
label
->
SetPosition
(
positionX_
,
positionY_
);
positionY_
+=
g_deltaCoordinateY2
;
UISwipeView
*
swipe
=
new
UISwipeView
(
UISwipeView
::
HORIZONTAL
);
swipe
->
SetIntercept
(
true
);
swipe
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
swipe
->
SetPosition
(
positionX_
,
positionY_
,
g_swipeW
,
g_swipeHorH
);
swipe
->
SetAnimatorTime
(
100
);
// 100: mean animator drag time(ms)
container_
->
Add
(
swipe
);
UILabelButton
*
button1
=
new
UILabelButton
();
button1
->
SetPosition
(
0
,
0
,
g_buttonW
,
g_buttonH
);
button1
->
SetText
(
"button1"
);
swipe
->
Add
(
button1
);
UILabelButton
*
button2
=
new
UILabelButton
();
button2
->
SetPosition
(
0
,
0
,
g_buttonW
,
g_buttonH
);
button2
->
SetText
(
"button2"
);
swipe
->
Add
(
button2
);
UILabelButton
*
button3
=
new
UILabelButton
();
button3
->
SetPosition
(
0
,
0
,
g_buttonW
,
g_buttonH
);
button3
->
SetText
(
"button3"
);
swipe
->
Add
(
button3
);
SetLastPos
(
swipe
);
positionY_
+=
g_swipeHorH
;
}
void
UITestUISwipeView
::
UIKit_Swipe_View_Test_Horizontal_003
()
{
if
(
container_
==
nullptr
)
{
return
;
...
...
@@ -115,7 +151,7 @@ void UITestUISwipeView::UIKit_Swipe_View_Test_Horizontal_002()
UISwipeView
*
swipe
=
new
UISwipeView
(
UISwipeView
::
HORIZONTAL
);
swipe
->
SetIntercept
(
true
);
swipe
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
swipe
->
SetPosition
(
positionX_
,
positionY_
,
g_swipeW
,
g_swipeH
);
swipe
->
SetPosition
(
positionX_
,
positionY_
,
g_swipeW
,
g_swipeH
orH
);
swipe
->
SetLoopState
(
true
);
swipe
->
SetAnimatorTime
(
100
);
// 100: mean animator drag time(ms)
container_
->
Add
(
swipe
);
...
...
@@ -132,7 +168,7 @@ void UITestUISwipeView::UIKit_Swipe_View_Test_Horizontal_002()
button3
->
SetText
(
"button3"
);
swipe
->
Add
(
button3
);
SetLastPos
(
swipe
);
positionY_
+=
g_swipeH
;
positionY_
+=
g_swipeH
orH
;
}
void
UITestUISwipeView
::
UIKit_Swipe_View_Test_Ver_001
()
...
...
test/uitest/test_ui_swipe_view/ui_test_ui_swipe_view.h
浏览文件 @
63564dca
...
...
@@ -33,6 +33,7 @@ public:
void
UIKit_Swipe_View_Test_Horizontal_001
();
void
UIKit_Swipe_View_Test_Horizontal_002
();
void
UIKit_Swipe_View_Test_Horizontal_003
();
void
UIKit_Swipe_View_Test_Ver_001
();
void
UIKit_Swipe_View_Test_Ver_002
();
void
UIKit_Swipe_View_Test_Remove_001
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录