diff --git a/graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets b/graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets index d03d3e67e1b2092706a9f0b65b08b4ff942a839f..ca987f9593a5f13192ddcbd77b97655710f45dd4 100644 --- a/graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets +++ b/graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets @@ -284,7 +284,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) console.log(msgStr + 'ohosWindow.create createWindowObj:' + JSON.stringify(createWindowObj)); let tempWnd = null; try { - // await ohosWindow.createWindow(createWindowObj).then((data) => { await ohosWindow.create(context, wndId, baseType).then((data) => { console.log(msgStr + 'ohosWindow.create data:' + JSON.stringify(data)); tempWnd = data @@ -431,91 +430,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) * @tc.name Test setSystemBarEnableTest1 * @tc.desc Verify that the scene shows the status bar and hides the navigation bar */ -// it('setSystemBarEnableTest1', 0, async function (done) { -// let caseName = 'setSystemBarEnableTest1'; -// let msgStr = 'jsunittest ' + caseName + ' '; -// let statusFlag = listenerStatus.ready; -// let navigationFlag = listenerStatus.ready; -// console.log(msgStr + 'begin'); -// console.log(msgStr + 'tempWnd.on systemBarTintChange finished'); -// let tempWnd = await windowStage.getMainWindow().catch((err) => { -// unexpectedError(err, caseName, 'windowStage.getMainWindow', done); -// }); -// console.log(msgStr + 'windowStage.getMainWindow, tempWnd: ' + tempWnd); -// expect(!!tempWnd).assertTrue(); -// await tempWnd.show().catch((err) => { -// unexpectedError(err, caseName, 'tempWnd.show', done); -// }); -// console.log(msgStr + 'tempWnd.show success'); -// await tempWnd.setFullScreen(true).catch((err) => { -// unexpectedError(err, caseName, 'tempWnd.setFullScreen(true)', done); -// }); -// console.log(msgStr + 'tempWnd.setFullScreen(true) success'); -// await tempWnd.setSystemBarEnable(['navigation']).catch((err) => { -// unexpectedError(err, caseName, 'tempWnd.setSystemBarEnable([navigation])', done); -// }); -// console.log(msgStr + 'tempWnd.setSystemBarEnable([navigation]) success'); -// await sleep(1000); -// statusFlag = listenerStatus.pending; -// navigationFlag = listenerStatus.pending; -// if (statusFlag === listenerStatus.pending || navigationFlag === listenerStatus.pending) { -// console.log(msgStr + 'start on !!!!'); -// listenerData.on = true; -// listenerData.typeStr = 'systemBarTintChange'; -// ohosWindow.on('systemBarTintChange', (systemBarData) => { -// console.log(msgStr + 'tempWnd.on systemBarTintChange, systemBatData : ' + JSON.stringify(systemBarData)); -// console.log(msgStr + 'tempWnd.on , statusFlag : ' + JSON.stringify(statusFlag)); -// console.log(msgStr + 'tempWnd.on , listenerStatus.pending : ' + JSON.stringify(listenerStatus.pending)); -// console.log(msgStr + 'tempWnd.on , navigationFlag : ' + JSON.stringify(navigationFlag)); -// console.log(msgStr + 'tempWnd.on , listenerStatus.pending : ' + JSON.stringify(listenerStatus.pending)); -// -// setTimeout(() => { -// console.log(msgStr + 'tempWnd.on , 3 statusFlag : ' + JSON.stringify(statusFlag)); -// console.log(msgStr + 'tempWnd.on , 3 listenerStatus.pending : ' + JSON.stringify(listenerStatus.pending)); -// console.log(msgStr + 'tempWnd.on , 3 navigationFlag : ' + JSON.stringify(navigationFlag)); -// console.log(msgStr + 'tempWnd.on , 3 listenerStatus.pending : ' + JSON.stringify(listenerStatus.pending)); -// -// if (statusFlag === listenerStatus.pending || navigationFlag === listenerStatus.pending) { -// console.log(msgStr + 'systemBarTintChange compare start!'); -// expect(!!systemBarData).assertTrue(); -// expect(!!systemBarData.regionTint).assertTrue(); -// let arrLength = systemBarData.regionTint.length; -// getData(0, arrLength) -// -// function getData(i, length) { -// let tempData = systemBarData.regionTint[i]; -// console.log(msgStr + 'compare, type: ' + tempData.type + ';isEnable: ' + tempData.isEnable); -// if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR && statusFlag === listenerStatus.pending) { -// statusFlag = listenerStatus.finished; -// expect(!tempData.isEnable).assertTrue(); -// } else if (tempData.type === ohosWindow.WindowType.TYPE_NAVIGATION_BAR && navigationFlag === listenerStatus.pending) { -// navigationFlag = listenerStatus.finished; -// expect(tempData.isEnable).assertTrue(); -// } -// if (++i { -// unexpectedError(err, caseName, 'tempWnd.setSystemBarEnable([status])', done); -// }); -// console.log(msgStr + 'tempWnd.setSystemBarEnable([status]) success'); -// console.log(msgStr + 'tempWnd.setSystemBarEnable([status]) success, statusFlag : ' + JSON.stringify(statusFlag)); -// console.log(msgStr + 'tempWnd.setSystemBarEnable([status]) success, listenerStatus.pending : ' + JSON.stringify(listenerStatus.pending)); -// console.log(msgStr + 'tempWnd.setSystemBarEnable([status]) success, navigationFlag : ' + JSON.stringify(navigationFlag)); -// console.log(msgStr + 'tempWnd.setSystemBarEnable([status]) success, listenerStatus.pending : ' + JSON.stringify(listenerStatus.pending)); -// }) it('setSystemBarEnableTest1', 0, async function (done) { let caseName = 'setSystemBarEnableTest1'; let msgStr = 'jsunittest ' + caseName + ' '; diff --git a/graphic/windowStage/entry/src/main/ets/test/windowRefactorInterface.test.ets b/graphic/windowStage/entry/src/main/ets/test/windowRefactorInterface.test.ets index 006e9d89a24a15e469467faec496b6d04daec86b..6c8d6bf105e5ea9fba3d2520a8da2e35536cc48d 100644 --- a/graphic/windowStage/entry/src/main/ets/test/windowRefactorInterface.test.ets +++ b/graphic/windowStage/entry/src/main/ets/test/windowRefactorInterface.test.ets @@ -16,7 +16,6 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import ohosWindow from '@ohos.window'; - export default function windowRefactorInterfaceTest(context, windowStage, abilityStorage) { console.info('windowTest context: ' + JSON.stringify(context)) console.info('windowTest abilityStorage: ' + JSON.stringify(abilityStorage)) @@ -88,6 +87,8 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit it('setWindowSystemBarPropertiesTest1', 0, async function (done) { let cloneColorArr = JSON.parse(JSON.stringify(commonRGBColorArr)); let listenerFlag = listenerStatus.ready; + let caseName = 'setWindowSystemBarPropertiesTest1'; + let msgStr = 'jsunittest ' + caseName + ' '; console.info('setWindowSystemBarPropertiesTest1'); listenerData.on = true; listenerData.typeStr = 'systemBarTintChange'; @@ -101,7 +102,9 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit console.info(`ohosWindow.on catch error: ${JSON.stringify(error)}`) } let arrLength = systemBarData.regionTint.length; - for (let i = 0; i < arrLength; i++) { + getData(0, arrLength) + + function getData(i, length) { // 单个导航栏或者系统状态信息 let SystemBarRegionTint = systemBarData.regionTint[i]; if (SystemBarRegionTint.type === ohosWindow.WindowType.TYPE_STATUS_BAR || SystemBarRegionTint.type === ohosWindow.WindowType.TYPE_NAVIGATION_BAR) { @@ -114,6 +117,12 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit } catch (error) { console.info(`ohosWindow.on catch error: ${JSON.stringify(error)}`) } + if (++i < length) { + getData(i, length) + console.log(msgStr+'jixuzhixing i: ' + i); + } else { + console.log(msgStr+'i++ { console.info('setWindowSystemBarPropertiesTest1 success'); expect(TRUE_FLAG).assertTrue(); + if (++i < length) { + getData(i, length) + console.log(msgStr+'jixuzhixing i: ' + i); + } else { + console.log(msgStr+'i++ { console.info('setWindowSystemBarPropertiesTest1 error : ' + JSON.stringify(err)); @@ -172,6 +189,8 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit let listenerFlag = listenerStatus.ready; listenerData.on = true; listenerData.typeStr = 'systemBarTintChange'; + let caseName = 'setWindowSystemBarPropertiesTest2'; + let msgStr = 'jsunittest ' + caseName + ' '; console.info('setWindowSystemBarPropertiesTest2'); ohosWindow.on('systemBarTintChange', (systemBarData) => { console.info('setWindowSystemBarPropertiesTest2 systemBatData : ' + JSON.stringify(systemBarData)); @@ -240,7 +259,9 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit await sleep(1000); listenerFlag = listenerStatus.pending; let loopCount = commonNUMBERColorArr.length; - for (let i = 0; i < loopCount; i++) { + getData(0, loopCount) + + function getData(i, length) { let tempColor = commonNUMBERColorArr[i]; let systemBarProperties = { statusBarColor: tempColor, @@ -252,6 +273,12 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit }; mainWsync.setWindowSystemBarProperties(systemBarProperties).then(() => { console.info('setWindowSystemBarPropertiesTest2 success'); + if (++i < length) { + getData(i, length) + console.log(msgStr + 'jixuzhixing i: ' + i); + } else { + console.log(msgStr + 'i++ { @@ -270,6 +297,8 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit it('setWindowSystemBarPropertiesTest3', 0, async function (done) { let cloneColorArr = JSON.parse(JSON.stringify(commonKEYColorArr)); let listenerFlag = listenerStatus.ready; + let caseName = 'setWindowSystemBarPropertiesTest3'; + let msgStr = 'jsunittest ' + caseName + ' '; console.info('setWindowSystemBarPropertiesTest3 start'); listenerData.on = true; listenerData.typeStr = 'systemBarTintChange'; @@ -315,7 +344,9 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit await sleep(1000); listenerFlag = listenerStatus.pending; let loopCount = commonKEYColorArr.length; - for (let i = 0; i < loopCount; i++) { + getData(0, loopCount) + + function getData(i, length) { let tempColor = commonKEYColorArr[i]; let systemBarProperties = { statusBarColor: tempColor, @@ -327,6 +358,12 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit }; tempWnd.setWindowSystemBarProperties(systemBarProperties).then(() => { console.info('setWindowSystemBarPropertiesTest3 success'); + if (++i < length) { + getData(i, length) + console.log(msgStr + 'jixuzhixing i: ' + i); + } else { + console.log(msgStr + 'i++ {