Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
15a6a090
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,发现更多精彩内容 >>
提交
15a6a090
编写于
6月 21, 2021
作者:
O
openharmony_ci
提交者:
Gitee
6月 21, 2021
浏览文件
操作
浏览文件
下载
差异文件
!231 新增滚动条测试用例
Merge pull request !231 from YueBiang/bar
上级
67503ee7
f2e13b3d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
83 addition
and
12 deletion
+83
-12
test/unittest/components/ui_scroll_bar_test.cpp
test/unittest/components/ui_scroll_bar_test.cpp
+83
-12
未找到文件。
test/unittest/components/ui_scroll_bar_test.cpp
浏览文件 @
15a6a090
...
@@ -18,6 +18,9 @@
...
@@ -18,6 +18,9 @@
#include "components/ui_arc_scroll_bar.h"
#include "components/ui_arc_scroll_bar.h"
#include "components/ui_box_scroll_bar.h"
#include "components/ui_box_scroll_bar.h"
#include "components/ui_list.h"
#include "components/ui_scroll_view.h"
#include "engines/gfx/gfx_engine_manager.h"
using
namespace
testing
::
ext
;
using
namespace
testing
::
ext
;
...
@@ -34,27 +37,32 @@ void ScrollBarTest::TearDownTestCase() {}
...
@@ -34,27 +37,32 @@ void ScrollBarTest::TearDownTestCase() {}
class
TestArcScrollBarTest
:
public
UIArcScrollBar
{
class
TestArcScrollBarTest
:
public
UIArcScrollBar
{
public:
public:
int16_t
GetWidth
()
int16_t
GetWidth
()
const
{
{
return
width_
;
return
width_
;
}
}
int16_t
GetRadius
()
int16_t
GetRadius
()
const
{
{
return
radius_
;
return
radius_
;
}
}
const
Style
*
GetBackStyle
()
const
Style
*
GetBackStyle
()
const
{
{
return
backgroundStyle_
;
return
backgroundStyle_
;
}
}
const
Style
*
GetForeStyle
()
const
Style
*
GetForeStyle
()
const
{
{
return
foregroundStyle_
;
return
foregroundStyle_
;
}
}
float
GetProportion
()
float
GetProportion
()
const
{
{
return
foregroundProportion_
;
return
foregroundProportion_
;
}
}
uint8_t
GetOpacity
()
uint8_t
GetOpacity
()
const
{
{
return
opacity_
;
return
opacity_
;
}
}
...
@@ -62,32 +70,95 @@ public:
...
@@ -62,32 +70,95 @@ public:
class
TestBoxScrollBarTest
:
public
UIBoxScrollBar
{
class
TestBoxScrollBarTest
:
public
UIBoxScrollBar
{
public:
public:
int16_t
GetWidth
()
int16_t
GetWidth
()
const
{
{
return
backgroundRect_
.
GetWidth
();
return
backgroundRect_
.
GetWidth
();
}
}
int16_t
GetHeight
()
int16_t
GetHeight
()
const
{
{
return
backgroundRect_
.
GetHeight
();
return
backgroundRect_
.
GetHeight
();
}
}
const
Style
*
GetBackStyle
()
const
Style
*
GetBackStyle
()
const
{
{
return
backgroundStyle_
;
return
backgroundStyle_
;
}
}
const
Style
*
GetForeStyle
()
const
Style
*
GetForeStyle
()
const
{
{
return
foregroundStyle_
;
return
foregroundStyle_
;
}
}
float
GetProportion
()
float
GetProportion
()
const
{
{
return
foregroundProportion_
;
return
foregroundProportion_
;
}
}
uint8_t
GetOpacity
()
uint8_t
GetOpacity
()
const
{
{
return
opacity_
;
return
opacity_
;
}
}
};
};
class
TestUIScrollView
:
public
UIScrollView
{
public:
bool
GetXScrollBarVisible
()
const
{
return
xScrollBarVisible_
;
}
bool
GetYScrollBarVisible
()
const
{
return
yScrollBarVisible_
;
}
};
class
TestUIList
:
public
UIList
{
public:
bool
GetXScrollBarVisible
()
const
{
return
xScrollBarVisible_
;
}
bool
GetYScrollBarVisible
()
const
{
return
yScrollBarVisible_
;
}
};
HWTEST_F
(
ScrollBarTest
,
UIScrollBarSetXScrollBarVisible
,
TestSize
.
Level0
)
{
TestUIScrollView
scrollView
;
TestUIList
uiList
;
EXPECT_FALSE
(
scrollView
.
GetXScrollBarVisible
());
EXPECT_FALSE
(
uiList
.
GetXScrollBarVisible
());
BaseGfxEngine
::
GetInstance
()
->
SetScreenShape
(
ScreenShape
::
CIRCLE
);
scrollView
.
SetXScrollBarVisible
(
true
);
uiList
.
SetXScrollBarVisible
(
true
);
EXPECT_FALSE
(
scrollView
.
GetXScrollBarVisible
());
EXPECT_FALSE
(
uiList
.
GetXScrollBarVisible
());
BaseGfxEngine
::
GetInstance
()
->
SetScreenShape
(
ScreenShape
::
RECTANGLE
);
scrollView
.
SetXScrollBarVisible
(
true
);
uiList
.
SetXScrollBarVisible
(
true
);
EXPECT_TRUE
(
scrollView
.
GetXScrollBarVisible
());
EXPECT_TRUE
(
uiList
.
GetXScrollBarVisible
());
}
HWTEST_F
(
ScrollBarTest
,
UIScrollBarSetYScrollBarVisible
,
TestSize
.
Level0
)
{
TestUIScrollView
scrollView
;
TestUIList
uiList
;
EXPECT_FALSE
(
scrollView
.
GetYScrollBarVisible
());
EXPECT_FALSE
(
uiList
.
GetYScrollBarVisible
());
scrollView
.
SetYScrollBarVisible
(
true
);
uiList
.
SetYScrollBarVisible
(
true
);
EXPECT_TRUE
(
scrollView
.
GetYScrollBarVisible
());
EXPECT_TRUE
(
uiList
.
GetYScrollBarVisible
());
}
HWTEST_F
(
ScrollBarTest
,
UIScrollBarSetPosition
,
TestSize
.
Level0
)
HWTEST_F
(
ScrollBarTest
,
UIScrollBarSetPosition
,
TestSize
.
Level0
)
{
{
constexpr
int16_t
VALID_POSITION
=
5
;
constexpr
int16_t
VALID_POSITION
=
5
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录