diff --git a/4011/xts_demo/entry/src/main/src/test/Ability.test.ets b/4011/xts_demo/entry/src/main/src/test/Ability.test.ets index 590f9d170039ec9ac1c0755e431994b36e3f6c09..ea6b64dde40a13ea47e34c54bc23e09b86bcca66 100644 --- a/4011/xts_demo/entry/src/main/src/test/Ability.test.ets +++ b/4011/xts_demo/entry/src/main/src/test/Ability.test.ets @@ -1,7 +1,14 @@ -import { describe, it, expect, TestType, Size, Level} from "../../index"; +import { describe, it, expect, TestType, Size, Level, beforeAll} from "../../index"; import hilog from '@ohos.hilog' +import window from '@ohos.window' +import { BusinessError } from '@ohos.base' import abilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; import Utils from './Util.test'; +import { AppStorage } from '@ohos.arkui.stateManagement'; +import display from '@ohos.display' +import type { AsyncCallback, Callback } from '@ohos.base' +import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession'; + let domain: number = 0x0000; //日志标识,0x0000作为测试框架的业务标识 let tag: string = 'testTag'; //日志标识字符串,作为tag标识当前runner类下的测试行为 @@ -9,20 +16,989 @@ export default function abilityTest() { let abilityDelegator:abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator() describe("abilityTest", (): void => { hilog.info(domain, tag, '%{public}s', 'describe start'); - it("abilityTest001", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { - hilog.info(domain, tag, '%{public}s', 'abilityTest001 start'); + //let sleep = (sleepMs: number) => new Promise(resolve => setTimeout(resolve, sleepMs)); + //let context: common.UIAbilityContext; + let windowStage: window.WindowStage; + let win: window.Window; + // let session:UIExtensionContentSession; + //let isAutoWindow: string = ''; + //let isPCStatus: string = ''; + beforeAll(() => { + //context = AppStorage.get('context') as common.UIAbilityContext; + //console.log('windowTest context: ' + JSON.stringify(context)) + windowStage = AppStorage.get('windowStage') as window.WindowStage; + win = windowStage.getMainWindowSync(); + + //isAutoWindow = settings.getValueSync(context, 'window_pcmode_switch_status', '',settings.domainName.DEVICE_SHARED); + //console.info(`isAutoWindow: ${JSON.stringify(isAutoWindow)}`); + //isPCStatus = settings.getValueSync(context, 'isStatusBarExist', '', settings.domainName.USER_PROPERTY) + //isPCStatus == '' 非PC设备 + //isPCStatus == '1' PC设备状态栏dock未融合 + //isPCStatus == '0' PC设备状态栏dock融合 + //console.info(`beforeAll isPCStatus: `+ isPCStatus); + }) + it("testGetMainWindowCallBack", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + hilog.info(domain, tag, '%{public}s', 'testGetMainWindowCallBack start'); + windowStage.getMainWindow((err: BusinessError, data: window.Window) => { + const errCode: number = err.code; + if (errCode) { + console.error(`finaltest [ANI] getMainWindow callback fail . Cause code: ${err.code}, message: ${err.message}`); + expect(false).assertTrue(); + done(); + } + let win2 = data; + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] getMainWindow callback success' + JSON.stringify(win2)); + expect(win2 != null).assertTrue(); + done(); + }); + }) + it("testGetMainWindowPromise", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + hilog.info(domain, tag, '%{public}s', 'testGetMainWindowPromise start'); + windowStage.getMainWindow().then((ret: window.Window): void => { + expect(ret != null).assertTrue(); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] getMainWindow promise success ' + JSON.stringify(ret)); + }).catch((e: NullishType): void => { + let err = e as BusinessError; + expect(false).assertTrue(); + hilog.info(0x0000, '[ANI]', `finaltest [ANI] getMainWindow promise Failed . Cause code: ${err.code}, message: ${err.message}`); + }); + done(); + }) + it("testsetWaterMarkFlagCallBack", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + hilog.info(domain, tag, '%{public}s', 'testGetMainWindowCallBack start'); + win.setWaterMarkFlag(true,(err: BusinessError) : void=> { + const errCode: number = err.code; + if (errCode) { + expect(false).assertTrue(); + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWaterMarkFlag callback Failed , Cause code: ${err.code}, message: ${err.message}`); + done(); + } + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWaterMarkFlag callback Succeed ` ); + }); + expect(true).assertTrue(); + done(); + }) + it("testsetWaterMarkFlagPromise", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + win.setWaterMarkFlag(true).then((): void => { + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setWaterMarkFlag promise Succeeded ' + JSON.stringify(win)); + }).catch((e: NullishType): void => { + expect(false).assertTrue(); + let err = e as BusinessError; + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setWaterMarkFlag promise fall ' + JSON.stringify(e)); + }); + expect(true).assertTrue(); + done(); + }) + + it("testgetPropertiesCallBack", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + hilog.info(domain, tag, '%{public}s', 'testGetMainWindowCallBack start'); + win.getProperties((err: BusinessError, properties: window.WindowProperties) : void=> { + const errCode: number = err.code; + if (errCode) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] getProperties callback Failed , Cause code: ${err.code}, message: ${err.message}`); + expect(false).assertTrue(); + done(); + } + expect(properties!= null).assertTrue(); + hilog.info(0x0000, '[ANI]', `finaltest [ANI] getProperties callback Succeed` + JSON.stringify(properties)); + }); + done(); + }) + + it("testgetPropertiesPromise", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + win.getProperties().then((ret: window.WindowProperties): void => { + expect(ret != null).assertTrue(); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] getProperties promise Succeeded' + JSON.stringify(ret)); + }).catch((e: NullishType): void => { + + let err = e as BusinessError; + hilog.info(0x0000, '[ANI]', + `finaltest [ANI] getProperties promis Failed, Cause code: ${err.code}, message: ${err.message}`); + expect(false).assertTrue(); + }); + done(); + }) + it("testgetWindowProperties", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { try{ - let context = abilityDelegator.getAppContext() - hilog.info(domain, tag, '%{public}s', '1111111'+ context.filesDir); - }catch(err){ - hilog.info(domain, tag, '%{public}s', '222222'+ JSON.stringify(err)); + let ret= win.getWindowProperties(); + expect(ret != null).assertTrue(); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] getWindowProperties sync Succeeded' + JSON.stringify(ret)); + }catch(e:Error){ + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] getWindowProperties fail'); + expect(false).assertTrue(); } - hilog.info(domain, tag, '%{public}s', 'abilityTest001 second'); - expect(8.0).assertLarger(7.0) - hilog.info(domain, tag, '%{public}s', 'abilityTest001 three'); - done() - hilog.info(domain, tag, '%{public}s', 'abilityTest001 end'); + done(); }) + + it("testsetWindowDecorHeight", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + try { + win.setWindowDecorHeight(100); + expect(true).assertTrue(); + hilog.info(0x0000, "hh", "finaltest [ANI] setWindowDecorHeight success"); + } + catch (e: Error) { + expect(false).assertTrue(); + hilog.error(0x0000, "hh", "finaltest [ANI] setWindowDecorHeight error"); + } + done(); + }) + it("testgetWindowDecorHeight", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + try { + let decorHeight = win.getWindowDecorHeight(); + hilog.info(0x0000, "hh", "finaltest [ANI] getWindowDecorHeight success"+JSON.stringify(decorHeight)); + expect(true).assertTrue(); + } + catch (e: Error) { + expect(false).assertTrue(); + hilog.error(0x0000, "hh", "finaltest [ANI] getWindowDecorHeight error"); + } + done(); + }) + + it("testsetWindowDecorVisible", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + try { + win.setWindowDecorVisible(false); + hilog.info(0x0000, "hh", "finaltest [ANI] setWindowDecorVisible success"); + expect(true).assertTrue(); + } + catch (e: Error) { + hilog.error(0x0000, "hh", "finaltest [ANI] testsetWindowDecorVisible error"+e); + expect(false).assertTrue(); + } + done(); + }) + + it("testsetSpecificSystemBarEnabled", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + win.setSpecificSystemBarEnabled("status", true, true).then((): void => { + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setSpecificSystemBarEnabled promise Succeeded'); + + expect(true).assertTrue(); + }).catch((e: NullishType): void => { + let err = e as BusinessError; + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setSpecificSystemBarEnabled promise Failed, Cause code: ${err.code}, message: ${err.message}`); + expect(false).assertTrue(); + }); + done(); + }) + it("testsetWindowKeepScreenOnCallBack", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + try { + win.setWindowKeepScreenOn(false, (err: BusinessError): void => { + const errCode: number = err.code; + if (errCode) { + expect(false).assertTrue(); + hilog.info(0x0000, '[ANI]', + `finaltest [ANI] setWindowKeepScreenOn callback Failed, Cause code: ${err.code}, message: ${err.message}`); + done(); + } + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowKeepScreenOn callback Succeed`); + expect(true).assertTrue(); + }); + } catch (e: Error) { + hilog.error(0x0000, '[ani]', 'finaltest [ANI] setWindowKeepScreenOn callback Failed: ' + e.message); + expect(false).assertTrue(); + } + done(); + }) + it("testsetWindowKeepScreenOnPromise", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + win.setWindowKeepScreenOn(true).then((): void => { + expect(true).assertTrue(); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setWindowKeepScreenOn promise Succeeded'); + }).catch((e: NullishType): void => { + expect(false).assertTrue(); + let err = e as BusinessError; + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowKeepScreenOn promise Failed, Cause code: ${err.code}, message: ${err.message}`); + }); + done(); + }) + it("testsetWindowSystemBarEnableCallBack", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + let names: 'status' | 'navigation' = 'status'; + try { + win.setWindowSystemBarEnable(Array.of(names), (err: BusinessError):void => { + const errCode: number = err.code; + if (errCode) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowSystemBarEnable callback Failed, Cause code: ${err.code}, message: ${err.message}`); + expect(false).assertTrue(); + done(); + } + expect(true).assertTrue(); + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowSystemBarEnable callback Succeed`); + }); + } catch (e: Error) { + expect(false).assertTrue(); + hilog.error(0x0000, '[ani]', 'finaltest [ANI] setWindowSystemBarEnable callback Failed: ' + e.message); + } + done(); + }) + it("testsetWindowSystemBarEnablePromise", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + let names: 'status' | 'navigation' = 'status'; + win.setWindowSystemBarEnable(Array.of(names)).then((): void => { + expect(true).assertTrue(); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setWindowSystemBarEnable promise Succeeded'); + }).catch((e: NullishType): void => { + expect(false).assertTrue(); + let err = e as BusinessError; + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowSystemBarEnable promise Failed, Cause code: ${err.code}, message: ${err.message}`); + }); + done(); + }) + it("testsetShowOnLockScreen", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + try{ + windowStage.setShowOnLockScreen(false); + expect(true).assertTrue(); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setShowOnLockScreen Succeeded'); + }catch(e:Error){ + expect(false).assertTrue(); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setShowOnLockScreen error'+e); + } + done(); + }) + it("testsetWindowBackgroundColorSync", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + let color: string = '#00ff33'; + try { + win.setWindowBackgroundColor(color); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setWindowBackgroundColor sync success '); + expect(true).assertTrue(); + } catch (e: Error) { + hilog.error(0x0000, '[ANI]', 'finaltest [ANI] setWindowBackgroundColor sync Failed: ' + e.message); + expect(false).assertTrue(); + } + done(); + }) + it("testsetBackgroundColorCallBack", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + let color: string = '#00ff33'; + try { + let names: 'status' | 'navigation' = 'status'; + win.setBackgroundColor(color, (err: BusinessError) => { + const errCode: number = err.code; + if (errCode) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setwindowbackgroundcolor callback Failed, Cause code: ${err.code}, message: ${err.message}`); + expect(false).assertTrue(); + done(); + } + expect(true).assertTrue(); + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setwindowbackgroundcolor callback Succeed`); + }); + } catch (e: Error) { + expect(false).assertTrue(); + hilog.error(0x0000, '[ani]', 'finaltest [ANI] setwindowbackgroundcolor callback Failed: ' + e.message); + } + done(); + }) + it("testsetBackgroundColorPromise", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + let color: string = '#00ff33'; + let names: 'status' | 'navigation' = 'status'; + win.setBackgroundColor(color).then((): void => { + expect(true).assertTrue(); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setwindowbackgroundcolor promise Succeeded'); + }).catch((e: NullishType): void => { + expect(false).assertTrue(); + let err = e as BusinessError; + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setwindowbackgroundcolor promise Failed, Cause code: ${err.code}, message: ${err.message}`); + }); + done(); + }) + it("testisWindowSupportWideGamutCallBack", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + try{ + win.isWindowSupportWideGamut((err: BusinessError, data: boolean) => { + const errCode: number = err.code; + if (errCode) { + hilog.info(0x0000, '[ANI]' ,'finaltest [ANI] isWindowSupportWideGamut callback Failed '+errCode); + expect(false).assertTrue(); + done(); + } + hilog.info(0x0000, '[ANI]' ,'finaltest [ANI] isWindowSupportWideGamut callback success= '+ data); + expect(true).assertTrue(); + }); + }catch(e:Error){ + hilog.info(0x0000, '[ANI]' ,'finaltest [ANI] isWindowSupportWideGamut callback Failed'+ e); + expect(false).assertTrue(); + } + done(); + }) + it("testisWindowSupportWideGamutPromise", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + win.isWindowSupportWideGamut().then((data: boolean): void => { + expect(false).assertTrue(); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] isWindowSupportWideGamut promise Succeeded'+data); + }).catch((e: NullishType): void => { + expect(false).assertTrue(); + let err = e as BusinessError; + hilog.info(0x0000, '[ANI]', `finaltest [ANI] isWindowSupportWideGamut promise Failed , Cause code: ${err.code}, message: ${err.message}`); + }); + done(); + }) + it("testsetWindowSystemBarPropertiesSync", TestType.FUNCTION|Size.MEDIUMTEST|Level.LEVEL1, async (done: () => void): Promise => { + try{ + let systemBarProperties: window.SystemBarProperties = { + statusBarColor: '#ff00ff', + navigationBarColor: '#00ff00', + //以下两个属性从API Version8开始支持 + statusBarContentColor: '#ffffff', + navigationBarContentColor: '#00ffff' + }; + win.setWindowSystemBarProperties(systemBarProperties); + expect(true).assertTrue(); + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowSystemBarProperties sync Succeeded `); + }catch(e:Error){ + expect(false).assertTrue(); + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowSystemBarProperties sync Failed , Cause code: ${e}`); + } + done(); + }) + + it("testSetWindowSystemBarPropertiesCallback", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, + async (done: () => void): Promise => { + hilog.info(domain, tag, '%{public}s', 'testSetWindowSystemBarPropertiesCallback start'); + let systemBarProperties: window.SystemBarProperties = { + statusBarColor: '#ff00ff', + navigationBarColor: '#00ff00', + //以下两个属性从API Version8开始支持 + statusBarContentColor: '#ffffff', + navigationBarContentColor: '#00ffff' + }; + try { + let names: 'status' | 'navigation' = 'status'; + win.setWindowSystemBarProperties(systemBarProperties, (err: BusinessError) : void => { + const errCode: number = err.code; + if (errCode) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowSystemBarProperties callback Failed , Cause code: ${err.code}, message: ${err.message}`); + expect(false).assertTrue(); + done(); + } + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowSystemBarProperties callback Succeed`); + expect(true).assertTrue(); + }); + } catch (e: Error) { + hilog.error(0x0000, '[ani]', 'finaltest [ANI] setWindowSystemBarProperties callback Failed: ' + e.message); + expect(false).assertTrue(); + } + done(); + }); + it("testSetWindowSystemBarPropertiesPromise", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, + async (done: () => void): Promise => { + hilog.info(domain, tag, '%{public}s', 'testSetWindowSystemBarPropertiesPromise start'); + let systemBarProperties: window.SystemBarProperties = { + statusBarColor: '#ff00ff', + navigationBarColor: '#00ff00', + //以下两个属性从API Version8开始支持 + statusBarContentColor: '#ffffff', + navigationBarContentColor: '#00ffff' + }; + win.setWindowSystemBarProperties(systemBarProperties).then((): void => { + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setWindowSystemBarProperties promise Succeeded'); + expect(true).assertTrue(); + done(); + }).catch((e: NullishType): void => { + let err = e as BusinessError; + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowSystemBarProperties promise Failed, Cause code: ${err.code}, message: ${err.message}`); + expect(false).assertTrue(); + done(); + }); + done(); + }); + it("testSetWindowLayoutFullScreenCallback", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, + async (done: () => void): Promise => { + hilog.info(domain, tag, '%{public}s', 'testSetWindowLayoutFullScreenCallback start'); + try { + let names: 'status' | 'navigation' = 'status'; + win.setWindowLayoutFullScreen(true, (err: BusinessError) => { + const errCode: number = err.code; + if (errCode) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowLayoutFullScreen callback Failed, Cause code: ${err.code}, message: ${err.message}`); + expect(false).assertTrue(); + done(); + } + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowLayoutFullScreen callback Succeed`); + expect(true).assertTrue(); + done(); + }); + } catch (e: Error) { + hilog.error(0x0000, '[ani]', 'finaltest [ANI] setWindowLayoutFullScreen callback error: ' + e.message); + expect(false).assertTrue(); + done(); + } + done(); + }); + it("testSetWindowLayoutFullScreenPromise", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, + async (done: () => void): Promise => { + hilog.info(domain, tag, '%{public}s', 'testSetWindowLayoutFullScreenPromise start'); + win.setWindowLayoutFullScreen(true).then((): void => { + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setWindowLayoutFullScreen promise Succeeded'); + expect(true).assertTrue(); + done(); + }).catch((e: NullishType): void => { + let err = e as BusinessError; + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowLayoutFullScreen promise Failed, Cause code: ${err},:${err}`); + expect(false).assertTrue(); + done(); + }); + done(); + }); + it("testSetWindowLayoutFullScreenSync", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, (): void => { + hilog.info(domain, tag, '%{public}s', 'testSetWindowLayoutFullScreenSync start'); + + try { + win.setWindowLayoutFullScreen(true); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setWindowLayoutFullScreen sync Succeeded'); + expect(true).assertTrue(); + } catch (e) { + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setWindowLayoutFullScreen sync Failed: ' + e); + expect(false).assertTrue(); + } + }); + it("testSetImmersiveModeEnabledStateSync", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, + async (done: () => void): Promise => { + hilog.info(domain, tag, '%{public}s', 'testSetImmersiveModeEnabledStateSync start'); + try { + win.setImmersiveModeEnabledState(true); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setImmersiveModeEnabledState success'); + expect(true).assertTrue(); + done(); + } catch (err) { + hilog.error(0x0000, '[ANI]', 'finaltest [ANI] setImmersiveModeEnabledState failed'+err); + expect(false).assertTrue(); + done(); + } + }); + it("onOffWindowStatusChangeTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, + async (done: () => void): Promise => { + let callback = (data: window.WindowStatusType): void => { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] onOffWindowStatusChangeTest callback success status:${data as int}`); + }; + + try{ + win.on('windowStatusChange', callback); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] on_windowStatusChange success'); + expect(true).assertTrue(); + }catch(e: Error){ + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] on_WindowStatusChangeTest fail e:'+JSON.stringify(e)); + expect(false).assertTrue(); + } + + try{ + win.off('windowStatusChange', callback); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] off_windowStatusChange success'); + expect(true).assertTrue(); + }catch(e: Error){ + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] off_windowStatusChange fail e:'+JSON.stringify(e)); + expect(false).assertTrue(); + } + done(); + }); + it("onOffWindowSizeChangeTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, + async (done: () => void): Promise => { + let callback = (data: window.Size): void => { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] onOffWindowSizeChangeTest callback success:${JSON.stringify(data)}`); + }; + try{ + win.on('windowSizeChange', callback); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] on_windowSizeChange success'); + expect(true).assertTrue(); + }catch(e: Error){ + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] on_windowSizeChange fail e:'+JSON.stringify(e)); + expect(false).assertTrue(); + done(); + } + try{ + win.off('windowSizeChange', callback); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] off_windowSizeChange success'); + expect(true).assertTrue(); + }catch(e: Error){ + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] windowSizeChange fail e:'+JSON.stringify(e)); + expect(false).assertTrue(); + done(); + } + done(); + }); + + // 2. windowEvent监听测试 + it("onOffWindowEventTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, + async (done: () => void): Promise => { + let callback = (data: window.WindowEventType): void => { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] onOffWindowEventTest callback success:${data as int}`); + }; + try{ + win.on('windowEvent', callback); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] on_WindowEvent success'); + expect(true).assertTrue(); + }catch(e: Error){ + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] on WindowEvent fail e:'+JSON.stringify(e)); + expect(false).assertTrue(); + done(); + } + try{ + win.off('windowEvent', callback); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] off_WindowEvent success'); + expect(true).assertTrue(); + }catch(e: Error){ + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] off_WindowEvent fail e:'+JSON.stringify(e)); + expect(false).assertTrue(); + done(); + } + done(); + }); + + // 3. 禁用窗口装饰测试 + it("disableWindowDecorTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, + async (done: () => void): Promise => { + try{ + windowStage.disableWindowDecor(); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] disableWindowDecorTest Success'); + expect(true).assertTrue(); + }catch(e:Error){ + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] disableWindowDecorTest fail'+e.message); + expect(false).assertTrue(); + done(); + } + done(); + }); + + // 4. 获取窗口避让区域测试 + it("getWindowAvoidAreaTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, + async (done: () => void): Promise => { + try{ + let area = win.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] getWindowAvoidArea success:'+JSON.stringify(area)); + expect(area != null).assertTrue(); + }catch(e: Error){ + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] getWindowAvoidArea fail:'+JSON.stringify(e)); + expect(false).assertTrue(); + done(); + } + done(); + }); + it("recoverTestPromise", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + win.recover().then((): void => { + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] recover Succeeded'); + expect(true).assertTrue(); + }).catch((e: NullishType): void => { + let err = e as BusinessError; + hilog.info(0x0000, '[ANI]', `finaltest [ANI] recover fail. Cause code: ${err.code}, message: ${err.message}`); + expect(false).assertTrue(); + }); + done(); + }); + + it("recoverTestSync", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + try{ + win.recover(); + expect(true).assertTrue(); + }catch(e:Error){ + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] recover fail.'); + expect(false).assertTrue(); + } + done(); + }); + + it("setWindowColorSpaceTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + win.setWindowColorSpace(window.ColorSpace.WIDE_GAMUT, (err: BusinessError) => { + const errCode: number = err.code; + if (errCode) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowColorSpaceTest callback Failed . Cause code: ${err.code}, message: ${err.message}`); + expect(false).assertTrue(); + done(); + } + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setWindowColorSpaceTest callback Succeeded.'); + expect(true).assertTrue(); + }); + + try { + let promise = win.setWindowColorSpace(window.ColorSpace.WIDE_GAMUT); + promise.then((): void => { + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setWindowColorSpace promise success'); + expect(true).assertTrue(); + }).catch((err: NullishType): void => { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowColorSpace promise Failed. err: ${JSON.stringify(err)}`); + expect(false).assertTrue(); + }); + } catch (exception) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowColorSpaceTest promise Failed. Cause exception: ${JSON.stringify(exception)}`); + expect(false).assertTrue(); + } + done(); + }); + + it("setPreferredOrientationTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + win.setPreferredOrientation(window.Orientation.AUTO_ROTATION, (err: BusinessError) => { + const errCode: number = err.code; + if (errCode) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setPreferredOrientation callback Failed. Cause code : ${err.code}, message: ${err.message}`); + expect(false).assertTrue(); + done(); + } + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setPreferredOrientation callback Succeeded .'); + expect(true).assertTrue(); + }); + + try { + let promise = win.setPreferredOrientation(window.Orientation.AUTO_ROTATION); + promise.then((): void => { + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setPreferredOrientation promise success'); + expect(true).assertTrue(); + }).catch((err: NullishType): void => { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setPreferredOrientation promise Failed . err: ${JSON.stringify(err)}`); + expect(false).assertTrue(); + }); + } catch (exception) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setPreferredOrientation promise Failed. Cause exception: ${JSON.stringify(exception)}`); + expect(false).assertTrue(); + } + done(); + }); + + it("setWindowPrivacyModeTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + win.setWindowPrivacyMode(true, (err: BusinessError) => { + const errCode: number = err.code; + if (errCode) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowPrivacyMode callback Failed. Cause code: ${err.code}, message: ${err.message}`); + expect(false).assertTrue(); + done(); + } + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setWindowPrivacyMode callback Succeeded .'); + expect(true).assertTrue(); + }); + + try { + let promise = win.setWindowPrivacyMode(true); + promise.then((): void => { + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setWindowPrivacyMode promise success. Data: '); + expect(true).assertTrue(); + }).catch((err: NullishType): void => { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowPrivacyMode promise fail. err: ${JSON.stringify(err)}`); + expect(false).assertTrue(); + }); + } catch (exception) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setWindowPrivacyMode promise Failed. Cause exception: ${JSON.stringify(exception)}`); + expect(false).assertTrue(); + } + done(); + }); + + //setUIContentTest and loadcontent + it("setUIContentTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + try { + win.setUIContent('pages/Index', (err: BusinessError) => { + const errCode: number = err.code; + if (errCode) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setUIContentTest callback Failed errCode: ${JSON.stringify(errCode)}`); + expect(false).assertTrue(); + return; + } + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setUIContentTest callback Succeeded'); + expect(true).assertTrue(); + }); + } catch (exception) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setUIContentTest callback Failed exception: ${JSON.stringify(exception)}`); + expect(false).assertTrue(); + } + + try { + let promise = win.setUIContent('pages/Index'); + promise.then((): void => { + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] setUIContentTest promise success'); + expect(true).assertTrue(); + }).catch((err: NullishType): void => { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setUIContentTest promise Failed. err: ${JSON.stringify(err)}`); + expect(false).assertTrue(); + }); + } catch (exception) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] setUIContentTest promise Failed exception: ${JSON.stringify(exception)}`); + expect(false).assertTrue(); + } + done(); + }); + + it("loadContentTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + try { + win.loadContent('pages/Index', (err: BusinessError) => { + const errCode: number = err.code; + if (errCode) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] loadContent callback Failed Cause code: ${err.code}, message: ${err.message}`); + expect(false).assertTrue(); + return; + } + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] loadContent callback Succeeded'); + expect(true).assertTrue(); + }); + } catch (exception) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] loadContent callback Failed Cause exception: ${JSON.stringify(exception)}`); + expect(false).assertTrue(); + } + + try { + let promise = win.loadContent('pages/Index'); + promise.then((): void => { + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] loadContent promise success'); + expect(true).assertTrue(); + }).catch((err: NullishType): void => { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] loadContent promise Failed. err: ${JSON.stringify(err)}`); + expect(false).assertTrue(); + }); + } catch (exception) { + hilog.info(0x0000, '[ANI]', `finaltest [ANI] loadContent promise Failed Cause exception: ${JSON.stringify(exception)}`); + expect(false).assertTrue(); + } + done(); + }); + // display + it("isFoldableTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + try { + let foldable = display.isFoldable(); + hilog.info(0x0000, '[ANI]', `finaltest [ANI] isFoldable success: ${foldable}`); + expect(true).assertTrue(); + } catch (exception : Error) { + hilog.error(0x0000, '[ANI]', `finaltest [ANI] isFoldable fail: ${JSON.stringify(exception)}`); + expect(false).assertTrue(); + } + done(); + }); + + it("getFoldStatusTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + try { + let foldStatus = display.getFoldStatus(); + hilog.info(0x0000, '[ANI]', `finaltest [ANI] getFoldStatus success: ${JSON.stringify(foldStatus)}`); + expect(true).assertTrue(); + } catch (err) { + hilog.error(0x0000, '[ANI]', `finaltest [ANI] getFoldStatus fail: ${JSON.stringify(err)}`); + expect(false).assertTrue(); + } + done(); + }); + + it("getFoldDisplayModeTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + try { + let foldDisplayMode = display.getFoldDisplayMode(); + hilog.info(0x0000, '[ANI]', `finaltest [ANI] getFoldDisplayMode success. Data: ${JSON.stringify(foldDisplayMode)}`); + expect(true).assertTrue(); + } catch (err) { + hilog.error(0x0000, '[ANI]', `finaltest [ANI] getFoldDisplayMode fail. Data: ${JSON.stringify(err)}`); + expect(false).assertTrue(); + } + done(); + }); + + it("getCurrentFoldCreaseRegionTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + try { + let foldCreaseRegion: display.FoldCreaseRegion = display.getCurrentFoldCreaseRegion(); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] getCurrentFoldCreaseRegion success. Data: ' + JSON.stringify(foldCreaseRegion)); + expect(true).assertTrue(); + } catch (exception : Error) { + hilog.error(0x0000, '[ANI]', `finaltest [ANI] getCurrentFoldCreaseRegion fail. Err: ${JSON.stringify(exception)}`); + expect(false).assertTrue(); + } + done(); + }); + + // it("getDefaultDisplaySyncTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + // try { + // let display1 = display.getDefaultDisplaySync(); + // hilog.info(0x0000, '[ANI]', `finaltest [ANI] getDefaultDisplaySync success. Data: ${JSON.stringify(display1)}`); + // expect(true).assertTrue(); + // } catch (exception : Error) { + // hilog.error(0x0000, '[ANI]', `finaltest [ANI] getDefaultDisplaySync fail. Err: ${JSON.stringify(exception)}`); + // expect(false).assertTrue(); + // } + // done(); + // }); + + // it("getDisplayByIdSyncTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + // try { + // let displayId = 0; + // let display2 = display.getDisplayByIdSync(displayId); + // hilog.info(0x0000, '[ANI]', `finaltest [ANI] getDisplayByIdSync success. Data: ${JSON.stringify(display2)}`); + // expect(true).assertTrue(); + // } catch (exception : Error) { + // hilog.error(0x0000, '[ANI]', `finaltest [ANI] getDisplayByIdSync fail. Err: ${JSON.stringify(exception)}`); + // expect(false).assertTrue(); + // } + // done(); + // }); + + // it("getAllDisplaysPromiseTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + // try { + // let displays: Array; + // let promise: Promise> = display.getAllDisplays() as Promise>; + // promise.then((data: Array): void => { + // displays = data; + // hilog.info(0x0000, '[ANI]', 'finaltest [ANI] getAllDisplays promise succeed. Data: ' + JSON.stringify(data)); + // expect(true).assertTrue(); + // done(); + // }).catch((err: Error): void => { + // hilog.error(0x0000, '[ANI]', `finaltest [ANI] getAllDisplays promise Fail. Err: ${JSON.stringify(err)}`); + // expect(false).assertTrue(); + // done(); + // }); + // } catch (exception : Error) { + // hilog.info(0x0000, '[ANI]', `finaltest [ANI] getAllDisplays promise Fail. Err: ${JSON.stringify(exception)}`); + // expect(false).assertTrue(); + // done(); + // } + // }); + + // it("getAllDisplaysCallbackTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + // try { + // let displayClass: Array; + // display.getAllDisplays((err: Error, data: Array): void => { + // if (err) { + // hilog.error(0x0000, '[ANI]', `finaltest [ANI] getAllDisplays ayncCallback fail. Err: ${JSON.stringify(err)}`); + // expect(false).assertTrue(); + // done(); + // return; + // } + // hilog.info(0x0000, '[ANI]', 'finaltest [ANI] getAllDisplays ayncCallback succeed. Data: ' + JSON.stringify(data)); + // expect(true).assertTrue(); + // done(); + // }); + // } catch (err : Error) { + // hilog.error(0x0000, '[ANI]', `finaltest [ANI] getAllDisplays ayncCallback fail. Err: ${JSON.stringify(err)}`); + // expect(false).assertTrue(); + // done(); + // } + // }); + // + // it("getCutoutInfoPromiseTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + // let cutoutInfoDisplay: display.Display = display.getDefaultDisplaySync(); + // let cutoutInfoPromise: Promise = cutoutInfoDisplay.getCutoutInfo(); + // cutoutInfoPromise.then((data: display.CutoutInfo): void => { + // hilog.info(0x0000, '[ANI]', 'finaltest [ANI] getCutoutInfo promise succeed.'); + // expect(true).assertTrue(); + // done(); + // }).catch((err: Error): void => { + // hilog.error(0x0000, '[ANI]', `finaltest [ANI] getCutoutInfo promise fail. Err: ${JSON.stringify(err)}`); + // expect(false).assertTrue(); + // done(); + // }); + // }); + // + // it("getCutoutInfoCallbackTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + // let cutoutInfoDisplay: display.Display = display.getDefaultDisplaySync(); + // cutoutInfoDisplay.getCutoutInfo((err: BusinessError, data: display.CutoutInfo) => { + // if (err?.code) { + // hilog.error(0x0000, '[ANI]', `finaltest [ANI] getCutoutInfo callback fail. Err: ${err}`); + // expect(false).assertTrue(); + // done(); + // return; + // } + // hilog.info(0x0000, '[ANI]', 'finaltest [ANI] getCutoutInfo callback succeed.'); + // expect(true).assertTrue(); + // done(); + // }); + // }); + // + // it("displayAddListenerTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + // let callback1: Callback = (data: number):void => { + // hilog.info(0x0000, '[ANI]', 'Listening enabled. Data: ' + JSON.stringify(data)); + // }; + // try { + // display.on("add", callback1); + // display.off("add", callback1); + // hilog.info(0x0000, '[ANI]', 'finaltest [ANI] on_add success'); + // expect(true).assertTrue(); + // } catch (err: Error) { + // hilog.info(0x0000, '[ANI]', 'finaltest [ANI] on_add fail Err: '+ JSON.stringify(err)); + // expect(false).assertTrue(); + // } + // done(); + // }); + // + // it("foldStatusChangeListenerTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + // let callback2: Callback = (data: display.FoldStatus): void => { + // hilog.info(0x0000, '[ANI]', 'Listening enabled. Data: ' + JSON.stringify(data)); + // }; + // try { + // display.on("foldStatusChange", callback2); + // display.off("foldStatusChange", callback2); + // hilog.info(0x0000, '[ANI]', 'finaltest [ANI] off_foldStatusChange success'); + // expect(true).assertTrue(); + // } catch (err: Error) { + // hilog.info(0x0000, '[ANI]', 'finaltest [ANI] off_foldStatusChange fail'+err); + // expect(false).assertTrue(); + // } + // done(); + // }); + // + // it("foldDisplayModeChangeListenerTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + // let callback3: Callback = (data: display.FoldDisplayMode): void => { + // hilog.info(0x0000, '[ANI]', 'Listening enabled. Data: ' + JSON.stringify(data)); + // }; + // try { + // display.on("foldDisplayModeChange", callback3); + // display.off("foldDisplayModeChange", callback3); + // hilog.info(0x0000, '[ANI]', 'finaltest [ANI] off_foldDisplayModeChange success'); + // expect(true).assertTrue(); + // } catch (err: Error) { + // hilog.info(0x0000, '[ANI]', 'finaltest [ANI] off_foldDisplayModeChange fail'+err); + // expect(false).assertTrue(); + // } + // done(); + // }); + it("onOffFoldStatusChangeTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + let callback: Callback = (data: display.FoldStatus): void => { + hilog.info(0x0000, '[ANI]', 'Listening change enabled. Data: ' + JSON.stringify(data)); + }; + + try { + display.on("foldStatusChange", callback); + display.off("foldStatusChange", callback); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] on_off_foldStatusChange success'); + expect(true).assertTrue(); + } catch (err: Error) { + hilog.error(0x0000, '[ANI]', `finaltest [ANI] on_off_foldStatusChange Failed. message: ${err}`); + expect(false).assertTrue(); + } + done(); + }); + + it("onOffFoldDisplayModeChangeTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + let callback: Callback = (data: display.FoldDisplayMode): void => { + hilog.info(0x0000, '[ANI]', 'Listening change enabled. Data: ' + JSON.stringify(data)); + }; + + try { + display.on("foldDisplayModeChange", callback); + display.off("foldDisplayModeChange", callback); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] on_off_foldDisplayModeChange success'); + expect(true).assertTrue(); + } catch (err: Error) { + hilog.error(0x0000, '[ANI]', `finaltest [ANI] on_off_foldDisplayModeChange Failed. message: ${err}`); + expect(false).assertTrue(); + } + done(); + }); + + it("displayOnOffChangeTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + let callback: Callback = (data: number): void => { + hilog.info(0x0000, '[ANI]', 'Listening change enabled. Data: ' + JSON.stringify(data)); + }; + + try { + display.on("change", callback); + display.off("change", callback); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] display on_off_Change success'); + expect(true).assertTrue(); + } catch (err: Error) { + hilog.error(0x0000, '[ANI]', `finaltest [ANI] display on_off_Change Failed. message: ${err}`); + expect(false).assertTrue(); + } + done(); + }); + + it("screenOnOffChangeTest", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL1, async (done: () => void): Promise => { + let callback: Callback = (data: number): void => { + hilog.info(0x0000, '[ANI]', 'Listening change enabled. Data: ' + JSON.stringify(data)); + }; + + try { + display.on("change", callback); + display.off("change", callback); + hilog.info(0x0000, '[ANI]', 'finaltest [ANI] screen on_off_Change success'); + expect(true).assertTrue(); + } catch (err: Error) { + hilog.error(0x0000, '[ANI]', `finaltest [ANI] screen on_off_Change Failed. message: ${err}`); + expect(false).assertTrue(); + } + done(); + }); + }) hilog.info(domain, tag, '%{public}s', 'abilityTest end');