Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4f57f955
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看板
提交
4f57f955
编写于
11月 04, 2022
作者:
华
华华小仙女
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加try catch
Signed-off-by:
N
华华小仙女
<
zhurong18@h-partners.com
>
上级
51e57c30
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
58 addition
and
37 deletion
+58
-37
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
...indowStage/entry/src/main/ets/test/windowPromise.test.ets
+58
-37
未找到文件。
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
浏览文件 @
4f57f955
...
@@ -1009,7 +1009,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1009,7 +1009,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console.log(msgStr + 'ohosWindow.create ' + tempType + ' start');
console.log(msgStr + 'ohosWindow.create ' + tempType + ' start');
let createData = null;
let createData = null;
try {
try {
ohosWindow.create(context, windId, tempType).then((data) => {
await
ohosWindow.create(context, windId, tempType).then((data) => {
createData = data
createData = data
expect(!!createData).assertTrue();
expect(!!createData).assertTrue();
}).catch((err) => {
}).catch((err) => {
...
@@ -1146,23 +1146,27 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1146,23 +1146,27 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
});
});
}
}
catch (err) {
catch (err) {
console.log(msgStr + '
tempWnd.loadContent(null)
catch err:' + JSON.stringify(err));
console.log(msgStr + '
ohosWindow.createWindow
catch err:' + JSON.stringify(err));
}
}
console.log(msgStr + 'tempWnd.loadContent start');
console.log(msgStr + 'tempWnd.loadContent start');
let errFlag = false;
let errFlag = false;
let loadContentData = null;
let loadContentData = null;
tempWnd.loadContent(null).then((data) => {
try {
loadContentData = data;
await tempWnd.loadContent(null).then((data) => {
}).catch((err) => {
loadContentData = data;
errFlag = true;
}).catch((err) => {
expectedError(err, caseName, 'tempWnd.loadContent', done, 1003);
errFlag = true;
console.log(msgStr + 'tempWnd.loadContent(null)' + JSON.stringify(err));
expectedError(err, caseName, 'tempWnd.loadContent', done, 1003);
});
console.log(msgStr + 'tempWnd.loadContent(null)' + JSON.stringify(err));
console.log(msgStr + 'tempWnd.loadContent loadContentData:' + JSON.stringify(loadContentData));
});
if (!errFlag) {
console.log(msgStr + 'tempWnd.loadContent loadContentData:' + JSON.stringify(loadContentData));
console.log(msgStr + 'should report err');
if (!errFlag) {
expect(TRUE_FLAG).assertFail();
console.log(msgStr + 'should report err');
done();
expect(TRUE_FLAG).assertFail();
done();
}
} catch (err) {
console.log(msgStr + 'tempWnd.loadContent(null) catch err:' + JSON.stringify(err));
}
}
})
})
...
@@ -1394,13 +1398,18 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1394,13 +1398,18 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let msgStr = 'jsunittest ' + caseName + ' ';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
console.log(msgStr + 'begin');
let screens = null;
let screens = null;
screenManager.getAllScreens().then((data) => {
try {
screens = data
await screenManager.getAllScreens().then((data) => {
}).catch(err => {
screens = data
unexpectedError(err, caseName, 'screenManager.getAllScreen', done);
console.log(msgStr + 'screenManager.getAllScreen' + JSON.stringify(screens));
})
expect(!!screens).assertTrue();
console.log(msgStr + 'screenManager.getAllScreen' + JSON.stringify(screens));
}).catch(err => {
expect(!!screens).assertTrue();
unexpectedError(err, caseName, 'screenManager.getAllScreen', done);
})
}
catch (err) {
console.log(msgStr + 'screenManager.getAllScreen catch err:' + JSON.stringify(err));
}
let currentDeviceDefault = null;
let currentDeviceDefault = null;
await display.getDefaultDisplay().then((data) => {
await display.getDefaultDisplay().then((data) => {
currentDeviceDefault = data
currentDeviceDefault = data
...
@@ -1621,14 +1630,20 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1621,14 +1630,20 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
name: wndId, windowType: baseType, ctx: context
name: wndId, windowType: baseType, ctx: context
}
}
let tempWnd = null;
let tempWnd = null;
ohosWindow.createWindow(createWindowObj).then((data) => {
try {
tempWnd = data
await ohosWindow.createWindow(createWindowObj).then((data) => {
}).catch((err) => {
tempWnd = data
unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done);
console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + JSON.stringify(tempWnd));
});
expect(!!tempWnd).assertTrue();
console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + JSON.stringify(tempWnd));
console.info('showWithAnimationTest1 ****' + Reflect.has(tempWnd, 'showWithAnimation'))
expect(!!tempWnd).assertTrue();
}).catch((err) => {
console.info('showWithAnimationTest1 ****' + Reflect.has(tempWnd, 'showWithAnimation'))
unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done);
});
}
catch (err) {
console.log(msgStr + 'ohosWindow.create catch err:' + JSON.stringify(err));
}
await tempWnd.showWithAnimation().then((data) => {
await tempWnd.showWithAnimation().then((data) => {
console.info('Succeeded in showing the window with animation. Data: ' + JSON.stringify(data));
console.info('Succeeded in showing the window with animation. Data: ' + JSON.stringify(data));
done();
done();
...
@@ -1651,15 +1666,21 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1651,15 +1666,21 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
name: wndId, windowType: baseType, ctx: context
name: wndId, windowType: baseType, ctx: context
}
}
let tempWnd = null;
let tempWnd = null;
ohosWindow.createWindow(createWindowObj).then((data) => {
try {
tempWnd = data
await ohosWindow.createWindow(createWindowObj).then((data) => {
}).catch((err) => {
tempWnd = data
unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done);
console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + JSON.stringify(tempWnd));
});
expect(!!tempWnd).assertTrue();
console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + JSON.stringify(tempWnd));
}).catch((err) => {
expect(!!tempWnd).assertTrue();
unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done);
});
}
catch(err) {
console.log(msgStr + 'ohosWindow.create catch err:' + JSON.stringify(err));
}
let findWnd = null;
let findWnd = null;
ohosWindow.find(wndId).then((data) => {
await
ohosWindow.find(wndId).then((data) => {
findWnd = data
findWnd = data
}).catch((err) => {
}).catch((err) => {
unexpectedError(err, caseName, 'ohosWindow.find', done);
unexpectedError(err, caseName, 'ohosWindow.find', done);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录