Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8ddb2f32
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8ddb2f32
编写于
4月 28, 2022
作者:
L
liziqiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
window add xts acts
Signed-off-by:
N
liziqiang
<
liziqiang8@huawei.com
>
上级
d8a85883
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
777 addition
and
16 deletion
+777
-16
graphic/windowstandard/src/main/js/default/test/window.test.js
...ic/windowstandard/src/main/js/default/test/window.test.js
+777
-16
未找到文件。
graphic/windowstandard/src/main/js/default/test/window.test.js
浏览文件 @
8ddb2f32
...
@@ -95,11 +95,17 @@ describe('window_test', function () {
...
@@ -95,11 +95,17 @@ describe('window_test', function () {
wnd
.
getProperties
().
then
((
data
)
=>
{
wnd
.
getProperties
().
then
((
data
)
=>
{
console
.
log
(
'
windowTest getPropertiesTest1 wnd.getProperties success, data :
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
windowTest getPropertiesTest1 wnd.getProperties success, data :
'
+
JSON
.
stringify
(
data
));
expect
(
data
.
type
!=
null
).
assertTrue
();
expect
(
data
.
type
!=
null
).
assertTrue
();
expect
(
data
.
windowRect
!=
null
).
assertTrue
();
expect
(
data
.
windowRect
.
height
!=
null
).
assertTrue
();
expect
(
data
.
windowRect
.
left
!=
null
).
assertTrue
();
expect
(
data
.
windowRect
.
top
!=
null
).
assertTrue
();
expect
(
data
.
windowRect
.
width
!=
null
).
assertTrue
();
expect
(
!
data
.
isFullScreen
).
assertTrue
();
expect
(
!
data
.
isFullScreen
).
assertTrue
();
expect
(
!
data
.
isLayoutFullScreen
).
assertTrue
();
expect
(
!
data
.
isLayoutFullScreen
).
assertTrue
();
expect
(
data
.
focusable
).
assertTrue
();
expect
(
data
.
focusable
).
assertTrue
();
expect
(
data
.
touchable
).
assertTrue
();
expect
(
data
.
touchable
).
assertTrue
();
expect
(
!
data
.
isKeepScreenOn
).
assertTrue
();
expect
(
!
data
.
isTransparent
).
assertTrue
();
expect
(
data
.
brightness
!=
null
).
assertTrue
();
done
();
done
();
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
windowTest getPropertiesTest1 wnd.getProperties failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
windowTest getPropertiesTest1 wnd.getProperties failed, err :
'
+
JSON
.
stringify
(
err
));
...
@@ -130,11 +136,17 @@ describe('window_test', function () {
...
@@ -130,11 +136,17 @@ describe('window_test', function () {
done
();
done
();
}
else
{
}
else
{
expect
(
data
.
type
!=
null
).
assertTrue
();
expect
(
data
.
type
!=
null
).
assertTrue
();
expect
(
data
.
windowRect
!=
null
).
assertTrue
();
expect
(
data
.
windowRect
.
height
!=
null
).
assertTrue
();
expect
(
data
.
windowRect
.
left
!=
null
).
assertTrue
();
expect
(
data
.
windowRect
.
top
!=
null
).
assertTrue
();
expect
(
data
.
windowRect
.
width
!=
null
).
assertTrue
();
expect
(
!
data
.
isFullScreen
).
assertTrue
();
expect
(
!
data
.
isFullScreen
).
assertTrue
();
expect
(
!
data
.
isLayoutFullScreen
).
assertTrue
();
expect
(
!
data
.
isLayoutFullScreen
).
assertTrue
();
expect
(
data
.
focusable
).
assertTrue
();
expect
(
data
.
focusable
).
assertTrue
();
expect
(
data
.
touchable
).
assertTrue
();
expect
(
data
.
touchable
).
assertTrue
();
expect
(
!
data
.
isKeepScreenOn
).
assertTrue
();
expect
(
!
data
.
isTransparent
).
assertTrue
();
expect
(
data
.
brightness
!=
null
).
assertTrue
();
done
();
done
();
}
}
})
})
...
@@ -997,6 +1009,7 @@ describe('window_test', function () {
...
@@ -997,6 +1009,7 @@ describe('window_test', function () {
wnd
.
show
().
then
(()
=>
{
wnd
.
show
().
then
(()
=>
{
wnd
.
isShowing
().
then
(
res
=>
{
wnd
.
isShowing
().
then
(
res
=>
{
expect
(
res
).
assertTrue
();
expect
(
res
).
assertTrue
();
wnd
.
destroy
();
done
();
done
();
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
windowTest IsShowingTest1 wnd.isShowing failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
windowTest IsShowingTest1 wnd.isShowing failed, err :
'
+
JSON
.
stringify
(
err
));
...
@@ -1050,6 +1063,7 @@ describe('window_test', function () {
...
@@ -1050,6 +1063,7 @@ describe('window_test', function () {
done
();
done
();
}
else
{
}
else
{
expect
(
res2
).
assertTrue
();
expect
(
res2
).
assertTrue
();
data
.
destroy
();
done
();
done
();
}
}
})
})
...
@@ -1443,11 +1457,11 @@ describe('window_test', function () {
...
@@ -1443,11 +1457,11 @@ describe('window_test', function () {
/**
/**
* @tc.number SUB_WMS_MOVETO_JSAPI_00
7
* @tc.number SUB_WMS_MOVETO_JSAPI_00
1
* @tc.name Test move_Test_001
* @tc.name Test move_Test_001
* @tc.desc Verify the scene where the window moves
* @tc.desc Verify the scene where the window moves
*/
*/
it
(
'
move_Test_001
'
,
0
,
function
()
{
it
(
'
move_Test_001
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest moveTest1 begin
'
);
console
.
log
(
'
windowTest moveTest1 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest moveTest1 getTopWindow wnd
'
+
wnd
);
console
.
log
(
'
windowTest moveTest1 getTopWindow wnd
'
+
wnd
);
...
@@ -1556,7 +1570,7 @@ describe('window_test', function () {
...
@@ -1556,7 +1570,7 @@ describe('window_test', function () {
for
(
var
i
=
1
;
i
<=
5
;
i
++
)
{
for
(
var
i
=
1
;
i
<=
5
;
i
++
)
{
wnd
.
moveTo
(
100
,
100
).
then
(()
=>
{
wnd
.
moveTo
(
100
,
100
).
then
(()
=>
{
expect
(
TRUE_WINDOW
).
assertTrue
();
expect
(
TRUE_WINDOW
).
assertTrue
();
},(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
windowTest moveTest5 wnd.moveTo failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
windowTest moveTest5 wnd.moveTo failed, err :
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
expect
().
assertFail
();
done
();
done
();
...
@@ -1572,23 +1586,24 @@ describe('window_test', function () {
...
@@ -1572,23 +1586,24 @@ describe('window_test', function () {
})
})
/**
/**
* @tc.number SUB_WMS_MOVETO_JSAPI_00
1
* @tc.number SUB_WMS_MOVETO_JSAPI_00
6
* @tc.name Test move_Test_006
* @tc.name Test move_Test_006
* @tc.desc Verify th
at the window is moved into the normal scene
* @tc.desc Verify th
e scene where the window moves
*/
*/
it
(
'
move_Test_006
'
,
0
,
async
function
(
done
)
{
it
(
'
move_Test_006
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest moveTest6 begin
'
);
console
.
log
(
'
windowTest moveTest6 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest moveTest6 getTopWindow wnd:
'
+
wnd
);
console
.
log
(
'
windowTest moveTest6 getTopWindow wnd:
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
moveTo
(
200
,
200
).
then
(()
=>
{
wnd
.
moveTo
(
-
200
,
-
200
,
(
err
)
=>
{
console
.
log
(
'
windowTest moveTest6 wnd.moveTo success
'
);
if
(
err
)
{
expect
(
TRUE_WINDOW
).
assertTrue
();
console
.
log
(
'
windowTest moveTest6 wnd.moveTo failed, err :
'
+
JSON
.
stringify
(
err
));
done
();
done
();
},
(
err
)
=>
{
}
else
{
console
.
log
(
'
windowTest moveTest6 wnd.moveTo failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
windowTest moveTest6 wnd.moveTo success
'
);
expect
().
assertFail
();
expect
(
TRUE_WINDOW
).
assertTrue
();
done
();
done
();
}
})
})
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
windowTest moveTest6 getTopWindow failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
windowTest moveTest6 getTopWindow failed, err :
'
+
JSON
.
stringify
(
err
));
...
@@ -1791,7 +1806,7 @@ describe('window_test', function () {
...
@@ -1791,7 +1806,7 @@ describe('window_test', function () {
* @tc.name Test resetSize_Test_006
* @tc.name Test resetSize_Test_006
* @tc.desc Verify the scene where the window resets size
* @tc.desc Verify the scene where the window resets size
*/
*/
it
(
'
resetSize_Test_006
'
,
0
,
function
()
{
it
(
'
resetSize_Test_006
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest ResetSizeTest6 begin
'
);
console
.
log
(
'
windowTest ResetSizeTest6 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest ResetSizeTest6 getTopWindow wnd:
'
+
wnd
);
console
.
log
(
'
windowTest ResetSizeTest6 getTopWindow wnd:
'
+
wnd
);
...
@@ -1928,4 +1943,750 @@ describe('window_test', function () {
...
@@ -1928,4 +1943,750 @@ describe('window_test', function () {
}
}
})
})
/**
* @tc.number SUB_WMS_SETFOCUSABLE_JSAPI_001
* @tc.name Test setFocusable_Test_001
* @tc.desc Setting window focus acquisition and defocus
*/
it
(
'
setFocusable_Test_001
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setFocusableTest1 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setFocusableTest1 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
data
.
focusable
).
assertTrue
();
wnd
.
setFocusable
(
false
).
then
(()
=>
{
console
.
log
(
'
windowTest setFocusableTest1 setFocusable(false) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
!
data
.
focusable
).
assertTrue
();
wnd
.
setFocusable
(
true
).
then
(()
=>
{
console
.
log
(
'
windowTest setFocusableTest1 setFocusable(true) success
'
);
expect
(
TRUE_WINDOW
).
assertTrue
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest1 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest1 setFocusable failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest1 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest1 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETFOCUSABLE_JSAPI_002
* @tc.name Test setFocusable_Test_002
* @tc.desc The setting window loses focus and cannot be touched
*/
it
(
'
setFocusable_Test_002
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setFocusableTest2 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setFocusableTest2 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setFocusable
(
false
).
then
(()
=>
{
console
.
log
(
'
windowTest setFocusableTest2 setFocusable(false) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
!
data
.
focusable
).
assertTrue
();
wnd
.
setTouchable
(
false
).
then
(()
=>
{
console
.
log
(
'
windowTest setFocusableTest2 setTouchable(false) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
!
data
.
touchable
).
assertTrue
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest2 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest2 setTouchable failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest2 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest2 setFocusable failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest2 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETFOCUSABLE_JSAPI_003
* @tc.name Test setFocusable_Test_003
* @tc.desc Set the window to lose focus and be touchable
*/
it
(
'
setFocusable_Test_003
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setFocusableTest3 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setFocusableTest3 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setFocusable
(
false
).
then
(()
=>
{
console
.
log
(
'
windowTest setFocusableTest3 setFocusable(false) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
!
data
.
focusable
).
assertTrue
();
wnd
.
setTouchable
(
true
).
then
(()
=>
{
console
.
log
(
'
windowTest setFocusableTest3 setTouchable(true) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
data
.
touchable
).
assertTrue
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest3 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest3 setTouchable failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest3 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest3 setFocusable failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest3 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETFOCUSABLE_JSAPI_004
* @tc.name Test setFocusable_Test_004
* @tc.desc Setting the window to get focus is not touchable
*/
it
(
'
setFocusable_Test_004
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setFocusableTest4 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setFocusableTest4 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setFocusable
(
true
).
then
(()
=>
{
console
.
log
(
'
windowTest setFocusableTest4 setFocusable(true) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
data
.
focusable
).
assertTrue
();
wnd
.
setTouchable
(
false
).
then
(()
=>
{
console
.
log
(
'
windowTest setFocusableTest4 setTouchable(false) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
!
data
.
touchable
).
assertTrue
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest4 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest4 setTouchable failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest4 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest4 setFocusable failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest4 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETFOCUSABLE_JSAPI_005
* @tc.name Test setFocusable_Test_005
* @tc.desc Set the window to get focus and touch
*/
it
(
'
setFocusable_Test_005
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setFocusableTest5 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setFocusableTest5 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setFocusable
(
true
).
then
(()
=>
{
console
.
log
(
'
windowTest setFocusableTest5 setFocusable(true) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
data
.
focusable
).
assertTrue
();
wnd
.
setTouchable
(
true
).
then
(()
=>
{
console
.
log
(
'
windowTest setFocusableTest5 setTouchable(true) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
data
.
touchable
).
assertTrue
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest5 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest5 setTouchable failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest5 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest5 setFocusable failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setFocusableTest4 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETTOUCHABLE_JSAPI_001
* @tc.name Test setTouchable_Test_001
* @tc.desc Set whether the window can be touched or not
*/
it
(
'
setTouchable_Test_001
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setTouchableTest1 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setTouchableTest1 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
data
.
touchable
).
assertTrue
();
wnd
.
setTouchable
(
false
).
then
(()
=>
{
console
.
log
(
'
windowTest setTouchableTest1 setTouchable(false) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
!
data
.
touchable
).
assertTrue
();
wnd
.
setTouchable
(
true
).
then
(()
=>
{
console
.
log
(
'
windowTest setTouchableTest2 setTouchable(true) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
data
.
touchable
).
assertTrue
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setTouchableTest2 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setTouchableTest2 setTouchable failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setTouchableTest1 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setTouchableTest1 setTouchable failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setTouchableTest1 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setTouchableTest1 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETKEEPSCREENON_JSAPI_001
* @tc.name Test setKeepScreenOn_Test_001
* @tc.desc Set whether the window can be touched or not
*/
it
(
'
setKeepScreenOn_Test_001
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setKeepScreenOnTest1 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest1 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
!
data
.
isKeepScreenOn
).
assertTrue
();
wnd
.
setKeepScreenOn
(
true
).
then
(()
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest1 setKeepScreenOn(true) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
data
.
isKeepScreenOn
).
assertTrue
();
wnd
.
setKeepScreenOn
(
false
).
then
(()
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest1 setKeepScreenOn(false) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
!
data
.
isKeepScreenOn
).
assertTrue
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest1 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest1 setKeepScreenOn failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest1 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest1 setKeepScreenOn failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest1 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest1 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETKEEPSCREENON_JSAPI_002
* @tc.name Test setKeepScreenOn_Test_002
* @tc.desc Set whether the window can be touched or not
*/
it
(
'
setKeepScreenOn_Test_002
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setKeepScreenOnTest2 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest2 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
!
data
.
isKeepScreenOn
).
assertTrue
();
wnd
.
setKeepScreenOn
(
true
).
then
(()
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest2 setKeepScreenOn(true) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
data
.
touchable
).
assertTrue
();
wnd
.
setKeepScreenOn
(
false
).
then
(()
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest2 setKeepScreenOn(false) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
!
data
.
touchable
).
assertTrue
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest2 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest2 setKeepScreenOn failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest2 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest2 setKeepScreenOn failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest2 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
}
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setKeepScreenOnTest1 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBACKGROUNDCOLOR_JSAPI_001
* @tc.name Test setBackgroundColor_Test_001
* @tc.desc Set the window background color to red and Default opacity
*/
it
(
'
setBackgroundColor_Test_001
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setBackgroundColorTest1 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest1 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBackgroundColor
(
"
#ffff00
"
).
then
(()
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest1 setBrightness(#ffff00) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
!
data
.
isTransparent
).
assertTrue
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest1 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest1 setBackgroundColor failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest1 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBACKGROUNDCOLOR_JSAPI_002
* @tc.name Test setBackgroundColor_Test_002
* @tc.desc Set the window background color to red opaque
*/
it
(
'
setBackgroundColor_Test_002
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setBackgroundColorTest2 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest2 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBackgroundColor
(
"
#ffffff00
"
).
then
(()
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest2 setBrightness(#ffffff00) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
!
data
.
isTransparent
).
assertTrue
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest2 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest2 setBackgroundColor failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest2 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBACKGROUNDCOLOR_JSAPI_003
* @tc.name Test setBackgroundColor_Test_003
* @tc.desc Set the window background color to red transparent
*/
it
(
'
setBackgroundColor_Test_003
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setBackgroundColorTest3 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest3 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBackgroundColor
(
"
#00ffff00
"
).
then
(()
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest3 setBrightness(#00ffff00) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
data
.
isTransparent
).
assertTrue
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest3 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest3 setBackgroundColor failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest3 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBACKGROUNDCOLOR_JSAPI_004
* @tc.name Test setBackgroundColor_Test_004
* @tc.desc Set the background color input parameter as an outlier
*/
it
(
'
setBackgroundColor_Test_004
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setBackgroundColorTest4 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest4 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBackgroundColor
(
"
ff00
"
).
then
(()
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest4 setBrightness(#ff00) success
'
);
expect
().
assertFail
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest4 setBackgroundColor failed: err
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
130
);
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest4 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBACKGROUNDCOLOR_JSAPI_005
* @tc.name Test setBackgroundColor_Test_005
* @tc.desc Setting window background color input exception ARGB
*/
it
(
'
setBackgroundColor_Test_005
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setBackgroundColorTest5 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest5 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBackgroundColor
(
"
#hhgghhgg
"
).
then
(()
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest5 setBrightness(#hhgghhgg) success
'
);
expect
().
assertFail
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest5 setBackgroundColor failed: err
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
130
);
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest5 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBACKGROUNDCOLOR_JSAPI_006
* @tc.name Test setBackgroundColor_Test_006
* @tc.desc Setting window background color input exception RGB
*/
it
(
'
setBackgroundColor_Test_006
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setBackgroundColorTest6 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest6 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBackgroundColor
(
"
#gghhkk
"
).
then
(()
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest6 setBrightness(#gghhkk) success
'
);
expect
().
assertFail
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest6 setBackgroundColor failed: err
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
130
);
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest6 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBRIGHTNESS_JSAPI_001
* @tc.name Test setBrightness_Test_001
* @tc.desc Setting the brightness bar input parameter is normal
*/
it
(
'
setBrightness_Test_001
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setBrightnessTest1 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setBrightnessTest1 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBrightness
(
0
).
then
(()
=>
{
console
.
log
(
'
windowTest setBrightnessTest1 setBrightness(0) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
console
.
log
(
'
windowTest setBrightnessTest1 getProperties data
'
+
data
);
expect
(
data
.
brightness
).
assertEqual
(
0
);
wnd
.
setBrightness
(
0.5
).
then
(()
=>
{
console
.
log
(
'
windowTest setBrightnessTest1 setBrightness(0.5) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
console
.
log
(
'
windowTest setBrightnessTest1 getProperties data
'
+
data
);
expect
(
data
.
brightness
).
assertEqual
(
0.5
);
wnd
.
setBrightness
(
1
).
then
(()
=>
{
console
.
log
(
'
windowTest setBrightnessTest1 setBrightness(1) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
console
.
log
(
'
windowTest setBrightnessTest1 getProperties data
'
+
data
);
expect
(
data
.
brightness
).
assertEqual
(
1
);
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest1 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest1 setBrightness failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest1 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest1 setBrightness failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest1 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest1 setBrightness failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest1 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBRIGHTNESS_JSAPI_002
* @tc.name Test setBrightness_Test_002
* @tc.desc Set the brightness bar input parameter to decimal
*/
it
(
'
setBrightness_Test_002
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setBrightnessTest2 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setBrightnessTest2 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBrightness
(
0.564789
).
then
(()
=>
{
console
.
log
(
'
windowTest setBrightnessTest2 setBrightness(0.564789) success
'
);
wnd
.
getProperties
().
then
(
data
=>
{
console
.
log
(
'
windowTest setBrightnessTest2 getProperties data
'
+
data
);
expect
(
TRUE_WINDOW
).
assertTrue
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest2 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest2 setBrightness failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest2 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBRIGHTNESS_JSAPI_003
* @tc.name Test setBrightness_Test_003
* @tc.desc Set the brightness bar input parameter to number max
*/
it
(
'
setBrightness_Test_003
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setBrightnessTest3 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setBrightnessTest3 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBrightness
(
Number
.
MAX_VALUE
).
then
(()
=>
{
console
.
log
(
'
windowTest setBrightnessTest3 setBrightness(Number.MAX_VALUE) success
'
);
expect
().
assertFail
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest3 setBrightness failed: err
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
130
);
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest3 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBRIGHTNESS_JSAPI_004
* @tc.name Test setBrightness_Test_004
* @tc.desc Set the brightness bar input parameter to number min
*/
it
(
'
setBrightness_Test_004
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setBrightnessTest4 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setBrightnessTest4 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBrightness
(
Number
.
MIN_VALUE
).
then
(()
=>
{
console
.
log
(
'
windowTest setBrightnessTest4 setBrightness(Number.MIN_VALUE) success
'
);
expect
(
TRUE_WINDOW
).
assertTrue
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest4 setBrightness failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest4 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBRIGHTNESS_JSAPI_005
* @tc.name Test setBrightness_Test_005
* @tc.desc Setting brightness bar input parameter exception
*/
it
(
'
setBrightness_Test_005
'
,
0
,
function
(
done
)
{
console
.
log
(
'
windowTest setBrightnessTest5 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setBrightnessTest5 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBrightness
(
1.1
).
then
(()
=>
{
console
.
log
(
'
windowTest setBrightnessTest5 setBrightness(1.1) success
'
);
expect
().
assertFail
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest5 setBrightness failed: err
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
130
);
wnd
.
setBrightness
(
-
0.1
).
then
(()
=>
{
console
.
log
(
'
windowTest setBrightnessTest5 setBrightness(-0.1) success
'
);
expect
().
assertFail
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest5 setBrightness failed: err
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
130
);
done
();
})
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest5 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录