Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
31715d36
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
31715d36
编写于
12月 09, 2022
作者:
华
华华小仙女
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化异步接口用例
Signed-off-by:
N
华华小仙女
<
zhurong18@h-partners.com
>
上级
cae32025
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
42 addition
and
91 deletion
+42
-91
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
...indowStage/entry/src/main/ets/test/windowPromise.test.ets
+0
-86
graphic/windowStage/entry/src/main/ets/test/windowRefactorInterface.test.ets
.../entry/src/main/ets/test/windowRefactorInterface.test.ets
+42
-5
未找到文件。
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
浏览文件 @
31715d36
...
@@ -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
...
@@ -431,91 +430,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -431,91 +430,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
* @tc.name Test setSystemBarEnableTest1
* @tc.name Test setSystemBarEnableTest1
* @tc.desc Verify that the scene shows the status bar and hides the navigation bar
* @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 <setWindowTypeTest1 length) {
// getData(i, length)
// console.log(msgStr + 'jixuzhixing i: ' + i);
// } else {
// console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
// }
// }
// ohosWindow.off('systemBarTintChange');
// }
// done();
// }, 3000)
// })
// }
//
//
// await tempWnd.setSystemBarEnable(['status']).catch((err) => {
// 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
)
{
it
(
'setSystemBarEnableTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setSystemBarEnableTest1'
;
let
caseName
=
'setSystemBarEnableTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
...
graphic/windowStage/entry/src/main/ets/test/windowRefactorInterface.test.ets
浏览文件 @
31715d36
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录