未验证 提交 50ebdb52 编写于 作者: O openharmony_ci 提交者: Gitee

!6878 【窗口子系统】优化用例异步接口处理的问题

Merge pull request !6878 from 华华小仙女/master
...@@ -1964,14 +1964,14 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -1964,14 +1964,14 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
sumCount++ sumCount++
console.info(msgStr + 'Succeeded in setting the window mode. count: ' + sumCount); console.info(msgStr + 'Succeeded in setting the window mode. count: ' + sumCount);
console.info(msgStr + 'Succeeded in setting the window mode. loopCount.length: ' + loopCount.length); console.info(msgStr + 'Succeeded in setting the window mode. loopCount.length: ' + loopCount.length);
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length + ' ,tempType:' + tempType);
}
if (sumCount == loopCount.length) done(); if (sumCount == loopCount.length) done();
} }
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length + ' ,tempType:' + tempType);
}
}) })
} catch (exception) { } catch (exception) {
console.error(msgStr + 'try catch Failed to set the window mode. Cause: ' + JSON.stringify(exception)); console.error(msgStr + 'try catch Failed to set the window mode. Cause: ' + JSON.stringify(exception));
......
...@@ -574,7 +574,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -574,7 +574,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.info(`ohosWindow.on catch error: ${JSON.stringify(error)}`) console.info(`ohosWindow.on catch error: ${JSON.stringify(error)}`)
} }
let arrLength = systemBarData.regionTint.length; let arrLength = systemBarData.regionTint.length;
for (let i = 0; i < arrLength; i++) { getData(0, arrLength)
function getData(i, length) {
let tempData = systemBarData.regionTint[i]; let tempData = systemBarData.regionTint[i];
if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR || tempData.type === ohosWindow.WindowType.TYPE_NAVIGATION_BAR) { if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR || tempData.type === ohosWindow.WindowType.TYPE_NAVIGATION_BAR) {
console.log(msgStr + 'systemBarTintChange compare start!'); console.log(msgStr + 'systemBarTintChange compare start!');
...@@ -587,6 +589,12 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -587,6 +589,12 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
} catch (error) { } catch (error) {
console.info(`ohosWindow.on catch error: ${JSON.stringify(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++<length i: ' + i + ' ,length:' + length);
}
} }
} }
} }
...@@ -635,7 +643,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -635,7 +643,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'tempWnd.setSystemBarEnable([status, navigation]) success'); console.log(msgStr + 'tempWnd.setSystemBarEnable([status, navigation]) success');
listenerFlag = listenerStatus.pending; listenerFlag = listenerStatus.pending;
let loopCount = commonRGBColorArr.length let loopCount = commonRGBColorArr.length
for (let i = 0; i < loopCount; i++) { getData(0, loopCount)
function getData(i, length) {
let tempColor = commonRGBColorArr[i]; let tempColor = commonRGBColorArr[i];
let systemBarProperties = { let systemBarProperties = {
statusBarColor: tempColor, statusBarColor: tempColor,
...@@ -652,8 +662,15 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -652,8 +662,15 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
unexpectedError(err, caseName, 'tempWnd.setSystemBarProperties' + tempColor + ' ', done); unexpectedError(err, caseName, 'tempWnd.setSystemBarProperties' + tempColor + ' ', done);
} }
console.log(msgStr + 'tempWnd.setSystemBarProperties ' + tempColor + ' success'); console.log(msgStr + 'tempWnd.setSystemBarProperties ' + tempColor + ' success');
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
}) })
} }
setTimeout(() => { setTimeout(() => {
console.log(msgStr + 'time wait finished. compareCount: ' + compareCount); console.log(msgStr + 'time wait finished. compareCount: ' + compareCount);
listenerFlag = listenerStatus.finished; listenerFlag = listenerStatus.finished;
...@@ -806,7 +823,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -806,7 +823,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'tempWnd.setSystemBarEnable([status, navigation]) success'); console.log(msgStr + 'tempWnd.setSystemBarEnable([status, navigation]) success');
listenerFlag = listenerStatus.pending; listenerFlag = listenerStatus.pending;
let loopCount = commonNUMBERColorArr.length let loopCount = commonNUMBERColorArr.length
for (let i = 0; i < loopCount; i++) { getData(0, loopCount)
function getData(i, length) {
console.log(msgStr+'tempWnd.setSystemBarEnable i:'+i); console.log(msgStr+'tempWnd.setSystemBarEnable i:'+i);
let tempColor = commonNUMBERColorArr[i]; let tempColor = commonNUMBERColorArr[i];
let systemBarProperties = { let systemBarProperties = {
...@@ -827,6 +846,12 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -827,6 +846,12 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.info(`tempWnd.setSystemBarProperties catch error: ${JSON.stringify(error)}`) console.info(`tempWnd.setSystemBarProperties catch error: ${JSON.stringify(error)}`)
} }
} }
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
}) })
} }
}) })
...@@ -858,7 +883,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -858,7 +883,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.info(`ohosWindow.on catch error: ${JSON.stringify(error)}`) console.info(`ohosWindow.on catch error: ${JSON.stringify(error)}`)
} }
let arrLength = systemBarData.regionTint.length; let arrLength = systemBarData.regionTint.length;
for (let i = 0; i < arrLength; i++) { getData(0, arrLength)
function getData(i, length) {
let tempData = systemBarData.regionTint[i]; let tempData = systemBarData.regionTint[i];
if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR || tempData.type === ohosWindow.WindowType.TYPE_NAVIGATION_BAR) { if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR || tempData.type === ohosWindow.WindowType.TYPE_NAVIGATION_BAR) {
console.log(msgStr + 'systemBarTintChange compare start!'); console.log(msgStr + 'systemBarTintChange compare start!');
...@@ -871,6 +898,12 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -871,6 +898,12 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
} catch (error) { } catch (error) {
console.info(`ohosWindow.on catch error: ${JSON.stringify(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++<length i: ' + i + ' ,length:' + length);
}
} }
} }
} }
...@@ -919,7 +952,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -919,7 +952,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'tempWnd.setSystemBarEnable([status, navigation]) success'); console.log(msgStr + 'tempWnd.setSystemBarEnable([status, navigation]) success');
listenerFlag = listenerStatus.pending; listenerFlag = listenerStatus.pending;
let loopCount = commonRGBColorArr.length let loopCount = commonRGBColorArr.length
for (let i = 0; i < loopCount; i++) { getData(0, loopCount)
function getData(i, length) {
let tempColor = commonKEYColorArr[i]; let tempColor = commonKEYColorArr[i];
let systemBarProperties = { let systemBarProperties = {
statusBarColor: tempColor, statusBarColor: tempColor,
...@@ -938,6 +973,12 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -938,6 +973,12 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
} catch (error) { } catch (error) {
console.info(`tempWnd.setSystemBarProperties catch error: ${JSON.stringify(error)}`) console.info(`tempWnd.setSystemBarProperties catch error: ${JSON.stringify(error)}`)
} }
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
done(); done();
} }
}) })
...@@ -963,7 +1004,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -963,7 +1004,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'begin context==' + JSON.stringify(context)); console.log(msgStr + 'begin context==' + JSON.stringify(context));
let loopCount = appWindowTypeArr.length; let loopCount = appWindowTypeArr.length;
console.log(msgStr + 'loopCount: ' + loopCount); console.log(msgStr + 'loopCount: ' + loopCount);
for (let i = 0; i < loopCount; i++) { getData(0, loopCount)
function getData(i, length) {
let tempType = ohosWindow.WindowType.TYPE_APP; let tempType = ohosWindow.WindowType.TYPE_APP;
let windId = 'createTest5' + i; let windId = 'createTest5' + i;
console.log(msgStr + 'ohosWindow.create ' + tempType + ' start'); console.log(msgStr + 'ohosWindow.create ' + tempType + ' start');
...@@ -973,10 +1016,17 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -973,10 +1016,17 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
if (err && err.code) { if (err && err.code) {
try { try {
expect(err.code === 1003).assertTrue(); expect(err.code === 1003).assertTrue();
} catch (error) { } catch (error) {
console.info(`ohosWindow.create catch error: ${JSON.stringify(error)}`) console.info(`ohosWindow.create catch error: ${JSON.stringify(error)}`)
} }
console.log(msgStr + 'ohosWindow.create err.code==' + JSON.stringify(err.code)) console.log(msgStr + 'ohosWindow.create err.code==' + JSON.stringify(err.code))
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
if (i === loopCount - 1) { if (i === loopCount - 1) {
done(); done();
} }
...@@ -997,7 +1047,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -997,7 +1047,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'begin'); console.log(msgStr + 'begin');
let loopCount = systemWindowTypeArr.length; let loopCount = systemWindowTypeArr.length;
console.log('jsunittest loopCount: ' + loopCount); console.log('jsunittest loopCount: ' + loopCount);
for (let i = 0; i < loopCount; i++) { getData(0, loopCount)
function getData(i, length) {
let tempType = ohosWindow.WindowType.TYPE_SYSTEM_ALERT; let tempType = ohosWindow.WindowType.TYPE_SYSTEM_ALERT;
let windId = 'createTest6' + i; let windId = 'createTest6' + i;
console.log(msgStr + 'ohosWindow.create ' + tempType + ' start'); console.log(msgStr + 'ohosWindow.create ' + tempType + ' start');
...@@ -1030,6 +1082,12 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -1030,6 +1082,12 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
} catch (error) { } catch (error) {
console.info(`tempWnd.getProperties catch error: ${JSON.stringify(error)}`) console.info(`tempWnd.getProperties catch error: ${JSON.stringify(error)}`)
} }
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
}) })
}) })
} }
...@@ -1890,8 +1948,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -1890,8 +1948,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
currentDeviceDefault = data; currentDeviceDefault = data;
currentDeviceDefaultDpi = parseInt(currentDeviceDefault.densityDPI) currentDeviceDefaultDpi = parseInt(currentDeviceDefault.densityDPI)
let dpiItem = [-80, 80, 1000, 160, 0, 320, 188.88, 0, 640, 300, currentDeviceDefaultDpi]; let dpiItem = [-80, 80, 1000, 160, 0, 320, 188.88, 0, 640, 300, currentDeviceDefaultDpi];
for (let i = 0;i < dpiItem.length; i++) { getData(0, dpiItem.length)
await sleep(1000);
function getData(i, length) {
screens[0].setDensityDpi(dpiItem[i], (errDpi, dataDpi) => { screens[0].setDensityDpi(dpiItem[i], (errDpi, dataDpi) => {
if (errDpi.code) { if (errDpi.code) {
console.error('Failed to set DensityDpi. Cause: ' + JSON.stringify(err) + dpiItem[i]); console.error('Failed to set DensityDpi. Cause: ' + JSON.stringify(err) + dpiItem[i]);
...@@ -1910,6 +1969,12 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -1910,6 +1969,12 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
} catch (error) { } catch (error) {
console.info(`tempWnd.show catch error: ${JSON.stringify(error)}`) console.info(`tempWnd.show catch error: ${JSON.stringify(error)}`)
} }
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
} }
}) })
}) })
...@@ -1940,14 +2005,21 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -1940,14 +2005,21 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
let orientationItem = ['UNSPECIFIED', 'PORTRAIT', 'LANDSCAPE', 'PORTRAIT_INVERTED', let orientationItem = ['UNSPECIFIED', 'PORTRAIT', 'LANDSCAPE', 'PORTRAIT_INVERTED',
'LANDSCAPE_INVERTED', 'AUTO_ROTATION', 'AUTO_ROTATION_PORTRAIT', 'AUTO_ROTATION_LANDSCAPE', 'LANDSCAPE_INVERTED', 'AUTO_ROTATION', 'AUTO_ROTATION_PORTRAIT', 'AUTO_ROTATION_LANDSCAPE',
'AUTO_ROTATION_RESTRICTED', 'AUTO_ROTATION_PORTRAIT_RESTRICTED', 'AUTO_ROTATION_LANDSCAPE_RESTRICTED', 'LOCKED', 'UNSPECIFIED']; 'AUTO_ROTATION_RESTRICTED', 'AUTO_ROTATION_PORTRAIT_RESTRICTED', 'AUTO_ROTATION_LANDSCAPE_RESTRICTED', 'LOCKED', 'UNSPECIFIED'];
for (let i = 0;i < orientationItem.length; i++) { getData(0, orientationItem.length)
await sleep(1000);
async function getData(i, length) {
let orientation = ohosWindow.Orientation[orientationItem[i]] let orientation = ohosWindow.Orientation[orientationItem[i]]
await mainWin.setPreferredOrientation(orientation, (err, data) => { await mainWin.setPreferredOrientation(orientation, (err, data) => {
if (err && err.code) { if (err && err.code) {
console.log(msgStr + 'window.setPreferredOrientation failed set error' + orientation); console.log(msgStr + 'window.setPreferredOrientation failed set error' + orientation);
} }
num++ num++
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
if (num == orientationItem.length) done(); if (num == orientationItem.length) done();
console.log(msgStr + 'success set window.setPreferredOrientation ' + orientation + JSON.stringify(data)); console.log(msgStr + 'success set window.setPreferredOrientation ' + orientation + JSON.stringify(data));
}) })
......
...@@ -284,7 +284,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -284,7 +284,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console.log(msgStr + 'ohosWindow.create createWindowObj:' + JSON.stringify(createWindowObj)); console.log(msgStr + 'ohosWindow.create createWindowObj:' + JSON.stringify(createWindowObj));
let tempWnd = null; let tempWnd = null;
try { try {
// await ohosWindow.createWindow(createWindowObj).then((data) => {
await ohosWindow.create(context, wndId, baseType).then((data) => { await ohosWindow.create(context, wndId, baseType).then((data) => {
console.log(msgStr + 'ohosWindow.create data:' + JSON.stringify(data)); console.log(msgStr + 'ohosWindow.create data:' + JSON.stringify(data));
tempWnd = data tempWnd = data
...@@ -352,9 +351,11 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -352,9 +351,11 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
expect(!!tempWnd).assertTrue(); expect(!!tempWnd).assertTrue();
let loopCount1 = systemWindowTypeArr; let loopCount1 = systemWindowTypeArr;
console.log(msgStr + 'ohosWindow.windowType' + JSON.stringify(loopCount1)) console.log(msgStr + 'ohosWindow.windowType' + JSON.stringify(loopCount1))
for (let i = 1; i < loopCount1.length; i++) { getData(1, loopCount1.length)
async function getData(i, length) {
let tempType = ohosWindow.WindowType[loopCount1[i]]; let tempType = ohosWindow.WindowType[loopCount1[i]];
console.log(msgStr + 'tempWnd.setWindowType: ' + tempType + ' ,start'); console.log(msgStr + 'tempWnd.setWindowType: ' + tempType + ' ,start ,i:'+i);
tempTypeArr.push(tempType); tempTypeArr.push(tempType);
console.log(msgStr + 'tempTypeArr: ' + JSON.stringify(tempTypeArr)); console.log(msgStr + 'tempTypeArr: ' + JSON.stringify(tempTypeArr));
let windowTypeData = await tempWnd.setWindowType(tempType).catch((err) => { let windowTypeData = await tempWnd.setWindowType(tempType).catch((err) => {
...@@ -376,11 +377,18 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -376,11 +377,18 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
tempTypeArr.splice(tempTypeArr.findIndex(item => item === prodata.type), 1); tempTypeArr.splice(tempTypeArr.findIndex(item => item === prodata.type), 1);
console.log(msgStr + '(loopCount1.length - i): ' + (loopCount1.length - i)); console.log(msgStr + '(loopCount1.length - i): ' + (loopCount1.length - i));
console.log(msgStr + '(tempTypeArr.length + 1): ' + (tempTypeArr.length + 1)); console.log(msgStr + '(tempTypeArr.length + 1): ' + (tempTypeArr.length + 1));
console.log(msgStr + '(loopCount1.length - 1): ' + (loopCount1.length - 1));
if (i == loopCount1.length - 1) { if (i == loopCount1.length - 1) {
expect((loopCount1.length - i) == (tempTypeArr.length + 1)).assertTrue(); expect((loopCount1.length - i) == (tempTypeArr.length + 1)).assertTrue();
console.log(msgStr + 'tempWnd.getProperties i=' + i + ' , loopCount1.length-1==' + loopCount1.length); console.log(msgStr + 'tempWnd.getProperties i=' + i + ' , loopCount1.length-1==' + loopCount1.length);
done();
} }
if (++i <= length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
done();
} }
} }
} }
...@@ -499,7 +507,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -499,7 +507,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console.log(msgStr + 'tempWnd.setSystemBarEnable([status]) success, navigationFlag : ' + JSON.stringify(navigationFlag)); console.log(msgStr + 'tempWnd.setSystemBarEnable([status]) success, navigationFlag : ' + JSON.stringify(navigationFlag));
console.log(msgStr + 'tempWnd.setSystemBarEnable([status]) success, listenerStatus.pending : ' + JSON.stringify(listenerStatus.pending)); console.log(msgStr + 'tempWnd.setSystemBarEnable([status]) success, listenerStatus.pending : ' + JSON.stringify(listenerStatus.pending));
}) })
/** /**
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_002 * @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_002
* @tc.name Test setSystemBarEnableTest2 * @tc.name Test setSystemBarEnableTest2
...@@ -520,7 +527,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -520,7 +527,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
expect(!!systemBarData).assertTrue(); expect(!!systemBarData).assertTrue();
expect(!!systemBarData.regionTint).assertTrue(); expect(!!systemBarData.regionTint).assertTrue();
let arrLength = systemBarData.regionTint.length; let arrLength = systemBarData.regionTint.length;
for (let i = 0; i < arrLength; i++) { getData(0, arrLength)
function getData(i, length) {
let tempData = systemBarData.regionTint[i]; let tempData = systemBarData.regionTint[i];
console.log(msgStr + 'compare, type: ' + tempData.type + ';isEnable: ' + tempData.isEnable); console.log(msgStr + 'compare, type: ' + tempData.type + ';isEnable: ' + tempData.isEnable);
if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR && statusFlag === listenerStatus.pending) { if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR && statusFlag === listenerStatus.pending) {
...@@ -530,6 +539,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -530,6 +539,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
navigationFlag = listenerStatus.finished; navigationFlag = listenerStatus.finished;
expect(tempData.isEnable).assertTrue(); expect(tempData.isEnable).assertTrue();
} }
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
} }
} }
done(); done();
...@@ -581,7 +596,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -581,7 +596,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
expect(!!systemBarData).assertTrue(); expect(!!systemBarData).assertTrue();
expect(!!systemBarData.regionTint).assertTrue(); expect(!!systemBarData.regionTint).assertTrue();
let arrLength = systemBarData.regionTint.length; let arrLength = systemBarData.regionTint.length;
for (let i = 0; i < arrLength; i++) { getData(0, arrLength)
function getData(i, length) {
let tempData = systemBarData.regionTint[i]; let tempData = systemBarData.regionTint[i];
console.log(msgStr + 'compare, type: ' + tempData.type + ';isEnable: ' + tempData.isEnable); console.log(msgStr + 'compare, type: ' + tempData.type + ';isEnable: ' + tempData.isEnable);
if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR && statusFlag === listenerStatus.pending) { if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR && statusFlag === listenerStatus.pending) {
...@@ -591,6 +608,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -591,6 +608,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
navigationFlag = listenerStatus.finished; navigationFlag = listenerStatus.finished;
expect(tempData.isEnable).assertTrue(); expect(tempData.isEnable).assertTrue();
} }
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
} }
} }
done(); done();
...@@ -642,7 +665,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -642,7 +665,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
expect(!!systemBarData).assertTrue(); expect(!!systemBarData).assertTrue();
expect(!!systemBarData.regionTint).assertTrue(); expect(!!systemBarData.regionTint).assertTrue();
let arrLength = systemBarData.regionTint.length; let arrLength = systemBarData.regionTint.length;
for (let i = 0; i < arrLength; i++) { getData(0, arrLength)
function getData(i, length) {
let tempData = systemBarData.regionTint[i]; let tempData = systemBarData.regionTint[i];
console.log(msgStr + 'compare, type: ' + tempData.type + ';isEnable: ' + tempData.isEnable); console.log(msgStr + 'compare, type: ' + tempData.type + ';isEnable: ' + tempData.isEnable);
if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR && statusFlag === listenerStatus.pending) { if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR && statusFlag === listenerStatus.pending) {
...@@ -652,6 +677,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -652,6 +677,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
navigationFlag = listenerStatus.finished; navigationFlag = listenerStatus.finished;
expect(!tempData.isEnable).assertTrue(); expect(!tempData.isEnable).assertTrue();
} }
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
} }
} }
done(); done();
...@@ -738,7 +769,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -738,7 +769,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
expect(!!systemBarData).assertTrue(); expect(!!systemBarData).assertTrue();
expect(!!systemBarData.regionTint).assertTrue(); expect(!!systemBarData.regionTint).assertTrue();
let arrLength = systemBarData.regionTint.length; let arrLength = systemBarData.regionTint.length;
for (let i = 0; i < arrLength; i++) { getData(0, arrLength)
function getData(i, length) {
let tempData = systemBarData.regionTint[i]; let tempData = systemBarData.regionTint[i];
if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR || tempData.type === ohosWindow.WindowType.TYPE_NAVIGATION_BAR) { if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR || tempData.type === ohosWindow.WindowType.TYPE_NAVIGATION_BAR) {
console.log(msgStr + 'systemBarTintChange compare start!'); console.log(msgStr + 'systemBarTintChange compare start!');
...@@ -747,6 +780,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -747,6 +780,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let contentColorIndex = cloneColorArr.indexOf(tempData.contentColor); let contentColorIndex = cloneColorArr.indexOf(tempData.contentColor);
expect(backgroundIndex === -1).assertTrue(); expect(backgroundIndex === -1).assertTrue();
expect(contentColorIndex === -1).assertTrue(); expect(contentColorIndex === -1).assertTrue();
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
} }
} }
} }
...@@ -773,7 +812,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -773,7 +812,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
await sleep(1000); await sleep(1000);
listenerFlag = listenerStatus.pending; listenerFlag = listenerStatus.pending;
let loopCount = commonRGBColorArr.length; let loopCount = commonRGBColorArr.length;
for (let i = 0; i < loopCount; i++) { getData(0, loopCount)
async function getData(i, length) {
let tempColor = commonRGBColorArr[i]; let tempColor = commonRGBColorArr[i];
let systemBarProperties = { let systemBarProperties = {
statusBarColor: tempColor, statusBarColor: tempColor,
...@@ -785,6 +826,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -785,6 +826,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
}; };
tempWnd.setSystemBarProperties(systemBarProperties).then(() => { tempWnd.setSystemBarProperties(systemBarProperties).then(() => {
console.log(msgStr + 'tempWnd.setSystemBarProperties ' + tempColor + ' success'); console.log(msgStr + 'tempWnd.setSystemBarProperties ' + tempColor + ' success');
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
}, (err) => { }, (err) => {
console.log(msgStr + 'tempWnd.setSystemBarProperties failed, err : ' + JSON.stringify(err)); console.log(msgStr + 'tempWnd.setSystemBarProperties failed, err : ' + JSON.stringify(err));
expect(TRUE_FLAG).assertFail(); expect(TRUE_FLAG).assertFail();
...@@ -817,7 +864,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -817,7 +864,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
expect(!!systemBarData).assertTrue(); expect(!!systemBarData).assertTrue();
expect(!!systemBarData.regionTint).assertTrue(); expect(!!systemBarData.regionTint).assertTrue();
let arrLength = systemBarData.regionTint.length; let arrLength = systemBarData.regionTint.length;
for (let i = 0; i < arrLength; i++) { getData(0, arrLength)
function getData(i, length) {
let tempData = systemBarData.regionTint[i]; let tempData = systemBarData.regionTint[i];
if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR) { if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR) {
console.log(msgStr + 'systemBarTintChange compare start!'); console.log(msgStr + 'systemBarTintChange compare start!');
...@@ -846,6 +895,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -846,6 +895,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
expect(backgroundIndex !== -1).assertTrue(); expect(backgroundIndex !== -1).assertTrue();
expect(contentColorIndex !== -1).assertTrue(); expect(contentColorIndex !== -1).assertTrue();
} }
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
} }
} }
done(); done();
...@@ -871,7 +926,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -871,7 +926,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
await sleep(1000); await sleep(1000);
listenerFlag = listenerStatus.pending; listenerFlag = listenerStatus.pending;
let loopCount = commonNUMBERColorArr.length; let loopCount = commonNUMBERColorArr.length;
for (let i = 0; i < loopCount; i++) { getData(0, loopCount)
function getData(i, length) {
let tempColor = commonNUMBERColorArr[i]; let tempColor = commonNUMBERColorArr[i];
let systemBarProperties = { let systemBarProperties = {
statusBarColor: tempColor, statusBarColor: tempColor,
...@@ -883,6 +940,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -883,6 +940,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
}; };
tempWnd.setSystemBarProperties(systemBarProperties).then(() => { tempWnd.setSystemBarProperties(systemBarProperties).then(() => {
console.log(msgStr + 'tempWnd.setSystemBarProperties ' + tempColor + ' success'); console.log(msgStr + 'tempWnd.setSystemBarProperties ' + tempColor + ' success');
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
}, (err) => { }, (err) => {
console.log(msgStr + 'tempWnd.setSystemBarProperties failed, err : ' + JSON.stringify(err)); console.log(msgStr + 'tempWnd.setSystemBarProperties failed, err : ' + JSON.stringify(err));
expect(TRUE_FLAG).assertFail(); expect(TRUE_FLAG).assertFail();
...@@ -910,7 +973,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -910,7 +973,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
expect(!!systemBarData).assertTrue(); expect(!!systemBarData).assertTrue();
expect(!!systemBarData.regionTint).assertTrue(); expect(!!systemBarData.regionTint).assertTrue();
let arrLength = systemBarData.regionTint.length; let arrLength = systemBarData.regionTint.length;
for (let i = 0; i < arrLength; i++) { getData(0, loopCount)
function getData(i, length) {
let tempData = systemBarData.regionTint[i]; let tempData = systemBarData.regionTint[i];
console.log(msgStr + 'i=' + i + ' , ohosWindow.on for=' + JSON.stringify(tempData)); console.log(msgStr + 'i=' + i + ' , ohosWindow.on for=' + JSON.stringify(tempData));
if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR || tempData.type === ohosWindow.WindowType.TYPE_NAVIGATION_BAR) { if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR || tempData.type === ohosWindow.WindowType.TYPE_NAVIGATION_BAR) {
...@@ -920,6 +985,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -920,6 +985,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let contentColorIndex = cloneColorArr.indexOf(tempData.contentColor); let contentColorIndex = cloneColorArr.indexOf(tempData.contentColor);
expect(backgroundIndex === -1).assertTrue(); expect(backgroundIndex === -1).assertTrue();
expect(contentColorIndex === -1).assertTrue(); expect(contentColorIndex === -1).assertTrue();
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
} }
} }
} }
...@@ -946,7 +1017,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -946,7 +1017,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
await sleep(1000); await sleep(1000);
listenerFlag = listenerStatus.pending; listenerFlag = listenerStatus.pending;
let loopCount = commonKEYColorArr.length; let loopCount = commonKEYColorArr.length;
for (let i = 0; i < loopCount; i++) { getData(0, loopCount)
function getData(i, length) {
let tempColor = commonKEYColorArr[i]; let tempColor = commonKEYColorArr[i];
let systemBarProperties = { let systemBarProperties = {
statusBarColor: tempColor, statusBarColor: tempColor,
...@@ -958,6 +1031,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -958,6 +1031,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
}; };
tempWnd.setSystemBarProperties(systemBarProperties).then(() => { tempWnd.setSystemBarProperties(systemBarProperties).then(() => {
console.log(msgStr + 'tempWnd.setSystemBarProperties ' + tempColor + ' success'); console.log(msgStr + 'tempWnd.setSystemBarProperties ' + tempColor + ' success');
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
}, (err) => { }, (err) => {
console.log(msgStr + 'tempWnd.setSystemBarProperties failed, err : ' + JSON.stringify(err)); console.log(msgStr + 'tempWnd.setSystemBarProperties failed, err : ' + JSON.stringify(err));
expect(TRUE_FLAG).assertFail(); expect(TRUE_FLAG).assertFail();
...@@ -977,7 +1056,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -977,7 +1056,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console.log(msgStr + 'begin'); console.log(msgStr + 'begin');
let loopCount = systemWindowTypeDicArr.length; let loopCount = systemWindowTypeDicArr.length;
console.log(msgStr + 'loopCount: ' + loopCount); console.log(msgStr + 'loopCount: ' + loopCount);
for (let i = 0; i < loopCount; i++) { getData(0, loopCount)
async function getData(i, length) {
let tempType = systemWindowTypeDic[systemWindowTypeDicArr[i]]; let tempType = systemWindowTypeDic[systemWindowTypeDicArr[i]];
let windId = 'createTest1' + i; let windId = 'createTest1' + i;
console.log(msgStr + 'ohosWindow.create ' + tempType + ' start'); console.log(msgStr + 'ohosWindow.create ' + tempType + ' start');
...@@ -987,6 +1068,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -987,6 +1068,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
}); });
console.log(msgStr + 'ohosWindow.create ' + tempType + 'finished, wnd: ' + tempWnd); console.log(msgStr + 'ohosWindow.create ' + tempType + 'finished, wnd: ' + tempWnd);
expect(!!tempWnd).assertTrue(); expect(!!tempWnd).assertTrue();
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
} }
console.log(msgStr + 'done '); console.log(msgStr + 'done ');
done(); done();
...@@ -1003,7 +1090,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -1003,7 +1090,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let loopCount = systemWindowTypeArr.length; let loopCount = systemWindowTypeArr.length;
console.log(msgStr + ' loopCount: ' + loopCount); console.log(msgStr + ' loopCount: ' + loopCount);
let n = 0 let n = 0
for (let i = 0; i < loopCount; i++) { getData(0, loopCount)
async function getData(i, length) {
let tempType = ohosWindow.WindowType.TYPE_SYSTEM_ALERT; let tempType = ohosWindow.WindowType.TYPE_SYSTEM_ALERT;
let windId = 'createTest2' + i; let windId = 'createTest2' + i;
console.log(msgStr + 'ohosWindow.create ' + tempType + ' start'); console.log(msgStr + 'ohosWindow.create ' + tempType + ' start');
...@@ -1041,6 +1130,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -1041,6 +1130,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
expect(true).assertFail(); expect(true).assertFail();
} }
} }
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
} }
done(); done();
}) })
...@@ -1101,7 +1196,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -1101,7 +1196,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let tempWnd = null; let tempWnd = null;
try { try {
await ohosWindow.createWindow(createWindowObj).then((data) => { await ohosWindow.createWindow(createWindowObj).then((data) => {
// await ohosWindow.create(context, wndId, baseType).then((data) => {
tempWnd = data tempWnd = data
console.log(msgStr + 'ohosWindow.create ' + baseWndType + ' , wnd: ' + tempWnd); console.log(msgStr + 'ohosWindow.create ' + baseWndType + ' , wnd: ' + tempWnd);
}).catch((err) => { }).catch((err) => {
...@@ -1262,6 +1356,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -1262,6 +1356,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
}); });
expect(!!subWindow).assertTrue(); expect(!!subWindow).assertTrue();
console.log(msgStr + 'windowStage.createSubWindow end subWindow=' + JSON.stringify(subWindow)); console.log(msgStr + 'windowStage.createSubWindow end subWindow=' + JSON.stringify(subWindow));
console.log(msgStr + 'windowStage.createSubWindow end !!subWindow=' + !!subWindow);
done(); done();
}) })
/** /**
...@@ -1419,7 +1514,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -1419,7 +1514,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console.log(msgStr + 'screen.setDensityDpi display.getDefaultDisplay current device' + JSON.stringify(currentDeviceDefault)); console.log(msgStr + 'screen.setDensityDpi display.getDefaultDisplay current device' + JSON.stringify(currentDeviceDefault));
let currentDeviceDefaultDpi = parseInt(currentDeviceDefault.densityDPI) let currentDeviceDefaultDpi = parseInt(currentDeviceDefault.densityDPI)
let dpiItem = [-80, 80, 1000, 160, 0, 320, 188.88, 0, 640, 300, currentDeviceDefaultDpi]; let dpiItem = [-80, 80, 1000, 160, 0, 320, 188.88, 0, 640, 300, currentDeviceDefaultDpi];
for (let i = 0;i < dpiItem.length; i++) { getData(0, dpiItem.length)
async function getData(i, length) {
await sleep(1000); await sleep(1000);
await screens[0].setDensityDpi(dpiItem[i]).then(async () => { await screens[0].setDensityDpi(dpiItem[i]).then(async () => {
console.log(msgStr + 'screen.setDensityDpi success set DPI ' + dpiItem[i]); console.log(msgStr + 'screen.setDensityDpi success set DPI ' + dpiItem[i]);
...@@ -1433,6 +1530,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -1433,6 +1530,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let isEqual = Number(defaultDpi.densityDPI) == dpiItem[i] let isEqual = Number(defaultDpi.densityDPI) == dpiItem[i]
console.log(msgStr + 'same ? ' + isEqual) console.log(msgStr + 'same ? ' + isEqual)
expect(isEqual).assertTrue() expect(isEqual).assertTrue()
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
}).catch(err => { }).catch(err => {
console.log(msgStr + 'screen.setDensityDpi failed set DPI error' + dpiItem[i]); console.log(msgStr + 'screen.setDensityDpi failed set DPI error' + dpiItem[i]);
}); });
...@@ -1458,13 +1561,21 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -1458,13 +1561,21 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let orientationItem = ['UNSPECIFIED', 'PORTRAIT', 'LANDSCAPE', 'PORTRAIT_INVERTED', let orientationItem = ['UNSPECIFIED', 'PORTRAIT', 'LANDSCAPE', 'PORTRAIT_INVERTED',
'LANDSCAPE_INVERTED', 'AUTO_ROTATION', 'AUTO_ROTATION_PORTRAIT', 'AUTO_ROTATION_LANDSCAPE', 'LANDSCAPE_INVERTED', 'AUTO_ROTATION', 'AUTO_ROTATION_PORTRAIT', 'AUTO_ROTATION_LANDSCAPE',
'AUTO_ROTATION_RESTRICTED', 'AUTO_ROTATION_PORTRAIT_RESTRICTED', 'AUTO_ROTATION_LANDSCAPE_RESTRICTED', 'LOCKED', 'UNSPECIFIED']; 'AUTO_ROTATION_RESTRICTED', 'AUTO_ROTATION_PORTRAIT_RESTRICTED', 'AUTO_ROTATION_LANDSCAPE_RESTRICTED', 'LOCKED', 'UNSPECIFIED'];
for (let i = 0;i < orientationItem.length; i++) { getData(0, orientationItem.length)
async function getData(i, length) {
await sleep(1000); await sleep(1000);
let orientation = ohosWindow.Orientation[orientationItem[i]] let orientation = ohosWindow.Orientation[orientationItem[i]]
console.log(msgStr + 'i : ' + i + ' ,orientation : ' + orientation); console.log(msgStr + 'i : ' + i + ' ,orientation : ' + orientation);
console.log(msgStr + 'i : ' + i + ' ,ohosWindow.Orientation : ' + JSON.stringify(ohosWindow.Orientation)); console.log(msgStr + 'i : ' + i + ' ,ohosWindow.Orientation : ' + JSON.stringify(ohosWindow.Orientation));
await mainWin.setPreferredOrientation(orientation).then(() => { await mainWin.setPreferredOrientation(orientation).then(() => {
console.log(msgStr + 'success set window.setPreferredOrientation : ' + orientation); console.log(msgStr + 'success set window.setPreferredOrientation : ' + orientation);
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
num++ num++
if(num == orientationItem.length) done(); if(num == orientationItem.length) done();
}).catch(err => { }).catch(err => {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
import ohosWindow from '@ohos.window'; import ohosWindow from '@ohos.window';
export default function windowRefactorInterfaceTest(context, windowStage, abilityStorage) { export default function windowRefactorInterfaceTest(context, windowStage, abilityStorage) {
console.info('windowTest context: ' + JSON.stringify(context)) console.info('windowTest context: ' + JSON.stringify(context))
console.info('windowTest abilityStorage: ' + JSON.stringify(abilityStorage)) console.info('windowTest abilityStorage: ' + JSON.stringify(abilityStorage))
...@@ -88,6 +87,8 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit ...@@ -88,6 +87,8 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit
it('setWindowSystemBarPropertiesTest1', 0, async function (done) { it('setWindowSystemBarPropertiesTest1', 0, async function (done) {
let cloneColorArr = JSON.parse(JSON.stringify(commonRGBColorArr)); let cloneColorArr = JSON.parse(JSON.stringify(commonRGBColorArr));
let listenerFlag = listenerStatus.ready; let listenerFlag = listenerStatus.ready;
let caseName = 'setWindowSystemBarPropertiesTest1';
let msgStr = 'jsunittest ' + caseName + ' ';
console.info('setWindowSystemBarPropertiesTest1'); console.info('setWindowSystemBarPropertiesTest1');
listenerData.on = true; listenerData.on = true;
listenerData.typeStr = 'systemBarTintChange'; listenerData.typeStr = 'systemBarTintChange';
...@@ -101,7 +102,9 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit ...@@ -101,7 +102,9 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit
console.info(`ohosWindow.on catch error: ${JSON.stringify(error)}`) console.info(`ohosWindow.on catch error: ${JSON.stringify(error)}`)
} }
let arrLength = systemBarData.regionTint.length; let arrLength = systemBarData.regionTint.length;
for (let i = 0; i < arrLength; i++) { getData(0, arrLength)
function getData(i, length) {
// 单个导航栏或者系统状态信息 // 单个导航栏或者系统状态信息
let SystemBarRegionTint = systemBarData.regionTint[i]; let SystemBarRegionTint = systemBarData.regionTint[i];
if (SystemBarRegionTint.type === ohosWindow.WindowType.TYPE_STATUS_BAR || SystemBarRegionTint.type === ohosWindow.WindowType.TYPE_NAVIGATION_BAR) { 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 ...@@ -114,6 +117,12 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit
} catch (error) { } catch (error) {
console.info(`ohosWindow.on catch error: ${JSON.stringify(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++<length i: ' + i + ' ,length:' + length);
}
done(); done();
} }
} }
...@@ -135,7 +144,9 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit ...@@ -135,7 +144,9 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit
await sleep(1000); await sleep(1000);
listenerFlag = listenerStatus.pending; listenerFlag = listenerStatus.pending;
let loopCount = commonRGBColorArr.length; let loopCount = commonRGBColorArr.length;
for (let i = 0; i < loopCount; i++) { getData(0, loopCount)
function getData(i, length) {
let tempColor = commonRGBColorArr[i]; let tempColor = commonRGBColorArr[i];
let systemBarProperties = { let systemBarProperties = {
statusBarColor: tempColor, statusBarColor: tempColor,
...@@ -148,6 +159,12 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit ...@@ -148,6 +159,12 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit
mainWsync.setWindowSystemBarProperties(systemBarProperties).then(() => { mainWsync.setWindowSystemBarProperties(systemBarProperties).then(() => {
console.info('setWindowSystemBarPropertiesTest1 success'); console.info('setWindowSystemBarPropertiesTest1 success');
expect(TRUE_FLAG).assertTrue(); expect(TRUE_FLAG).assertTrue();
if (++i < length) {
getData(i, length)
console.log(msgStr+'jixuzhixing i: ' + i);
} else {
console.log(msgStr+'i++<length i: ' + i + ' ,length:' + length);
}
done(); done();
}).catch(err => { }).catch(err => {
console.info('setWindowSystemBarPropertiesTest1 error : ' + JSON.stringify(err)); console.info('setWindowSystemBarPropertiesTest1 error : ' + JSON.stringify(err));
...@@ -172,6 +189,8 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit ...@@ -172,6 +189,8 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit
let listenerFlag = listenerStatus.ready; let listenerFlag = listenerStatus.ready;
listenerData.on = true; listenerData.on = true;
listenerData.typeStr = 'systemBarTintChange'; listenerData.typeStr = 'systemBarTintChange';
let caseName = 'setWindowSystemBarPropertiesTest2';
let msgStr = 'jsunittest ' + caseName + ' ';
console.info('setWindowSystemBarPropertiesTest2'); console.info('setWindowSystemBarPropertiesTest2');
ohosWindow.on('systemBarTintChange', (systemBarData) => { ohosWindow.on('systemBarTintChange', (systemBarData) => {
console.info('setWindowSystemBarPropertiesTest2 systemBatData : ' + JSON.stringify(systemBarData)); console.info('setWindowSystemBarPropertiesTest2 systemBatData : ' + JSON.stringify(systemBarData));
...@@ -240,7 +259,9 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit ...@@ -240,7 +259,9 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit
await sleep(1000); await sleep(1000);
listenerFlag = listenerStatus.pending; listenerFlag = listenerStatus.pending;
let loopCount = commonNUMBERColorArr.length; let loopCount = commonNUMBERColorArr.length;
for (let i = 0; i < loopCount; i++) { getData(0, loopCount)
function getData(i, length) {
let tempColor = commonNUMBERColorArr[i]; let tempColor = commonNUMBERColorArr[i];
let systemBarProperties = { let systemBarProperties = {
statusBarColor: tempColor, statusBarColor: tempColor,
...@@ -252,6 +273,12 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit ...@@ -252,6 +273,12 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit
}; };
mainWsync.setWindowSystemBarProperties(systemBarProperties).then(() => { mainWsync.setWindowSystemBarProperties(systemBarProperties).then(() => {
console.info('setWindowSystemBarPropertiesTest2 success'); console.info('setWindowSystemBarPropertiesTest2 success');
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
expect(TRUE_FLAG).assertTrue(); expect(TRUE_FLAG).assertTrue();
done(); done();
}).catch(err => { }).catch(err => {
...@@ -270,6 +297,8 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit ...@@ -270,6 +297,8 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit
it('setWindowSystemBarPropertiesTest3', 0, async function (done) { it('setWindowSystemBarPropertiesTest3', 0, async function (done) {
let cloneColorArr = JSON.parse(JSON.stringify(commonKEYColorArr)); let cloneColorArr = JSON.parse(JSON.stringify(commonKEYColorArr));
let listenerFlag = listenerStatus.ready; let listenerFlag = listenerStatus.ready;
let caseName = 'setWindowSystemBarPropertiesTest3';
let msgStr = 'jsunittest ' + caseName + ' ';
console.info('setWindowSystemBarPropertiesTest3 start'); console.info('setWindowSystemBarPropertiesTest3 start');
listenerData.on = true; listenerData.on = true;
listenerData.typeStr = 'systemBarTintChange'; listenerData.typeStr = 'systemBarTintChange';
...@@ -315,7 +344,9 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit ...@@ -315,7 +344,9 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit
await sleep(1000); await sleep(1000);
listenerFlag = listenerStatus.pending; listenerFlag = listenerStatus.pending;
let loopCount = commonKEYColorArr.length; let loopCount = commonKEYColorArr.length;
for (let i = 0; i < loopCount; i++) { getData(0, loopCount)
function getData(i, length) {
let tempColor = commonKEYColorArr[i]; let tempColor = commonKEYColorArr[i];
let systemBarProperties = { let systemBarProperties = {
statusBarColor: tempColor, statusBarColor: tempColor,
...@@ -327,6 +358,12 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit ...@@ -327,6 +358,12 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit
}; };
tempWnd.setWindowSystemBarProperties(systemBarProperties).then(() => { tempWnd.setWindowSystemBarProperties(systemBarProperties).then(() => {
console.info('setWindowSystemBarPropertiesTest3 success'); console.info('setWindowSystemBarPropertiesTest3 success');
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
expect(TRUE_FLAG).assertTrue(); expect(TRUE_FLAG).assertTrue();
done(); done();
}).catch(err => { }).catch(err => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册