äFill in the missing mocks

Signed-off-by: hungry_feiwei <huxiao31@huawei.com>
Change-Id: Ieb3c3338c4a4c536646d4095963ec47c3baa0f84
This commit is contained in:
hungry_feiwei
2022-07-07 16:47:33 +08:00
parent 1a28a70017
commit b42a86bb73
8 changed files with 120 additions and 2 deletions
@@ -16,6 +16,12 @@
import { paramMock } from "../utils"
export function mockInputConsumer() {
const KeyOptions = {
preKeys: ["[PC preview] unknown preKeys"],
finalKey: "[PC preview] unknown finalKey",
isFinalKeyDown: "[PC preview] unknown isFinalKeyDown",
finalKeyDownDuration: "[PC preview] unknown finalKeyDownDuration",
}
const EventType = ['key']
const inputConsumer = {
on: function (...args) {
@@ -16,17 +16,30 @@
import { paramMock } from "../utils"
export function mockInputDevice() {
const DeviceListener = {
type: '[PC preview] unknow type',
deviceId: '[PC preview] unknow deviceId',
}
const AxisRange = {
source: '[PC preview] unknow source',
axis: '[PC preview] unknow axis',
max: '[PC preview] unknow max',
min: '[PC preview] unknow min'
min: '[PC preview] unknow min',
fuzz: '[PC preview] unknow fuzz',
flat: '[PC preview] unknow flat',
resolution: '[PC preview] unknow resolution',
}
const InputDeviceData = {
id: '[PC preview] unknow id',
name: '[PC preview] unknow name',
sources: ['[PC preview] unknow sources'],
axisRanges: [AxisRange]
axisRanges: [AxisRange],
bus: '[PC preview] unknow bus',
product: '[PC preview] unknow product',
vendor: '[PC preview] unknow vendor',
version: '[PC preview] unknow version',
phys: '[PC preview] unknow phys',
uniq: '[PC preview] unknow uniq',
}
const KeyboardType = {
NONE: 0,
@@ -0,0 +1,24 @@
/*
* 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.
*/
export function mockInputEvent() {
const InputEvent = {
id: '[PC preview] unknow id',
deviceId: '[PC preview] unknow deviceId',
actionTime: '[PC preview] unknow actionTime',
screenId: '[PC preview] unknow screenId',
windowId: '[PC preview] unknow windowId',
}
}
@@ -14,6 +14,9 @@
*/
export function mockInputMonitor() {
const TouchEventReceiver = {
"touchEvent": '[PC preview] unknow boolean'
}
const touches = [{
force: 1.67,
globalX: 122,
@@ -16,6 +16,8 @@
export const KeyCode = {
KEYCODE_FN: 0,
KEYCODE_UNKNOWN: -1,
KEYCODE_HOME: 1,
KEYCODE_BACK: 2,
KEYCODE_MEDIA_PLAY_PAUSE: 10,
KEYCODE_MEDIA_STOP: 11,
KEYCODE_MEDIA_NEXT: 12,
@@ -20,6 +20,25 @@ export const Action = {
}
export function mockKeyEvent() {
const Key = {
code: '[PC preview] unknow code',
pressedTime: '[PC preview] unknow pressedTime',
deviceId: '[PC preview] unknow deviceId',
}
const KeyEvent = {
action: '[PC preview] unknow action',
key: Key,
unicodeChar: '[PC preview] unknow unicodeChar',
keys: ['[PC preview] unknow Key'],
ctrlKey: '[PC preview] unknow ctrlKey',
altKey: '[PC preview] unknow altKey',
shiftKey: '[PC preview] unknow shiftKey',
logoKey: '[PC preview] unknow logoKey',
fnKey: '[PC preview] unknow fnKey',
capsLock: '[PC preview] unknow capsLock',
numLock: '[PC preview] unknow numLock',
scrollLock: '[PC preview] unknow scrollLock',
}
const keyEvent = {
Action,
}
@@ -41,6 +41,31 @@ export const Axis = {
}
export function mockMouseEvent() {
const AxisValue = {
axis: '[PC preview] unknow axis',
value: '[PC preview] unknow value',
}
const MouseEvent = {
action: '[PC preview] unknow action',
screenX: '[PC preview] unknow screenX',
screenY: '[PC preview] unknow screenY',
windowX: '[PC preview] unknow windowX',
windowY: '[PC preview] unknow windowY',
rawDeltaX: '[PC preview] unknow rawDeltaX',
rawDeltaY: '[PC preview] unknow rawDeltaY',
button: '[PC preview] unknow button',
pressedButtons: ['[PC preview] unknow pressedButtons'],
axes: ['[PC preview] unknow axes'],
pressedKeys: ['[PC preview] unknow pressedKeys'],
ctrlKey: '[PC preview] unknow ctrlKey',
altKey: '[PC preview] unknow altKey',
shiftKey: '[PC preview] unknow shiftKey',
logoKey: '[PC preview] unknow logoKey',
fnKey: '[PC preview] unknow fnKey',
capsLock: '[PC preview] unknow capsLock',
numLock: '[PC preview] unknow numLock',
scrollLock: '[PC preview] unknow scrollLock',
}
const mouseEvent = {
Action,
Button,
@@ -38,6 +38,32 @@ export const SourceType = {
}
export function mockTouchEvent() {
const Touch = {
id: '[PC preview] unknow id',
pressedTime: '[PC preview] unknow pressedTime',
screenX: '[PC preview] unknow screenX',
screenY: '[PC preview] unknow screenY',
windowX: '[PC preview] unknow windowX',
windowY: '[PC preview] unknow windowY',
pressure: '[PC preview] unknow pressure',
width: '[PC preview] unknow width',
height: '[PC preview] unknow height',
tiltX: '[PC preview] unknow tiltX',
tiltY: '[PC preview] unknow tiltY',
toolX: '[PC preview] unknow toolX',
toolY: '[PC preview] unknow toolY',
toolWidth: '[PC preview] unknow toolWidth',
toolHeight: '[PC preview] unknow toolHeight',
rawX: '[PC preview] unknow rawX',
rawY: '[PC preview] unknow rawY',
toolType: '[PC preview] unknow toolType',
}
const TouchEvent = {
action: '[PC preview] unknow action',
touch: '[PC preview] unknow Touch',
touches: ['[PC preview] unknow Touch'],
sourceType: '[PC preview] unknow SourceType',
}
const touchEvent = {
Action,
ToolType,