Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
9938a225
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看板
提交
9938a225
编写于
5月 31, 2022
作者:
Z
zhurong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add xts
Signed-off-by:
N
zhurong
<
zhurong18@h-partners.com
>
上级
48a242e5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
306 deletion
+35
-306
;
;
+8
-0
graphic/windowStage/entry/src/main/ets/test/windowCallback.test.ets
...ndowStage/entry/src/main/ets/test/windowCallback.test.ets
+17
-264
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
...indowStage/entry/src/main/ets/test/windowPromise.test.ets
+10
-42
未找到文件。
;
0 → 100644
浏览文件 @
9938a225
Merge branch 'master' of https://gitee.com/huahua-fairy/xts_acts
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
add
graphic/windowStage/entry/src/main/ets/test/windowCallback.test.ets
浏览文件 @
9938a225
...
...
@@ -115,270 +115,6 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
}, time);
})
}
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_006
* @tc.name Test setSystemBarEnableTest6
* @tc.desc Test ohosWindow.setSystemBarEnable API function test1.
*/
it('setSystemBarEnableTest6', 0, done => {
let caseName = 'setSystemBarEnableTest6';
let msgStr = 'jsunittest ' + caseName + ' ';
let [flagStatus, flagNav] = [false, false];
console.log(msgStr + 'begin');
listenerData.on = true;
listenerData.typeStr = 'systemBarTintChange';
ohosWindow.on('systemBarTintChange', systembartintstate => {
console.log(msgStr + 'ohosWindow.on systembartintstate.regionTint : ' + JSON.stringify(systembartintstate.regionTint));
if (flagStatus || flagNav) {
expect(!!systembartintstate).assertTrue();
expect(!!systembartintstate.regionTint).assertTrue();
console.log(msgStr + 'flagStatus || flagNav' + msgStr + 'ohosWindow.on systemBarTintChange regionTint:' + JSON.stringify(systembartintstate.regionTint));
done();
}
})
let mainWnd = null;
console.log(msgStr + 'mainWnd = null');
console.log(msgStr + 'windowStage = ' + JSON.stringify(windowStage));
windowStage.getMainWindow((err, data) => {
console.log(msgStr + 'getMainWindow data2' + JSON.stringify(data));
if (err && err.code) {
unexpectedError(data, caseName, 'windowStage.getMainWindow', done);
}
expect(!!data).assertTrue();
mainWnd = data;
console.log(msgStr + 'await windowStage JSON.stringify(mainWnd)===' + JSON.stringify(mainWnd));
mainWnd.show((err, data) => {
console.log(msgStr + 'mainWnd.show err' + JSON.stringify(err));
console.log(msgStr + 'mainWnd.show data' + JSON.stringify(data));
if (err && err.code) {
unexpectedError(data, caseName, 'mainWnd.show', done);
}
expect(!data).assertTrue();
console.log(msgStr + 'mainWnd.show success');
mainWnd.setFullScreen(true, (err, data) => {
console.log(msgStr + 'mainWnd.setFullScreen data:' + JSON.stringify(data));
if (err && err.code) {
unexpectedError(data, caseName, 'mainWnd.setFullScreen true', done);
}
expect(!data).assertTrue();
console.log(msgStr + 'mainWnd.setFullScreen success');
flagNav = true;
mainWnd.setSystemBarEnable(['navigation'], (err, data) => {
console.log(msgStr + 'mainWnd.setSystemBarEnable navigation JSON.stringify(data)==' + JSON.stringify(data));
if (err && err.code) {
unexpectedError(data, caseName, 'mainWnd.setSystemBarEnable [navigation]', done);
}
expect(!data).assertTrue();
console.log(msgStr + 'mainWnd.setSystemBarEnable success flagNav==' + flagNav);
flagStatus = true;
mainWnd.setSystemBarEnable(['status'], (err, data) => {
console.log(msgStr + 'mainWnd.setSystemBarEnable status JSON.stringify(data)===' + JSON.stringify(data));
if (err && err.code) {
console.log(msgStr + 'mainWnd.setSystemBarEnable status JSON.stringify(err)===' + JSON.stringify(err));
unexpectedError(data, caseName, 'mainWnd.setSystemBarEnable [status]', done);
}
expect(!data).assertTrue();
})
})
})
})
})
console.log(msgStr + 'finished!!');
});
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_007
* @tc.name Test setSystemBarEnableTest7
* @tc.desc Verify that the scene hides the status bar and displays the navigation bar.
*/
it('setSystemBarEnableTest7', 0, function (done) {
let caseName = 'setSystemBarEnableTest7';
let msgStr = 'jsunittest ' + caseName + ' ';
let [flagStatus, flagNav] = [false, false];
console.log(msgStr + 'begin');
listenerData.on = true;
listenerData.typeStr = 'systemBarTintChange';
ohosWindow.on('systemBarTintChange', systembartintstate => {
console.log(msgStr + 'ohosWindow.on systembartintstate :' + JSON.stringify(systembartintstate));
console.log(msgStr + 'ohosWindow.on systembartintstate.regionTint : ' + JSON.stringify(systembartintstate.regionTint));
if (flagStatus || flagNav) {
console.log(msgStr + 'ohosWindow.on flagStatus || flagNav:');
expect(!!systembartintstate).assertTrue();
done();
}
})
let mainWnd = null;
console.log(msgStr + 'mainWnd = null')
windowStage.getMainWindow((err, data) => {
if (err && err.code) {
unexpectedError(data, caseName, 'windowStage.getMainWindow', done);
}
expect(!!data).assertTrue();
mainWnd = data;
console.log(msgStr + 'await windowStage JSON.stringify(mainWnd)===' + JSON.stringify(mainWnd));
mainWnd.show((err, data) => {
if (err && err.code) {
unexpectedError(data, caseName, 'mainWnd.show', done);
}
console.log(msgStr + 'mainWnd.show success');
expect(!data).assertTrue();
mainWnd.setFullScreen(true, (err, data) => {
console.log(msgStr + 'mainWnd.setFullScreen' + JSON.stringify(data));
if (err && err.code) {
unexpectedError(data, caseName, 'mainWnd.setFullScreen true', done);
}
expect(!data).assertTrue();
mainWnd.setSystemBarEnable(['status'], (err, data) => {
console.log(msgStr + 'mainWnd.setSystemBarEnable status JSON.stringify(data)==' + JSON.stringify(data));
if (err && err.code) {
unexpectedError(data, caseName, 'mainWnd.setSystemBarEnable [status]', done);
}
flagStatus = true;
expect(!data).assertTrue();
mainWnd.setSystemBarEnable(['navigation'], (err, data) => {
if (err && err.code) {
unexpectedError(data, caseName, 'mainWnd.setSystemBarEnable [navitgation]', done);
}
flagNav = true;
expect(!data).assertTrue();
})
})
})
})
})
console.log(msgStr + 'finished!!');
});
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_008
* @tc.name Test setSystemBarEnableTest8
* @tc.desc Verify that the scene displays both the status bar and the navigation bar.
*/
it('setSystemBarEnableTest8', 0, function (done) {
let caseName = 'setSystemBarEnableTest8';
let msgStr = 'jsunittest ' + caseName + ' ';
let [flagStatus, flagNav] = [false, false];
console.log(msgStr + 'begin');
let mainWnd = null;
console.log(msgStr + 'mainWnd = null');
windowStage.getMainWindow((err, data) => {
if (err && err.code) {
unexpectedError(data, caseName, 'windowStage.getMainWindow', done);
}
expect(!!data).assertTrue();
mainWnd = data;
console.log(msgStr + 'await windowStage JSON.stringify(mainWnd)===' + JSON.stringify(mainWnd));
mainWnd.show((err, data) => {
if (err && err.code) {
unexpectedError(data, caseName, 'mainWnd.show', done);
}
console.log(msgStr + 'mainWnd.show success');
expect(!data).assertTrue();
mainWnd.setFullScreen(true, (err, data) => {
console.log(msgStr + 'mainWnd.setFullScreen' + JSON.stringify(data));
if (err && err.code) {
unexpectedError(data, caseName, 'mainWnd.setFullScreen true', done);
}
expect(!data).assertTrue();
mainWnd.setSystemBarEnable([], (err, data) => {
console.log(msgStr + 'mainWnd.setSystemBarEnable [] JSON.stringify(data)==' + JSON.stringify(data));
if (err && err.code) {
unexpectedError(data, caseName, 'mainWnd.setSystemBarEnable []', done);
}
expect(!data).assertTrue();
listenerData.on = true;
listenerData.typeStr = 'systemBarTintChange';
setTimeout(() => {
ohosWindow.on('systemBarTintChange', systembartintstate => {
console.log(msgStr + 'ohosWindow.on systemBarTintChange :' + JSON.stringify(systembartintstate));
console.log(msgStr + 'ohosWindow.on systembartintstate.regionTint : ' + JSON.stringify(systembartintstate.regionTint));
setTimeout(() => {
if (flagStatus || flagNav) {
let enable = systembartintstate.regionTint[0].isEnable
let numType = systembartintstate.regionTint[0].type
console.log(msgStr + 'ohosWindow.on isEnable : ' + JSON.stringify(enable));
console.log(msgStr + 'ohosWindow.on numType : ' + JSON.stringify(numType));
expect(numType === 2112 || enable).assertTrue();
}
done();
}, 3000)
})
}, 2300)
mainWnd.setSystemBarEnable(['status', 'navigation'], (err, data) => {
if (err && err.code) {
unexpectedError(data, caseName, 'mainWnd.setSystemBarEnable [status,navigation]', done);
}
flagStatus = true;
flagNav = true;
expect(!data).assertTrue();
})
})
})
})
})
});
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_009
* @tc.name Test setSystemBarEnableTest9
* @tc.desc Verify that the scene hides both the status bar and the navigation bar.
*/
// it('setSystemBarEnableTest9', 0, function (done) {
// let caseName = 'setSystemBarEnableTest9';
// let msgStr = 'jsunittest ' + caseName + ' ';
// let [flagStatus, flagNav] = [false, false];
// console.log(msgStr + 'begin');
// let mainWnd = null;
// console.log(msgStr + 'mainWnd = null');
// windowStage.getMainWindow((err, data) => {
// if (err && err.code) {
// unexpectedError(data, caseName, 'windowStage.getMainWindow', done);
// }
// expect(!!data).assertTrue();
// mainWnd = data;
// console.log(msgStr + 'await windowStage JSON.stringify(mainWnd)===' + JSON.stringify(mainWnd));
// mainWnd.show((err, data) => {
// if (err && err.code) {
// unexpectedError(data, caseName, 'mainWnd.show', done);
// }
// console.log(msgStr + 'mainWnd.show success');
// expect(!data).assertTrue();
// mainWnd.setFullScreen(true, (err, data) => {
// console.log(msgStr + 'mainWnd.setFullScreen' + JSON.stringify(data));
// if (err && err.code) {
// unexpectedError(data, caseName, 'mainWnd.setFullScreen', done);
// }
// expect(!data).assertTrue();
// mainWnd.setSystemBarEnable(['status', 'navigation'], (err, data) => {
// console.log(msgStr + 'mainWnd.setSystemBarEnable status,navigation JSON.stringify(data)==' + JSON.stringify(data));
// if (err && err.code) {
// unexpectedError(data, caseName, 'mainWnd.setSystemBarEnable [status,navigation]', done);
// }
// flagStatus = true;
// flagNav = true;
// expect(!data).assertTrue();
// listenerData.on = true;
// listenerData.typeStr = 'systemBarTintChange';
// ohosWindow.on('systemBarTintChange', (systembartintstate) => {
// console.log(msgStr + 'ohosWindow.on systemBarTintChange :' + JSON.stringify(systembartintstate));
// console.log(msgStr + 'ohosWindow.on systemBarTintChange systembartintstate.regionTint : ' + JSON.stringify(systembartintstate.regionTint));
// if (flagStatus || flagNav) {
// expect(!!systembartintstate).assertTrue();
// done();
// }
// })
// mainWnd.setSystemBarEnable([], (err, data) => {
// if (err && err.code) {
// unexpectedError(data, caseName, 'mainWnd.setSystemBarEnable []', done);
// }
// expect(!data).assertTrue();
// done();
// })
// })
// })
// })
// })
// });
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_010
* @tc.name Test setSystemBarEnableTest10
...
...
@@ -1162,6 +898,23 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
});
})
/**
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_012
* @tc.name Test loadContentTest12
* @tc.desc Verify the scenario of loading an existing page
*/
it('loadContentTest12', 0, function (done) {
let caseName = 'loadContentTest12';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
windowStage.loadContent(null, abilityStorage, (err, data) => {
if (err && err.code) {
expectedError(err, caseName, 'windowStage.loadContent', done,130);
console.log(msgStr + 'windowStage.loadContent(pages/index/index.ets)' + JSON.stringify(err));
}
done();
});
})
/**
* @tc.number SUB_WINDOW_CREATESUBWINDOW_JSAPI_003
* @tc.name Test createSubWindowTest3
* @tc.desc Verify the scenario of creating an auxiliary window
...
...
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
浏览文件 @
9938a225
...
...
@@ -95,7 +95,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
function expectedError(error, caseName, apiName, done, code) {
let msgStr = 'jsunittest ' + caseName + ' ' + apiName + ' failed, err: ';
console.log(msgStr + JSON.stringify(error));
console.log(msgStr + 'code:'
+
code);
console.log(msgStr + 'code:'
+
code);
if (error.code === code) {
expect(TRUE_FLAG).assertTrue();
}
...
...
@@ -234,9 +234,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
listenerData.typeStr = 'systemAvoidAreaChange';
tempWnd.on('systemAvoidAreaChange', (avoidAreaData) => {
console.log(msgStr + 'tempWnd.on systemAvoidAreaChange, systemBatData : ' + JSON.stringify(avoidAreaData));
setTimeout(()
=>
{
setTimeout(()
=>
{
console.log(msgStr + 'tempWnd.on systemAvoidAreaChange, systemBatData 1100 : ' + JSON.stringify(avoidAreaData));
},1100)
},
1100)
done();
})
console.log(msgStr + 'tempWnd.on systemAvoidAreaChange finished');
...
...
@@ -994,7 +994,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
expectedError(err, caseName, 'tempWnd.loadContent', done, 130);
console.log(msgStr + 'tempWnd.loadContent(null)' + JSON.stringify(err));
});
console.log(msgStr + 'tempWnd.loadContent loadContentData:'
+
JSON.stringify(loadContentData));
console.log(msgStr + 'tempWnd.loadContent loadContentData:'
+
JSON.stringify(loadContentData));
if (!errFlag) {
console.log(msgStr + 'should report err');
expect(TRUE_FLAG).assertFail();
...
...
@@ -1029,10 +1029,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let load5 = await windowStage.loadContent(null, abilityStorage).catch((err) => {
expectedError(err, caseName, 'tempWnd.loadContent', done,130);
expectedError(err, caseName, 'tempWnd.loadContent', done,
130);
console.log(msgStr + 'tempWnd.loadContent(pages/index/index.ets)' + JSON.stringify(err));
});
// expect(!load5).assertTrue();
console.log(msgStr + 'tempWnd.loadContent end load5=' + JSON.stringify(load5));
done();
})
...
...
@@ -1113,19 +1112,18 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin ');
let mainWnd = null;
let windowData = await ohosWindow.create(context,
'setPrivacyModeTest1', ohosWindow.WindowType.TYPE_SYSTEM_ALERT).catch((err) => {
unexpectedError(err, caseName, 'ohosWindow.create', done);
done(
);
})
let windowData = await ohosWindow.create(context,
'setPrivacyModeTest1', ohosWindow.WindowType.TYPE_SYSTEM_ALERT)
.catch((err) => {
unexpectedError(err, caseName, 'ohosWindow.create', done
);
})
expect(!!windowData).assertTrue();
console.log(msgStr + 'window.create success windowData' + windowData);
mainWnd = windowData;
let firstPro = await mainWnd.getProperties().catch((err, data) => {
unexpectedError(err, caseName, 'mainWnd.getProperties', done);
done();
})
expect(!firstPro.isPrivacyMode).assertTrue();
console.log(msgStr + 'mainWnd.getProperties firstPro=' + JSON.stringify(firstPro));
expect(!firstPro.isPrivacyMode).assertTrue();
let firstPrivacyMode = await mainWnd.setPrivacyMode(true).catch((err, data) => {
unexpectedError(err, caseName, 'mainWnd.setPrivacyMode', done);
console.log(msgStr + 'mainWnd.setPrivacyMode(true) err=' + JSON.stringify(err));
...
...
@@ -1134,7 +1132,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console.log(msgStr + 'mainWnd.setPrivacyMode true firstPrivacyMode=' + JSON.stringify(firstPrivacyMode));
let secondPro = await mainWnd.getProperties().catch((err, data) => {
unexpectedError(err, caseName, 'mainWnd.getProperties', done);
done();
})
console.log(msgStr + 'mainWnd.getProperties secondPro:' + JSON.stringify(secondPro.isPrivacyMode));
expect(secondPro.isPrivacyMode).assertTrue();
...
...
@@ -1146,39 +1143,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console.log(msgStr + 'mainWnd.setPrivacyMode(false) secondPrivacyMode=' + JSON.stringify(secondPrivacyMode));
let lastPro = await mainWnd.getProperties().catch((err, data) => {
unexpectedError(err, caseName, 'mainWnd.getProperties', done);
done();
})
console.log(msgStr + 'mainWnd.getProperties lastPro:' + JSON.stringify(lastPro.isPrivacyMode));
expect(!lastPro.isPrivacyMode).assertTrue();
done();
})
/**
* @tc.number SUB_WINDOW_DESTROY_JSAPI_001
* @tc.name Test destroyTest1
* @tc.desc Verification window destruction scenario.
*/
it('destroyTest1', 0, async function (done) {
let caseName = 'destroyTest1';
let msgStr = 'jsunittest ' + caseName + ' ';
let baseWndType = 1;
let windowId = 'destroyTest1';
console.log(msgStr + 'begin');
let tempWnd = await ohosWindow.create(context, windowId, baseWndType).catch((err) => {
unexpectedError(err, caseName, 'ohosWindow.create', done);
});
console.log(msgStr + 'ohosWindow.create ' + baseWndType + ' wnd: ' + tempWnd);
expect(!!tempWnd).assertTrue();
console.log(msgStr + 'tempWnd.destroy start');
await tempWnd.destroy().catch((err) => {
unexpectedError(err, caseName, 'tempWnd.destroy', done);
});
console.log(msgStr + 'tempWnd.destroy end');
let findWnd = await ohosWindow.find(windowId).catch((err) => {
expectedError(err, caseName, 'ohosWindow.find', done);
});
console.log(msgStr + 'find findWnd:'+JSON.stringify(findWnd));
expect(!findWnd).assertTrue();
done();
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录