mirror of
https://gitee.com/openharmony/third_party_jsframework
synced 2024-11-27 00:40:37 +00:00
add mock for getCutoutInfo
Signed-off-by: xpeng <pengxin33@huawei.com> Change-Id: I2ff8847d1cb9a04acbfdd3d5779cd6a507f0d0df
This commit is contained in:
parent
a2bcc90ab8
commit
214b3bc3aa
@ -30,6 +30,29 @@ const DisplayType = {
|
||||
change: 'change'
|
||||
}
|
||||
|
||||
export const Rect = {
|
||||
left: '[PC preview] unknow left',
|
||||
top: '[PC preview] unknow top',
|
||||
width: '[PC preview] unknow width',
|
||||
height: '[PC preview] unknow height',
|
||||
}
|
||||
|
||||
export const WaterfallDisplayAreaRects = {
|
||||
left: Rect,
|
||||
top: Rect,
|
||||
width: Rect,
|
||||
height: Rect
|
||||
}
|
||||
|
||||
export const allBoudingRectsMock = [
|
||||
Rect
|
||||
]
|
||||
|
||||
export const CutoutInfo = {
|
||||
boundingRects: allBoudingRectsMock,
|
||||
waterfallDisplayAreaRects: WaterfallDisplayAreaRects
|
||||
}
|
||||
|
||||
export const Display = {
|
||||
id: '[PC preview] unknow id',
|
||||
name: '[PC preview] unknow name',
|
||||
@ -43,7 +66,19 @@ export const Display = {
|
||||
densityPixels: '[PC preview] unknow densityPixels',
|
||||
scaledDensity: '[PC preview] unknow scaledDensity',
|
||||
xDPI: '[PC preview] unknow xDPI',
|
||||
yDPI: '[PC preview] unknow yDPI'
|
||||
yDPI: '[PC preview] unknow yDPI',
|
||||
getCutoutInfo: function(...args) {
|
||||
console.warn('Display.getCutoutInfo 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, CutoutInfo);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(CutoutInfo);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function mockDisplay() {
|
||||
|
Loading…
Reference in New Issue
Block a user