未验证 提交 2707fd47 编写于 作者: O openharmony_ci 提交者: Gitee

!8193 优化用例

Merge pull request !8193 from 姚翠/master
...@@ -35,14 +35,7 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -35,14 +35,7 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
var systemWindowTypeDicArr = []; var systemWindowTypeDicArr = [];
var systemWindowTypeDic = { var systemWindowTypeDic = {
'TYPE_SYSTEM_ALERT': 1, 'TYPE_SYSTEM_ALERT': 1,
'TYPE_INPUT_METHOD': 2,
'TYPE_STATUS_BAR': 3,
'TYPE_PANEL': 4,
'TYPE_KEYGUARD': 5,
'TYPE_VOLUME_OVERLAY': 6,
'TYPE_NAVIGATION_BAR': 7,
'TYPE_FLOAT': 8, 'TYPE_FLOAT': 8,
// 'TYPE_FLOAT_CAMERA': 9
} }
var windowLayoutModeArr = []; var windowLayoutModeArr = [];
var windowLayoutModeDic = { var windowLayoutModeDic = {
...@@ -2051,7 +2044,7 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -2051,7 +2044,7 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
try { try {
let isLayoutFullScreen = false; let isLayoutFullScreen = false;
await wnd.setWindowLayoutFullScreen(isLayoutFullScreen).then(() => { await wnd.setWindowLayoutFullScreen(isLayoutFullScreen).then(() => {
console.info(msgStr + 'Succeeded in setting the window layout to full-screen mode.'); console.info(msgStr + 'Succeeded in setting the window not layout to full-screen mode.');
try { try {
let propData = wnd.getWindowProperties() let propData = wnd.getWindowProperties()
console.info(msgStr + 'wnd.getWindowProperties propData: ' + JSON.stringify(propData)); console.info(msgStr + 'wnd.getWindowProperties propData: ' + JSON.stringify(propData));
...@@ -2141,7 +2134,7 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -2141,7 +2134,7 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
try { try {
wnd.setWindowLayoutFullScreen(isLayoutFullScreen, (err) => { wnd.setWindowLayoutFullScreen(isLayoutFullScreen, (err) => {
if (err.code) { if (err.code) {
console.error(msgStr + 'err Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err)); console.error(msgStr + 'err Failed to set the window not layout to full-screen mode. Cause:' + JSON.stringify(err));
try { try {
expect().assertFail(); expect().assertFail();
} catch (error) { } catch (error) {
...@@ -2150,7 +2143,7 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta ...@@ -2150,7 +2143,7 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
done(); done();
return; return;
} }
console.info(msgStr + 'Succeeded in setting the window layout to full-screen mode.'); console.info(msgStr + 'Succeeded in setting the window not layout to full-screen mode.');
try { try {
let propData = wnd.getWindowProperties() let propData = wnd.getWindowProperties()
console.log(msgStr + JSON.stringify(propData)); console.log(msgStr + JSON.stringify(propData));
......
...@@ -40,14 +40,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -40,14 +40,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
var systemWindowTypeArr = []; var systemWindowTypeArr = [];
var systemWindowTypeDic = { var systemWindowTypeDic = {
'TYPE_SYSTEM_ALERT': 1, 'TYPE_SYSTEM_ALERT': 1,
'TYPE_INPUT_METHOD': 2,
'TYPE_STATUS_BAR': 3,
'TYPE_PANEL': 4,
'TYPE_KEYGUARD': 5,
'TYPE_VOLUME_OVERLAY': 6,
'TYPE_NAVIGATION_BAR': 7,
'TYPE_FLOAT': 8, 'TYPE_FLOAT': 8,
'TYPE_FLOAT_CAMERA': 9
} }
var windowLayoutModeArr = []; var windowLayoutModeArr = [];
var windowLayoutModeDic = { var windowLayoutModeDic = {
...@@ -1591,10 +1584,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -1591,10 +1584,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
let caseName = 'loadContentTest9'; let caseName = 'loadContentTest9';
let msgStr = 'jsunittest ' + caseName + ' '; let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin'); console.log(msgStr + 'begin');
windowStage.loadContent('pages/index/index.ets', (err, data) => { windowStage.loadContent('MainAbility/pages/second/second', (err, data) => {
if (err && err.code) { if (err && err.code) {
unexpectedError(err, caseName, 'windowStage.loadContent', done); unexpectedError(err, caseName, 'windowStage.loadContent', done);
console.log(msgStr + 'windowStage.loadContent(pages/index/index.ets)' + JSON.stringify(err)); console.log(msgStr + 'windowStage loadContent MainAbility/pages/second/second' + JSON.stringify(err));
} else { } else {
try { try {
expect(!data).assertTrue(); expect(!data).assertTrue();
...@@ -1618,7 +1611,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -1618,7 +1611,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
try { try {
windowStage.loadContent(null, (err, data) => { windowStage.loadContent(null, (err, data) => {
console.log(msgStr + 'windowStage.loadContent(pages/index/index.ets)' + JSON.stringify(err)); console.log(msgStr + 'windowStage loadContent null' + JSON.stringify(err));
try { try {
expect(false).assertTrue(); expect(false).assertTrue();
} catch (error) { } catch (error) {
...@@ -1627,7 +1620,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -1627,7 +1620,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
done(); done();
}); });
} catch (err) { } catch (err) {
console.log(msgStr + 'windowStage.loadContent(pages/index/index.ets) catch err' + JSON.stringify(err)); console.log(msgStr + 'windowStage loadContent null catch err' + JSON.stringify(err));
try { try {
expect(err.code == 401).assertTrue(); expect(err.code == 401).assertTrue();
} catch (error) { } catch (error) {
...@@ -1647,10 +1640,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -1647,10 +1640,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
let msgStr = 'jsunittest ' + caseName + ' '; let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin'); console.log(msgStr + 'begin');
windowStage.loadContent('pages/index/index.ets', abilityStorage, (err, data) => { windowStage.loadContent('MainAbility/pages/second/second', abilityStorage, (err, data) => {
if (err && err.code) { if (err && err.code) {
unexpectedError(err, caseName, 'windowStage.loadContent', done); unexpectedError(err, caseName, 'windowStage.loadContent', done);
console.log(msgStr + 'windowStage.loadContent(pages/index/index.ets)' + JSON.stringify(err)); console.log(msgStr + 'windowStage loadContent MainAbility/pages/second/second' + JSON.stringify(err));
} else { } else {
try { try {
expect(!data).assertTrue(); expect(!data).assertTrue();
...@@ -1674,7 +1667,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -1674,7 +1667,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
try { try {
windowStage.loadContent(null, abilityStorage, (err, data) => { windowStage.loadContent(null, abilityStorage, (err, data) => {
console.log(msgStr + 'windowStage.loadContent(pages/index/index.ets)' + JSON.stringify(err)); console.log(msgStr + 'windowStage loadContent null ' + JSON.stringify(err));
try { try {
expect(false).assertTrue(); expect(false).assertTrue();
} catch (error) { } catch (error) {
...@@ -1683,7 +1676,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -1683,7 +1676,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
done(); done();
}); });
} catch (err) { } catch (err) {
console.log(msgStr + 'windowStage.loadContent(pages/index/index.ets) catch err ' + JSON.stringify(err)); console.log(msgStr + 'windowStage loadContent null catch err ' + JSON.stringify(err));
try { try {
expect(err.code === 401).assertTrue(); expect(err.code === 401).assertTrue();
} catch (error) { } catch (error) {
...@@ -2037,6 +2030,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -2037,6 +2030,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
expect().assertFail(); expect().assertFail();
done(); done();
}); });
await sleep(3000)
console.info(msgStr + 'Succeeded in setting window orientation. orientation: ' + orientation + "step: " + i); console.info(msgStr + 'Succeeded in setting window orientation. orientation: ' + orientation + "step: " + i);
} }
done() done()
...@@ -2102,6 +2096,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -2102,6 +2096,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'windowStage.getMainWindow' + JSON.stringify(mainWin)); console.log(msgStr + 'windowStage.getMainWindow' + JSON.stringify(mainWin));
expect(!!mainWin).assertTrue(); expect(!!mainWin).assertTrue();
await sleep(2000)
mainWin.snapshot((err, data) => { mainWin.snapshot((err, data) => {
if (err && err.code) { if (err && err.code) {
console.log(msgStr + 'snapshot err.code:' + JSON.stringify(err.code)); console.log(msgStr + 'snapshot err.code:' + JSON.stringify(err.code));
...@@ -2324,10 +2319,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -2324,10 +2319,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
}) })
}) })
/** /**
* @tc.number SUB_WINDOW_SETASPECTRATIO_JSAPI_001 * @tc.number SUB_WINDOW_SETASPECTRATIO_JSAPI_001
* @tc.name Test setAspectRatioTest1 * @tc.name Test setAspectRatioTest1
* @tc.desc Validate the scenario cancelled after setting the proportion of the content layout of the main window * @tc.desc Validate the scenario cancelled after setting the proportion of the content layout of the main window
*/ */
it('setAspectRatioTest1', 0, async function (done) { it('setAspectRatioTest1', 0, async function (done) {
let caseName = 'setAspectRatioTest1'; let caseName = 'setAspectRatioTest1';
let msgStr = 'jsunittest ' + caseName + ' '; let msgStr = 'jsunittest ' + caseName + ' ';
...@@ -2389,10 +2384,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -2389,10 +2384,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
await resetAspectRatio() await resetAspectRatio()
}) })
/** /**
* @tc.number SUB_WINDOW_SETASPECTRATIO_JSAPI_003 * @tc.number SUB_WINDOW_SETASPECTRATIO_JSAPI_003
* @tc.name Test setAspectRatioTest3 * @tc.name Test setAspectRatioTest3
* @tc.desc Validate the scenario where the content layout proportion of the main window is abnormal * @tc.desc Validate the scenario where the content layout proportion of the main window is abnormal
*/ */
it('setAspectRatioTest3', 0, async function (done) { it('setAspectRatioTest3', 0, async function (done) {
let caseName = 'setAspectRatioTest3'; let caseName = 'setAspectRatioTest3';
let msgStr = 'jsunittest ' + caseName + ' '; let msgStr = 'jsunittest ' + caseName + ' ';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册