未验证 提交 761b919f 编写于 作者: O openharmony_ci 提交者: Gitee

!7181 优化用例

Merge pull request !7181 from 姚翠/monthly_20221018
...@@ -1912,13 +1912,14 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -1912,13 +1912,14 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
sumCount++ sumCount++
console.info(msgStr + 'Succeeded in setting the window mode. count: ' + sumCount); console.info(msgStr + 'Succeeded in setting the window mode. count: ' + sumCount);
console.info(msgStr + 'Succeeded in setting the window mode. loopCount.length: ' + loopCount.length); console.info(msgStr + 'Succeeded in setting the window mode. loopCount.length: ' + loopCount.length);
if (sumCount == loopCount.length) done();
if (++i < length) { if (++i < length) {
getData(i, length) getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i); console.log(msgStr + 'jixuzhixing i: ' + i);
} else { } else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length + ' ,tempType:' + tempType); console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length + ' ,tempType:' + tempType);
} }
if (sumCount == loopCount.length) done();
}).catch((err) => { }).catch((err) => {
console.log(msgStr + 'currentType: ' + tempType) console.log(msgStr + 'currentType: ' + tempType)
console.error(msgStr + 'Failed to set the window mode. Cause: ' + JSON.stringify(err)); console.error(msgStr + 'Failed to set the window mode. Cause: ' + JSON.stringify(err));
...@@ -2082,5 +2083,25 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -2082,5 +2083,25 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
} }
; ;
}) })
/**
* @tc.number SUB_WMS_ENUM_WINDOWSTAGEEVENTTYPERENAME_JSAPI_001
* @tc.name Test enumWindowStageEventTypeReName_Test_001.
* @tc.desc To test the enum value of WindowStageEventType.
*/
it('enumWindowStageEventTypeReName_Test_001', 0, async function (done) {
console.info('test the enum value of WindowStageEventType begin');
try {
expect(1).assertEqual(ohosWindow.WindowStageEventType.SHOWN);
expect(2).assertEqual(ohosWindow.WindowStageEventType.ACTIVE);
expect(3).assertEqual(ohosWindow.WindowStageEventType.INACTIVE);
expect(4).assertEqual(ohosWindow.WindowStageEventType.HIDDEN);
done();
} catch (err) {
console.info('test enum value of windowStageEventType error ' + JSON.stringify(err));
expect().assertFail();
done();
}
})
}) })
} }
...@@ -1119,40 +1119,6 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -1119,40 +1119,6 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
unexpectedError(err, caseName, 'ohosWindow.create', done); unexpectedError(err, caseName, 'ohosWindow.create', done);
}) })
}) })
/**
* @tc.number SUB_WINDOW_CREATE_JSAPI_008
* @tc.name Test createTest8
* @tc.desc Verify the scenario of creating a window with duplicate IDs
*/
it('createTest8', 0, done => {
let caseName = 'createTest8';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let windowId = 'sameid'
ohosWindow.create(context, windowId, 1, (err, data) => {
console.log(msgStr + 'ohosWindow.create 1 once err: ' + JSON.stringify(err));
if (err && err.code) {
unexpectedError(err, caseName, 'ohosWindow.create', done);
}
expect(!!data).assertTrue();
ohosWindow.create(context, windowId, 1, (err, data) => {
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));
try {
expect(err.code).assertEqual(1001)
} catch (error) {
console.info(`tempWnd.show catch error: ${JSON.stringify(error)}`)
}
done();
} else {
unexpectedError(err, caseName, 'ohosWindow.create', done);
console.log(msgStr + 'ohosWindow.create 1 twice data: ' + JSON.stringify(data));
}
})
})
})
/** /**
* @tc.number SUB_WINDOW_ON_OFF_JSAPI_005 * @tc.number SUB_WINDOW_ON_OFF_JSAPI_005
* @tc.name Test listenerTest5 * @tc.name Test listenerTest5
...@@ -1240,19 +1206,16 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -1240,19 +1206,16 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
it('setWindowTypeTest3', 0, function (done) { it('setWindowTypeTest3', 0, function (done) {
let caseName = 'setWindowTypeTest3'; let caseName = 'setWindowTypeTest3';
let msgStr = 'jsunittest ' + caseName + ' '; let msgStr = 'jsunittest ' + caseName + ' ';
let baseWndType = 1;
let windowId = 'setWindowTypeTest3';
console.log(msgStr + 'begin'); console.log(msgStr + 'begin');
let tempWnd = null let tempWnd = null
let tempTypeArr = []; let tempTypeArr = [];
ohosWindow.create(context, windowId, baseWndType, (err, data) => {
try { try {
console.log(msgStr + 'ohosWindow.create err' + JSON.stringify(err)); let data = windowStage.getMainWindowSync();
console.log(msgStr + 'ohosWindow.create data' + JSON.stringify(data)); console.log(msgStr + 'ohosWindow.create data' + JSON.stringify(data));
console.log(msgStr + 'ohosWindow.create !!data' + !!data); console.log(msgStr + 'ohosWindow.create !!data' + !!data);
if (!!data) { if (!!data) {
tempWnd = data tempWnd = data
console.log(msgStr + 'ohosWindow.create ' + baseWndType + ' wnd: ' + tempWnd); // console.log(msgStr + 'ohosWindow.create ' + baseWndType + ' wnd: ' + tempWnd);
try { try {
expect(!!tempWnd).assertTrue(); expect(!!tempWnd).assertTrue();
} catch (error) { } catch (error) {
...@@ -1327,7 +1290,6 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -1327,7 +1290,6 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
} catch (err) { } catch (err) {
console.log(msgStr + 'ohosWindow.create catch err: ' + JSON.stringify(err)); console.log(msgStr + 'ohosWindow.create catch err: ' + JSON.stringify(err));
} }
})
}) })
/** /**
* @tc.number SUB_WINDOW_SETWINDOWTYPE_JSAPI_004 * @tc.number SUB_WINDOW_SETWINDOWTYPE_JSAPI_004
...@@ -1337,13 +1299,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -1337,13 +1299,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
it('setWindowTypeTest4', 0, function (done) { it('setWindowTypeTest4', 0, function (done) {
let caseName = 'setWindowTypeTest4'; let caseName = 'setWindowTypeTest4';
let msgStr = 'jsunittest ' + caseName + ' '; let msgStr = 'jsunittest ' + caseName + ' ';
let baseWndType = 1;
let changedWndType = null; let changedWndType = null;
let windowId = 'setWindowTypeTest4';
console.log(msgStr + 'begin'); console.log(msgStr + 'begin');
let tempWnd = null let tempWnd = null
ohosWindow.create(context, windowId, baseWndType, (err, data) => { let data = windowStage.getMainWindowSync();
console.log(msgStr + 'ohosWindow.create err' + JSON.stringify(err));
console.log(msgStr + 'ohosWindow.create data' + JSON.stringify(data)); console.log(msgStr + 'ohosWindow.create data' + JSON.stringify(data));
console.log(msgStr + 'ohosWindow.create !!data' + !!data); console.log(msgStr + 'ohosWindow.create !!data' + !!data);
if (!!data) { if (!!data) {
...@@ -1368,10 +1327,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -1368,10 +1327,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
done(); done();
} }
}) })
} else { }
unexpectedError(err, caseName, 'ohosWindow.create', done);
}
})
}) })
/** /**
* @tc.number SUB_WINDOW_DESTROY_JSAPI_002 * @tc.number SUB_WINDOW_DESTROY_JSAPI_002
...@@ -2270,5 +2226,60 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -2270,5 +2226,60 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
}) })
}) })
}) })
/**
* @tc.number SUB_WINDOW_CREATE_JSAPI_008
* @tc.name Test createTest8
* @tc.desc Verify the scenario of creating a window with duplicate IDs
*/
it('createTest8', 0, done => {
let caseName = 'createTest8';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let windowId = 'sameid'
ohosWindow.create(context, windowId, 1, (err, data) => {
console.log(msgStr + 'ohosWindow.create 1 once err: ' + JSON.stringify(err));
if (err && err.code) {
unexpectedError(err, caseName, 'ohosWindow.create', done);
}
expect(!!data).assertTrue();
ohosWindow.create(context, windowId, 1, (err, data) => {
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));
try {
expect(err.code).assertEqual(1001)
} catch (error) {
console.info(`tempWnd.show catch error: ${JSON.stringify(error)}`)
}
done();
} else {
unexpectedError(err, caseName, 'ohosWindow.create', done);
console.log(msgStr + 'ohosWindow.create 1 twice data: ' + JSON.stringify(data));
}
})
})
})
/**
* @tc.number SUB_WINDOW_CREATE_JSAPI_004
* @tc.name Test createTest4
* @tc.desc Verify the scenario of creating a window with duplicate IDs
*/
it('createTest4', 0, async function (done) {
let caseName = 'createTest4';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let windowId = 'sameids'
let ohosData = await ohosWindow.create(context, windowId, 1).catch((err) => {
console.log(msgStr + 'ohosWindow.create 1 once err: ' + JSON.stringify(err));
unexpectedError(err, caseName, 'ohosWindow.create', done);
})
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(1001)
done();
})
console.log(msgStr + 'ohosWindow.create 1 twice ohosDataError: ' + JSON.stringify(ohosDataError));
})
}) })
} }
...@@ -1158,28 +1158,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -1158,28 +1158,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
}); });
}) })
/** /**
* @tc.number SUB_WINDOW_CREATE_JSAPI_004
* @tc.name Test createTest4
* @tc.desc Verify the scenario of creating a window with duplicate IDs
*/
it('createTest4', 0, async function (done) {
let caseName = 'createTest4';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let windowId = 'sameids'
let ohosData = await ohosWindow.create(context, windowId, 1).catch((err) => {
console.log(msgStr + 'ohosWindow.create 1 once err: ' + JSON.stringify(err));
unexpectedError(err, caseName, 'ohosWindow.create', done);
})
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(1001)
done();
})
console.log(msgStr + 'ohosWindow.create 1 twice ohosDataError: ' + JSON.stringify(ohosDataError));
})
/**
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_001 * @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_001
* @tc.name Test loadContentTest1 * @tc.name Test loadContentTest1
* @tc.desc Verify the scenario of loading an existing page * @tc.desc Verify the scenario of loading an existing page
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册