Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0cb45fda
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看板
未验证
提交
0cb45fda
编写于
2月 22, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 22, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7693 多模子系统pointer 5条case添加canIUse判断调用
Merge pull request !7693 from 岳鑫瑶/master
上级
e97ac3eb
71846294
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
121 addition
and
82 deletion
+121
-82
multimodalinput/input_js_standard/src/main/js/test/Pointer.test.js
...linput/input_js_standard/src/main/js/test/Pointer.test.js
+121
-82
未找到文件。
multimodalinput/input_js_standard/src/main/js/test/Pointer.test.js
浏览文件 @
0cb45fda
/*
* Copyright (c) 2022 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright (c) 2022 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
pointer
from
'
@ohos.multimodalInput.pointer
'
import
window
from
'
@ohos.window
'
...
...
@@ -65,32 +65,40 @@ export default function Pointer_test() {
it
(
'
Pointer_PointerVisibleTest_002
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`Pointer_PointerVisibleTest_002 enter`
);
try
{
await
pointer
.
setPointerVisible
(
true
).
then
(
data
=>
{
console
.
info
(
`Pointer_PointerVisibleTest_002 success_1, data=
${
JSON
.
stringify
(
data
)}
`
);
expect
(
true
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
info
(
`Pointer_PointerVisibleTest_002 failed, err=
${
JSON
.
stringify
(
err
)}
`
);
expect
(
false
).
assertTrue
();
});
}
catch
(
error
)
{
console
.
info
(
`Pointer_PointerVisibleTest_002 error`
);
expect
(
false
).
assertTrue
();
}
try
{
pointer
.
isPointerVisible
((
err
,
data
)
=>
{
if
(
err
)
{
var
result
=
canIUse
(
"
SystemCapability.MultimodalInput.Input.Pointer
"
);
console
.
info
(
'
Pointer_PointerVisibleTest_002 segregate result=
'
+
result
);
if
(
result
)
{
try
{
await
pointer
.
setPointerVisible
(
true
).
then
(
data
=>
{
console
.
info
(
`Pointer_PointerVisibleTest_002 success_1, data=
${
JSON
.
stringify
(
data
)}
`
);
expect
(
true
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
info
(
`Pointer_PointerVisibleTest_002 failed, err=
${
JSON
.
stringify
(
err
)}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
`Pointer_PointerVisibleTest_002 success_2, data=
${
JSON
.
stringify
(
data
)}
`
);
expect
(
data
==
true
).
assertTrue
();
done
();
}
});
}
catch
(
error
)
{
console
.
info
(
`Pointer_PointerVisibleTest_002 error`
);
expect
(
false
).
assertTrue
();
});
}
catch
(
error
)
{
console
.
info
(
`Pointer_PointerVisibleTest_002 error`
);
expect
(
false
).
assertTrue
();
}
try
{
pointer
.
isPointerVisible
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
`Pointer_PointerVisibleTest_002 failed, err=
${
JSON
.
stringify
(
err
)}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
`Pointer_PointerVisibleTest_002 success_2, data=
${
JSON
.
stringify
(
data
)}
`
);
expect
(
data
==
true
).
assertTrue
();
done
();
}
});
}
catch
(
error
)
{
console
.
info
(
`Pointer_PointerVisibleTest_002 error`
);
expect
(
false
).
assertTrue
();
}
}
else
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
Pointer_PointerVisibleTest_002 SystemCapability.MultimodalInput.Input.Pointer segregate
'
);
done
();
}
console
.
info
(
`Pointer_PointerVisibleTest_002 exit`
);
})
...
...
@@ -122,21 +130,28 @@ export default function Pointer_test() {
})
})
}
window
.
getTopWindow
(
async
(
err
,
data
)
=>
{
console
.
info
(
`case:SetPointerStyle_001 enter`
);
var
windowClass
=
data
;
if
(
err
&&
err
.
code
!=
0
)
{
console
.
info
(
`case:SetPointerStyle_001,getTopWindow failed, err=
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
`case:SetPointerStyle_001 ===========`
);
await
getPropertiesPromise
(
data
);
console
.
info
(
`case:SetPointerStyle_001 exit`
);
var
result
=
canIUse
(
"
SystemCapability.MultimodalInput.Input.Pointer
"
);
console
.
info
(
'
Pointer_SetPointerStyle_001 segregate result=
'
+
result
);
if
(
result
)
{
window
.
getTopWindow
(
async
(
err
,
data
)
=>
{
console
.
info
(
`case:SetPointerStyle_001 enter`
);
var
windowClass
=
data
;
if
(
err
&&
err
.
code
!=
0
)
{
console
.
info
(
`case:SetPointerStyle_001,getTopWindow failed, err=
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
`case:SetPointerStyle_001 ===========`
);
await
getPropertiesPromise
(
data
);
console
.
info
(
`case:SetPointerStyle_001 exit`
);
done
();
})
}
else
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
Pointer_SetPointerStyle_001 SystemCapability.MultimodalInput.Input.Pointer segregate
'
);
done
();
}
)
}
})
it
(
'
Pointer_SetPointerStyle_002
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`SetPointerStyle_002 enter`
);
function
getPropertiesPromise
(
windowClass
)
{
...
...
@@ -166,18 +181,26 @@ export default function Pointer_test() {
})
})
}
window
.
getTopWindow
(
async
(
err
,
data
)
=>
{
console
.
info
(
`case:SetPointerStyle_002 enter`
);
var
windowClass
=
data
;
if
(
err
&&
err
.
code
!=
0
)
{
console
.
info
(
`case:SetPointerStyle_002,getTopWindow failed, err=
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
`case:SetPointerStyle_002 ===========`
);
await
getPropertiesPromise
(
data
);
console
.
info
(
`case:SetPointerStyle_002 exit`
);
var
result
=
canIUse
(
"
SystemCapability.MultimodalInput.Input.Pointer
"
);
console
.
info
(
'
Pointer_SetPointerStyle_002 segregate result=
'
+
result
);
if
(
result
)
{
window
.
getTopWindow
(
async
(
err
,
data
)
=>
{
console
.
info
(
`case:SetPointerStyle_002 enter`
);
var
windowClass
=
data
;
if
(
err
&&
err
.
code
!=
0
)
{
console
.
info
(
`case:SetPointerStyle_002,getTopWindow failed, err=
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
`case:SetPointerStyle_002 ===========`
);
await
getPropertiesPromise
(
data
);
console
.
info
(
`case:SetPointerStyle_002 exit`
);
done
();
})
}
else
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
Pointer_SetPointerStyle_002 SystemCapability.MultimodalInput.Input.Pointer segregate
'
);
done
();
}
)
}
})
it
(
'
Pointer_GetPointerStyle_001
'
,
0
,
async
function
(
done
)
{
...
...
@@ -207,18 +230,26 @@ export default function Pointer_test() {
})
})
}
window
.
getTopWindow
(
async
(
err
,
data
)
=>
{
console
.
info
(
`case:GetPointerStyle_001 enter`
);
var
windowClass
=
data
;
if
(
err
&&
err
.
code
!=
0
)
{
console
.
info
(
`case:GetPointerStyle_001,getTopWindow failed, err=
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
`case:GetPointerStyle_001 ===========`
);
await
getPropertiesPromise
(
data
);
console
.
info
(
`case:GetPointerStyle_001 exit`
);
var
result
=
canIUse
(
"
SystemCapability.MultimodalInput.Input.Pointer
"
);
console
.
info
(
'
Pointer_GetPointerStyle_001 segregate result=
'
+
result
);
if
(
result
)
{
window
.
getTopWindow
(
async
(
err
,
data
)
=>
{
console
.
info
(
`case:GetPointerStyle_001 enter`
);
var
windowClass
=
data
;
if
(
err
&&
err
.
code
!=
0
)
{
console
.
info
(
`case:GetPointerStyle_001,getTopWindow failed, err=
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
`case:GetPointerStyle_001 ===========`
);
await
getPropertiesPromise
(
data
);
console
.
info
(
`case:GetPointerStyle_001 exit`
);
done
();
})
}
else
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
Pointer_GetPointerStyle_001 SystemCapability.MultimodalInput.Input.Pointer segregate
'
);
done
();
}
)
}
})
it
(
'
Pointer_GetPointerStyle_002
'
,
0
,
async
function
(
done
)
{
...
...
@@ -251,19 +282,27 @@ export default function Pointer_test() {
})
})
}
window
.
getTopWindow
(
async
(
err
,
data
)
=>
{
console
.
info
(
`case:GetPointerStyle_002 enter`
);
var
windowClass
=
data
;
if
(
err
&&
err
.
code
!=
0
)
{
console
.
info
(
`case:GetPointerStyle_002,getTopWindow failed, err=
${
JSON
.
stringify
(
err
)}
`
);
var
result
=
canIUse
(
"
SystemCapability.MultimodalInput.Input.Pointer
"
);
console
.
info
(
'
Pointer_GetPointerStyle_002 segregate result=
'
+
result
);
if
(
result
)
{
window
.
getTopWindow
(
async
(
err
,
data
)
=>
{
console
.
info
(
`case:GetPointerStyle_002 enter`
);
var
windowClass
=
data
;
if
(
err
&&
err
.
code
!=
0
)
{
console
.
info
(
`case:GetPointerStyle_002,getTopWindow failed, err=
${
JSON
.
stringify
(
err
)}
`
);
done
();
return
;
}
console
.
info
(
`case:GetPointerStyle_002 ===========`
);
await
getPropertiesPromise
(
data
);
console
.
info
(
`case:GetPointerStyle_002 exit`
);
done
();
return
;
}
console
.
info
(
`case:GetPointerStyle_002 ===========`
);
await
getPropertiesPromise
(
data
);
console
.
info
(
`case:GetPointerStyle_002 exit`
);
})
}
else
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
Pointer_GetPointerStyle_002 SystemCapability.MultimodalInput.Input.Pointer segregate
'
);
done
();
}
)
}
})
it
(
'
Pointer_PointerStyle_test
'
,
0
,
function
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录