mirror of
https://github.com/openharmony/third_party_jsframework.git
synced 2026-07-18 20:44:48 -04:00
@@ -16,74 +16,6 @@
|
||||
import { paramMock } from './utils';
|
||||
|
||||
export function mockAccessibility() {
|
||||
const AbilitySubTypeMock = {
|
||||
UNSPECIFIED: 0,
|
||||
CA: 1
|
||||
};
|
||||
|
||||
const DisplayOrientationMock = {
|
||||
UNSPECIFIED: 1,
|
||||
LANDSCAPE: 2,
|
||||
PORTRAIT: 3,
|
||||
FOLLOWRECENT: 4
|
||||
};
|
||||
const LaunchModeMock = {
|
||||
SINGLETON: 0,
|
||||
STANDARD: 1
|
||||
};
|
||||
|
||||
const ApplicationInfoMock = {
|
||||
name: '[PC Preview] unknow name',
|
||||
description: '[PC Preview] unknow description',
|
||||
descriptionId: '[PC Preview] unknow descriptionId',
|
||||
systemApp: '[PC Preview] unknow systemApp',
|
||||
enabled: '[PC Preview] unknow enabled',
|
||||
label: '[PC Preview] unknow label',
|
||||
labelId: '[PC Preview] unknow labelId',
|
||||
icon: '[PC Preview] unknow icon',
|
||||
iconId: '[PC Preview] unknow iconId',
|
||||
process: '[PC Preview] unknow process',
|
||||
supportedModes: '[PC Preview] unknow supportedModes',
|
||||
moduleSourceDirs: '[PC Preview] unknow moduleSourceDirs',
|
||||
permissions: '[PC Preview] unknow permissions',
|
||||
permissions: '[PC Preview] unknow permissions',
|
||||
flags: '[PC Preview] unknow flags',
|
||||
entryDir: '[PC Preview] unknow entryDir'
|
||||
};
|
||||
|
||||
const AbilityInfoMock = {
|
||||
bundleName: '[PC Preview] unknow bundleName',
|
||||
name: '[PC Preview] unknow name',
|
||||
label: '[PC Preview] unknow label',
|
||||
description: '[PC Preview] unknow description',
|
||||
icon: '[PC Preview] unknow icon',
|
||||
labelId: '[PC Preview] unknow labelId',
|
||||
descriptionId: '[PC Preview] unknow descriptionId',
|
||||
moduleName: '[PC Preview] unknow moduleName',
|
||||
iconId: '[PC Preview] unknow iconId',
|
||||
process: '[PC Preview] unknow process',
|
||||
targetAbility: '[PC Preview] unknow targetAbility',
|
||||
backgroundModes: '[PC Preview] unknow backgroundModes',
|
||||
isVisible: '[PC Preview] unknow isVisible',
|
||||
formEnabled: '[PC Preview] unknow formEnabled',
|
||||
type: AbilityTypeMock,
|
||||
subType: AbilitySubTypeMock,
|
||||
orientation: DisplayOrientationMock,
|
||||
launchMode: LaunchModeMock,
|
||||
permissions: '[PC Preview] unknow permissions',
|
||||
deviceTypes: '[PC Preview] unknow deviceTypes',
|
||||
deviceCapabilities: '[PC Preview] unknow deviceCapabilities',
|
||||
readPermission: '[PC Preview] unknow readPermission',
|
||||
writePermission: '[PC Preview] unknow writePermission',
|
||||
applicationInfo: ApplicationInfoMock,
|
||||
formEntity: '[PC Preview] unknow formEntity',
|
||||
minFormHeight: '[PC Preview] unknow minFormHeight',
|
||||
defaultFormHeight: '[PC Preview] unknow defaultFormHeight',
|
||||
minFormWidth: '[PC Preview] unknow minFormWidth',
|
||||
defaultFormWidth: '[PC Preview] unknow defaultFormWidth',
|
||||
uri: '[PC Preview] unknow uri'
|
||||
};
|
||||
|
||||
const AbilityTypeMock = {
|
||||
audible: 'audible',
|
||||
generic: 'generic',
|
||||
@@ -106,13 +38,30 @@ export function mockAccessibility() {
|
||||
id: '[PC Preview] unknow id',
|
||||
name: '[PC Preview] unknow name',
|
||||
bundleName: '[PC Preview] unknow bundleName',
|
||||
abilityInfo: AbilityInfoMock,
|
||||
abilityTypes: [AbilityTypeMock],
|
||||
capabilities: [CapabilityMock],
|
||||
description: '[PC Preview] unknow description',
|
||||
eventTypes: [EventTypeMock]
|
||||
};
|
||||
|
||||
const CaptionsFontEdgeTypeMock = '[PC Preview] unknow CaptionsFontEdgeType';
|
||||
|
||||
const CaptionsFontFamilyMock = '[PC Preview] unknow CaptionsFontFamily';
|
||||
|
||||
const CaptionStyleMock = {
|
||||
fontFamily: [CaptionsFontFamilyMock],
|
||||
fontScale: '[PC Preview] unknow fontScale',
|
||||
fontColor: '[PC Preview] unknow fontColor',
|
||||
fontEdgeType: [CaptionsFontEdgeTypeMock],
|
||||
backgroundColor: '[PC Preview] unknow backgroundColor',
|
||||
windowColor: '[PC Preview] unknow windowColor'
|
||||
};
|
||||
|
||||
const CaptionsManagerMock = {
|
||||
enabled: '[PC Preview] unknow enabled',
|
||||
style: [CaptionStyleMock]
|
||||
};
|
||||
|
||||
const WindowUpdateTypeMock = '[PC Preview] unknow WindowUpdateType';
|
||||
|
||||
const ActionMock = '[PC Preview] unknow Action';
|
||||
@@ -207,6 +156,18 @@ export function mockAccessibility() {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
getCaptionsManager: function (...args) {
|
||||
console.warn('accessibility.getCaptionsManager 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, [CaptionsManagerMock]);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve([CaptionsManagerMock]);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user