未验证 提交 1ede9d7b 编写于 作者: O openharmony_ci 提交者: Gitee

!4860 【窗口子系统】修改编译问题&增加部件化&删除无效用例

Merge pull request !4860 from hekun/master
......@@ -23,6 +23,8 @@ ohos_js_hap_suite("ActsWindowStageTest") {
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsWindowStageTest"
subsystem_name = "window"
part_name = "window_manager"
}
ohos_app_scope("windowStage_app_profile") {
......
......@@ -16,7 +16,6 @@ export default class MainAbility extends Ability {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate windowStage="+ windowStage)
globalThis.windowStage = windowStage
globalThis.abilityStorage = this.storage
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null)
}
......
......@@ -520,134 +520,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
})
})
})
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARPROPERTIES_JSAPI_005
* @tc.name Test setSystemBarPropertiesTest5
* @tc.desc Verify the scene where the status bar and navigation bar colors are set in hexadecimal form
*/
it('setSystemBarPropertiesTest5', 0, done => {
let caseName = 'setSystemBarPropertiesTest5';
let msgStr = 'jsunittest ' + caseName + ' ';
let cloneColorArr = {
SBC: JSON.parse(JSON.stringify(commonNUMBERColorArr)),
SCC: JSON.parse(JSON.stringify(commonNUMBERColorArr)),
NBC: JSON.parse(JSON.stringify(commonNUMBERColorArr)),
NCC: JSON.parse(JSON.stringify(commonNUMBERColorArr))
};
let compareCount = 0;
let endNum = 0;
let listenerFlag = listenerStatus.ready;
console.log(msgStr + 'begin');
listenerData.on = true;
listenerData.typeStr = 'systemBarTintChange';
ohosWindow.on('systemBarTintChange', (systemBarData) => {
console.log(msgStr + 'tempWnd.on systemBarTintChange, systemBatData : ' + JSON.stringify(systemBarData));
if (listenerFlag === listenerStatus.pending) {
expect(!!systemBarData).assertTrue();
expect(!!systemBarData.regionTint).assertTrue();
let arrLength = systemBarData.regionTint.length;
for (let i = 0; i < arrLength; i++) {
let tempData = systemBarData.regionTint[i];
if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR) {
console.log(msgStr + 'systemBarTintChange compare start! arrLength= ' + arrLength);
compareCount++;
let backgroundIndex = cloneColorArr.SBC.indexOf(tempData.backgroundColor);
let contentColorIndex = cloneColorArr.SCC.indexOf(tempData.contentColor);
if (backgroundIndex >= 0) {
cloneColorArr.SBC.splice(backgroundIndex, 1);
}else{
console.log(msgStr + 'SBC tempData.backgroundColor:' + JSON.stringify(tempData.backgroundColor));
}
if (contentColorIndex >= 0) {
cloneColorArr.SCC.splice(contentColorIndex, 1);
}else{
console.log(msgStr + 'SCC tempData.contentColor:' + JSON.stringify(tempData.contentColor));
}
console.log(msgStr + 'compareCount: ' + compareCount + ' ,length: ' + JSON.stringify(cloneColorArr.SCC.length) + ' ,cloneColorArr.SBC:' + JSON.stringify(cloneColorArr.SBC));
console.log(msgStr + 'compareCount: ' + compareCount + ' ,length: ' + JSON.stringify(cloneColorArr.SCC.length) + ' ,cloneColorArr.SCC' + JSON.stringify(cloneColorArr.SCC));
} else if (tempData.type === ohosWindow.WindowType.TYPE_NAVIGATION_BAR) {
console.log(msgStr + 'systemBarTintChange compare start!');
compareCount++;
let backgroundIndex = cloneColorArr.NBC.indexOf(tempData.backgroundColor);
let contentColorIndex = cloneColorArr.NCC.indexOf(tempData.contentColor);
if (backgroundIndex >= 0) {
cloneColorArr.NBC.splice(backgroundIndex, 1);
} else {
console.log(msgStr + 'NBC tempData.backgroundColor:' + JSON.stringify(tempData.backgroundColor));
}
if (contentColorIndex >= 0) {
cloneColorArr.NCC.splice(contentColorIndex, 1);
} else {
console.log(msgStr + 'NCC tempData.contentColor:' + JSON.stringify(tempData.contentColor));
}
let ca = cloneColorArr;
let flag = ca.NCC.length || ca.NBC.length || ca.SBC.length || ca.SCC.length
if (compareCount === 18 && !flag) {
console.log(msgStr + 'compareCount: ' + compareCount + ' ,true flag:' + flag);
expect(true).assertTrue();
done();
} else {
console.log(msgStr + 'compareCount: ' + compareCount + ' ,flag:' + flag);
}
console.log(msgStr + 'compareCount: ' + endNum + ' ,compareCount: ' + compareCount + ' ,length: ' + JSON.stringify(cloneColorArr.NBC.length) + ' ,cloneColorArr.SBC:' + JSON.stringify(cloneColorArr.NBC));
console.log(msgStr + 'compareCount: ' + endNum + ' ,compareCount: ' + compareCount + ' ,length: ' + JSON.stringify(cloneColorArr.NCC.length) + ' ,cloneColorArr.SCC' + JSON.stringify(cloneColorArr.NCC));
endNum = compareCount
}
}
}
})
console.log(msgStr + 'tempWnd.on systemBarTintChange finished');
windowStage.getMainWindow((err, data) => {
if (err && err.code) {
unexpectedError(err, caseName, 'windowStage.getMainWindow', done);
}
let tempWnd = data
expect(!!tempWnd).assertTrue();
console.log(msgStr + 'windowStage.getMainWindow, tempWnd: ' + tempWnd);
tempWnd.show((err, data) => {
if (err && err.code) {
unexpectedError(err, caseName, 'tempWnd.show', done);
}
expect(!data).assertTrue();
console.log(msgStr + 'tempWnd.show success');
tempWnd.setFullScreen(true, (err, data) => {
if (err && err.code) {
unexpectedError(err, caseName, 'tempWnd.setFullScreen(true)', done);
}
expect(!data).assertTrue();
console.log(msgStr + 'tempWnd.setFullScreen(true) success');
tempWnd.setSystemBarEnable(['status', 'navigation'], (err, data) => {
if (err && err.code) {
unexpectedError(err, caseName, 'tempWnd.setSystemBarEnable([status, navigation])', done);
}
expect(!data).assertTrue();
console.log(msgStr + 'tempWnd.setSystemBarEnable([status, navigation]) success');
listenerFlag = listenerStatus.pending;
let loopCount = commonNUMBERColorArr.length
for (let i = 0; i < loopCount; i++) {
let tempColor = commonNUMBERColorArr[i];
let systemBarProperties = {
statusBarColor: tempColor,
isStatusBarLightIcon: true,
statusBarContentColor: tempColor,
navigationBarColor: tempColor,
isNavigationBarLightIcon: true,
navigationBarContentColor: tempColor,
};
tempWnd.setSystemBarProperties(systemBarProperties, (err, data) => {
console.log(msgStr + 'tempWnd.setSystemBarProperties err' + JSON.stringify(err));
console.log(msgStr + 'tempWnd.setSystemBarProperties data' + JSON.stringify(data));
if (err && err.code) {
expect(TRUE_FLAG).assertFail();
done();
}
})
}
})
})
})
})
})
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARPROPERTIES_JSAPI_006
* @tc.name Test setSystemBarPropertiesTest6
......
......@@ -1349,7 +1349,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
}
console.log(msgStr + 'done ');
done();
})
})
/**
* @tc.number SUB_WINDOW_SETPREFERREDORIENTATION_JSAPI_001
* @tc.name Test setPreferredOrientation
......@@ -1364,10 +1364,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
});
console.log(msgStr + 'windowStage.getMainWindow' + JSON.stringify(mainWin));
expect(!!mainWin).assertTrue();
let orientationItem = ['UNSPECIFIED','LOCKED','PORTRAIT_UNSPECIFIED','PORTRAIT','LANDSCAPE','PORTRAIT_INVERTED','LANDSCAPE_INVERTED','AUTO_ROTATION','AUTO_ROTATION_PORTRAIT','AUTO_ROTATION_LANDSCAPE','AUTO_ROTATION_RESTRICTED','AUTO_ROTATION_PORTRAIT_RESTRICTED','AUTO_ROTATION_LANDSCAPE_RESTRICTED'];
let orientationItem = ['UNSPECIFIED', 'LOCKED', 'PORTRAIT_UNSPECIFIED', 'PORTRAIT', 'LANDSCAPE', 'PORTRAIT_INVERTED', 'LANDSCAPE_INVERTED', 'AUTO_ROTATION', 'AUTO_ROTATION_PORTRAIT', 'AUTO_ROTATION_LANDSCAPE', 'AUTO_ROTATION_RESTRICTED', 'AUTO_ROTATION_PORTRAIT_RESTRICTED', 'AUTO_ROTATION_LANDSCAPE_RESTRICTED'];
for (let i = 0;i < orientationItem.length; i++) {
await sleep(1000);
let orientation=ohosWindow.Orientation[orientationItem[i]]
let orientation = ohosWindow.Orientation[orientationItem[i]]
await mainWin.setPreferredOrientation(orientation).then(() => {
console.log(msgStr + 'success set window.setPreferredOrientation ' + orientation);
}).catch(err => {
......@@ -1404,4 +1404,5 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console.log(msgStr + 'done ');
done();
})
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册