diff --git a/runtime/main/extend/systemplugin/napi/index.js b/runtime/main/extend/systemplugin/napi/index.js old mode 100755 new mode 100644 index 0b810a48..b2bf6cfa --- a/runtime/main/extend/systemplugin/napi/index.js +++ b/runtime/main/extend/systemplugin/napi/index.js @@ -176,6 +176,7 @@ import { mockTouchEvent } from './ohos_multimodalInput_touchEvent' import { mockUiAppearance } from './ohos_uiAppearance' import { mockContinationManager } from './ohos_continuation_continuationManager' import { mockUiTest } from './ohos_uitest' +import { mockWindowAnimationManager } from './ohos_animation_windowAnimationManager' import { mockAccessibility } from './ohos_accessibility' import { mockAccessibilityConfig } from './ohos_accessibility_config' import { mockAccessibilityExtensionAbility } from './ohos_application_AccessibilityExtensionAbility' @@ -514,6 +515,8 @@ export function mockRequireNapiFun() { return mockContinationManager(); case "uitest": return mockUiTest(); + case "animation.windowAnimationManager": + return mockWindowAnimationManager(); default: return global.requireNapiPreview(...args); } diff --git a/runtime/main/extend/systemplugin/napi/ohos_animation_windowAnimationManager.js b/runtime/main/extend/systemplugin/napi/ohos_animation_windowAnimationManager.js new file mode 100644 index 00000000..9839a613 --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/ohos_animation_windowAnimationManager.js @@ -0,0 +1,79 @@ +/* + * 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 { paramMock } from "../utils" + +export function mockWindowAnimationManager() { + const RRect = { + left: '[PC preview] unknow left', + top: '[PC preview] unknow top', + width: '[PC preview] unknow width', + height: '[PC preview] unknow height', + radius: '[PC preview] unknow radius', + } + const WindowAnimationTarget = { + bundleName: '[PC preview] unknow bundleName', + abilityName: '[PC preview] unknow abilityName', + windowBounds: RRect, + } + const WindowAnimationFinishedCallback = { + onAnimationFinish: function (...args) { + console.warn("WindowAnimationFinishedCallback.onAnimationFinish interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + } + const WindowAnimationController = { + onStartAppFromLauncher: function (...args) { + console.warn("WindowAnimationController.onStartAppFromLauncher interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + onStartAppFromRecent: function (...args) { + console.warn("WindowAnimationController.onStartAppFromRecent interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + onStartAppFromOther: function (...args) { + console.warn("WindowAnimationController.onStartAppFromOther interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + onAppTransition: function (...args) { + console.warn("WindowAnimationController.onAppTransition interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + onMinimizeWindow: function (...args) { + console.warn("WindowAnimationController.onMinimizeWindow interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + onCloseWindow: function (...args) { + console.warn("WindowAnimationController.onCloseWindow interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + onScreenUnlock: function (...args) { + console.warn("WindowAnimationController.onScreenUnlock interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + } + + const windowAnimationManager = { + WindowAnimationController, + WindowAnimationFinishedCallback, + WindowAnimationTarget, + RRect, + setController: function (...args) { + console.warn("windowAnimationManager.setController interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + } + } + return windowAnimationManager +} \ No newline at end of file