未验证 提交 1d346ac2 编写于 作者: O openharmony_ci 提交者: Gitee

!8416 xts-窗口生命周期相关用例修改

Merge pull request !8416 from chengxingzhen/master
......@@ -18,6 +18,14 @@
],
"type": "AppInstallKit",
"cleanup-apps": true
}
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"power-shell setmode 602",
"uinput -T -d 300 600 -m 300 600 300 100 -u 300 100"
]
}
]
}
......@@ -15,7 +15,15 @@
],
"type": "AppInstallKit",
"cleanup-apps": true
}
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"power-shell setmode 602",
"uinput -T -d 300 600 -m 300 600 300 100 -u 300 100"
]
}
]
}
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import { describe, beforeAll, it, expect } from '@ohos/hypium'
import commonEvent from '@ohos.commonEvent'
var subscriberInfo_MainAbility = {
......@@ -103,7 +103,12 @@ export default function abilityTest() {
})
function timeout() {
if (flag == true) {
expect().assertFail();
try {
expect().assertFail();
} catch (error) {
console.log(`ACTS_DoAbilityForeground_0100 startRunning failed: ${JSON.stringify(error)}`);
done();
}
console.log('ACTS_DoAbilityForeground_0100 - timeout');
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback);
}
......@@ -111,8 +116,6 @@ export default function abilityTest() {
setTimeout(timeout, START_ABILITY_TIMEOUT);
})
/*
* @tc.number : ACTS_DoAbilityForeground_0200
* @tc.name : change abilitystage to foreground
......@@ -139,7 +142,6 @@ export default function abilityTest() {
})
})
/*
* @tc.number : ACTS_DoAbilityForeground_0400
* @tc.name : change abilitystage to foreground
......
......@@ -15,6 +15,14 @@
],
"type": "AppInstallKit",
"cleanup-apps": true
}
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"power-shell setmode 602",
"uinput -T -d 300 600 -m 300 600 300 100 -u 300 100"
]
}
]
}
......@@ -729,28 +729,33 @@ export default function lifecycleTest() {
console.log(TAG + " listtemp1 is :" + listtemp1);
let exlist = listtemp;
let exlist1 = listtemp1;
expect(exlist[0]).assertEqual("MainAbility1 onWindowStageCreate");
expect(exlist[1]).assertEqual("MainAbility1 onAbilityForeground");
expect(exlist[2]).assertEqual("MainAbility1 onAbilityBackground");
expect(exlist[3]).assertEqual("MainAbility1 onAbilityForeground");
expect(exlist[4]).assertEqual("MainAbility1 onAbilityBackground");
expect(exlist[5]).assertEqual("MainAbility1 onAbilityForeground");
expect(exlist[6]).assertEqual("MainAbility1 onAbilityBackground");
expect(exlist1[0]).assertEqual("MainAbility2 onAbilityCreate");
expect(exlist1[1]).assertEqual("MainAbility2 onWindowStageCreate");
expect(exlist1[2]).assertEqual("MainAbility2 onAbilityForeground");
expect(exlist1[3]).assertEqual("MainAbility2 onAbilityBackground");
expect(exlist1[4]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist1[5]).assertEqual("MainAbility2 onAbilityDestroy");
expect(exlist1[6]).assertEqual("MainAbility2 onAbilityCreate");
expect(exlist1[7]).assertEqual("MainAbility2 onWindowStageCreate");
expect(exlist1[8]).assertEqual("MainAbility2 onAbilityForeground");
expect(exlist1[9]).assertEqual("MainAbility2 onAbilityBackground");
expect(exlist1[10]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist1[11]).assertEqual("MainAbility2 onAbilityDestroy");
expect(exlist1[12]).assertEqual("MainAbility2 onAbilityCreate");
expect(exlist1[13]).assertEqual("MainAbility2 onWindowStageCreate");
expect(exlist1[14]).assertEqual("MainAbility2 onAbilityForeground");
try {
expect(exlist[0]).assertEqual("MainAbility1 onWindowStageCreate");
expect(exlist[1]).assertEqual("MainAbility1 onAbilityForeground");
expect(exlist[2]).assertEqual("MainAbility1 onAbilityBackground");
expect(exlist[3]).assertEqual("MainAbility1 onAbilityForeground");
expect(exlist[4]).assertEqual("MainAbility1 onAbilityBackground");
expect(exlist[5]).assertEqual("MainAbility1 onAbilityForeground");
expect(exlist[6]).assertEqual("MainAbility1 onAbilityBackground");
expect(exlist1[0]).assertEqual("MainAbility2 onAbilityCreate");
expect(exlist1[1]).assertEqual("MainAbility2 onWindowStageCreate");
expect(exlist1[2]).assertEqual("MainAbility2 onAbilityForeground");
expect(exlist1[3]).assertEqual("MainAbility2 onAbilityBackground");
expect(exlist1[4]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist1[5]).assertEqual("MainAbility2 onAbilityDestroy");
expect(exlist1[6]).assertEqual("MainAbility2 onAbilityCreate");
expect(exlist1[7]).assertEqual("MainAbility2 onWindowStageCreate");
expect(exlist1[8]).assertEqual("MainAbility2 onAbilityForeground");
expect(exlist1[9]).assertEqual("MainAbility2 onAbilityBackground");
expect(exlist1[10]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist1[11]).assertEqual("MainAbility2 onAbilityDestroy");
expect(exlist1[12]).assertEqual("MainAbility2 onAbilityCreate");
expect(exlist1[13]).assertEqual("MainAbility2 onWindowStageCreate");
expect(exlist1[14]).assertEqual("MainAbility2 onAbilityForeground");
} catch (error) {
console.error(`${TAG} startRunning failed: ${JSON.stringify(error)}`);
done();
}
globalThis.applicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
......@@ -758,7 +763,7 @@ export default function lifecycleTest() {
console.log("------------Singlehap_LifeCycleTest_0800 END-------------");
done();
});
}, 4950);
}, 5950);
});
/*
......
......@@ -17,6 +17,14 @@
],
"type": "AppInstallKit",
"cleanup-apps": true
}
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"power-shell setmode 602",
"uinput -T -d 300 600 -m 300 600 300 100 -u 300 100"
]
}
]
}
......@@ -92,10 +92,16 @@ export default function abilityTest() {
}
console.log(TAG + "listKeyTemp is :" + listKeyTemp);
console.log(TAG + "globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId);
expect(transferStr0.indexOf("Hap2MainAbility3 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility3 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility3 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility3 onWindowStageDestroy")!=-1).assertTrue();
try {
expect(transferStr0.indexOf("Hap2MainAbility3 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility3 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility3 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility3 onWindowStageDestroy")!=-1).assertTrue();
} catch (error) {
console.log(`Multihap_WindowStageLifecycleTest_001 startRunning failed: ${JSON.stringify(error)}`);
done();
}
console.info(TAG + "globalThis.ApplicationContext4 is :" + JSON.stringify(globalThis.ApplicationContext4));
globalThis.ApplicationContext4
.unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => {
......
......@@ -15,6 +15,14 @@
],
"type": "AppInstallKit",
"cleanup-apps": true
}
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"power-shell setmode 602",
"uinput -T -d 300 600 -m 300 600 300 100 -u 300 100"
]
}
]
}
......@@ -88,6 +88,7 @@ export default function lifecycleTest() {
}).catch((error) => {
console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error));
})
setTimeout(function () {
console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list));
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid));
......@@ -111,13 +112,18 @@ export default function lifecycleTest() {
code = error.code;
});
setTimeout(function () {
expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue();
expect(code).assertEqual(0);
console.log("------------Singlehap_WindowStageLifeCycleTest_0100 END-------------");
done();
try {
expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue();
expect(code).assertEqual(0);
done();
console.log("------------Singlehap_WindowStageLifeCycleTest_0100 END-------------");
} catch (error) {
console.log(`Singlehap_WindowStageLifeCycleTest_0100 startRunning failed : ${JSON.stringify(error)}`);
done();
}
}, 1000);
}, 3000);
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册