From 9cff66b67151579135a2b1aa1b785e80a11b90c1 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Thu, 21 Jul 2022 17:32:50 +0800 Subject: [PATCH] Signed-off-by: lovechinamo Changes to be committed: --- .../extend/systemplugin/napi/ohos_wallpaper.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_wallpaper.js b/runtime/main/extend/systemplugin/napi/ohos_wallpaper.js index 3a8e0a14..e8af46e3 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_wallpaper.js +++ b/runtime/main/extend/systemplugin/napi/ohos_wallpaper.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-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 @@ -48,6 +48,18 @@ export function mockWallpaper() { }) } }, + getFile: function (...args) { + console.warn("wallpaper.getFile interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, getMinHeight: function (...args) { console.warn("wallpaper.getMinHeight interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.")