!622 增加自定义动画属性的api mock

Merge pull request !622 from chenhaiying/master
This commit is contained in:
openharmony_ci 2022-08-08 13:36:40 +00:00 committed by Gitee
commit 8c954f2d77
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -135,6 +135,25 @@ export const ColorSpace = {
WIDE_GAMUT: 1
}
const TransitionController = {
animationForShown : function(...args) {
console.warn("TransitionController.animationForShown interface mocked in the Previewer. How this interface works on the" +
" Previewer may be different from that on a real device.")
},
animationForHidden : function(...args) {
console.warn("TransitionController.animationForHidden interface mocked in the Previewer. How this interface works on the" +
" Previewer may be different from that on a real device.")
}
}
const TransitionContext = {
toWindow: Window,
completeTransition : function(...args) {
console.warn("TransitionContext.completeTransition interface mocked in the Previewer. How this interface works on the" +
" Previewer may be different from that on a real device.")
}
}
export const WindowStageEventType = {
FOREGROUND: 1,
ACTIVE: 2,
@ -490,6 +509,18 @@ export const Window = {
})
}
},
hideWithAnimation: function(...args) {
console.warn("Window.hideWithAnimation 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)
} else {
return new Promise((resolve) => {
resolve()
})
}
},
show: function(...args) {
console.warn("Window.show interface mocked in the Previewer. How this interface works on the" +
" Previewer may be different from that on a real device.")
@ -502,6 +533,18 @@ export const Window = {
})
}
},
showWithAnimation: function(...args) {
console.warn("Window.showWithAnimation 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)
} else {
return new Promise((resolve) => {
resolve()
})
}
},
isShowing: function(...args) {
console.warn("Window.isShowing interface mocked in the Previewer. How this interface works on the" +
" Previewer may be different from that on a real device.")
@ -655,11 +698,52 @@ export const Window = {
console.warn("Window.setCornerRadius interface mocked in the Previewer. How this interface works on the" +
" Previewer may be different from that on a real device.")
},
opacity: function(...args) {
console.warn("Window.opacity interface mocked in the Previewer. How this interface works on the" +
" Previewer may be different from that on a real device.")
},
scale: function(...args) {
console.warn("Window.scale interface mocked in the Previewer. How this interface works on the" +
" Previewer may be different from that on a real device.")
},
rotate: function(...args) {
console.warn("Window.rotate interface mocked in the Previewer. How this interface works on the" +
" Previewer may be different from that on a real device.")
},
translate: function(...args) {
console.warn("Window.translate interface mocked in the Previewer. How this interface works on the" +
" Previewer may be different from that on a real device.")
},
getTransitionController: function() {
console.warn("Window.getTransitionController interface mocked in the Previewer. How this interface works on the" +
" Previewer may be different from that on a real device.")
return TransitionController;
}
}
export const windowMock = Window
export function mockWindow() {
const ScaleOptions = {
x: '[PC preview] unknow x',
y: '[PC preview] unknow y',
pivotX: '[PC preview] unknow pivotX',
pivotY: '[PC preview] unknow pivotY'
}
const RotateOptions = {
x: '[PC preview] unknow x',
y: '[PC preview] unknow y',
z: '[PC preview] unknow z',
pivotX: '[PC preview] unknow pivotX',
pivotY: '[PC preview] unknow pivotY'
}
const TranslateOptions = {
x: '[PC preview] unknow x',
y: '[PC preview] unknow y',
z: '[PC preview] unknow z'
}
const window = {
BlurStyle: {
@ -804,6 +888,11 @@ export function mockWindow() {
Size,
WindowProperties,
ColorSpace,
ScaleOptions,
RotateOptions,
TranslateOptions,
TransitionContext,
TransitionController,
WindowStageEventType,
WindowStage
}