Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
cbf70e80
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看板
未验证
提交
cbf70e80
编写于
6月 25, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3768 【multimodalinput】【master】新增eventType 测试用例
Merge pull request !3768 from logic42/master
上级
8051adc2
547a3b21
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
252 addition
and
0 deletion
+252
-0
multimodalinput/input_js_standard/src/main/js/default/test/MultimodalInputEventType.test.js
...src/main/js/default/test/MultimodalInputEventType.test.js
+252
-0
未找到文件。
multimodalinput/input_js_standard/src/main/js/default/test/MultimodalInputEventType.test.js
0 → 100755
浏览文件 @
cbf70e80
/*
* 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
inputkeyCode
from
'
@ohos.multimodalInput.keyCode
'
import
keyEvent
from
'
@ohos.multimodalInput.keyEvent
'
import
mouseEvent
from
'
@ohos.multimodalInput.mouseEvent
'
import
touchEvent
from
'
@ohos.multimodalInput.touchEvent
'
import
{
Key
,
KeyEvent
}
from
'
@ohos.multimodalInput.keyEvent
'
import
{
AxisValue
,
MouseEvent
}
from
'
@ohos.multimodalInput.mouseEvent
'
import
{
Touch
,
TouchEvent
}
from
'
@ohos.multimodalInput.touchEvent
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
MultimodalInput_test
'
,
function
()
{
it
(
'
MultimodalInput_test::KeyEventTypeTest_0010
'
,
0
,
function
()
{
console
.
log
(
`MultimodalInput_test::KeyEventTypeTest_0010 enter`
);
expect
(
keyEvent
.
Action
.
CANCEL
==
0
).
assertTrue
();
expect
(
keyEvent
.
Action
.
DOWN
==
1
).
assertTrue
();
expect
(
keyEvent
.
Action
.
UP
==
2
).
assertTrue
();
console
.
log
(
`MultimodalInput_test::KeyEventTypeTest_0010 exit`
);
})
it
(
'
MultimodalInput_test::KeyEventTypeTest_0020
'
,
0
,
function
()
{
console
.
log
(
`MultimodalInput_test::KeyEventTypeTest_0020 enter`
);
let
testKey
:
Key
=
{
code
:
inputkeyCode
.
KeyCode
.
KEYCODE_FN
,
pressedTime
:
10
,
deviceId
:
1
};
expect
(
testKey
.
code
==
inputkeyCode
.
KeyCode
.
KEYCODE_FN
).
assertTrue
();
expect
(
testKey
.
pressedTime
==
10
).
assertTrue
();
expect
(
testKey
.
deviceId
==
1
).
assertTrue
();
console
.
log
(
`MultimodalInput_test::KeyEventTypeTest_0020 exit`
);
})
it
(
'
MultimodalInput_test::KeyEventTypeTest_0030
'
,
0
,
function
()
{
console
.
log
(
`MultimodalInput_test::KeyEventTypeTest_0030 enter`
);
let
testKey
:
Key
=
{
code
:
inputkeyCode
.
KeyCode
.
KEYCODE_FN
,
pressedTime
:
10
,
deviceId
:
1
};
let
testKeyEvent
:
KeyEvent
=
{
action
:
keyEvent
.
Action
.
DOWN
,
key
:
testKey
,
unicodeChar
:
1
,
keys
:
[
testKey
],
ctrlKey
:
true
,
altKey
:
true
,
shiftKey
:
true
,
logoKey
:
true
,
fnKey
:
true
,
capsLock
:
true
,
numLock
:
true
,
scrollLock
:
true
};
expect
(
testKeyEvent
.
action
==
keyEvent
.
Action
.
DOWN
).
assertTrue
();
expect
(
testKeyEvent
.
key
.
code
==
testKey
.
code
).
assertTrue
();
expect
(
testKeyEvent
.
unicodeChar
==
1
).
assertTrue
();
expect
(
testKeyEvent
.
keys
[
0
].
code
==
testKey
.
code
).
assertTrue
();
expect
(
testKeyEvent
.
ctrlKey
).
assertTrue
();
expect
(
testKeyEvent
.
altKey
).
assertTrue
();
expect
(
testKeyEvent
.
shiftKey
).
assertTrue
();
expect
(
testKeyEvent
.
logoKey
).
assertTrue
();
expect
(
testKeyEvent
.
fnKey
).
assertTrue
();
expect
(
testKeyEvent
.
capsLock
).
assertTrue
();
expect
(
testKeyEvent
.
numLock
).
assertTrue
();
expect
(
testKeyEvent
.
scrollLock
).
assertTrue
();
console
.
log
(
`MultimodalInput_test::KeyEventTypeTest_0030 exit`
);
})
it
(
'
MultimodalInput_test::MouseEventTypeTest_0010
'
,
0
,
function
()
{
console
.
log
(
`MultimodalInput_test::MouseEventTypeTest_0010 enter`
);
expect
(
mouseEvent
.
Action
.
CANCEL
==
0
).
assertTrue
();
expect
(
mouseEvent
.
Action
.
MOVE
==
1
).
assertTrue
();
expect
(
mouseEvent
.
Action
.
BUTTON_DOWN
==
2
).
assertTrue
();
expect
(
mouseEvent
.
Action
.
BUTTON_UP
==
3
).
assertTrue
();
expect
(
mouseEvent
.
Action
.
AXIS_BEGIN
==
4
).
assertTrue
();
expect
(
mouseEvent
.
Action
.
AXIS_UPDATE
==
5
).
assertTrue
();
expect
(
mouseEvent
.
Action
.
AXIS_END
==
6
).
assertTrue
();
console
.
log
(
`MultimodalInput_test::MouseEventTypeTest_0010 exit`
);
})
it
(
'
MultimodalInput_test::MouseEventTypeTest_0020
'
,
0
,
function
()
{
console
.
log
(
`MultimodalInput_test::MouseEventTypeTest_0020 enter`
);
expect
(
mouseEvent
.
Button
.
LEFT
==
0
).
assertTrue
();
expect
(
mouseEvent
.
Button
.
MIDDLE
==
1
).
assertTrue
();
expect
(
mouseEvent
.
Button
.
RIGHT
==
2
).
assertTrue
();
expect
(
mouseEvent
.
Button
.
SIDE
==
3
).
assertTrue
();
expect
(
mouseEvent
.
Button
.
EXTRA
==
4
).
assertTrue
();
expect
(
mouseEvent
.
Button
.
FORWARD
==
5
).
assertTrue
();
expect
(
mouseEvent
.
Button
.
BACK
==
6
).
assertTrue
();
expect
(
mouseEvent
.
Button
.
TASK
==
6
).
assertTrue
();
console
.
log
(
`MultimodalInput_test::MouseEventTypeTest_0020 exit`
);
})
it
(
'
MultimodalInput_test::MouseEventTypeTest_0030
'
,
0
,
function
()
{
console
.
log
(
`MultimodalInput_test::MouseEventTypeTest_0030 enter`
);
expect
(
mouseEvent
.
Axis
.
SCROLL_VERTICAL
==
0
).
assertTrue
();
expect
(
mouseEvent
.
Axis
.
SCROLL_HORIZONTAL
==
1
).
assertTrue
();
expect
(
mouseEvent
.
Axis
.
PINCH
==
2
).
assertTrue
();
console
.
log
(
`MultimodalInput_test::MouseEventTypeTest_0030 exit`
);
})
it
(
'
MultimodalInput_test::MouseEventTypeTest_0040
'
,
0
,
function
()
{
console
.
log
(
`MultimodalInput_test::MouseEventTypeTest_0040 enter`
);
let
testAxisValue
:
AxisValue
=
{
axis
:
mouseEvent
.
Axis
.
SCROLL_VERTICAL
,
value
:
1
};
expect
(
testAxisValue
.
axis
==
mouseEvent
.
Axis
.
SCROLL_VERTICAL
).
assertTrue
();
expect
(
testAxisValue
.
value
==
1
).
assertTrue
();
console
.
log
(
`MultimodalInput_test::MouseEventTypeTest_0040 exit`
);
})
it
(
'
MultimodalInput_test::MouseEventTypeTest_0050
'
,
0
,
function
()
{
console
.
log
(
`MultimodalInput_test::MouseEventTypeTest_0050 enter`
);
let
testAxisValue
:
AxisValue
=
{
axis
:
mouseEvent
.
Axis
.
SCROLL_VERTICAL
,
value
:
1
};
let
testMouseEvent
:
MouseEvent
=
{
action
:
mouseEvent
.
Action
.
CANCEL
,
screenX
:
1
,
screenY
:
1
,
windowX
:
1
,
windowY
:
1
,
rawDeltaX
:
1
,
rawDeltaY
:
1
,
button
:
mouseEvent
.
Button
.
LEFT
,
pressedButtons
:
[
mouseEvent
.
Button
.
LEFT
],
axes
:
[
testAxisValue
],
pressedKeys
:
[
inputkeyCode
.
KeyCode
.
KEYCODE_FN
],
ctrlKey
:
true
,
altKey
:
true
,
shiftKey
:
true
,
logoKey
:
true
,
fnKey
:
true
,
capsLock
:
true
,
numLock
:
true
,
scrollLock
:
true
};
expect
(
testMouseEvent
.
action
==
mouseEvent
.
Action
.
CANCEL
).
assertTrue
();
expect
(
testMouseEvent
.
screenX
==
1
).
assertTrue
();
expect
(
testMouseEvent
.
screenY
==
1
).
assertTrue
();
expect
(
testMouseEvent
.
windowX
==
1
).
assertTrue
();
expect
(
testMouseEvent
.
windowY
==
1
).
assertTrue
();
expect
(
testMouseEvent
.
rawDeltaX
==
1
).
assertTrue
();
expect
(
testMouseEvent
.
rawDeltaY
==
1
).
assertTrue
();
expect
(
testMouseEvent
.
button
==
mouseEvent
.
Button
.
LEFT
).
assertTrue
();
expect
(
testMouseEvent
.
pressedButtons
[
0
]
==
mouseEvent
.
Button
.
LEFT
).
assertTrue
();
expect
(
testMouseEvent
.
axes
[
0
].
axis
==
mouseEvent
.
Axis
.
SCROLL_VERTICAL
).
assertTrue
();
expect
(
testMouseEvent
.
pressedKeys
[
0
]
==
inputkeyCode
.
KeyCode
.
KEYCODE_FN
).
assertTrue
();
expect
(
testMouseEvent
.
ctrlKey
).
assertTrue
();
expect
(
testMouseEvent
.
altKey
).
assertTrue
();
expect
(
testMouseEvent
.
shiftKey
).
assertTrue
();
expect
(
testMouseEvent
.
logoKey
).
assertTrue
();
expect
(
testMouseEvent
.
fnKey
).
assertTrue
();
expect
(
testMouseEvent
.
capsLock
).
assertTrue
();
expect
(
testMouseEvent
.
numLock
).
assertTrue
();
expect
(
testMouseEvent
.
scrollLock
).
assertTrue
();
console
.
log
(
`MultimodalInput_test::MouseEventTypeTest_0050 exit`
);
})
it
(
'
MultimodalInput_test::TouchEventTypeTest_0010
'
,
0
,
function
()
{
console
.
log
(
`MultimodalInput_test::TouchEventTypeTest_0010 enter`
);
expect
(
touchEvent
.
Action
.
CANCEL
==
0
).
assertTrue
();
expect
(
touchEvent
.
Action
.
DOWN
==
1
).
assertTrue
();
expect
(
touchEvent
.
Action
.
MOVE
==
2
).
assertTrue
();
expect
(
touchEvent
.
Action
.
UP
==
3
).
assertTrue
();
console
.
log
(
`MultimodalInput_test::TouchEventTypeTest_0010 exit`
);
})
it
(
'
MultimodalInput_test::TouchEventTypeTest_0020
'
,
0
,
function
()
{
console
.
log
(
`MultimodalInput_test::TouchEventTypeTest_0020 enter`
);
expect
(
touchEvent
.
ToolType
.
FINGER
==
0
).
assertTrue
();
expect
(
touchEvent
.
ToolType
.
PEN
==
1
).
assertTrue
();
expect
(
touchEvent
.
ToolType
.
RUBBER
==
2
).
assertTrue
();
expect
(
touchEvent
.
ToolType
.
BRUSH
==
3
).
assertTrue
();
expect
(
touchEvent
.
ToolType
.
PENCIL
==
4
).
assertTrue
();
expect
(
touchEvent
.
ToolType
.
AIRBRUSH
==
5
).
assertTrue
();
expect
(
touchEvent
.
ToolType
.
MOUSE
==
6
).
assertTrue
();
expect
(
touchEvent
.
ToolType
.
LENS
==
7
).
assertTrue
();
console
.
log
(
`MultimodalInput_test::TouchEventTypeTest_0020 exit`
);
})
it
(
'
MultimodalInput_test::TouchEventTypeTest_0030
'
,
0
,
function
()
{
console
.
log
(
`MultimodalInput_test::TouchEventTypeTest_0030 enter`
);
expect
(
touchEvent
.
SourceType
.
TOUCH_SCREEN
==
0
).
assertTrue
();
expect
(
touchEvent
.
SourceType
.
PEN
==
1
).
assertTrue
();
expect
(
touchEvent
.
SourceType
.
TOUCH_PAD
==
2
).
assertTrue
();
console
.
log
(
`MultimodalInput_test::TouchEventTypeTest_0030 exit`
);
})
it
(
'
MultimodalInput_test::TouchEventTypeTest_0040
'
,
0
,
function
()
{
console
.
log
(
`MultimodalInput_test::TouchEventTypeTest_0040 enter`
);
let
testTouch
:
Touch
=
{
id
:
1
,
pressedTime
:
1
,
screenX
:
1
,
screenY
:
1
,
windowX
:
1
,
windowY
:
1
,
pressure
:
1
,
width
:
1
,
height
:
1
,
tiltX
:
1
,
tiltY
:
1
,
toolX
:
1
,
toolY
:
1
,
toolWidth
:
1
,
toolHeight
:
1
,
rawX
:
1
,
rawY
:
1
,
toolType
:
touchEvent
.
ToolType
.
FINGER
};
expect
(
testTouch
.
id
==
1
).
assertTrue
();
expect
(
touchEvent
.
pressedTime
==
1
).
assertTrue
();
expect
(
touchEvent
.
screenX
==
1
).
assertTrue
();
expect
(
touchEvent
.
screenY
==
1
).
assertTrue
();
expect
(
touchEvent
.
windowX
==
1
).
assertTrue
();
expect
(
touchEvent
.
windowY
==
1
).
assertTrue
();
expect
(
touchEvent
.
pressure
==
1
).
assertTrue
();
expect
(
touchEvent
.
width
==
1
).
assertTrue
();
expect
(
touchEvent
.
height
==
1
).
assertTrue
();
expect
(
touchEvent
.
tiltX
==
1
).
assertTrue
();
expect
(
touchEvent
.
tiltY
==
1
).
assertTrue
();
expect
(
touchEvent
.
toolX
==
1
).
assertTrue
();
expect
(
touchEvent
.
toolY
==
1
).
assertTrue
();
expect
(
touchEvent
.
toolWidth
==
1
).
assertTrue
();
expect
(
touchEvent
.
toolHeight
==
1
).
assertTrue
();
expect
(
touchEvent
.
rawX
==
1
).
assertTrue
();
expect
(
touchEvent
.
rawY
==
1
).
assertTrue
();
expect
(
touchEvent
.
toolType
==
touchEvent
.
ToolType
.
FINGER
).
assertTrue
();
console
.
log
(
`MultimodalInput_test::TouchEventTypeTest_0040 exit`
);
})
it
(
'
MultimodalInput_test::TouchEventTypeTest_0050
'
,
0
,
function
()
{
console
.
log
(
`MultimodalInput_test::TouchEventTypeTest_0050 enter`
);
let
testTouch
:
Touch
=
{
id
:
1
,
pressedTime
:
1
,
screenX
:
1
,
screenY
:
1
,
windowX
:
1
,
windowY
:
1
,
pressure
:
1
,
width
:
1
,
height
:
1
,
tiltX
:
1
,
tiltY
:
1
,
toolX
:
1
,
toolY
:
1
,
toolWidth
:
1
,
toolHeight
:
1
,
rawX
:
1
,
rawY
:
1
,
toolType
:
touchEvent
.
ToolType
.
FINGER
};
let
testTouchEvent
:
TouchEvent
=
{
action
:
touchEvent
.
Action
.
CANCEL
,
touch
:
testTouch
,
touches
:
[
testTouch
],
sourceType
:
touchEvent
.
SourceType
.
TOUCH_SCREEN
};
expect
(
testTouchEvent
.
action
==
touchEvent
.
Action
.
CANCEL
).
assertTrue
();
expect
(
testTouchEvent
.
touch
.
id
==
1
).
assertTrue
();
expect
(
testTouchEvent
.
touches
[
0
].
id
==
1
).
assertTrue
();
expect
(
testTouchEvent
.
sourceType
==
touchEvent
.
SourceType
.
TOUCH_SCREEN
).
assertTrue
();
console
.
log
(
`MultimodalInput_test::TouchEventTypeTest_0050 exit`
);
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录