提交 5595ef91 编写于 作者: C chensi10 提交者: Gitee

Merge branch 'master' of gitee.com:openharmony/xts_acts into checkboxxts4

Signed-off-by: Nchensi10 <chensi52@huawei.com>
此差异已折叠。
...@@ -22,6 +22,8 @@ ohos_js_hap_suite("ActsCallDataAbilityTest") { ...@@ -22,6 +22,8 @@ ohos_js_hap_suite("ActsCallDataAbilityTest") {
ets2abc = true ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsCallDataAbilityTest" hap_name = "ActsCallDataAbilityTest"
subsystem_name = "ability"
part_name = "ability_runtime"
} }
ohos_js_assets("actscalldataabilitytest_ets_assets") { ohos_js_assets("actscalldataabilitytest_ets_assets") {
source_dir = "./entry/src/main/ets" source_dir = "./entry/src/main/ets"
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"test-timeout": "600000", "test-timeout": "600000",
"bundle-name": "com.example.actsgetabilitystatestagetest", "bundle-name": "com.example.actsgetabilitystatestagetest",
"module-name": "entry", "module-name": "entry",
"shell-timeout": "600000" "shell-timeout": "10000"
}, },
"kits": [ "kits": [
{ {
......
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
*/ */
import Ability from '@ohos.app.ability.UIAbility' import Ability from '@ohos.app.ability.UIAbility'
import commonEvent from '@ohos.commonEvent'
function publishCallBackOne() {
console.log("====MainAbility2 Publish CallBack GetCurrentTopAbility");
}
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
onCreate(want, launchParam) { onCreate(want, launchParam) {
...@@ -27,9 +31,15 @@ export default class MainAbility extends Ability { ...@@ -27,9 +31,15 @@ export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability // Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate") console.log("[Demo] MainAbility onWindowStageCreate");
windowStage.setUIContent(this.context, "pages/index", null);
windowStage.setUIContent(this.context, "pages/index", null) windowStage.on('windowStageEvent', (data) => {
console.log(`ActsGetAbilityStatestAgeTest onWindwoStageMainAbilty2 is : ${JSON.stringify(data)}`);
if (data == 2 ) {
console.log(`ActsGetAbilityStatestAgeTest getWindowStageActiveMainAbility2 is sucess`);
commonEvent.publish("GetCurrentTopAbility", publishCallBackOne);
}
})
} }
onWindowStageDestroy() { onWindowStageDestroy() {
......
...@@ -14,6 +14,11 @@ ...@@ -14,6 +14,11 @@
*/ */
import Ability from '@ohos.app.ability.UIAbility' import Ability from '@ohos.app.ability.UIAbility'
import commonEvent from '@ohos.commonEvent'
function publishCallBackOne() {
console.log("====MainAbility3 Publish CallBack GetCurrentTopAbility");
}
export default class MainAbility3 extends Ability { export default class MainAbility3 extends Ability {
onCreate(want, launchParam) { onCreate(want, launchParam) {
...@@ -27,9 +32,16 @@ export default class MainAbility3 extends Ability { ...@@ -27,9 +32,16 @@ export default class MainAbility3 extends Ability {
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability // Main window is created, set main page for this ability
console.log("MainAbility3 onWindowStageCreate") console.log("MainAbility3 onWindowStageCreate");
windowStage.setUIContent(this.context, "pages/index", null) windowStage.setUIContent(this.context, "pages/index", null);
globalThis.ability3Context = this.context; globalThis.ability3Context = this.context;
windowStage.on('windowStageEvent', (data) => {
console.log(`ActsGetAbilityStatestAgeTest onWindwoStageMainAbilty3 is : ${JSON.stringify(data)}`);
if (data == 2 ) {
console.log(`ActsGetAbilityStatestAgeTest getWindowStageActiveMainAbility3 is sucess`);
commonEvent.publish("GetCurrentTopAbility", publishCallBackOne);
}
})
} }
onWindowStageDestroy() { onWindowStageDestroy() {
......
...@@ -13,7 +13,11 @@ ...@@ -13,7 +13,11 @@
* limitations under the License. * limitations under the License.
*/ */
import Ability from '@ohos.app.ability.UIAbility' import Ability from '@ohos.app.ability.UIAbility'
import commonEvent from '@ohos.commonEvent'
function publishCallBackOne() {
console.debug("====MainAbility4 Publish CallBack GetCurrentTopAbility");
}
export default class MainAbility4 extends Ability { export default class MainAbility4 extends Ability {
onCreate(want, launchParam) { onCreate(want, launchParam) {
...@@ -27,10 +31,16 @@ export default class MainAbility4 extends Ability { ...@@ -27,10 +31,16 @@ export default class MainAbility4 extends Ability {
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability // Main window is created, set main page for this ability
console.log("MainAbility4 onWindowStageCreate") console.log("MainAbility4 onWindowStageCreate");
windowStage.setUIContent(this.context, "pages/index", null) windowStage.setUIContent(this.context, "pages/index", null);
globalThis.ability4Context = this.context; globalThis.ability4Context = this.context;
//commonEvent.publish("ACTS_GetAppContext", PublishCallBackOne4); windowStage.on('windowStageEvent', (data) => {
console.log(`ActsGetAbilityStatestAgeTest onWindwoStageMainAbilty4 is : ${JSON.stringify(data)}`);
if (data == 2 ) {
console.log(`ActsGetAbilityStatestAgeTest getWindowStageActiveMainAbility4 is sucess`);
commonEvent.publish("GetCurrentTopAbility", publishCallBackOne);
}
})
} }
onWindowStageDestroy() { onWindowStageDestroy() {
......
...@@ -36,6 +36,13 @@ export default class MainAbility extends Ability { ...@@ -36,6 +36,13 @@ export default class MainAbility extends Ability {
globalThis.ability3Context = this.context globalThis.ability3Context = this.context
windowStage.setUIContent(this.context, "pages/index1", null) windowStage.setUIContent(this.context, "pages/index1", null)
windowStage.on('windowStageEvent', (data) => {
console.log(`ActsGetCurrentTopAbilityStagebTest onWindwoStage is : ${JSON.stringify(data)}`)
if (data == 2 ) {
console.log(`ActsGetCurrentTopAbilityStagebTest getWindowStageActive is sucess`)
commonEvent.publish("GetCurrentTopAbility", publishCallBackOne);
}
})
} }
onWindowStageDestroy() { onWindowStageDestroy() {
...@@ -46,7 +53,6 @@ export default class MainAbility extends Ability { ...@@ -46,7 +53,6 @@ export default class MainAbility extends Ability {
onForeground() { onForeground() {
// Ability has brought to foreground // Ability has brought to foreground
console.log("Ability1 onForeground") console.log("Ability1 onForeground")
commonEvent.publish("GetCurrentTopAbility", publishCallBackOne);
} }
......
...@@ -36,7 +36,20 @@ export default class TestAbility extends Ability { ...@@ -36,7 +36,20 @@ export default class TestAbility extends Ability {
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
console.log('TestAbility onWindowStageCreate') console.log('TestAbility onWindowStageCreate')
globalThis.onWindowStageActive = false;
let count = 0;
windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) windowStage.setUIContent(this.context, 'MainAbility/pages/index', null)
windowStage.on('windowStageEvent', (data) => {
console.log(`ActsApiTest onWindwoStage is : ${JSON.stringify(data)}`)
if (data == 2 ) {
console.log(`ActsApiTest onWindwoStage count is : ${count}`)
count++;
if (count == 2) {
console.log(`ActsApiTest onWindwoStage count is : ${count}`)
globalThis.onWindowStageActive = true;
}
}
})
} }
onWindowStageDestroy() { onWindowStageDestroy() {
......
...@@ -31,7 +31,18 @@ export default function abilityTest() { ...@@ -31,7 +31,18 @@ export default function abilityTest() {
describe('ActsChangeAbilityStagetest', function () { describe('ActsChangeAbilityStagetest', function () {
beforeAll(async function (done) { beforeAll(async function (done) {
console.info('beforeAll called') console.info('beforeAll called')
await sleep(2000) let delay = 3000;
let start = new Date().getTime();
while (true) {
if (globalThis.onWindowStageActive) {
console.log(`ActsApiTest getWindwoStageActive is success`)
break;
}
if (new Date().getTime() - start > delay) {
console.log(`ActsApiTest getWindwoStageActive is failed`)
break;
}
}
await globalThis.abilitydelegator.getCurrentTopAbility().then((data) => { await globalThis.abilitydelegator.getCurrentTopAbility().then((data) => {
mainability = data mainability = data
done() done()
......
#wrapper {
flex-direction: column;
}
#div1 {
width: 100%;
height: 100%;
justify-content: center;
align-items: center;
background-color: white;
}
#text1 {
height: 45px;
width: 150px;
font-size: 16px;
text-align: center;
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册