Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
1cb47c43
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,发现更多精彩内容 >>
提交
1cb47c43
编写于
6月 23, 2022
作者:
Z
zhurong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add xts Modify error code and replace file import
Signed-off-by:
N
zhurong
<
zhurong18@h-partners.com
>
上级
4308e6ae
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
27 deletion
+29
-27
graphic/windowStage/entry/src/main/ets/test/windowCallback.test.ets
...ndowStage/entry/src/main/ets/test/windowCallback.test.ets
+12
-11
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
...indowStage/entry/src/main/ets/test/windowPromise.test.ets
+17
-16
未找到文件。
graphic/windowStage/entry/src/main/ets/test/windowCallback.test.ets
浏览文件 @
1cb47c43
...
...
@@ -13,7 +13,8 @@
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "hypium/index"
import ohosWindow from '@ohos.window';
import display from '@ohos.display';
...
...
@@ -417,7 +418,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'mainWnd.setSystemBarEnable [null,123] JSON.stringify(data)==' + JSON.stringify(data));
console.log(msgStr + 'mainWnd.setSystemBarEnable [null,123] JSON.stringify(err)==' + JSON.stringify(err));
if (err && err.code) {
expect(err.code === 1
30
).assertTrue();
expect(err.code === 1
003
).assertTrue();
done();
} else {
unexpectedError(data, caseName, 'mainWnd.setSystemBarEnable [null,123]', done);
...
...
@@ -745,7 +746,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'ohosWindow.create err' + JSON.stringify(err));
console.log(msgStr + 'ohosWindow.create data' + JSON.stringify(data));
if (err && err.code) {
expect(err.code === 1
30
).assertTrue();
expect(err.code === 1
003
).assertTrue();
console.log(msgStr + 'ohosWindow.create err.code==' + JSON.stringify(err.code))
if (i === loopCount - 1) {
done();
...
...
@@ -812,7 +813,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
ohosWindow.create(context, windId, tempType, (err, data) => {
console.log(msgStr + 'ohosWindow.create data' + JSON.stringify(data));
if (err && err.code) {
expect(err.code === 1
30
).assertTrue();
expect(err.code === 1
003
).assertTrue();
done();
return;
}
...
...
@@ -840,7 +841,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'ohosWindow.create 1 twice err: ' + JSON.stringify(err));
if (err && err.code) {
console.log(msgStr + 'ohosWindow.create 1 twice data: ' + JSON.stringify(data));
expect(err.code).assertEqual(1
20
)
expect(err.code).assertEqual(1
001
)
done();
} else {
unexpectedError(err, caseName, 'ohosWindow.create', done);
...
...
@@ -1003,7 +1004,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
if (!!data) {
expectedError(err, caseName, 'tempWnd.setWindowType', done);
} else {
expect(err.code == 1
30
).assertTrue();
expect(err.code == 1
003
).assertTrue();
done();
}
})
...
...
@@ -1044,7 +1045,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'ohosWindow.find data' + JSON.stringify(data));
console.log(msgStr + 'ohosWindow.find !!data' + !!data);
if (err && err.code) {
expect(err.code == 1
20
).assertTrue();
expect(err.code == 1
001
).assertTrue();
done();
} else {
expectedError(err, caseName, 'tempWnd.setWindowType', done);
...
...
@@ -1116,7 +1117,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'tempWnd.loadContent data' + JSON.stringify(data));
console.log(msgStr + 'tempWnd.loadContent !!data' + !!data);
if (err && err.code) {
expect(err.code === 1
30
).assertTrue();
expect(err.code === 1
003
).assertTrue();
done();
} else {
expectedError(err, caseName, 'tempWnd.loadContent', done);
...
...
@@ -1158,7 +1159,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'begin');
windowStage.loadContent(null, (err, data) => {
if (err && err.code) {
expectedError(err, caseName, 'windowStage.loadContent', done, 1
30
);
expectedError(err, caseName, 'windowStage.loadContent', done, 1
003
);
console.log(msgStr + 'windowStage.loadContent(pages/index/index.ets)' + JSON.stringify(err));
}
done();
...
...
@@ -1196,7 +1197,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'begin');
windowStage.loadContent(null, abilityStorage, (err, data) => {
if (err && err.code) {
expectedError(err, caseName, 'windowStage.loadContent', done, 1
30
);
expectedError(err, caseName, 'windowStage.loadContent', done, 1
003
);
console.log(msgStr + 'windowStage.loadContent(pages/index/index.ets)' + JSON.stringify(err));
}
done();
...
...
@@ -1233,7 +1234,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'begin');
windowStage.createSubWindow(null, (err, data) => {
if (err && err.code) {
expectedError(err, caseName, 'windowStage.createSubWindow', done, 1
30
);
expectedError(err, caseName, 'windowStage.createSubWindow', done, 1
003
);
console.log(msgStr + 'windowStage.createSubWindow(null) err=' + JSON.stringify(err));
} else {
expect(false).assertTrue();
...
...
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
浏览文件 @
1cb47c43
...
...
@@ -12,9 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "
deccjsunit
/index"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "
hypium
/index"
import ohosWindow from '@ohos.window';
import screenManager from '@ohos.screen';
import display from '@ohos.display';
...
...
@@ -69,9 +68,11 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
beforeAll(function () {
console.log('jsunittest beforeall ohosWindow.WindowType=' + JSON.stringify(ohosWindow.WindowType));
systemWindowTypeDicArr = Object.keys(systemWindowTypeDic);
console.log('jsunittest beforeall systemWindowTypeDicArr=' + JSON.stringify(systemWindowTypeDicArr)+' ,length='+systemWindowTypeDicArr.length);
systemWindowValueArr = Object.keys(systemWindowTypeDic);
systemWindowTypeArr = Object.keys(systemWindowTypeDic);
for (i in ohosWindow.WindowType) {
console.log('jsunittest beforeall i=' + i);
windowTypeArr.push(ohosWindow.WindowType[i])
}
})
...
...
@@ -254,7 +255,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
await sleep(1000);
tempWnd.off('systemAvoidAreaChange');
console.log(msgStr + 'tempWnd.off systemAvoidAreaChange finished');
await sleep(1
20
0);
await sleep(1
001
0);
listenerOffFlag = listenerStatus.pending;
await tempWnd.setSystemBarEnable(['status', 'navigation']).catch((err) => {
unexpectedError(err, caseName, 'tempWnd.setSystemBarEnable([status, navigation])', done);
...
...
@@ -394,14 +395,14 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
expect(!!tempWnd).assertTrue();
let windowTypeData = await tempWnd.setWindowType(changedWndType).catch((err) => {
console.log(msgStr + 'tempWnd.setWindowType err: ' + JSON.stringify(err));
expectedError(err, caseName, 'tempWnd.setWindowType', done, 1
30
);
expectedError(err, caseName, 'tempWnd.setWindowType', done, 1
003
);
})
console.log(msgStr + 'tempWnd.setWindowType windowTypeData' + JSON.stringify(windowTypeData));
console.log(msgStr + 'tempWnd.setWindowType !windowTypeData' + !windowTypeData);
if (!!windowTypeData) {
unexpectedError(err, caseName, 'tempWnd.setWindowType', done);
} else {
expect(err.code == 1
30
).assertTrue();
expect(err.code == 1
003
).assertTrue();
done();
}
} else {
...
...
@@ -703,7 +704,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console.log(msgStr + 'tempWnd.setSystemBarEnable([]) success');
await tempWnd.setSystemBarEnable([null, '123']).catch((err) => {
console.log(msgStr + 'tempWnd.setSystemBarEnable([null, 123]) err=' + JSON.stringify(err));
expect(err.code === 1
30
).assertTrue();
expect(err.code === 1
003
).assertTrue();
done();
});
console.log(msgStr + 'tempWnd.setSystemBarEnable([null, 123]) finished');
...
...
@@ -966,8 +967,8 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let caseName = 'createTest1';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let loopCount =
appWindowType
Arr.length;
console.log(
'jsunittest
loopCount: ' + loopCount);
let loopCount =
systemWindowTypeDic
Arr.length;
console.log(
msgStr + '
loopCount: ' + loopCount);
for (let i = 0; i < loopCount; i++) {
let tempType = systemWindowTypeDic[systemWindowTypeDicArr[i]];
let windId = 'createTest1' + i;
...
...
@@ -977,7 +978,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
unexpectedError(err, caseName, 'ohosWindow.create ' + tempType, done);
});
console.log(msgStr + 'ohosWindow.create ' + tempType + 'finished, wnd: ' + tempWnd);
expect(!tempWnd).assertTrue();
expect(!
!
tempWnd).assertTrue();
}
console.log(msgStr + 'done ');
done();
...
...
@@ -1042,7 +1043,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console.log(msgStr + 'ohosWindow.create ' + tempType + ' start');
let nonExistWnd = await ohosWindow.create(context, windId, tempType).catch((err) => {
console.log(msgStr + 'ohosWindow.create err: ' + JSON.stringify(err));
expect(err.code === 1
30
).assertTrue();
expect(err.code === 1
003
).assertTrue();
done();
});
})
...
...
@@ -1063,7 +1064,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
expect(!!ohosData).assertTrue();
let ohosDataError = await ohosWindow.create(context, windowId, 1).catch((err) => {
console.log(msgStr + 'ohosWindow.create 1 twice err: ' + JSON.stringify(err));
expect(err.code).assertEqual(1
20
)
expect(err.code).assertEqual(1
001
)
done();
})
console.log(msgStr + 'ohosWindow.create 1 twice ohosDataError: ' + JSON.stringify(ohosDataError));
...
...
@@ -1114,7 +1115,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let errFlag = false;
let loadContentData = await tempWnd.loadContent(null).catch((err) => {
errFlag = true;
expectedError(err, caseName, 'tempWnd.loadContent', done, 1
30
);
expectedError(err, caseName, 'tempWnd.loadContent', done, 1
003
);
console.log(msgStr + 'tempWnd.loadContent(null)' + JSON.stringify(err));
});
console.log(msgStr + 'tempWnd.loadContent loadContentData:' + JSON.stringify(loadContentData));
...
...
@@ -1152,7 +1153,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let load4 = await windowStage.loadContent(null).catch((err) => {
expectedError(err, caseName, 'tempWnd.loadContent', done, 1
30
);
expectedError(err, caseName, 'tempWnd.loadContent', done, 1
003
);
console.log(msgStr + 'tempWnd.loadContent(pages/index/index.ets)' + JSON.stringify(err));
});
console.log(msgStr + 'tempWnd.loadContent end load5=' + JSON.stringify(load4));
...
...
@@ -1168,7 +1169,7 @@ 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, 1
30
);
expectedError(err, caseName, 'tempWnd.loadContent', done, 1
003
);
console.log(msgStr + 'tempWnd.loadContent(pages/index/index.ets)' + JSON.stringify(err));
});
console.log(msgStr + 'tempWnd.loadContent end load5=' + JSON.stringify(load5));
...
...
@@ -1218,7 +1219,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let subWindow = await windowStage.createSubWindow(null).catch((err) => {
expectedError(err, caseName, 'windowStage.createSubWindow', done, 1
30
);
expectedError(err, caseName, 'windowStage.createSubWindow', done, 1
003
);
console.log(msgStr + 'windowStage.createSubWindow(null) err=' + JSON.stringify(err));
});
console.log(msgStr + 'windowStage.createSubWindow end subWindow=' + JSON.stringify(subWindow));
...
...
@@ -1310,7 +1311,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
});
console.log(msgStr + 'tempWnd.destroy end');
let findWnd = await ohosWindow.find(windowId).catch((err) => {
expectedError(err, caseName, 'ohosWindow.find', done, 1
20
);
expectedError(err, caseName, 'ohosWindow.find', done, 1
001
);
});
console.log(msgStr + 'find findWnd: ' + JSON.stringify(findWnd));
expect(!findWnd).assertTrue();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录