Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
99bdd836
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
99bdd836
编写于
3月 25, 2022
作者:
H
hekun18@huawei.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change the testcase design
Signed-off-by:
N
hekun18@huawei.com
<
hekun18@huawei.com
>
上级
4600f6e1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
65 addition
and
97 deletion
+65
-97
graphic/windowstandard/src/main/js/default/test/window.test.js
...ic/windowstandard/src/main/js/default/test/window.test.js
+65
-97
未找到文件。
graphic/windowstandard/src/main/js/default/test/window.test.js
浏览文件 @
99bdd836
...
...
@@ -16,60 +16,27 @@ import app from '@system.app'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
window
from
'
@ohos.window
'
import
screen
from
'
@ohos.screen
'
import
display
from
'
@ohos.display
'
const
TRUE_WINDOW
=
true
;
const
avoidAreaType
=
3
;
describe
(
'
window_test
'
,
function
()
{
var
wnd
;
var
windowTypeArr
=
[];
var
windowTypeDic
=
{
'
APP_WINDOW_BASE
'
:
1
,
'
APP_MAIN_WINDOW_BASE
'
:
1
,
'
WINDOW_TYPE_APP_MAIN_WINDOW
'
:
1
,
'
APP_MAIN_WINDOW_END
'
:
1
,
'
APP_SUB_WINDOW_BASE
'
:
1000
,
'
WINDOW_TYPE_MEDIA
'
:
1000
,
'
WINDOW_TYPE_APP_SUB_WINDOW
'
:
1001
,
'
APP_SUB_WINDOW_END
'
:
1001
,
'
APP_WINDOW_END
'
:
1001
,
'
SYSTEM_WINDOW_BASE
'
:
2000
,
'
BELOW_APP_SYSTEM_WINDOW_BASE
'
:
2000
,
'
WINDOW_TYPE_WALLPAPER
'
:
2000
,
'
WINDOW_TYPE_DESKTOP
'
:
2001
,
'
BELOW_APP_SYSTEM_WINDOW_END
'
:
2001
,
'
ABOVE_APP_SYSTEM_WINDOW_BASE
'
:
2100
,
'
WINDOW_TYPE_APP_LAUNCHING
'
:
2100
,
'
WINDOW_TYPE_DOCK_SLICE
'
:
2101
,
'
WINDOW_TYPE_INCOMING_CALL
'
:
2102
,
'
WINDOW_TYPE_SEARCHING_BAR
'
:
2103
,
'
WINDOW_TYPE_SYSTEM_ALARM_WINDOW
'
:
2104
,
'
WINDOW_TYPE_INPUT_METHOD_FLOAT
'
:
2105
,
'
WINDOW_TYPE_FLOAT
'
:
2106
,
'
WINDOW_TYPE_TOAST
'
:
2107
,
'
WINDOW_TYPE_STATUS_BAR
'
:
2108
,
'
WINDOW_TYPE_PANEL
'
:
2109
,
'
WINDOW_TYPE_KEYGUARD
'
:
2110
,
'
WINDOW_TYPE_VOLUME_OVERLAY
'
:
2111
,
'
WINDOW_TYPE_NAVIGATION_BAR
'
:
2112
,
'
WINDOW_TYPE_DRAGGING_EFFECT
'
:
2113
,
'
WINDOW_TYPE_POINTER
'
:
2114
,
'
WINDOW_TYPE_LAUNCHER_RECENT
'
:
2115
,
'
WINDOW_TYPE_LAUNCHER_DOCK
'
:
2116
,
'
ABOVE_APP_SYSTEM_WINDOW_END
'
:
2116
,
'
SYSTEM_WINDOW_END
'
:
2116
}
var
topWindow
;
const
DELAY_TIME
=
3000
;
var
listenerStatus
;
var
height
;
function
callback
(
data
)
{
listenerStatus
=
1
;
console
.
log
(
'
windowTest OnOffTest callback
'
+
JSON
.
stringify
(
data
)
+
'
listenerStatus :
'
+
listenerStatus
);
function
windowSizeChangeCallback
(
data
)
{
console
.
log
(
'
windowTest OnOffTest1 callback
'
+
JSON
.
stringify
(
data
));
height
=
data
.
height
;
}
function
systemAvoidAreaChangeCallback
(
data
)
{
console
.
log
(
'
windowTest OnOffTest2 callback
'
+
JSON
.
stringify
(
data
));
height
=
data
.
bottomRect
.
height
;
}
beforeAll
(
function
(
done
)
{
windowTypeArr
=
Object
.
keys
(
windowTypeDic
);
console
.
log
(
'
windowTest beforeAll begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest beforeAll window.getTopWindow wnd:
'
+
wnd
);
...
...
@@ -874,7 +841,7 @@ describe('window_test', function () {
*/
it
(
'
find_Test_002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest findTest2 begin
'
);
window
.
find
(
'
nonexist
'
).
then
((
window
)
=>
{
window
.
find
(
'
window
'
).
then
((
window
)
=>
{
console
.
log
(
'
windowTest findTest2 wnd.find success, window :
'
+
JSON
.
stringify
(
window
));
expect
().
assertFail
();
done
();
...
...
@@ -912,7 +879,7 @@ describe('window_test', function () {
*/
it
(
'
find_Test_004
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest findTest4 begin
'
);
window
.
find
(
'
nonexist
'
,
(
err
,
data
)
=>
{
window
.
find
(
'
window
'
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
log
(
'
windowTest findTest4 wnd.find fail, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_WINDOW
).
assertTrue
();
...
...
@@ -933,40 +900,43 @@ describe('window_test', function () {
*/
it
(
'
onOff_Test_001
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest OnOffTest1 begin
'
);
window
.
getTopWindow
((
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
windowTest OnOffTest1 getTopWindow fail
'
+
JSON
.
stringify
(
err
.
code
));
expect
().
assertFail
();
done
();
}
else
{
expect
(
data
!=
null
).
assertTrue
();
data
.
on
(
'
windowSizeChange
'
,
callback
);
data
.
setLayoutFullScreen
(
true
,
(
err
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
windowTest OnOffTest1 setLayoutFullScreen fail
'
+
JSON
.
stringify
(
err
.
code
));
expect
().
assertFail
();
done
();
}
else
{
setTimeout
((
async
function
()
{
expect
(
listenerStatus
).
assertEqual
(
1
);
data
.
off
(
'
windowSizeChange
'
)
listenerStatus
=
0
;
data
.
setLayoutFullScreen
(
false
,
(
err
)
=>
{
if
(
err
.
code
!=
0
||
listenerStatus
==
1
)
{
console
.
log
(
'
windowTest OnOffTest1 setLayoutFullScreen callback fail
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
else
{
console
.
log
(
'
windowTest OnOffTest1 listenerStatus 3:
'
+
listenerStatus
);
expect
(
TRUE_WINDOW
).
assertTrue
();
done
();
}
})
}),
3000
)
}
})
}
display
.
getDefaultDisplay
().
then
(
dsp
=>
{
window
.
getTopWindow
((
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
windowTest OnOffTest1 getTopWindow fail
'
+
JSON
.
stringify
(
err
.
code
));
expect
().
assertFail
();
done
();
}
else
{
expect
(
data
!=
null
).
assertTrue
();
data
.
on
(
'
windowSizeChange
'
,
windowSizeChangeCallback
);
data
.
setLayoutFullScreen
(
true
,
(
err
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
windowTest OnOffTest1 setLayoutFullScreen fail
'
+
JSON
.
stringify
(
err
.
code
));
expect
().
assertFail
();
done
();
}
else
{
setTimeout
((
async
function
()
{
expect
(
dsp
.
height
==
height
).
assertTrue
();
data
.
off
(
'
windowSizeChange
'
);
data
.
setLayoutFullScreen
(
false
,
(
err
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
windowTest OnOffTest1 setLayoutFullScreen callback fail
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
else
{
expect
(
dsp
.
height
==
height
).
assertTrue
();
done
();
}
})
}),
3000
)
}
})
}
})
},
(
err
)
=>
{
console
.
log
(
'
displayTest OnOffTest1 getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
...
...
@@ -976,7 +946,7 @@ describe('window_test', function () {
* @tc.desc To verify the function of enabling and disabling lawful interception in the system and window
*/
it
(
'
onOff_Test_002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest OnOffTest2 begin
'
)
console
.
log
(
'
windowTest OnOffTest2 begin
'
)
;
window
.
getTopWindow
((
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
windowTest OnOffTest2 getTopWindow callback fail
'
+
JSON
.
stringify
(
err
.
code
));
...
...
@@ -984,7 +954,7 @@ describe('window_test', function () {
done
();
}
else
{
expect
(
data
!=
null
).
assertTrue
();
data
.
on
(
'
systemAvoidAreaChange
'
,
c
allback
);
data
.
on
(
'
systemAvoidAreaChange
'
,
systemAvoidAreaChangeC
allback
);
data
.
setFullScreen
(
true
,
(
err
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
windowTest OnOffTest2 setLayoutFullScreen callback fail
'
+
JSON
.
stringify
(
err
));
...
...
@@ -992,18 +962,16 @@ describe('window_test', function () {
done
();
}
else
{
setTimeout
((
async
function
()
{
console
.
log
(
'
windowTest OnOffTest2 listenerStatus 111:
'
+
listenerStatus
);
expect
(
listenerStatus
).
assertEqual
(
1
);
data
.
off
(
'
systemAvoidAreaChange
'
)
listenerStatus
=
0
;
expect
(
height
==
0
).
assertTrue
();
data
.
off
(
'
systemAvoidAreaChange
'
);
data
.
setFullScreen
(
false
,
(
err
)
=>
{
if
(
err
.
code
!=
0
||
listenerStatus
==
1
)
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
windowTest OnOffTest2 setLayoutFullScreen callback fail
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
else
{
console
.
log
(
'
windowTest OnOffTest2 off callback success
'
);
expect
(
TRUE_WINDOW
).
assertTrue
();
expect
(
height
==
0
).
assertTrue
();
done
();
}
})
...
...
@@ -1021,7 +989,7 @@ describe('window_test', function () {
*/
it
(
'
isShowing_Test_001
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest IsShowingTest1 begin
'
);
window
.
create
(
'
isSh
ow1
'
,
window
.
WindowType
.
TYPE_APP
).
then
(
wnd
=>
{
window
.
create
(
'
subWind
ow1
'
,
window
.
WindowType
.
TYPE_APP
).
then
(
wnd
=>
{
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
isShowing
().
then
(
res
=>
{
console
.
log
(
'
windowTest IsShowingTest1 wnd.isShowing data:
'
+
res
);
...
...
@@ -1055,7 +1023,7 @@ describe('window_test', function () {
*/
it
(
'
isShowing_Test_002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest IsShowingTest2 begin
'
);
window
.
create
(
'
isSh
ow2
'
,
window
.
WindowType
.
TYPE_APP
,
(
err
,
data
)
=>
{
window
.
create
(
'
subWind
ow2
'
,
window
.
WindowType
.
TYPE_APP
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
log
(
'
windowTest IsShowingTest2 window.create fail err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
...
...
@@ -1106,7 +1074,7 @@ describe('window_test', function () {
wnd
.
setColorSpace
(
window
.
ColorSpace
.
WIDE_GAMUT
).
then
(()
=>
{
console
.
log
(
'
windowTest SetColorSpaceTest1 setColorSpace WIDE_GAMUT
'
);
wnd
.
getColorSpace
().
then
(
res
=>
{
expect
(
res
==
1
).
assertTrue
();
expect
(
res
==
window
.
ColorSpace
.
WIDE_GAMUT
).
assertTrue
();
console
.
log
(
'
windowTest SetColorSpaceTest1 setColorSpace WIDE_GAMUT success
'
);
wnd
.
isSupportWideGamut
().
then
(
data
=>
{
expect
(
data
).
assertTrue
();
...
...
@@ -1181,7 +1149,7 @@ describe('window_test', function () {
expect
().
assertFail
();
done
();
}
else
{
expect
(
data
==
1
).
assertTrue
();
expect
(
data
==
window
.
ColorSpace
.
WIDE_GAMUT
).
assertTrue
();
wnd
.
isSupportWideGamut
((
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
windowTest SetColorSpaceTest3 getColorSpace callback fail
'
+
JSON
.
stringify
(
err
));
...
...
@@ -1238,7 +1206,7 @@ describe('window_test', function () {
*/
it
(
'
create_Test_001
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest CreateTest1 begin
'
);
window
.
create
(
'
subWindow
'
,
window
.
WindowType
.
TYPE_APP
).
then
(
wnd
=>
{
window
.
create
(
'
subWindow
3
'
,
window
.
WindowType
.
TYPE_APP
).
then
(
wnd
=>
{
console
.
log
(
'
windowTest CreateTest1 create success wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
done
();
...
...
@@ -1256,7 +1224,7 @@ describe('window_test', function () {
*/
it
(
'
create_Test_002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest CreateTest2 begin
'
);
window
.
create
(
'
subWindow
1
'
,
window
.
WindowType
.
TYPE_APP
,
(
err
,
data
)
=>
{
window
.
create
(
'
subWindow
4
'
,
window
.
WindowType
.
TYPE_APP
,
(
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
windowTest CreateTest2 create callback fail
'
+
JSON
.
stringify
(
err
.
code
));
expect
().
assertFail
();
...
...
@@ -1276,11 +1244,11 @@ describe('window_test', function () {
*/
it
(
'
destroy_Test_001
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest DestroyTest1 begin
'
);
window
.
create
(
'
subWindow
2
'
,
window
.
WindowType
.
TYPE_APP
).
then
(
wnd
=>
{
window
.
create
(
'
subWindow
5
'
,
window
.
WindowType
.
TYPE_APP
).
then
(
wnd
=>
{
console
.
log
(
'
windowTest DestroyTest1 create success wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
destroy
().
then
(()
=>
{
window
.
find
(
'
subWindow
2
'
).
then
((
data
)
=>
{
window
.
find
(
'
subWindow
5
'
).
then
((
data
)
=>
{
console
.
log
(
'
windowTest DestroyTest1 window.find success, window :
'
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
...
...
@@ -1309,7 +1277,7 @@ describe('window_test', function () {
*/
it
(
'
destroy_Test_002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest DestroyTest2 begin
'
);
window
.
create
(
'
subWindow
2
'
,
window
.
WindowType
.
TYPE_APP
,
(
err
,
data
)
=>
{
window
.
create
(
'
subWindow
6
'
,
window
.
WindowType
.
TYPE_APP
,
(
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
windowTest DestroyTest2 create callback fail
'
+
JSON
.
stringify
(
err
.
code
));
expect
().
assertFail
();
...
...
@@ -1322,7 +1290,7 @@ describe('window_test', function () {
expect
().
assertFail
();
done
();
}
else
{
window
.
find
(
'
subWindow
2
'
,
(
err
,
data
)
=>
{
window
.
find
(
'
subWindow
6
'
,
(
err
,
data
)
=>
{
console
.
log
(
'
windowTest DestroyTest2 find callback begin
'
+
JSON
.
stringify
(
data
));
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
windowTest DestroyTest2 find callback fail
'
+
JSON
.
stringify
(
err
.
code
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录