Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
13834ada
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看板
未验证
提交
13834ada
编写于
6月 30, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 30, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4013 add MultimodalInput test
Merge pull request !4013 from liuzixuan/master
上级
93022d6d
53d90100
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
315 addition
and
1 deletion
+315
-1
multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js
..._js_standard/src/main/js/default/test/InputDevice.test.js
+237
-0
multimodalinput/input_js_standard/src/main/js/default/test/ListMultimodalinput.test.js
...dard/src/main/js/default/test/ListMultimodalinput.test.js
+1
-0
multimodalinput/input_js_standard/src/main/js/default/test/MultimodalInputKey_Code.test.js
.../src/main/js/default/test/MultimodalInputKey_Code.test.js
+24
-1
multimodalinput/input_js_standard/src/main/js/default/test/inputMonitor.test.js
...js_standard/src/main/js/default/test/inputMonitor.test.js
+53
-0
未找到文件。
multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js
浏览文件 @
13834ada
...
...
@@ -253,4 +253,241 @@ describe('MultimodalInput_test', function () {
+
inputDevice
.
KeyboardType
.
REMOTE_CONTROL
);
expect
(
inputDevice
.
KeyboardType
.
REMOTE_CONTROL
==
5
).
assertTrue
();
})
it
(
'
ultimodalInputDevice_Startlistening_InputDevice_Events_test
'
,
0
,
function
(){
inputDevice
.
on
(
"
change
"
,()
=>
{
var
Type
=
inputDevice
.
DeviceListener
.
type
var
IdNumber
=
inputDevice
.
DeviceListener
.
deviceId
console
.
info
(
Type
)
expect
(
inputDevice
.
DeviceListener
.
type
===
'
add
'
||
inputDevice
.
DeviceListener
.
type
===
'
remove
'
).
assertTrue
();
console
.
info
(
IdNumber
)
expect
(
inputDevice
.
DeviceListener
.
type
).
assertInstanceOf
(
'
number
'
);
})
})
it
(
'
ultimodalInputDevice_Stoplistening_InputDevice_Events_test
'
,
0
,
function
(){
inputDevice
.
off
(
"
change
"
,()
=>
{
var
Type
=
inputDevice
.
DeviceListener
.
type
var
IdNumber
=
inputDevice
.
DeviceListener
.
deviceId
console
.
info
(
Type
)
expect
(
inputDevice
.
DeviceListener
.
type
===
'
add
'
||
inputDevice
.
DeviceListener
.
type
===
'
remove
'
).
assertTrue
();
console
.
info
(
IdNumber
)
expect
(
inputDevice
.
DeviceListener
.
type
).
assertInstanceOf
(
'
number
'
);
})
})
// 参数正确,返回一个数组
it
(
'
inputDevice::getDeviceIds_test-01
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::getDeviceIds_test-01 enter`
);
inputDevice
.
getDeviceIds
()
.
then
((
data
)
=>
{
expect
(
data
).
assertInstanceOf
(
'
Array
'
);
})
.
catch
(
error
=>
{
expect
(
false
).
assertTrue
();
})
})
// 参数正确,判断一种或多种设备
it
(
"
inputDevice::getDeviceIds_test-02
"
,
0
,
function
()
{
console
.
log
(
`inputDevice::getDeviceIds_test-02 enter`
);
inputDevice
.
getDeviceIds
()
.
then
((
data
)
=>
{
expect
(
data
.
length
>
0
).
assertTure
();
})
.
catch
(
error
=>
{
expect
(
false
).
assertTrue
();
})
})
it
(
"
inputDevice::setPointerLocation_test-01
"
,
0
,
function
()
{
console
.
log
(
`inputDevice::setPointerLocation_test-01 enter`
);
inputDevice
.
setPointerLocation
(
1
,
2
)
.
then
((
data
)
=>
{
expect
(
data
).
assertTure
();
})
.
catch
(
error
=>
{
expect
(
false
).
assertTrue
();
})
console
.
log
(
`inputDevice::setPointerLocation_test-01 exit`
);
})
it
(
"
inputDevice::setPointerLocation_test-02
"
,
0
,
function
()
{
console
.
log
(
`inputDevice::setPointerLocation_test-02 enter`
);
inputDevice
.
setPointerLocation
(
1
,
2
,(
data
,
error
)
=>
{
if
(
data
){
expect
(
true
).
assertTure
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
})
it
(
'
inputDevice::DeviceListener_test-01
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::DeviceListener_test-01 enter`
);
expect
(
(
inputDevice
.
DeviceListener
.
type
==
'
add
'
||
'
remove
'
)).
assertTrue
();
console
.
log
(
`inputDevice::DeviceListener_test-01 exit`
);
})
it
(
'
inputDevice::DeviceListener_test-02
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::DeviceListener_test-02 enter`
);
expect
(
(
inputDevice
.
DeviceListener
.
deviceId
)).
assertInstanceOf
(
"
number
"
);
console
.
log
(
`inputDevice::DeviceListener_test-02 exit`
);
})
it
(
'
inputDevice::AxisRange_test-01
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::AxisRange_test-01 enter`
);
expect
((
inputDevice
.
AxisRange
.
source
==
'
keyboard
'
||
'
mouse
'
||
'
touchpad
'
||
'
touchscreen
'
||
'
joystick
'
||
'
trackball
'
)).
assertTrue
();
console
.
log
(
`inputDevice::AxisRange_test-01 exit`
);
})
it
(
'
inputDevice::AxisRange_test-02
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::AxisRange_test-02 enter`
);
expect
((
inputDevice
.
AxisRange
.
axis
==
'
touchMajor
'
||
'
touchMinor
'
||
'
orientation
'
||
'
x
'
||
'
y
'
||
'
pressure
'
||
'
toolMinor
'
||
'
toolMajor
'
||
'
NULL
'
)).
assertTrue
();
console
.
log
(
`inputDevice::AxisRange_test-02 exit`
);
})
it
(
'
inputDevice::AxisRange_test-03
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::AxisRange_test-03 enter`
);
expect
(
(
inputDevice
.
AxisRange
.
max
)).
assertInstanceOf
(
"
number
"
);
console
.
log
(
`inputDevice::AxisRange_test-03 exit`
);
})
it
(
'
inputDevice::AxisRange_test-04
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::AxisRange_test-04 enter`
);
expect
(
(
inputDevice
.
AxisRange
.
min
)).
assertInstanceOf
(
"
number
"
);
console
.
log
(
`inputDevice::AxisRange_test-04 exit`
);
})
it
(
'
inputDevice::AxisRange_test-05
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::AxisRange_test-05 enter`
);
expect
(
(
inputDevice
.
AxisRange
.
fuzz
)).
assertInstanceOf
(
"
number
"
);
console
.
log
(
`inputDevice::AxisRange_test-05 exit`
);
})
it
(
'
inputDevice::AxisRange_test-06
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::AxisRange_test-06 enter`
);
expect
(
(
inputDevice
.
AxisRange
.
flat
)).
assertInstanceOf
(
"
number
"
);
console
.
log
(
`inputDevice::AxisRange_test-06 exit`
);
})
it
(
'
inputDevice::AxisRange_test-07
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::AxisRange_test-07 enter`
);
expect
(
(
inputDevice
.
AxisRange
.
resolution
)).
assertInstanceOf
(
"
number
"
);
console
.
log
(
`inputDevice::AxisRange_test-07 exit`
);
})
it
(
'
inputDevice::InputDeviceData_test-01
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::InputDeviceData_test-01 enter`
);
expect
(
(
inputDevice
.
InputDeviceData
.
id
)).
assertInstanceOf
(
"
number
"
);
console
.
log
(
`inputDevice::InputDeviceData_test-01 exit`
);
})
it
(
'
inputDevice::InputDeviceData_test-02
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::InputDeviceData_test-02 enter`
);
expect
(
(
inputDevice
.
InputDeviceData
.
name
)).
assertInstanceOf
(
"
string
"
);
console
.
log
(
`inputDevice::InputDeviceData_test-02 exit`
);
})
it
(
'
inputDevice::InputDeviceData_test-03
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::InputDeviceData_test-03 enter`
);
expect
(
(
inputDevice
.
InputDeviceData
.
sources
)).
assertInstanceOf
(
"
Array
"
);
console
.
log
(
`inputDevice::InputDeviceData_test-03 exit`
);
})
it
(
'
inputDevice::InputDeviceData_test-04
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::InputDeviceData_test-04 enter`
);
expect
(
(
inputDevice
.
InputDeviceData
.
axisRanges
)).
assertInstanceOf
(
"
Array
"
);
console
.
log
(
`inputDevice::InputDeviceData_test-04 exit`
);
})
it
(
'
inputDevice::InputDeviceData_test-05
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::InputDeviceData_test-05 enter`
);
expect
(
(
inputDevice
.
InputDeviceData
.
bus
)).
assertInstanceOf
(
"
Array
"
);
console
.
log
(
`inputDevice::InputDeviceData_test-05 exit`
);
})
it
(
'
inputDevice::InputDeviceData_test-06
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::InputDeviceData_test-06 enter`
);
expect
(
(
inputDevice
.
InputDeviceData
.
product
)).
assertInstanceOf
(
"
number
"
);
console
.
log
(
`inputDevice::InputDeviceData_test-06 exit`
);
})
it
(
'
inputDevice::InputDeviceData_test-07
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::InputDeviceData_test-07 enter`
);
expect
(
(
inputDevice
.
InputDeviceData
.
vendor
)).
assertInstanceOf
(
"
number
"
);
console
.
log
(
`inputDevice::InputDeviceData_test-07 exit`
);
})
it
(
'
inputDevice::InputDeviceData_test-08
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::InputDeviceData_test-08 enter`
);
expect
(
(
inputDevice
.
InputDeviceData
.
version
)).
assertInstanceOf
(
"
number
"
);
console
.
log
(
`inputDevice::InputDeviceData_test-08 exit`
);
})
it
(
'
inputDevice::InputDeviceData_test-09
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::InputDeviceData_test-09 enter`
);
expect
(
(
inputDevice
.
InputDeviceData
.
phys
)).
assertInstanceOf
(
"
string
"
);
console
.
log
(
`inputDevice::InputDeviceData_test-09 exit`
);
})
it
(
'
inputDevice::InputDeviceData_test-10
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::InputDeviceData_test-10 enter`
);
expect
(
(
inputDevice
.
InputDeviceData
.
uniq
)).
assertInstanceOf
(
"
string
"
);
console
.
log
(
`inputDevice::InputDeviceData_test-10 exit`
);
})
})
multimodalinput/input_js_standard/src/main/js/default/test/ListMultimodalinput.test.js
浏览文件 @
13834ada
...
...
@@ -16,3 +16,4 @@
require
(
'
./InputDevice.test.js
'
)
require
(
'
./MultimodalInputKey_Code.test.js
'
)
require
(
'
./inputMonitor.test.js
'
)
multimodalinput/input_js_standard/src/main/js/default/test/MultimodalInputKey_Code.test.js
浏览文件 @
13834ada
...
...
@@ -25,7 +25,7 @@ import {
describe
(
'
Multimodalinput_KeyCode_test
'
,
function
()
{
// 参数正确,返回一个数组
it
(
'
Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010
'
,
0
,
function
()
{
console
.
log
(
`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`
);
...
...
@@ -2818,6 +2818,29 @@ describe('Multimodalinput_KeyCode_test', function () {
console
.
log
(
`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_348 exit`
);
})
it
(
'
Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_349
'
,
0
,
function
()
{
console
.
log
(
`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_349 enter`
);
expect
(
inputkeyCode
.
KeyCode
.
KEYCODE_ADDRESSBOOK
==
2709
).
assertTrue
();
console
.
log
(
`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_349 exit`
);
})
it
(
'
Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_350
'
,
0
,
function
()
{
console
.
log
(
`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_350 enter`
);
expect
(
inputkeyCode
.
KeyCode
.
KEYCODE_BRIGHTNESS_MAX
==
2725
).
assertTrue
();
console
.
log
(
`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_350 exit`
);
})
})
multimodalinput/input_js_standard/src/main/js/default/test/inputMonitor.test.js
0 → 100644
浏览文件 @
13834ada
/*
* 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
inputDevice
from
'
@ohos.multimodalInput.inputMonitor
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
MultimodalInput_test
'
,
function
()
{
it
(
"
inputDevice::off-01
"
,
0
,
function
()
{
inputMonitor
.
on
(
"
touch
"
,(
event
)
=>
{
if
(
event
){
expect
(
true
).
assertTure
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
inputMonitor
.
off
(
"
touch
"
)
})
it
(
"
inputDevice::off-01
"
,
0
,
function
()
{
inputMonitor
.
on
(
"
mouse
"
,(
event
)
=>
{
if
(
event
){
expect
(
true
).
assertTure
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
inputMonitor
.
off
(
"
touch
"
)
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录