1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { paramMock } from '../utils'; 17import { AccessibilityExtensionContext } from './application/AccessibilityExtensionContext'; 18 19const AccessibilityEvent = { 20 eventType: '[PC Preview] unknown eventType', 21 target: '[PC Preview] unknown target', 22 timeStamp: '[PC Preview] unknown timeStamp' 23}; 24 25const GesturePoint = { 26 positionX: '[PC Preview] unknown positionX', 27 positionY: '[PC Preview] unknown positionY' 28 }; 29 30const GesturePath = { 31 points: [GesturePoint], 32 durationTime: '[PC Preview] unknown durationTime' 33}; 34 35export function mockAccessibilityExtensionAbility() { 36 const AccessibilityExtensionAbilityClass = class AccessibilityExtensionAbility { 37 constructor() { 38 console.warn('accessibilityExtensionAbility.constructor interface mocked in the Previewer.' + 39 ' How this interface works on the Previewer may be different from that on a real device.'); 40 this.context = new AccessibilityExtensionContext(); 41 this.onConnect = function (...args) { 42 console.warn('accessibilityExtensionAbility.onConnect interface mocked in the Previewer.' + 43 ' How this interface works on the Previewer may be different from that on a real device.'); 44 }; 45 this.onDisconnect = function (...args) { 46 console.warn('accessibilityExtensionAbility.onDisconnect interface mocked in the Previewer.' + 47 ' How this interface works on the Previewer may be different from that on a real device.'); 48 }; 49 this.onAccessibilityEvent = function (...args) { 50 console.warn('accessibilityExtensionAbility.onAccessibilityEvent interface mocked in the Previewer.' + 51 ' How this interface works on the Previewer may be different from that on a real device.'); 52 }; 53 this.onKeyEvent = function (...args) { 54 console.warn('accessibilityExtensionAbility.onKeyEvent interface mocked in the Previewer.' + 55 ' How this interface works on the Previewer may be different from that on a real device.'); 56 return paramMock.paramBooleanMock; 57 }; 58 } 59 }; 60 61 return AccessibilityExtensionAbilityClass; 62}