Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
9e7320cb
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,发现更多精彩内容 >>
提交
9e7320cb
编写于
8月 19, 2022
作者:
H
hk_js
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add testcase of callback interface
Signed-off-by:
N
hk_js
<
hekun18@huawei.com
>
上级
b403a943
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
659 addition
and
1 deletion
+659
-1
graphic/windowstandard/src/main/js/test/display.test.js
graphic/windowstandard/src/main/js/test/display.test.js
+184
-0
graphic/windowstandard/src/main/js/test/window.test.js
graphic/windowstandard/src/main/js/test/window.test.js
+475
-1
未找到文件。
graphic/windowstandard/src/main/js/test/display.test.js
浏览文件 @
9e7320cb
...
...
@@ -206,5 +206,189 @@ describe('display_test', function () {
}
})
/**
* @tc.number SUB_WMS_WATERFALLDISPLAYAREARECTS_JSAPI_001
* @tc.name Test waterfallDisplayAreaRects_Test_001.
* @tc.desc To test value of waterfallDisplayAreaRects.
*/
it
(
'
waterfallDisplayAreaRects_Test_001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
test the value of waterfallDisplayAreaRects begin
'
);
try
{
var
waterfallDisplayAreaRects
=
{
left
:
{
left
:
20
,
top
:
20
,
width
:
20
,
height
:
20
},
right
:
{
left
:
800
,
top
:
0
,
width
:
600
,
height
:
600
},
top
:
{
left
:
20
,
top
:
20
,
width
:
20
,
height
:
20
},
bottom
:
{
left
:
20
,
top
:
20
,
width
:
600
,
height
:
600
},
}
expect
(
waterfallDisplayAreaRects
.
left
!=
null
).
assertTrue
();
expect
(
waterfallDisplayAreaRects
.
right
!=
null
).
assertTrue
();
expect
(
waterfallDisplayAreaRects
.
top
!=
null
).
assertTrue
();
expect
(
waterfallDisplayAreaRects
.
bottom
!=
null
).
assertTrue
();
done
();
}
catch
(
err
)
{
console
.
error
(
'
test value of waterfallDisplayAreaRects error
'
+
JSON
.
stringify
(
err
));
expect
.
assertFail
();
done
();
}
})
/**
* @tc.number SUB_WMS_RECT_JSAPI_001
* @tc.name Test RECT_Test_001.
* @tc.desc To test value of RECT.
*/
it
(
'
displayAreaRects_Test_001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
test the value of aRect begin
'
);
try
{
var
rect
=
{
left
:
20
,
right
:
40
,
width
:
100
,
height
:
200
}
expect
(
20
).
assertEqual
(
rect
.
left
);
expect
(
40
).
assertEqual
(
rect
.
right
);
expect
(
100
).
assertEqual
(
rect
.
width
);
expect
(
200
).
assertEqual
(
rect
.
height
);
done
();
}
catch
(
err
)
{
console
.
error
(
'
test value of rect error
'
+
JSON
.
stringify
(
err
));
expect
.
assertFail
();
done
();
}
})
/**
* @tc.number SUB_WMS_CutoutInfo_JSAPI_001
* @tc.name Test CutoutInfo_Test_001.
* @tc.desc To test value of CutoutInfo.
*/
it
(
'
CutoutInfo_Test_001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
test the CutoutInfo of aRect begin
'
);
try
{
var
cutoutInfo
=
{
boudingRects
:
[{
left
:
20
,
right
:
40
,
width
:
100
,
height
:
200
}],
waterfallDisplayAreaRects
:
{
left
:
{
left
:
20
,
top
:
20
,
width
:
20
,
height
:
20
},
right
:
{
left
:
800
,
top
:
0
,
width
:
600
,
height
:
600
},
top
:
{
left
:
20
,
top
:
20
,
width
:
20
,
height
:
20
},
bottom
:
{
left
:
20
,
top
:
20
,
width
:
600
,
height
:
600
},
}
}
expect
(
1
).
assertEqual
(
cutoutInfo
.
boudingRects
.
length
);
expect
(
cutoutInfo
.
waterfallDisplayAreaRects
.
left
!=
null
).
assertTrue
();
expect
(
cutoutInfo
.
waterfallDisplayAreaRects
.
right
!=
null
).
assertTrue
();
expect
(
cutoutInfo
.
waterfallDisplayAreaRects
.
top
!=
null
).
assertTrue
();
expect
(
cutoutInfo
.
waterfallDisplayAreaRects
.
bottom
!=
null
).
assertTrue
();
done
();
}
catch
(
err
)
{
console
.
error
(
'
test value of CutoutInfo error
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
})
/**
* @tc.number SUB_WMS_GETDISPLAYCUtOUTINFO_JSAPI_001
* @tc.name Test getDisplayCutoutInfo_Test_001
* @tc.desc To test the function of getCutoutInfo
*/
it
(
'
getDisplayCutoutInfo_Test_001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
getCutoutInfo begin
'
);
display
.
getDefaultDisplay
().
then
(
dsp
=>
{
console
.
info
(
'
displayTest getCutoutInfo getDefaultDisplay id :
'
+
JSON
.
stringify
(
dsp
));
expect
(
dsp
!=
null
).
assertTrue
();
dsp
.
getCutoutInfo
((
err
,
data
)
=>
{
console
.
info
(
'
Succeeded in getting cutoutInfo. data:
'
+
JSON
.
stringify
(
data
));
if
(
err
.
code
)
{
console
.
error
(
'
Failed to get cutoutInfo. Cause:
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
else
{
console
.
error
(
'
success to get cutoutInfo. Cause:
'
+
JSON
.
stringify
(
err
));
expect
(
data
!=
null
).
assertTrue
();
done
();
}
})
},
(
err
)
=>
{
console
.
log
(
'
displayTest getgetCutoutInfo getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_GETDISPLAYCUtOUTINFO_JSAPI_002
* @tc.name Test getDisplayCutoutInfo_Test_002
* @tc.desc To test the function of getCutoutInfo
*/
it
(
'
getDisplayCutoutInfo_Test_002
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
getCutoutInfo begin
'
);
display
.
getDefaultDisplay
().
then
(
dsp
=>
{
console
.
info
(
'
displayTest getCutoutInfo getDefaultDisplay id2 :
'
+
JSON
.
stringify
(
dsp
));
expect
(
dsp
!=
null
).
assertTrue
();
dsp
.
getCutoutInfo
().
then
(
data
=>
{
console
.
info
(
'
Succeeded in getting cutoutInfo2. data:
'
+
JSON
.
stringify
(
data
));
expect
(
data
!=
null
).
assertTrue
();
done
();
}
,
err
=>
{
console
.
log
(
'
displayTest getCutoutInfo getDefaultDisplay id2 failed, err :
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
displayTest getgetCutoutInfo getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
})
}
graphic/windowstandard/src/main/js/test/window.test.js
浏览文件 @
9e7320cb
...
...
@@ -2645,7 +2645,6 @@ describe('window_test', function () {
expect
().
assertFail
();
done
();
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest1 setBrightness failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
...
...
@@ -3052,5 +3051,480 @@ describe('window_test', function () {
})
})
/**
* @tc.number SUB_WMS_SETBACKGROUNDCOLORCALLBACK_JSAPI_001
* @tc.name Test setBackgroundColorCALLBack_Test_001
* @tc.desc Set the window background color to red and Default opacity
*/
it
(
'
setBackgroundColorCallBack_Test_001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
windowTest setBackgroundColorCallBackTest1 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setBackgroundColorBackTest1 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBackgroundColor
(
"
#ffff00
"
,(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the background color. Cause:
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
else
{
console
.
info
(
'
Succeeded in setting the background color. Data:
'
+
JSON
.
stringify
(
data
));
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
!
data
.
isTransparent
).
assertTrue
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorCallBackTest1 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
}
})
},
(
err
)
=>
{
console
.
info
(
'
windowTest setBackgroundColorCallBackTest1 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBACKGROUNDCOLORCALLBACK_JSAPI_002
* @tc.name Test setBackgroundColorCallBack_Test_002
* @tc.desc Set the window background color to red opaque
*/
it
(
'
setBackgroundColorCallBack_Test_002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest setBackgroundColorCallBackTest2 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setBackgroundColorTestCallBack2 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBackgroundColor
(
"
#ffffff00
"
,(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the background color2. Cause:
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
else
{
console
.
info
(
'
Succeeded in setting the background color2. Data:
'
+
JSON
.
stringify
(
data
));
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
!
data
.
isTransparent
).
assertTrue
();
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorCallBackTest2 getProperties 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_SETBACKGROUNDCOLORCallBack_JSAPI_003
* @tc.name Test setBackgroundColorBack_Test_003
* @tc.desc Set the window background color to red transparent
*/
it
(
'
setBackgroundColorCallBack_Test_003
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest setBackgroundColorTestCallBack3 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
info
(
'
windowTest setBackgroundColorTest3 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBackgroundColor
(
"
#00ffff00
"
,(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the background color2. Cause:
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
else
{
console
.
info
(
'
Succeeded in setting the background color2. Data:
'
+
JSON
.
stringify
(
data
));
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
data
.
isTransparent
).
assertTrue
();
done
();
},
(
err
)
=>
{
console
.
info
(
'
windowTest setBackgroundColorCallBackTest3 getProperties failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
}
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorCallBackTest3 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBACKGROUNDCOLORBACK_JSAPI_004
* @tc.name Test setBackgroundColorBack_Test_004
* @tc.desc Set the background color input parameter as an outlier
*/
it
(
'
setBackgroundColorBack_Test_004
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
windowTest setBackgroundColorCallBackTest4 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
info
(
'
windowTest setBackgroundColorTestCallBack4 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBackgroundColor
(
"
ff00
"
,(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the background color2. Cause:
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
1003
);
done
();
}
else
{
console
.
info
(
'
Succeeded in setting the background color2. Data:
'
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
}
})
},
(
err
)
=>
{
console
.
info
(
'
windowTest setBackgroundColorCallBackTest4 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBACKGROUNDCOLORCallBack_JSAPI_005
* @tc.name Test setBackgroundColorCallBack_Test_005
* @tc.desc Setting window background color input exception ARGB
*/
it
(
'
setBackgroundColorCallBack_Test_005
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest setBackgroundColorCallBackTest5 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setBackgroundColorBackTest5 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBackgroundColor
(
"
#hhgghhgg
"
,(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the background color5. Cause:
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
1003
);
done
();
}
else
{
console
.
info
(
'
Succeeded in setting the background color5. Data:
'
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
}
})
},
(
err
)
=>
{
console
.
info
(
'
windowTest setBackgroundColorTest5 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBACKGROUNDCOLORCallBack_JSAPI_006
* @tc.name Test setBackgroundColorBack_Test_006
* @tc.desc Setting window background color input exception RGB
*/
it
(
'
setBackgroundColorCallBack_Test_006
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest setBackgroundColorTestCallBack6 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setBackgroundColorTestCallBack6 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBackgroundColor
(
"
#gghhkk
"
,(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the background color6. Cause:
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
1003
);
done
();
}
else
{
console
.
info
(
'
Succeeded in setting the background color6. Data:
'
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
}
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBackgroundColorTest6 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBRIGHTNESSCALLBACK_JSAPI_002
* @tc.name Test setBrightnessCallBack_Test_002
* @tc.desc Set the brightness bar input parameter to decimal
*/
it
(
'
setBrightnessCallBack_Test_002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest setBrightnessTestCallBack2 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setBrightnessTestCallBack2 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setBrightness
(
1
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the brightness2. Cause:
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
else
{
console
.
info
(
'
Succeeded in setting the brightness2. Data:
'
+
JSON
.
stringify
(
data
));
wnd
.
getProperties
().
then
(
data
=>
{
console
.
info
(
'
windowTest setBrightnessTest2 getProperties data
'
+
data
);
expect
(
data
.
brightness
).
assertEqual
(
1
);
done
();
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest2 getProperties 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_SETBRIGHTNESSCALLBACK_JSAPI_003
* @tc.name Test setBrightnessCallBack_Test_003
* @tc.desc Set the brightness bar input parameter to number max
*/
it
(
'
setBrightnessCallBack_Test_003
'
,
0
,
async
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
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
log
(
'
windowTest setBrightnessTest3 setBrightness failed: err
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
1003
);
done
();
}
else
{
console
.
log
(
'
windowTest setBrightnessTest3 setBrightness(Number.MAX_VALUE) success
'
);
expect
().
assertFail
();
done
();
}
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest3 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBRIGHTNESSCALLBACK_JSAPI_004
* @tc.name Test setBrightnessCallBack_Test_004
* @tc.desc Set the brightness bar input parameter to number min
*/
it
(
'
setBrightnessCallBack_Test_004
'
,
0
,
async
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
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
log
(
'
windowTest setBrightnessTest4 setBrightness failed: err
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
1003
);
done
();
}
else
{
console
.
log
(
'
windowTest setBrightnessTest4 setBrightness(Number.MIN_VALUE) success
'
);
expect
(
TRUE_WINDOW
).
assertTrue
();
done
();
}
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest4 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETBRIGHTNESSCALLBACK_JSAPI_005
* @tc.name Test setBrightnessCALLBACK_Test_005
* @tc.desc Setting brightness bar input parameter exception
*/
it
(
'
setBrightnessCallBack_Test_005
'
,
0
,
async
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
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
log
(
'
windowTest setBrightnessTest5 setBrightness failed: err
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
1003
);
done
();
}
else
{
console
.
log
(
'
windowTest setBrightnessTest5 setBrightness(1.1) success
'
);
expect
().
assertFail
();
done
();
}
})
},
(
err
)
=>
{
console
.
log
(
'
windowTest setBrightnessTest5 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_SETTOUCHABLECALLBACK_JSAPI_001
* @tc.name Test setTouchableCallBack_Test_001
* @tc.desc Set whether the window can be touched or not
*/
it
(
'
setTouchableCallBack_Test_001
'
,
0
,
async
function
(
done
)
{
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setTouchableTestCallBack1 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setTouchable
(
false
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window to be touchable. Cause:
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
else
{
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
!
data
.
touchable
).
assertTrue
();
wnd
.
setTouchable
(
true
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window to be touchable. Cause:
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
else
{
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
data
.
touchable
).
assertTrue
();
done
();
},
(
err
)
=>
{
console
.
info
(
'
windowTest setTouchableTestCallBack1 getProperties 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_SETFOCUSABLECALLBACK_JSAPI_001
* @tc.name Test setFocusable_Test_001
* @tc.desc Setting window focus acquisition and defocus
*/
it
(
'
setFocusableCallBack_Test_001
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest setFocusableTest1 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
log
(
'
windowTest setFocusableCallBack1 getTopWindow wnd
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
setFocusable
(
false
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window to be setFocusable. Cause:
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
else
{
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
!
data
.
focusable
).
assertTrue
();
wnd
.
setFocusable
(
true
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window to be setFocusable. Cause:
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
else
{
wnd
.
getProperties
().
then
(
data
=>
{
expect
(
data
.
focusable
).
assertTrue
();
done
();
},
(
err
)
=>
{
console
.
info
(
'
windowTest setFocusableTestCallBack1 getProperties 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 setFocusable1 getTopWindow failed: err
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_WMS_ENUM_AVOIDAREATYPE_JSAPI_001
* @tc.name Test avoidareatype_Test_001.
* @tc.desc To test the enum value of avoidareatype.
*/
it
(
'
enumAvoidAreaType_Test_001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
test the enum AvoidArea of orientation begin
'
);
try
{
expect
(
0
).
assertEqual
(
window
.
AvoidAreaType
.
TYPE_SYSTEM
);
expect
(
1
).
assertEqual
(
window
.
AvoidAreaType
.
TYPE_CUTOUT
);
expect
(
2
).
assertEqual
(
window
.
AvoidAreaType
.
TYPE_SYSTEM_GESTURE
);
expect
(
3
).
assertEqual
(
window
.
AvoidAreaType
.
TYPE_KEYBOARD
);
done
();
}
catch
(
err
)
{
console
.
info
(
'
test enum value of AvoidArea error
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
})
/**
* @tc.number SUB_WMS_GETAVOIDAREAADD_JSAPI_001
* @tc.name Test getAvoidAreaAdd_Test_001
* @tc.desc Get System type avoidance area
*/
it
(
'
getAvoidAreaAdd_Test_001
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest getAvoidAreaAdd_Test_001 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
info
(
'
windowTest getAvoidAreaTestAdd window.getTopWindow wnd:
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
getAvoidArea
(
window
.
AvoidAreaType
.
TYPE_KEYBOARD
,
(
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
windowTest getAvoidAreaTestAdd1 wnd.getAvoidArea callback fail
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
else
{
expect
(
data
.
topRect
!=
null
).
assertTrue
();
expect
(
data
.
rightRect
!=
null
).
assertTrue
();
expect
(
data
.
bottomRect
!=
null
).
assertTrue
();
expect
(
data
.
leftRect
!=
null
).
assertTrue
();
done
();
}
})
})
})
/**
* @tc.number SUB_WMS_GETAVOIDAREAADD_JSAPI_002
* @tc.name Test getAvoidAreaAdd_Test_002
* @tc.desc Get invalid parameter avoidarea
*/
it
(
'
getAvoidAreaAdd_Test_002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
windowTest getAvoidAreaAdd_Test_002 begin
'
);
window
.
getTopWindow
().
then
(
wnd
=>
{
console
.
info
(
'
windowTest getAvoidAreaTestAdd002 window.getTopWindow wnd:
'
+
wnd
);
expect
(
wnd
!=
null
).
assertTrue
();
wnd
.
getAvoidArea
(
-
1
,
(
err
,
data
)
=>
{
console
.
info
(
'
windowTest getAvoidAreaTestAdd2
'
+
JSON
.
stringify
(
data
));
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
windowTest getAvoidAreaTestAdd002 wnd.getAvoidArea callback fail
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
else
{
expect
(
data
.
topRect
!=
null
).
assertTrue
();
expect
(
data
.
rightRect
!=
null
).
assertTrue
();
expect
(
data
.
bottomRect
!=
null
).
assertTrue
();
expect
(
data
.
leftRect
!=
null
).
assertTrue
();
done
();
}
})
})
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录