Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
3cd6f964
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,发现更多精彩内容 >>
提交
3cd6f964
编写于
3月 13, 2022
作者:
L
liuyuxiang-bear
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix revise-issue.
Signed-off-by:
N
liuyuxiang-bear
<
liuyuxiang7@huawei.com
>
上级
b6f74d8e
变更
26
隐藏空白更改
内联
并排
Showing
26 changed file
with
63 addition
and
61 deletion
+63
-61
README.md
README.md
+1
-1
changelog.md
changelog.md
+1
-1
frameworks/animator/interpolation.cpp
frameworks/animator/interpolation.cpp
+6
-4
frameworks/common/text.cpp
frameworks/common/text.cpp
+1
-1
frameworks/components/ui_checkbox.cpp
frameworks/components/ui_checkbox.cpp
+4
-4
frameworks/components/ui_image_view.cpp
frameworks/components/ui_image_view.cpp
+1
-1
frameworks/components/ui_time_picker.cpp
frameworks/components/ui_time_picker.cpp
+1
-1
frameworks/components/ui_view.cpp
frameworks/components/ui_view.cpp
+4
-1
frameworks/dfx/ui_dump_dom_tree.cpp
frameworks/dfx/ui_dump_dom_tree.cpp
+1
-1
frameworks/imgdecode/cache_manager.cpp
frameworks/imgdecode/cache_manager.cpp
+1
-1
frameworks/imgdecode/file_img_decoder.cpp
frameworks/imgdecode/file_img_decoder.cpp
+1
-1
frameworks/window/window.cpp
frameworks/window/window.cpp
+1
-1
frameworks/window/window_impl.cpp
frameworks/window/window_impl.cpp
+1
-1
frameworks/window/window_impl.h
frameworks/window/window_impl.h
+1
-1
interfaces/kits/components/root_view.h
interfaces/kits/components/root_view.h
+1
-1
interfaces/kits/font/base_font.h
interfaces/kits/font/base_font.h
+1
-1
test/framework/src/compare_tools.cpp
test/framework/src/compare_tools.cpp
+1
-1
test/uitest/test_border_margin_padding/ui_test_border_margin_padding.cpp
...t_border_margin_padding/ui_test_border_margin_padding.cpp
+1
-1
test/uitest/test_font/ui_test_font.cpp
test/uitest/test_font/ui_test_font.cpp
+2
-2
test/uitest/test_label/ui_test_label.cpp
test/uitest/test_label/ui_test_label.cpp
+6
-6
test/uitest/test_opacity/ui_test_opacity.cpp
test/uitest/test_opacity/ui_test_opacity.cpp
+0
-3
test/uitest/test_progress_bar/ui_test_circle_progress.cpp
test/uitest/test_progress_bar/ui_test_circle_progress.cpp
+1
-1
test/uitest/test_qrcode/ui_test_qrcode.cpp
test/uitest/test_qrcode/ui_test_qrcode.cpp
+2
-2
test/uitest/test_texture_mapper/ui_test_texture_mapper.cpp
test/uitest/test_texture_mapper/ui_test_texture_mapper.cpp
+1
-1
test/uitest/test_view_bitmap/ui_test_view_bitmap.cpp
test/uitest/test_view_bitmap/ui_test_view_bitmap.cpp
+1
-1
test/unittest/components/ui_view_unit_test.cpp
test/unittest/components/ui_view_unit_test.cpp
+21
-21
未找到文件。
README.md
浏览文件 @
3cd6f964
...
...
@@ -51,7 +51,7 @@ The graphics UI directly calls the HAL API or uses the client provided by the Wi
├── interfaces # APIs
│ ├── innerkits # APIs between modules
│ │ └── xxx # Sub-module APIs
│ └── kits # Extern
e
l APIs
│ └── kits # Extern
a
l APIs
│ │ └── xxx # Sub-module APIs
├── test # Test code
│ ├── framework
...
...
changelog.md
浏览文件 @
3cd6f964
...
...
@@ -83,7 +83,7 @@
(1) ColorMode新增TSC6枚举 类型。
(2) UIImageView成员变量colorF
ro
mat由4位修改为8位。
(2) UIImageView成员变量colorF
or
mat由4位修改为8位。
(3) 合入时间2021.6.17
...
...
frameworks/animator/interpolation.cpp
浏览文件 @
3cd6f964
...
...
@@ -21,7 +21,7 @@ namespace OHOS {
/* B(t) = P0*(1-t)^3 + 3*P1*t*(1-t)^2 + 3*P2*t^2*(1-t) + P3*t^3 */
int16_t
Interpolation
::
GetBezierInterpolation
(
int16_t
t
,
int16_t
u0
,
int16_t
u1
,
int16_t
u2
,
int16_t
u3
)
{
int64_t
invT
=
1024
-
t
;
// Intergerlize the standard equation, 1.0f is d
e
vided into 1024 parts
int64_t
invT
=
1024
-
t
;
// Intergerlize the standard equation, 1.0f is d
i
vided into 1024 parts
int64_t
invT2
=
invT
*
invT
;
int64_t
invT3
=
invT2
*
invT
;
int64_t
t2
=
t
*
t
;
...
...
@@ -31,8 +31,10 @@ int16_t Interpolation::GetBezierInterpolation(int16_t t, int16_t u0, int16_t u1,
ret
+=
BEZIER_COEFFICIENT
*
invT2
*
t
*
u1
;
ret
+=
BEZIER_COEFFICIENT
*
invT
*
t2
*
u2
;
ret
+=
t3
*
u3
;
ret
=
ret
>>
30
;
// 30: cubic shift
return
static_cast
<
int16_t
>
(
ret
);
uint64_t
uret
=
(
ret
<
0
)
?
(
-
ret
)
:
ret
;
int16_t
value
=
static_cast
<
int16_t
>
(
uret
>>
30
);
// 30: cubic shift
return
(
ret
<
0
)
?
(
-
value
)
:
value
;
}
/* B(t) = P0*(1-t)^3 + 3*P1*t*(1-t)^2 + 3*P2*t^2*(1-t) + P3*t^3 */
...
...
@@ -76,7 +78,7 @@ float Interpolation::GetBezierY(float x, float x1, float y1, float x2, float y2)
/* Attention: precision must be carefully selected
* too small may lead to misconvergence and a decrease of performance
* too large may cause the curve rugged even make some points outlier */
constexpr
float
PRECISION
=
0.05
f
;
// 0.05f make se
r
veral outliers near inflection point
constexpr
float
PRECISION
=
0.05
f
;
// 0.05f make several outliers near inflection point
/* Newton Method to solve t from x */
while
(
MATH_ABS
(
xt
-
x
)
>
PRECISION
)
{
...
...
frameworks/common/text.cpp
浏览文件 @
3cd6f964
...
...
@@ -131,7 +131,7 @@ void Text::SetFont(const char* name, uint8_t size, char*& destName, uint8_t& des
void
Text
::
SetFontId
(
uint8_t
fontId
)
{
if
((
fontId
>=
UIFontBuilder
::
GetInstance
()
->
GetTotalFontId
())
||
((
fontId_
==
fontId
)
&&
(
fontSize_
!=
0
)))
{
GRAPHIC_LOGE
(
"Text::SetFontId invalid fontId(%d)"
,
fontId
);
GRAPHIC_LOGE
(
"Text::SetFontId invalid fontId(%
hh
d)"
,
fontId
);
return
;
}
UITextLanguageFontParam
*
fontParam
=
UIFontBuilder
::
GetInstance
()
->
GetTextLangFontsTable
(
fontId
);
...
...
frameworks/components/ui_checkbox.cpp
浏览文件 @
3cd6f964
...
...
@@ -65,16 +65,16 @@ void UICheckBox::SetState(UICheckBoxState state, bool needAnimater)
}
state_
=
state
;
if
((
image_
[
SELECTED
].
GetSrcType
()
==
IMG_SRC_UNKNOWN
)
||
(
image_
[
UNSELECTED
].
GetSrcType
()
==
IMG_SRC_UNKNOWN
))
{
if
(
needAnimater
)
{
#if DEFAULT_ANIMATION
if
(
needAnimater
)
{
checkBoxAnimator_
.
Start
();
ResetCallback
();
#else
backgroundOpacity_
=
(
state_
==
SELECTED
)
?
OPA_OPAQUE
:
0
;
#endif
}
else
{
backgroundOpacity_
=
(
state_
==
SELECTED
)
?
OPA_OPAQUE
:
0
;
}
#else
backgroundOpacity_
=
(
state_
==
SELECTED
)
?
OPA_OPAQUE
:
0
;
#endif
}
if
(
onStateChangeListener_
!=
nullptr
)
{
onStateChangeListener_
->
OnChange
(
state
);
...
...
frameworks/components/ui_image_view.cpp
浏览文件 @
3cd6f964
...
...
@@ -225,7 +225,7 @@ UIImageView::UIImageView()
imageHeight_
(
0
),
autoEnable_
(
true
),
needRefresh_
(
false
),
colorFormat_
(
UNKNOW
),
colorFormat_
(
UNKNOW
N
),
blurLevel_
(
BlurLevel
::
LEVEL0
),
algorithm_
(
TransformAlgorithm
::
BILINEAR
),
reserve_
(
0
)
...
...
frameworks/components/ui_time_picker.cpp
浏览文件 @
3cd6f964
...
...
@@ -193,7 +193,7 @@ void UITimePicker::TimeSelectedCallback()
void
UITimePicker
::
GetValueByIndex
(
char
*
value
,
uint8_t
len
,
uint16_t
index
,
int16_t
start
,
int16_t
end
)
{
if
((
value
!=
nullptr
)
&&
(
index
<
end
-
start
+
1
))
{
if
(
sprintf_s
(
value
,
len
,
"%02
d
"
,
index
)
<
0
)
{
if
(
sprintf_s
(
value
,
len
,
"%02
u
"
,
index
)
<
0
)
{
return
;
}
}
...
...
frameworks/components/ui_view.cpp
浏览文件 @
3cd6f964
...
...
@@ -83,7 +83,7 @@ UIView::~UIView()
bool
UIView
::
OnPreDraw
(
Rect
&
invalidatedArea
)
const
{
Rect
rect
(
GetRect
());
int16_t
r
=
style_
->
borderRadius_
;
uint16_t
r
=
style_
->
borderRadius_
;
// radius must be positive
if
(
r
==
COORD_MAX
)
{
return
true
;
}
...
...
@@ -298,6 +298,9 @@ void UIView::Shear(const Vector2<float>& shearX, const Vector2<float>& shearY, c
if
(
transMap_
==
nullptr
)
{
ReMeasure
();
transMap_
=
new
TransformMap
();
if
(
transMap_
==
nullptr
)
{
return
;
}
}
bool
firstTrans
=
transMap_
->
IsInvalid
();
Rect
joinRect
=
transMap_
->
GetBoxRect
();
...
...
frameworks/dfx/ui_dump_dom_tree.cpp
浏览文件 @
3cd6f964
...
...
@@ -314,7 +314,7 @@ void UIDumpDomTree::OutputDomTree(UIView* view, cJSON* usr)
GRAPHIC_LOGE
(
"UIDumpDomTree::OutputDomTree cJSON create object failed Err!
\n
"
);
return
;
}
/* usr must be a array. */
/* usr must be a
n
array. */
cJSON_AddItemToArray
(
usr
,
dumpUsr
);
}
...
...
frameworks/imgdecode/cache_manager.cpp
浏览文件 @
3cd6f964
/*
* Copyright (c) 2020 Huawei Device Co., Ltd.
* Copyright (c) 2020
-2021
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
...
...
frameworks/imgdecode/file_img_decoder.cpp
浏览文件 @
3cd6f964
...
...
@@ -80,7 +80,7 @@ RetCode FileImgDecoder::GetHeader(ImgResDsc& dsc)
if
(
readCount
!=
sizeof
(
ImageHeader
))
{
dsc
.
imgInfo
.
header
.
width
=
0
;
dsc
.
imgInfo
.
header
.
height
=
0
;
dsc
.
imgInfo
.
header
.
colorMode
=
UNKNOW
;
dsc
.
imgInfo
.
header
.
colorMode
=
UNKNOW
N
;
return
RetCode
::
FAIL
;
}
...
...
frameworks/window/window.cpp
浏览文件 @
3cd6f964
...
...
@@ -37,7 +37,7 @@ void Window::DestoryWindow(Window* window)
WindowImpl
*
windowImpl
=
reinterpret_cast
<
WindowImpl
*>
(
window
);
windowImpl
->
RemoveFromDisplay
();
windowImpl
->
UnbindRootView
();
windowImpl
->
Dest
or
y
();
windowImpl
->
Dest
ro
y
();
delete
windowImpl
;
}
}
...
...
frameworks/window/window_impl.cpp
浏览文件 @
3cd6f964
...
...
@@ -42,7 +42,7 @@ bool WindowImpl::Create(const WindowConfig& config)
return
true
;
}
void
WindowImpl
::
Dest
or
y
()
void
WindowImpl
::
Dest
ro
y
()
{
Flush
();
if
(
iWindow_
!=
nullptr
)
{
...
...
frameworks/window/window_impl.h
浏览文件 @
3cd6f964
...
...
@@ -45,7 +45,7 @@ public:
void
Update
();
void
Flush
();
bool
Create
(
const
WindowConfig
&
config
);
void
Dest
or
y
();
void
Dest
ro
y
();
void
AddToDisplay
();
void
RemoveFromDisplay
();
...
...
interfaces/kits/components/root_view.h
浏览文件 @
3cd6f964
...
...
@@ -319,7 +319,7 @@ private:
#if LOCAL_RENDER
void
RemoveViewFromInvalidMap
(
UIView
*
view
);
void
DrawInvalidMap
(
const
Rect
&
buffRect
);
void
OptimizeInvalidView
(
UIView
*
curview
,
UIView
*
backgroud
,
List
<
Rect
>
&
renderedRects
);
void
OptimizeInvalidView
(
UIView
*
curview
,
UIView
*
backgrou
n
d
,
List
<
Rect
>
&
renderedRects
);
void
OptimizeInvalidMap
();
std
::
map
<
UIView
*
,
Graphic
::
Vector
<
Rect
>>
invalidateMap_
;
...
...
interfaces/kits/font/base_font.h
浏览文件 @
3cd6f964
...
...
@@ -51,7 +51,7 @@ public:
* @brief Get font id
*
* @param ttfName
* @param size 0: inva
il
d size
* @param size 0: inva
li
d size
* @return uint8_t
*/
virtual
uint8_t
GetFontId
(
const
char
*
ttfName
,
uint8_t
size
)
const
=
0
;
...
...
test/framework/src/compare_tools.cpp
浏览文件 @
3cd6f964
...
...
@@ -152,7 +152,7 @@ bool CompareTools::SaveByBit(uint32_t fd)
struct
BitmapInfoHeader
bitmapInfo
=
{
0
};
bitmapInfo
.
bfSize
=
imageBit
.
dataSize
+
BITMAP_HEADER_SIZE
;
bitmapInfo
.
bfOffBits
=
BITMAP_HEADER_SIZE
;
bitmapInfo
.
biSize
=
40
;
// 40: bitmap infomation header size
bitmapInfo
.
biSize
=
40
;
// 40: bitmap info
r
mation header size
bitmapInfo
.
biWidth
=
imageBit
.
header
.
width
;
bitmapInfo
.
biHeight
=
-
imageBit
.
header
.
height
;
bitmapInfo
.
biPlanes
=
1
;
...
...
test/uitest/test_border_margin_padding/ui_test_border_margin_padding.cpp
浏览文件 @
3cd6f964
...
...
@@ -609,7 +609,7 @@ void UITestBorderMarginPadding::UIKit_UITestBorderMarginPadding_Test_015()
UIQrcode
*
qrcode
=
new
UIQrcode
();
qrcode
->
SetStyle
(
style_
);
qrcode
->
Resize
(
60
,
60
);
// 60: height
qrcode
->
SetQrcodeInfo
(
"Hello
\n
HarmonyOS Lite
GUI"
);
qrcode
->
SetQrcodeInfo
(
"Hello
\n
Test of
GUI"
);
listScroll_
->
Add
(
qrcode
);
}
...
...
test/uitest/test_font/ui_test_font.cpp
浏览文件 @
3cd6f964
...
...
@@ -465,7 +465,7 @@ void UITestFont::UIKitFontMultiLanguage001()
#else
label
->
SetFontId
(
F_ROBOTOCONDENSED_REGULAR_30_4
);
#endif
label
->
SetText
(
"Hello,
HarmonyOS Lite
GUI"
);
label
->
SetText
(
"Hello,
Test of
GUI"
);
container_
->
Add
(
label
);
positionY_
+=
LABEL_HEIGHT
+
GAP
;
}
...
...
@@ -494,7 +494,7 @@ void UITestFont::UIKitFontMultiLanguage002()
#else
label
->
SetFontId
(
F_ROBOTOCONDENSED_REGULAR_30_4
);
#endif
label
->
SetText
(
"Hello
\n
HarmonyOS Lite
GUI"
);
label
->
SetText
(
"Hello
\n
Test of
GUI"
);
container_
->
Add
(
label
);
positionY_
+=
LABEL_HEIGHT
*
2
+
GAP
;
// 2 : double
}
...
...
test/uitest/test_label/ui_test_label.cpp
浏览文件 @
3cd6f964
...
...
@@ -98,7 +98,7 @@ void UITestLabel::UIKit_UILabel_Test_Display_001()
uiViewGroupFrame
->
SetStyle
(
STYLE_BORDER_RADIUS
,
VIEW_STYLE_BORDER_RADIUS
);
uiViewGroupFrame
->
SetStyle
(
STYLE_BACKGROUND_OPA
,
0
);
uiLabel
=
new
UILabel
();
uiLabel
->
SetText
(
"
HarmonyOS Lite
图形子系统"
);
uiLabel
->
SetText
(
"
Test of
图形子系统"
);
uiLabel
->
SetFont
(
DEFAULT_VECTOR_FONT_FILENAME
,
26
);
// 26: font size
uiLabel
->
SetPosition
(
0
,
141
,
280
,
336
);
// 141: y-coordinate; 280: width; 336: height
uiViewGroupFrame
->
Add
(
uiLabel
);
...
...
@@ -234,14 +234,14 @@ bool UITestLabel::OnClick(UIView& view, const ClickEvent& event)
}
else
if
(
&
view
==
labelBeyondBtn1_
)
{
uiLabel
->
Resize
(
288
,
35
);
// 288: width; 35: height
uiLabel
->
SetFont
(
DEFAULT_VECTOR_FONT_FILENAME
,
FONT_DEFAULT_SIZE
);
uiLabel
->
SetText
(
"
HarmonyOS Lite 图形子系统,HarmonyOS Lite
图形子系统 "
);
uiLabel
->
SetText
(
"
Test of 图形子系统,Test of
图形子系统 "
);
uiLabel
->
SetLineBreakMode
(
UILabel
::
LINE_BREAK_CLIP
);
}
else
if
(
&
view
==
labelBeyondBtn2_
)
{
uiLabel
->
Resize
(
288
,
35
);
// 288: width; 35: height
uiLabel
->
SetText
(
"
HarmonyOS Lite 图形子系统,HarmonyOS Lite
图形子系统 "
);
uiLabel
->
SetText
(
"
Test of 图形子系统,Test of
图形子系统 "
);
uiLabel
->
SetLineBreakMode
(
UILabel
::
LINE_BREAK_ELLIPSIS
);
}
else
if
(
&
view
==
labelBeyondBtn3_
)
{
uiLabel
->
SetText
(
"
HarmonyOS Lite 图形子系统,HarmonyOS Lite
图形子系统 "
);
uiLabel
->
SetText
(
"
Test of 图形子系统,Test of
图形子系统 "
);
uiLabel
->
SetLineBreakMode
(
UILabel
::
LINE_BREAK_MARQUEE
);
}
else
{
ExpandClick
(
view
,
event
);
...
...
@@ -270,10 +270,10 @@ void UITestLabel::ExpandClick(UIView& view, const ClickEvent& event) const
}
else
if
(
&
view
==
labelDirectionBtn2_
)
{
uiLabel
->
SetDirect
(
TEXT_DIRECT_RTL
);
}
else
if
(
&
view
==
labelSizeBtn1_
)
{
uiLabel
->
SetText
(
"
HarmonyOS Lite 图形子系统,HarmonyOS Lite
图形子系统 "
);
uiLabel
->
SetText
(
"
Test of 图形子系统,Test of
图形子系统 "
);
uiLabel
->
SetLineBreakMode
(
UILabel
::
LINE_BREAK_ADAPT
);
}
else
if
(
&
view
==
labelSizeBtn2_
)
{
uiLabel
->
SetText
(
"
HarmonyOS Lite 图形子系统,HarmonyOS Lite
图形子系统 "
);
uiLabel
->
SetText
(
"
Test of 图形子系统,Test of
图形子系统 "
);
uiLabel
->
SetLineBreakMode
(
UILabel
::
LINE_BREAK_WRAP
);
}
}
...
...
test/uitest/test_opacity/ui_test_opacity.cpp
浏览文件 @
3cd6f964
...
...
@@ -231,9 +231,6 @@ void UITestOpacity::UIKitOpacityTestUIArcLabel001()
UIArcLabel
*
label
=
CreateTestCaseUIArcLabel
(
"01234567"
,
200
);
// 200: opacity
group
->
Add
(
label
);
UIArcLabel
*
label2
=
CreateTestCaseUIArcLabel
(
"01234567"
,
100
);
// 100: opacity
if
(
label2
==
nullptr
)
{
return
;
}
label2
->
SetArcTextCenter
(
CENTER_X
+
200
,
CENTER_Y
+
20
);
// 200: width 20 : height
group
->
Add
(
label2
);
container_
->
Add
(
group
);
...
...
test/uitest/test_progress_bar/ui_test_circle_progress.cpp
浏览文件 @
3cd6f964
...
...
@@ -460,7 +460,7 @@ bool UITestCircleProgress::OnClick(UIView& view, const ClickEvent& event)
imgPos
.
x
++
;
circleProgress_
->
SetBackgroundImagePosition
(
imgPos
.
x
,
imgPos
.
y
);
circleProgress_
->
SetProgressImagePosition
(
imgPos
.
x
,
imgPos
.
y
);
}
else
if
(
&
view
==
imgPos
X
Btn_
)
{
}
else
if
(
&
view
==
imgPos
Y
Btn_
)
{
imgPos
.
y
++
;
circleProgress_
->
SetBackgroundImagePosition
(
imgPos
.
x
,
imgPos
.
y
);
circleProgress_
->
SetProgressImagePosition
(
imgPos
.
x
,
imgPos
.
y
);
...
...
test/uitest/test_qrcode/ui_test_qrcode.cpp
浏览文件 @
3cd6f964
...
...
@@ -75,7 +75,7 @@ void UITestQrcode::UIKitUIQrcodeTestDisplay001()
UIQrcode
*
qrcode
=
new
UIQrcode
();
qrcode
->
SetPosition
(
20
,
30
,
60
,
60
);
// 20 x 30 y 150 width 60 height
const
char
*
str
=
"Hello
\n
HarmonyOS Lite
GUI"
;
const
char
*
str
=
"Hello
\n
Test of
GUI"
;
qrcode
->
SetQrcodeInfo
(
str
);
group
->
Add
(
qrcode
);
container_
->
Add
(
group
);
...
...
@@ -90,7 +90,7 @@ void UITestQrcode::UIKitUIQrcodeTestDisplay002()
UIQrcode
*
qrcode
=
new
UIQrcode
();
qrcode
->
SetPosition
(
20
,
30
);
// 20 x 30 y
const
char
*
str
=
"Hello
\n
HarmonyOS Lite
GUI"
;
const
char
*
str
=
"Hello
\n
Test of
GUI"
;
qrcode
->
SetQrcodeInfo
(
str
);
qrcode
->
SetWidth
(
120
);
// 120 width
qrcode
->
SetHeight
(
250
);
// 250 height
...
...
test/uitest/test_texture_mapper/ui_test_texture_mapper.cpp
浏览文件 @
3cd6f964
...
...
@@ -53,7 +53,7 @@ void UITestTextureMapper::SetUp()
uiViewGroupFrame
->
SetStyle
(
STYLE_BORDER_RADIUS
,
VIEW_STYLE_BORDER_RADIUS
);
uiViewGroupFrame
->
SetStyle
(
STYLE_BACKGROUND_OPA
,
0
);
textureMapper_
=
new
UITextureMapper
();
textureMapper_
->
SetPosition
(
200
,
50
,
200
,
200
);
// 200:position x; 50: positon y; 200: width; 200: height
textureMapper_
->
SetPosition
(
200
,
50
,
200
,
200
);
// 200:position x; 50: posit
i
on y; 200: width; 200: height
textureMapper_
->
SetSrc
(
RED_IMAGE_PATH
);
textureMapper_
->
SetRotateStart
(
0
);
textureMapper_
->
SetRotateEnd
(
360
);
// 360: the end angle of rotation
...
...
test/uitest/test_view_bitmap/ui_test_view_bitmap.cpp
浏览文件 @
3cd6f964
...
...
@@ -26,7 +26,7 @@ class ViewBitmapListener : public UIView::OnClickListener {
public:
ViewBitmapListener
(
UIViewGroup
*
container
,
UIImageView
*
img
)
:
container_
(
container
),
img_
(
img
)
{
memset_s
(
&
info_
,
sizeof
(
ImageInfo
),
0
,
sizeof
(
ImageInfo
));
(
void
)
memset_s
(
&
info_
,
sizeof
(
ImageInfo
),
0
,
sizeof
(
ImageInfo
));
if
((
img
!=
nullptr
)
&&
(
container
!=
nullptr
))
{
container
->
Add
(
img
);
img
->
SetVisible
(
false
);
...
...
test/unittest/components/ui_view_unit_test.cpp
浏览文件 @
3cd6f964
...
...
@@ -38,8 +38,8 @@ namespace {
const
float
POS_Y_PERCENT
=
0.2
;
const
float
DEFAULT_WIDTH_PERCENT
=
0.3
;
const
float
DEFAULT_HEIGHT_PERCENT
=
0.4
;
const
float
INVA
IL
D_PERCENT_ZERO
=
0.0
f
;
const
float
INVA
IL
D_PERCENT_ONE
=
1.0
f
;
const
float
INVA
LI
D_PERCENT_ZERO
=
0.0
f
;
const
float
INVA
LI
D_PERCENT_ONE
=
1.0
f
;
const
int16_t
DEFAULE_ANGLE
=
45
;
const
Vector2
<
float
>
VIEW_CENTER
=
{
50
,
50
};
const
Vector2
<
float
>
SCALE_VALUE
=
{
0.5
f
,
0.5
f
};
...
...
@@ -442,10 +442,10 @@ HWTEST_F(UIViewTest, UIViewSetWidthPercent_001, TestSize.Level0)
viewGroup
->
SetWidth
(
DEFAULE_WIDTH
);
viewGroup
->
SetHeight
(
DEFAULE_HEIGHT
);
// Input inva
il
d percent, SetWidthPercent failed
view_
->
SetWidthPercent
(
INVA
IL
D_PERCENT_ZERO
);
// Input inva
li
d percent, SetWidthPercent failed
view_
->
SetWidthPercent
(
INVA
LI
D_PERCENT_ZERO
);
EXPECT_EQ
(
view_
->
GetWidth
(),
DEFAULE_WIDTH
);
view_
->
SetWidthPercent
(
INVA
IL
D_PERCENT_ONE
);
view_
->
SetWidthPercent
(
INVA
LI
D_PERCENT_ONE
);
EXPECT_EQ
(
view_
->
GetWidth
(),
DEFAULE_WIDTH
);
view_
->
SetWidthPercent
(
POS_X_PERCENT
);
...
...
@@ -485,10 +485,10 @@ HWTEST_F(UIViewTest, UIViewSetHeightPercent_001, TestSize.Level0)
viewGroup
->
SetWidth
(
DEFAULE_WIDTH
);
viewGroup
->
SetHeight
(
DEFAULE_HEIGHT
);
// Input inva
il
d percent, SetHeightPercent failed
view_
->
SetHeightPercent
(
INVA
IL
D_PERCENT_ZERO
);
// Input inva
li
d percent, SetHeightPercent failed
view_
->
SetHeightPercent
(
INVA
LI
D_PERCENT_ZERO
);
EXPECT_EQ
(
view_
->
GetHeight
(),
DEFAULE_HEIGHT
);
view_
->
SetHeightPercent
(
INVA
IL
D_PERCENT_ONE
);
view_
->
SetHeightPercent
(
INVA
LI
D_PERCENT_ONE
);
EXPECT_EQ
(
view_
->
GetHeight
(),
DEFAULE_HEIGHT
);
view_
->
SetHeightPercent
(
POS_Y_PERCENT
);
...
...
@@ -530,11 +530,11 @@ HWTEST_F(UIViewTest, UIViewResizePercent_001, TestSize.Level0)
viewGroup
->
SetWidth
(
DEFAULE_WIDTH
);
viewGroup
->
SetHeight
(
DEFAULE_HEIGHT
);
// Input inva
il
d percent, ResizePercent failed
view_
->
ResizePercent
(
INVA
IL
D_PERCENT_ZERO
,
POS_Y_PERCENT
);
// Input inva
li
d percent, ResizePercent failed
view_
->
ResizePercent
(
INVA
LI
D_PERCENT_ZERO
,
POS_Y_PERCENT
);
EXPECT_EQ
(
view_
->
GetHeight
(),
DEFAULE_HEIGHT
);
EXPECT_EQ
(
view_
->
GetWidth
(),
DEFAULE_WIDTH
);
view_
->
ResizePercent
(
POS_X_PERCENT
,
INVA
IL
D_PERCENT_ONE
);
view_
->
ResizePercent
(
POS_X_PERCENT
,
INVA
LI
D_PERCENT_ONE
);
EXPECT_EQ
(
view_
->
GetHeight
(),
DEFAULE_HEIGHT
);
EXPECT_EQ
(
view_
->
GetWidth
(),
DEFAULE_WIDTH
);
...
...
@@ -576,10 +576,10 @@ HWTEST_F(UIViewTest, UIViewSetXPercent_001, TestSize.Level0)
viewGroup
->
SetWidth
(
DEFAULE_WIDTH
);
viewGroup
->
SetHeight
(
DEFAULE_HEIGHT
);
// Input inva
il
d percent, SetXPercent failed
view_
->
SetXPercent
(
INVA
IL
D_PERCENT_ZERO
);
// Input inva
li
d percent, SetXPercent failed
view_
->
SetXPercent
(
INVA
LI
D_PERCENT_ZERO
);
EXPECT_EQ
(
view_
->
GetX
(),
POS_X
);
view_
->
SetXPercent
(
INVA
IL
D_PERCENT_ONE
);
view_
->
SetXPercent
(
INVA
LI
D_PERCENT_ONE
);
EXPECT_EQ
(
view_
->
GetX
(),
POS_X
);
view_
->
SetXPercent
(
POS_X_PERCENT
);
...
...
@@ -619,10 +619,10 @@ HWTEST_F(UIViewTest, UIViewSetYPercent_001, TestSize.Level0)
viewGroup
->
SetWidth
(
DEFAULE_WIDTH
);
viewGroup
->
SetHeight
(
DEFAULE_HEIGHT
);
// Input inva
il
d percent, SetYPercent failed
view_
->
SetYPercent
(
INVA
IL
D_PERCENT_ZERO
);
// Input inva
li
d percent, SetYPercent failed
view_
->
SetYPercent
(
INVA
LI
D_PERCENT_ZERO
);
EXPECT_EQ
(
view_
->
GetY
(),
POS_Y
);
view_
->
SetYPercent
(
INVA
IL
D_PERCENT_ONE
);
view_
->
SetYPercent
(
INVA
LI
D_PERCENT_ONE
);
EXPECT_EQ
(
view_
->
GetY
(),
POS_Y
);
view_
->
SetYPercent
(
POS_Y_PERCENT
);
...
...
@@ -664,8 +664,8 @@ HWTEST_F(UIViewTest, UIViewSetPositionPercent_001, TestSize.Level0)
viewGroup
->
SetWidth
(
DEFAULE_WIDTH
);
viewGroup
->
SetHeight
(
DEFAULE_HEIGHT
);
// Input inva
il
d percent, SetPositionPercent failed
view_
->
SetPositionPercent
(
INVA
ILD_PERCENT_ZERO
,
INVAIL
D_PERCENT_ONE
);
// Input inva
li
d percent, SetPositionPercent failed
view_
->
SetPositionPercent
(
INVA
LID_PERCENT_ZERO
,
INVALI
D_PERCENT_ONE
);
EXPECT_EQ
(
view_
->
GetX
(),
POS_X
);
EXPECT_EQ
(
view_
->
GetY
(),
POS_Y
);
...
...
@@ -713,8 +713,8 @@ HWTEST_F(UIViewTest, UIViewSetPositionPercent_002, TestSize.Level0)
viewGroup
->
SetWidth
(
DEFAULE_WIDTH
);
viewGroup
->
SetHeight
(
DEFAULE_HEIGHT
);
// Input inva
il
d percent, SetPositionPercent failed
view_
->
SetPositionPercent
(
INVA
ILD_PERCENT_ZERO
,
INVAIL
D_PERCENT_ONE
,
DEFAULT_WIDTH_PERCENT
,
DEFAULT_HEIGHT_PERCENT
);
// Input inva
li
d percent, SetPositionPercent failed
view_
->
SetPositionPercent
(
INVA
LID_PERCENT_ZERO
,
INVALI
D_PERCENT_ONE
,
DEFAULT_WIDTH_PERCENT
,
DEFAULT_HEIGHT_PERCENT
);
EXPECT_EQ
(
view_
->
GetHeight
(),
DEFAULE_HEIGHT
);
EXPECT_EQ
(
view_
->
GetWidth
(),
DEFAULE_WIDTH
);
EXPECT_EQ
(
view_
->
GetX
(),
POS_X
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录