提交 7f5cd752 编写于 作者: 华华小仙女

1.修改签名文件2.优化displayAndWindowRefactorInterface.test.ets用例

Signed-off-by: N华华小仙女 <zhurong18@h-partners.com>
上级 78fdecee
...@@ -200,8 +200,9 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -200,8 +200,9 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
let loopCount = systemWindowTypeDicArr.length; let loopCount = systemWindowTypeDicArr.length;
console.log(msgStr + 'loopCount: ' + loopCount); console.log(msgStr + 'loopCount: ' + loopCount);
let num = 0 let num = 0
for (let i = 0; i < loopCount; i++) { getData(0, loopCount)
sleep(500)
async function getData(i, length) {
let tempType = Number(ohosWindow.WindowType[systemWindowTypeDicArr[i]]) let tempType = Number(ohosWindow.WindowType[systemWindowTypeDicArr[i]])
let windId = 'createWindowTest1' + i; let windId = 'createWindowTest1' + i;
console.log(msgStr + 'ohosWindow.createWindow: ' + tempType + ' start'); console.log(msgStr + 'ohosWindow.createWindow: ' + tempType + ' start');
...@@ -220,6 +221,12 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -220,6 +221,12 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
console.log(msgStr + 'ohosWindow.createWindow ' + tempType + 'finished, wnd: ' + JSON.stringify(tempWnd)); console.log(msgStr + 'ohosWindow.createWindow ' + tempType + 'finished, wnd: ' + JSON.stringify(tempWnd));
expect(!!tempWnd).assertTrue(); expect(!!tempWnd).assertTrue();
num++; num++;
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length + ' ,tempType:' + tempType);
}
if (num == loopCount) done(); if (num == loopCount) done();
} catch (exception) { } catch (exception) {
console.error(msgStr + 'Failed to create the window. Cause: ' + JSON.stringify(exception)); console.error(msgStr + 'Failed to create the window. Cause: ' + JSON.stringify(exception));
...@@ -1199,7 +1206,9 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -1199,7 +1206,9 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
}); });
console.log(msgStr + 'ohosWindow.createWindow ' + baseWndType + ' wnd: ' + tempWnd); console.log(msgStr + 'ohosWindow.createWindow ' + baseWndType + ' wnd: ' + tempWnd);
expect(!!tempWnd).assertTrue(); expect(!!tempWnd).assertTrue();
for (var i = 1; i <= 5; i++) { getData(1, 5)
function getData(i, length) {
try { try {
tempWnd.resize(100, 100).then((data) => { tempWnd.resize(100, 100).then((data) => {
console.info(msgStr + 'Succeeded in changing the window size. Data:' + JSON.stringify(data)); console.info(msgStr + 'Succeeded in changing the window size. Data:' + JSON.stringify(data));
...@@ -1207,6 +1216,12 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -1207,6 +1216,12 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
}).catch((err) => { }).catch((err) => {
console.error(msgStr + 'Failed to change the window size. Cause: ' + JSON.stringify(err)); console.error(msgStr + 'Failed to change the window size. Cause: ' + JSON.stringify(err));
expect(err.code).assertEqual(6); expect(err.code).assertEqual(6);
if (++i <= length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length);
}
done(); done();
tempWnd.detroyWindow(); tempWnd.detroyWindow();
}) })
...@@ -1284,7 +1299,9 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -1284,7 +1299,9 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
unexpectedError(create_err, caseName, 'ohosWindow.createWindow', done); unexpectedError(create_err, caseName, 'ohosWindow.createWindow', done);
return; return;
} }
for (let i = 1; i <= 5; i++) { getData(1, 5)
function getData(i, length) {
width = width * i; width = width * i;
height = height * i; height = height * i;
try { try {
...@@ -1295,6 +1312,12 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -1295,6 +1312,12 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
return; return;
} }
console.info(msgStr + 'Succeeded in changing the window size.'); console.info(msgStr + 'Succeeded in changing the window size.');
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 (exception) { } catch (exception) {
...@@ -1302,7 +1325,6 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -1302,7 +1325,6 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
} }
; ;
} }
}) })
} catch (exception) { } catch (exception) {
console.error(msgStr + 'Failed to create the window. Cause: ' + JSON.stringify(exception)); console.error(msgStr + 'Failed to create the window. Cause: ' + JSON.stringify(exception));
...@@ -1871,7 +1893,6 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -1871,7 +1893,6 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
* @tc.desc Test window.setWindowMode API function test. * @tc.desc Test window.setWindowMode API function test.
*/ */
it('setWindowModeTest1', 0, function (done) { it('setWindowModeTest1', 0, function (done) {
//['UNDEFINED','FULLSCREEN','PRIMARY','SECONDARY','FLOATING']
let windowModeArr = ['FULLSCREEN', 'PRIMARY', 'SECONDARY', 'FLOATING'] let windowModeArr = ['FULLSCREEN', 'PRIMARY', 'SECONDARY', 'FLOATING']
let caseName = 'setWindowModeTest1'; let caseName = 'setWindowModeTest1';
let msgStr = 'jsunittest ' + caseName + ' '; let msgStr = 'jsunittest ' + caseName + ' ';
...@@ -1881,8 +1902,9 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -1881,8 +1902,9 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
expect(!!tempWnd).assertTrue(); expect(!!tempWnd).assertTrue();
let loopCount = windowModeArr; let loopCount = windowModeArr;
console.log(msgStr + 'ohosWindow.windowType' + JSON.stringify(loopCount)) console.log(msgStr + 'ohosWindow.windowType' + JSON.stringify(loopCount))
for (let i = 0; i < loopCount.length; i++) { getData(0, loopCount.length)
sleep(500)
function getData(i, length) {
let tempType = ohosWindow.WindowMode[loopCount[i]]; let tempType = ohosWindow.WindowMode[loopCount[i]];
console.log(msgStr + 'tempWnd.setWindowMode ' + tempType + ' start'); console.log(msgStr + 'tempWnd.setWindowMode ' + tempType + ' start');
try { try {
...@@ -1891,6 +1913,12 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -1891,6 +1913,12 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
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 (sumCount == loopCount.length) done();
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length + ' ,tempType:' + tempType);
}
}).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));
...@@ -1969,8 +1997,9 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -1969,8 +1997,9 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
expect(!!tempWnd).assertTrue(); expect(!!tempWnd).assertTrue();
let loopCount = windowModeArr; let loopCount = windowModeArr;
console.log(msgStr + 'ohosWindow.windowType' + JSON.stringify(loopCount)) console.log(msgStr + 'ohosWindow.windowType' + JSON.stringify(loopCount))
for (let i = 0; i < loopCount.length; i++) { getData(0, loopCount.length)
sleep(500)
function getData(i, length) {
let tempType = ohosWindow.WindowMode[loopCount[i]]; let tempType = ohosWindow.WindowMode[loopCount[i]];
console.log(msgStr + 'tempWnd.setWindowMode ' + tempType + ' start'); console.log(msgStr + 'tempWnd.setWindowMode ' + tempType + ' start');
try { try {
...@@ -1982,6 +2011,12 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -1982,6 +2011,12 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
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));
expect(err.code == 401).assertTrue(); expect(err.code == 401).assertTrue();
if (++i < length) {
getData(i, length)
console.log(msgStr + 'jixuzhixing i: ' + i);
} else {
console.log(msgStr + 'i++<length i: ' + i + ' ,length:' + length + ' ,tempType:' + tempType);
}
done(); done();
}); });
} catch (exception) { } catch (exception) {
...@@ -2009,8 +2044,9 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -2009,8 +2044,9 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
expect(!!wnd).assertTrue(); expect(!!wnd).assertTrue();
let loopCount = windowModeArr; let loopCount = windowModeArr;
console.log(msgStr + 'ohosWindow.windowType' + JSON.stringify(loopCount)) console.log(msgStr + 'ohosWindow.windowType' + JSON.stringify(loopCount))
for (let i = 0; i < loopCount.length; i++) { getData(0, loopCount.length)
sleep(500)
function getData(i, length) {
let tempType = ohosWindow.WindowMode[loopCount[i]]; let tempType = ohosWindow.WindowMode[loopCount[i]];
console.log(msgStr + 'tempWnd.setWindowMode ' + tempType + ' start'); console.log(msgStr + 'tempWnd.setWindowMode ' + tempType + ' start');
try { try {
...@@ -2023,6 +2059,12 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -2023,6 +2059,12 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
} catch (error) { } catch (error) {
console.info(`ohosWindow.createWindow catch error: ${JSON.stringify(error)}`) console.info(`ohosWindow.createWindow 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 + ' ,tempType:' + tempType);
}
done(); done();
} else { } else {
sumCount++ sumCount++
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册