Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
d240b051
G
Graphic Ui
项目概览
OpenHarmony
/
Graphic Ui
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
未验证
提交
d240b051
编写于
8月 29, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 29, 2022
浏览文件
操作
浏览文件
下载
差异文件
!732 TDD用例设计
Merge pull request !732 from 施其昌/master
上级
221d7275
cd725dab
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
436 addition
and
9 deletion
+436
-9
interfaces/kits/components/ui_axis.h
interfaces/kits/components/ui_axis.h
+40
-0
interfaces/kits/components/ui_button.h
interfaces/kits/components/ui_button.h
+11
-0
interfaces/kits/components/ui_chart.h
interfaces/kits/components/ui_chart.h
+30
-0
test/unittest/components/ui_abstract_progress_unit_test.cpp
test/unittest/components/ui_abstract_progress_unit_test.cpp
+9
-9
test/unittest/components/ui_axis_unit_test.cpp
test/unittest/components/ui_axis_unit_test.cpp
+196
-0
test/unittest/components/ui_button_unit_test.cpp
test/unittest/components/ui_button_unit_test.cpp
+37
-0
test/unittest/components/ui_canvas_unit_test.cpp
test/unittest/components/ui_canvas_unit_test.cpp
+50
-0
test/unittest/components/ui_chart_unit_test.cpp
test/unittest/components/ui_chart_unit_test.cpp
+31
-0
test/unittest/components/ui_checkbox_unit_test.cpp
test/unittest/components/ui_checkbox_unit_test.cpp
+32
-0
未找到文件。
interfaces/kits/components/ui_axis.h
浏览文件 @
d240b051
...
...
@@ -107,6 +107,16 @@ public:
enableReverse_
=
enable
;
}
/**
* @brief Obtains the enableReverse_.
*
* @return Returns the enableReverse_.
*/
bool
GetEnableReverse
()
const
{
return
enableReverse_
;
}
const
Point
&
GetStartPoint
()
const
{
return
start_
;
...
...
@@ -117,6 +127,16 @@ public:
return
end_
;
}
/**
* @brief Sets the markInterval_.
*
* @param Sets the markInterval_.
*/
void
SetMarkInterval
(
float
Interval
)
{
markInterval_
=
Interval
;
}
float
GetMarkInterval
()
const
{
return
markInterval_
;
...
...
@@ -237,6 +257,16 @@ public:
*/
void
SetMarkNum
(
uint16_t
count
)
override
;
/**
* @brief Obtains the markDataCount_.
*
* @return Returns the markDataCount_.
*/
uint16_t
GetMarkNum
()
const
{
return
markDataCount_
;
}
void
UpdateAxisPoints
()
override
;
private:
...
...
@@ -305,6 +335,16 @@ public:
*/
void
SetMarkNum
(
uint16_t
count
)
override
;
/**
* @brief Obtains the markDataCount_.
*
* @return Returns the markDataCount_.
*/
uint16_t
GetMarkNum
()
const
{
return
markDataCount_
;
}
void
UpdateAxisPoints
()
override
;
private:
...
...
interfaces/kits/components/ui_button.h
浏览文件 @
d240b051
...
...
@@ -411,6 +411,17 @@ public:
{
enableAnimation_
=
enable
;
}
/**
* @brief Obtains the value of a style.
*
* @param enableAnimation.
* @return Returns enableAnimation_.
*/
bool
GetEnableButtonAnimation
()
const
{
return
enableAnimation_
;
}
#endif
protected:
...
...
interfaces/kits/components/ui_chart.h
浏览文件 @
d240b051
...
...
@@ -478,6 +478,16 @@ public:
enableHeadPoint_
=
enable
;
}
/**
* @brief enableHeadPoint_.
*
* @return Returns enableHeadPoint_.
*/
bool
GetEnableHeadPoint
()
const
{
return
enableHeadPoint_
;
}
/**
* @brief Enables the feature of drawing the top point of a polyline. If there are multiple top points,
* only the first one is drawn.
...
...
@@ -492,6 +502,16 @@ public:
enableTopPoint_
=
enable
;
}
/**
* @brief enableTopPoint_.
*
* @return Returns enableTopPoint_.
*/
bool
GetEnableTopPoint
()
const
{
return
enableTopPoint_
;
}
/**
* @brief Enables the feature of drawing the bottom point of a polyline. If there are multiple bottom points,
* only the first one is drawn.
...
...
@@ -506,6 +526,16 @@ public:
enableBottomPoint_
=
enable
;
}
/**
* @brief enableBottomPoint_.
*
* @return Returns enableBottomPoint_.
*/
bool
GetEnableBottomPoint
()
const
{
return
enableBottomPoint_
;
}
void
DrawPoint
(
BufferInfo
&
gfxDstBuffer
,
const
Rect
&
mask
);
void
Refresh
();
...
...
test/unittest/components/ui_abstract_progress_unit_test.cpp
浏览文件 @
d240b051
...
...
@@ -26,9 +26,6 @@ namespace {
const
int16_t
MIN_VALUE
=
20
;
const
char
*
foreground
=
"D:/"
;
const
char
*
background
=
"D:/"
;
const
ImageInfo
*
foregroundImageInfo
;
const
ImageInfo
*
backgroundImageInfo
;
const
ImageInfo
*
groundImageInfo
;
}
class
UIAbsatrctProgressTest
:
public
testing
::
Test
{
public:
...
...
@@ -256,9 +253,9 @@ HWTEST_F(UIAbsatrctProgressTest, UIAbsatrctProgressSetImage_002, TestSize.Level1
const
Image
*
backgroundImage
=
new
Image
();
const
Image
*
foregroundImage
=
new
Image
();
const
Image
*
GroundImage
=
new
Image
();
foregroundImageInfo
=
static_cast
<
ImageInfo
*>
(
UIMalloc
(
sizeof
(
ImageInfo
)));
backgroundImageInfo
=
static_cast
<
ImageInfo
*>
(
UIMalloc
(
sizeof
(
ImageInfo
)));
groundImageInfo
=
static_cast
<
ImageInfo
*>
(
UIMalloc
(
sizeof
(
ImageInfo
)));
ImageInfo
*
foregroundImageInfo
=
static_cast
<
ImageInfo
*>
(
UIMalloc
(
sizeof
(
ImageInfo
)));
ImageInfo
*
backgroundImageInfo
=
static_cast
<
ImageInfo
*>
(
UIMalloc
(
sizeof
(
ImageInfo
)));
ImageInfo
*
groundImageInfo
=
static_cast
<
ImageInfo
*>
(
UIMalloc
(
sizeof
(
ImageInfo
)));
abstractProgress_
->
SetImage
(
foregroundImageInfo
,
backgroundImageInfo
);
if
(
foregroundImageInfo
==
nullptr
&&
GroundImage
->
GetImageInfo
()
==
nullptr
)
{
EXPECT_EQ
(
foregroundImage
->
GetSrcType
(),
2
);
// 0 : IMG_SRC_VARIABLE 1 : IMG_SRC_FILE 2 : IMG_SRC_UNKNOWN
...
...
@@ -280,8 +277,11 @@ HWTEST_F(UIAbsatrctProgressTest, UIAbsatrctProgressSetImage_002, TestSize.Level1
GroundImage
=
nullptr
;
delete
foregroundImage
;
foregroundImage
=
nullptr
;
UIFree
(
&
foregroundImageInfo
);
UIFree
(
&
backgroundImageInfo
);
UIFree
(
&
groundImageInfo
);
UIFree
(
foregroundImageInfo
);
foregroundImageInfo
=
nullptr
;
UIFree
(
backgroundImageInfo
);
backgroundImageInfo
=
nullptr
;
UIFree
(
groundImageInfo
);
groundImageInfo
=
nullptr
;
}
}
// namespace OHOS
test/unittest/components/ui_axis_unit_test.cpp
浏览文件 @
d240b051
...
...
@@ -24,6 +24,7 @@ namespace OHOS {
namespace
{
const
int16_t
LARGER_VALUE
=
10
;
const
int16_t
SMALLER_VALUE
=
2
;
const
bool
ENABLE
=
true
;
}
class
UIAxisTest
:
public
testing
::
Test
{
public:
...
...
@@ -146,4 +147,199 @@ HWTEST_F(UIAxisTest, UIYAxisSetDataRange_002, TestSize.Level1)
}
EXPECT_EQ
(
axisY_
->
SetDataRange
(
LARGER_VALUE
,
SMALLER_VALUE
),
false
);
}
/**
* @tc.name: UIYAxisSetMarkNum_001
* @tc.desc: Verify SetMarkNum function, equal.
*/
HWTEST_F
(
UIAxisTest
,
UIXAxisSetMarkNum_001
,
TestSize
.
Level1
)
{
if
(
axisY_
==
nullptr
)
{
EXPECT_EQ
(
1
,
0
);
return
;
}
int16_t
COUNT
=
1
;
axisX_
->
SetMarkNum
(
COUNT
);
EXPECT_EQ
(
axisX_
->
GetMarkNum
(),
COUNT
);
}
/**
* @tc.name: UIYAxisSetMarkNum_001
* @tc.desc: Verify SetMarkNum function, equal.
*/
HWTEST_F
(
UIAxisTest
,
UIYAxisSetMarkNum_001
,
TestSize
.
Level1
)
{
if
(
axisY_
==
nullptr
)
{
EXPECT_EQ
(
1
,
0
);
return
;
}
int16_t
COUNT
=
1
;
axisY_
->
SetMarkNum
(
COUNT
);
EXPECT_EQ
(
axisY_
->
GetMarkNum
(),
COUNT
);
COUNT
=
2
;
axisY_
->
SetMarkNum
(
COUNT
);
axisY_
->
UpdateAxis
();
EXPECT_EQ
(
axisY_
->
GetMarkNum
(),
COUNT
);
}
/**
* @tc.name: UIAxisEnableReverse_001
* @tc.desc: Verify EnableReverse function, equal.
*/
HWTEST_F
(
UIAxisTest
,
UIAxisEnableReverse_001
,
TestSize
.
Level1
)
{
if
(
axisX_
==
nullptr
)
{
EXPECT_EQ
(
1
,
0
);
return
;
}
axisX_
->
EnableReverse
(
ENABLE
);
EXPECT_EQ
(
axisX_
->
GetEnableReverse
(),
ENABLE
);
}
/**
* @tc.name: UIAxisGetStartPoint_001
* @tc.desc: Verify GetStartPoint function, equal.
*/
HWTEST_F
(
UIAxisTest
,
UIAxisGetStartPoint_001
,
TestSize
.
Level1
)
{
if
(
axisX_
==
nullptr
)
{
EXPECT_EQ
(
1
,
0
);
return
;
}
Point
start_
=
{
0
,
0
};
EXPECT_EQ
(
axisX_
->
GetStartPoint
().
x
,
start_
.
x
);
EXPECT_EQ
(
axisX_
->
GetStartPoint
().
y
,
start_
.
y
);
}
/**
* @tc.name: UIAxisGetEndPoint_001
* @tc.desc: Verify GetEndPoint function, equal.
*/
HWTEST_F
(
UIAxisTest
,
UIAxisGetEndPoint_001
,
TestSize
.
Level1
)
{
if
(
axisX_
==
nullptr
)
{
EXPECT_EQ
(
1
,
0
);
return
;
}
Point
end_
=
{
0
,
0
};
EXPECT_EQ
(
axisX_
->
GetEndPoint
().
x
,
end_
.
x
);
EXPECT_EQ
(
axisX_
->
GetEndPoint
().
y
,
end_
.
y
);
}
/**
* @tc.name: UIAxisGetMarkInterval_001
* @tc.desc: Verify GetMarkInterval function, equal.
*/
HWTEST_F
(
UIAxisTest
,
UIAxisGetMarkInterval_001
,
TestSize
.
Level1
)
{
if
(
axisX_
==
nullptr
)
{
EXPECT_EQ
(
1
,
0
);
return
;
}
float
markInterval
=
0
;
axisX_
->
SetMarkInterval
(
markInterval
);
EXPECT_EQ
(
axisX_
->
GetMarkInterval
(),
markInterval
);
}
/**
* @tc.name: UIAxisOnPreDraw_001
* @tc.desc: Verify OnPreDraw function, equal.
*/
HWTEST_F
(
UIAxisTest
,
UIAxisOnPreDraw_001
,
TestSize
.
Level1
)
{
if
(
axisX_
==
nullptr
)
{
EXPECT_EQ
(
1
,
0
);
return
;
}
Rect
*
invalidatedArea
=
new
Rect
();
EXPECT_EQ
(
axisX_
->
OnPreDraw
(
*
invalidatedArea
),
false
);
delete
invalidatedArea
;
invalidatedArea
=
nullptr
;
}
/**
* @tc.name: UIAxisUpdateAxisPoints_001
* @tc.desc: Verify UpdateAxisPoints function, equal.
*/
HWTEST_F
(
UIAxisTest
,
UIAxisUpdateAxisPoints_001
,
TestSize
.
Level1
)
{
if
(
axisX_
==
nullptr
)
{
EXPECT_EQ
(
1
,
0
);
return
;
}
axisX_
->
UpdateAxisPoints
();
Point
endx
=
axisX_
->
GetEndPoint
();
Point
startx
=
axisX_
->
GetStartPoint
();
EXPECT_EQ
(
endx
.
y
,
startx
.
y
);
}
/**
* @tc.name: UIAxisUpdateAxisPoints_002
* @tc.desc: Verify UpdateAxisPoints function, equal.
*/
HWTEST_F
(
UIAxisTest
,
UIAxisUpdateAxisPoints_002
,
TestSize
.
Level1
)
{
if
(
axisY_
==
nullptr
)
{
EXPECT_EQ
(
1
,
0
);
return
;
}
axisY_
->
UpdateAxisPoints
();
Point
endx
=
axisY_
->
GetEndPoint
();
Point
startx
=
axisY_
->
GetStartPoint
();
EXPECT_EQ
(
endx
.
x
,
startx
.
x
);
}
/**
* @tc.name: UIAxisTranslateToPixel_001
* @tc.desc: Verify TranslateToPixel function, equal.
*/
HWTEST_F
(
UIAxisTest
,
UIAxisTranslateToPixel_001
,
TestSize
.
Level1
)
{
if
(
axisX_
==
nullptr
)
{
EXPECT_EQ
(
1
,
0
);
return
;
}
int16_t
value
=
2
;
float
minXStep
=
0
;
Point
startx
=
axisX_
->
GetStartPoint
();
axisX_
->
TranslateToPixel
(
value
);
int16_t
value2
=
startx
.
x
+
static_cast
<
int16_t
>
((
value
-
0
)
*
minXStep
);
EXPECT_EQ
(
value
,
value2
);
}
/**
* @tc.name: UIAxisTranslateToPixel_002
* @tc.desc: Verify TranslateToPixel function, equal.
*/
HWTEST_F
(
UIAxisTest
,
UIAxisTranslateToPixel_002
,
TestSize
.
Level1
)
{
if
(
axisY_
==
nullptr
)
{
EXPECT_EQ
(
1
,
0
);
return
;
}
int16_t
value
=
2
;
float
minYStep
=
0
;
Point
starty
=
axisY_
->
GetStartPoint
();
axisX_
->
TranslateToPixel
(
value
);
int16_t
value2
=
starty
.
y
+
static_cast
<
int16_t
>
((
0
-
value
+
0
)
*
minYStep
);
EXPECT_EQ
(
value
,
value2
);
}
/**
* @tc.name: UIAxisTranslateToPixel_003
* @tc.desc: Verify TranslateToPixel function, equal.
*/
HWTEST_F
(
UIAxisTest
,
UIAxisTranslateToPixel_003
,
TestSize
.
Level1
)
{
if
(
axisY_
==
nullptr
)
{
EXPECT_EQ
(
1
,
0
);
return
;
}
int16_t
value
=
2
;
float
minYStep
=
0
;
Point
starty
=
axisY_
->
GetStartPoint
();
axisY_
->
TranslateToPixel
(
value
);
int16_t
value2
=
starty
.
y
-
static_cast
<
int16_t
>
((
value
-
0
)
*
minYStep
);
EXPECT_EQ
(
value
,
value2
);
}
}
// namespace OHOS
test/unittest/components/ui_button_unit_test.cpp
浏览文件 @
d240b051
...
...
@@ -18,6 +18,7 @@
#include <climits>
#include <gtest/gtest.h>
#include "test_resource_config.h"
#include "draw/draw_utils.h"
using
namespace
testing
::
ext
;
...
...
@@ -337,4 +338,40 @@ HWTEST_F(UIButtonTest, UIButtonSetStateForStyle_001, TestSize.Level1)
button_
->
SetStateForStyle
(
UIButton
::
ButtonState
::
PRESSED
);
EXPECT_EQ
(
button_
->
GetStyle
(
STYLE_BACKGROUND_COLOR
),
Color
::
Green
().
full
);
}
/**
* @tc.name: UIButtonSetImageSrc_002
* @tc.desc: Verify SetImageSrc function.
*/
HWTEST_F
(
UIButtonTest
,
UIButtonSetImageSrc_002
,
TestSize
.
Level0
)
{
if
(
button_
==
nullptr
)
{
EXPECT_NE
(
0
,
0
);
return
;
}
ImageInfo
*
defaultImgSrc
=
static_cast
<
ImageInfo
*>
(
UIMalloc
(
sizeof
(
ImageInfo
)));
ImageInfo
*
triggeredImgSrc
=
static_cast
<
ImageInfo
*>
(
UIMalloc
(
sizeof
(
ImageInfo
)));
button_
->
SetImageSrc
(
defaultImgSrc
,
triggeredImgSrc
);
ASSERT_TRUE
(
button_
->
GetCurImageSrc
());
EXPECT_EQ
(
button_
->
GetCurImageSrc
()
->
GetSrcType
(),
IMG_SRC_VARIABLE
);
UIFree
(
triggeredImgSrc
);
triggeredImgSrc
=
nullptr
;
UIFree
(
defaultImgSrc
);
defaultImgSrc
=
nullptr
;
}
/**
* @tc.name: UIButtonEnableButtonAnimation_001
* @tc.desc: Verify EnableButtonAnimation function.
*/
HWTEST_F
(
UIButtonTest
,
UIButtonEnableButtonAnimation_001
,
TestSize
.
Level0
)
{
if
(
button_
==
nullptr
)
{
EXPECT_NE
(
0
,
0
);
return
;
}
bool
enable
=
true
;
button_
->
EnableButtonAnimation
(
enable
);
EXPECT_EQ
(
button_
->
GetEnableButtonAnimation
(),
enable
);
}
}
// namespace OHOS
test/unittest/components/ui_canvas_unit_test.cpp
浏览文件 @
d240b051
...
...
@@ -1850,6 +1850,7 @@ HWTEST_F(UICanvasTest, UICanvasShadowColor_001, TestSize.Level1)
ColorType
color
=
Color
::
Red
();
paint_
->
SetShadowColor
(
color
);
EXPECT_EQ
(
paint_
->
GetShadowColor
().
full
,
color
.
full
);
EXPECT_EQ
(
paint_
->
HaveShadow
(),
true
);
}
HWTEST_F
(
UICanvasTest
,
UICanvasShadowColor_002
,
TestSize
.
Level0
)
{
...
...
@@ -1940,6 +1941,7 @@ HWTEST_F(UICanvasTest, UICanvasCreateLinearGradient_001, TestSize.Level1)
EXPECT_EQ
(
paint_
->
GetLinearGradientPoint
().
y0
,
START_Y
);
EXPECT_EQ
(
paint_
->
GetLinearGradientPoint
().
x1
,
END_X
);
EXPECT_EQ
(
paint_
->
GetLinearGradientPoint
().
y1
,
END_Y
);
EXPECT_EQ
(
paint_
->
GetGradient
(),
Paint
::
Gradient
::
Linear
);
}
HWTEST_F
(
UICanvasTest
,
UICanvasCreateLinearGradient_002
,
TestSize
.
Level0
)
...
...
@@ -2140,4 +2142,52 @@ HWTEST_F(UICanvasTest, UICanvasSetRotate_002, TestSize.Level1)
EXPECT_EQ
(
fontStyle
.
letterSpace
,
LETTER_SPACE
);
EXPECT_EQ
(
paint_
->
GetRotateAngle
(),
ROTATE
);
}
/**
* @tc.name: UICanvasInitDash_001
* @tc.desc: Verify InitDash function, equal.
* @tc.type: FUNC
*/
HWTEST_F
(
UICanvasTest
,
UICanvasInitDash_001
,
TestSize
.
Level0
)
{
if
(
canvas_
==
nullptr
)
{
EXPECT_EQ
(
1
,
0
);
return
;
}
if
(
paint_
==
nullptr
)
{
EXPECT_EQ
(
1
,
0
);
return
;
}
#if GRAPHIC_ENABLE_DASH_GENERATE_FLAG
Paint
*
paint3
=
new
Paint
();
paint_
->
InitDash
(
*
paint3
);
EXPECT_EQ
(
paint_
->
GetLineDash
(),
nullptr
);
delete
paint3
;
paint3
=
nullptr
;
#endif
Paint
*
paint1
=
new
Paint
();
paint1
->
Init
(
*
paint_
);
EXPECT_EQ
(
paint1
->
GetChangeFlag
(),
false
);
ColorType
color
=
Color
::
Red
();
paint1
->
SetStrokeStyle
(
color
);
EXPECT_EQ
(
paint1
->
GetStrokeColor
().
full
,
color
.
full
);
color
=
Color
::
Yellow
();
paint1
->
SetFillStyle
(
color
);
EXPECT_EQ
(
paint1
->
GetFillColor
().
full
,
color
.
full
);
paint1
->
SetStrokeStyle
(
Paint
::
PaintStyle
::
GRADIENT
);
EXPECT_EQ
(
paint1
->
GetStyle
(),
Paint
::
PaintStyle
::
GRADIENT
);
paint1
->
SetFillStyle
(
Paint
::
PaintStyle
::
STROKE_FILL_STYLE
);
EXPECT_EQ
(
paint1
->
GetStyle
(),
Paint
::
PaintStyle
::
STROKE_FILL_STYLE
);
paint1
->
GetTransAffine
();
paint1
->
SetUICanvas
(
canvas_
);
EXPECT_EQ
(
paint1
->
GetUICanvas
(),
canvas_
);
EXPECT_EQ
(
paint1
->
HaveComposite
(),
false
);
delete
paint1
;
paint1
=
nullptr
;
}
}
// namespace OHOS
test/unittest/components/ui_chart_unit_test.cpp
浏览文件 @
d240b051
...
...
@@ -488,4 +488,35 @@ HWTEST_F(UIChartDataSerialTest, UIChartClearDataSerial_001, TestSize.Level1)
ret
=
chart_
->
DeleteDataSerial
(
chartDataSerial_
);
EXPECT_EQ
(
ret
,
false
);
}
/**
* @tc.name: UIChartGetValleyData_001
* @tc.desc: Verify GetValleyData function, equal.
*/
HWTEST_F
(
UIChartDataSerialTest
,
UIChartGetValleyData_001
,
TestSize
.
Level1
)
{
if
(
chart_
==
nullptr
)
{
EXPECT_EQ
(
1
,
0
);
return
;
}
UIChart
*
chart
=
static_cast
<
UIChart
*>
(
chart_
);
chartDataSerial_
->
BindToChart
(
chart
);
bool
flag
=
true
;
chartDataSerial_
->
EnableHeadPoint
(
flag
);
chartDataSerial_
->
EnableTopPoint
(
flag
);
chartDataSerial_
->
EnableBottomPoint
(
flag
);
EXPECT_EQ
(
chartDataSerial_
->
GetEnableHeadPoint
(),
flag
);
EXPECT_EQ
(
chartDataSerial_
->
GetEnableTopPoint
(),
flag
);
EXPECT_EQ
(
chartDataSerial_
->
GetEnableBottomPoint
(),
flag
);
BufferInfo
*
gfxDstBuffer
=
new
BufferInfo
();
Rect
*
mask
=
new
Rect
();
chartDataSerial_
->
DrawPoint
(
*
gfxDstBuffer
,
*
mask
);
chartDataSerial_
->
Refresh
();
EXPECT_EQ
(
chartDataSerial_
->
GetValleyData
(),
0
);
delete
gfxDstBuffer
;
gfxDstBuffer
=
nullptr
;
delete
mask
;
mask
=
nullptr
;
}
}
test/unittest/components/ui_checkbox_unit_test.cpp
浏览文件 @
d240b051
...
...
@@ -14,6 +14,7 @@
*/
#include "components/ui_checkbox.h"
#include "test_resource_config.h"
#include <climits>
#include <gtest/gtest.h>
...
...
@@ -94,4 +95,35 @@ HWTEST_F(UICheckBoxTest, UICheckBoxSetState_001, TestSize.Level0)
checkBox_
->
SetState
(
UICheckBox
::
UICheckBoxState
::
UNSELECTED
);
EXPECT_EQ
(
checkBox_
->
GetState
(),
UICheckBox
::
UICheckBoxState
::
UNSELECTED
);
}
/**
* @tc.name: UICheckBoxSetSelectedStateColor_001
* @tc.desc: Verify SetSelectedStateColor function, equal.
*/
HWTEST_F
(
UICheckBoxTest
,
UICheckBoxSetSelectedStateColor_001
,
TestSize
.
Level0
)
{
if
(
checkBox_
==
nullptr
)
{
EXPECT_NE
(
0
,
0
);
return
;
}
ColorType
color
=
Color
::
Red
();
checkBox_
->
SetSelectedStateColor
(
color
);
EXPECT_EQ
(
checkBox_
->
GetSelectedStateColor
().
full
,
color
.
full
);
}
/**
* @tc.name: UICheckBoxOnPreDraw_001
* @tc.desc: Verify OnPreDraw function, equal.
*/
HWTEST_F
(
UICheckBoxTest
,
UICheckBoxOnPreDraw_001
,
TestSize
.
Level0
)
{
if
(
checkBox_
==
nullptr
)
{
EXPECT_NE
(
0
,
0
);
return
;
}
Rect
*
invalidatedArea
=
new
Rect
();
EXPECT_EQ
(
checkBox_
->
OnPreDraw
(
*
invalidatedArea
),
false
);
delete
invalidatedArea
;
invalidatedArea
=
nullptr
;
}
}
// namespace OHOS
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录