mirror of
https://github.com/openharmony/third_party_jsframework.git
synced 2026-07-19 14:33:33 -04:00
Mock:截屏监听、窗口截图接口
Signed-off-by: realice <hanbing12@huawei.com> Change-Id: Ia366605c8c263fb9adae7ca5ad40ee3679ff7c7f
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
import { paramMock } from "../utils"
|
||||
import { PixelMapMock } from "./ohos_multimedia_image"
|
||||
|
||||
export const WindowType = {
|
||||
TYPE_APP: 0,
|
||||
@@ -533,6 +534,7 @@ export const Window = {
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
if (args[0] === 'keyboardHeightChange'|| args[0] === 'systemAvoidAreaChange'
|
||||
|| args[0] === 'windowSizeChange'|| args[0] === 'touchOutside'|| args[0] === 'avoidAreaChange'
|
||||
|| args[0] === 'screenshot'
|
||||
){
|
||||
console.warn(`Window.on you has registered ${args[0]} event`)
|
||||
} else {
|
||||
@@ -549,6 +551,7 @@ export const Window = {
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
if (args[0] === 'keyboardHeightChange'|| args[0] === 'systemAvoidAreaChange'
|
||||
|| args[0] === 'windowSizeChange'|| args[0] === 'touchOutside'|| args[0] === 'avoidAreaChange'
|
||||
|| args[0] === 'screenshot'
|
||||
){
|
||||
console.warn(`Window.off you has registered ${args[0]} event`)
|
||||
} else {
|
||||
@@ -594,6 +597,18 @@ export const Window = {
|
||||
})
|
||||
}
|
||||
},
|
||||
snapshot: function (...args) {
|
||||
console.warn("Window.snapshot 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, PixelMapMock)
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(PixelMapMock)
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
export const windowMock = Window
|
||||
|
||||
Reference in New Issue
Block a user