未验证 提交 33c15107 编写于 作者: O openharmony_ci 提交者: Gitee

!4957 元能力新增用例

Merge pull request !4957 from chengxingzhen/master
......@@ -18,8 +18,10 @@ group("actssupportfunction") {
if (is_standard_system) {
deps = [
"actssupportfunctiontest:ActsSupportFunctionTest",
"faonandoffscreen:FaOnAndOffScreen",
"fasupportfunction:fasupportfunction",
"fasupportfunctionthree:fasupportfunctionthree",
"stageonandoffscreen:StageOnAndOffScreen",
"stagesupportfunction:StageSupportFunction",
]
}
......
......@@ -15,7 +15,9 @@
"FaSupportFunction.hap",
"FaSupportFunctionTwo.hap",
"FaSupportFunctionThree.hap",
"StageSupportFunction.hap"
"StageSupportFunction.hap",
"FaOnAndOffScreen.hap",
"StageOnAndOffScreen.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -15,9 +15,11 @@
import abilityIsTerminatingTest from './AbilityIsTerminating.test';
import faSetDisplayOrientation from './FaSetDisplayOrientation.test';
import faShowOnLock from './FaShowOnLock.test';
import onAndOffScreenTest from './OnAndOffScreenTest.test';
export default function testsuite() {
abilityIsTerminatingTest();
faSetDisplayOrientation();
faShowOnLock();
onAndOffScreenTest();
}
\ No newline at end of file
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("FaOnAndOffScreen") {
hap_name = "FaOnAndOffScreen"
hap_profile = "./entry/src/main/config.json"
testonly = true
deps = [
":faonandoffscreen_resources",
":faonandoffscreen_ts_assets",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("faonandoffscreen_ts_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("faonandoffscreen_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"app": {
"bundleName": "ohos.acts.aafwk.test.faonandoffscreen",
"vendor": "huawei",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 9,
"target": 9
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.aafwk.test.faonandoffscreen",
"name": ".entry",
"mainAbility": ".MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "ets",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "singleton"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ability_featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
var TAG1 = "Fa:FaOnAndOffScreen:MainAbility:";
var listPush1 = "FaOnAndOffScreen_MainAbility_";
var lifeList = [];
export default {
onCreate() {
console.log(TAG1 + 'onCreate');
lifeList.push('onCreate');
},
onDestroy() {
console.log(TAG1 + 'onDestroy');
},
onActive() {
console.log(TAG1 + 'onActive');
lifeList.push('onActive');
commonEvent.publish(listPush1 + "onActive", (err) => {
console.log(TAG1 + listPush1 + "onActive");
});
},
onInactive() {
console.log(TAG1 + 'onInactive');
lifeList.push('onInactive');
},
onShow() {
console.log(TAG1 + 'onShow');
lifeList.push('onShow');
let options = {
parameters: {
lifeList: lifeList
}
}
commonEvent.publish(listPush1 + "onShow", options, (err) => {
console.log(TAG1 + listPush1 + "onShow");
});
},
onHide() {
console.log(TAG1 + 'onHide');
lifeList.push('onHide');
let options = {
parameters: {
lifeList: lifeList
}
}
commonEvent.publish(listPush1 + "onHide", options, (err) => {
console.log(TAG1 + listPush1 + "onHide");
});
},
onNewWant(want) {
console.log(TAG1 + 'onNewWant');
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'Hello World FaOnAndOffScreen 1'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Row() {
Button() {
Text('FaOnAndOffScreen_MainAbility1')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('30%')
.height('5%')
.onClick(()=>{
})
}
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"color": [
{
"name": "white",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "FaOnAndOffScreen"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "ohos.acts.aafwk.test.stageonandoffscreen",
"vendor": "huawei",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"debug": false,
"description" : "$string:app_name",
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "actsfstageonandoffscreen"
}
]
}
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("StageOnAndOffScreen") {
hap_name = "StageOnAndOffScreen"
hap_profile = "entry/src/main/module.json"
testonly = true
deps = [
":stageonandoffscreen_js_assets",
":stageonandoffscreen_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("stageonandoffscreen_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("stageonandoffscreen_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("stageonandoffscreen_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":stageonandoffscreen_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage";
var TAG0 = 'StageOnAndOffScreen:AbilityStage:';
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log(TAG0 + "onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability';
import commonEvent from '@ohos.commonEvent';
var TAG1 = 'StageOnAndOffScreen:MainAbility:';
var listPush1 = "StageOnAndOffScreen_MainAbility_";
var lifeList = [];
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log(TAG1 + 'onCreate');
lifeList.push('onCreate');
}
onDestroy() {
console.log(TAG1 + 'onDestroy');
}
onWindowStageCreate(windowStage) {
console.log(TAG1 + 'onWindowStageCreate');
windowStage.loadContent("pages/index", (err, data) => {
if (err.code) {
console.log(TAG1 + 'Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
console.log(TAG1 + 'Succeeded in loading the content. Data: ' + JSON.stringify(data));
});
}
onWindowStageDestroy() {
console.log(TAG1 + 'onWindowStageDestroy');
}
onForeground() {
console.log(TAG1 + 'onForeground');
lifeList.push('onForeground');
let options = {
parameters: {
lifeList: lifeList
}
}
commonEvent.publish(listPush1 + "onForeground", options, (err) => {
console.log(TAG1 + listPush1 + "onForeground");
});
}
onBackground() {
console.log(TAG1 + 'onBackground');
lifeList.push('onBackground');
let options = {
parameters: {
lifeList: lifeList
}
}
commonEvent.publish(listPush1 + "onBackground", options, (err) => {
console.log(TAG1 + listPush1 + "onBackground");
});
}
};
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability';
import commonEvent from '@ohos.commonEvent';
var TAG2 = 'StageOnAndOffScreen:MainAbility2:';
var listPush2 = "StageOnAndOffScreen_MainAbility2_";
export default class MainAbility2 extends Ability {
onCreate(want, launchParam) {
console.log(TAG2 + 'onCreate');
commonEvent.publish(listPush2 + "onCreate", (err) => {
console.log(TAG2 + listPush2 + "onCreate");
});
}
onDestroy() {
console.log(TAG2 + 'onDestroy');
commonEvent.publish(listPush2 + "onDestroy", (err) => {
console.log(TAG2 + listPush2 + "onDestroy");
});
}
onWindowStageCreate(windowStage) {
console.log(TAG2 + 'onWindowStageCreate');
commonEvent.publish(listPush2 + "onWindowStageCreate", (err) => {
console.log(TAG2 + listPush2 + "onWindowStageCreate");
});
windowStage.loadContent("pages/second", (err, data) => {
if (err.code) {
console.log(TAG2 + 'Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
console.log(TAG2 + 'Succeeded in loading the content. Data: ' + JSON.stringify(data));
});
}
onWindowStageDestroy() {
console.log(TAG2 + 'onWindowStageDestroy');
commonEvent.publish(listPush2 + "onWindowStageDestroy", (err) => {
console.log(TAG2 + listPush2 + "onWindowStageDestroy");
});
}
onForeground() {
console.log(TAG2 + 'onForeground');
commonEvent.publish(listPush2 + "onForeground", (err) => {
console.log(TAG2 + listPush2 + "onForeground");
});
setTimeout(async () => {
let wantNum = {
bundleName: "ohos.acts.aafwk.test.stageonandoffscreen",
abilityName: "MainAbility3"
}
this.context.startAbility(wantNum).then((data) => {
console.log(TAG2 + "startAbility data = " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG2 + "startAbility error = " + JSON.stringify(error));
})
}, 1000);
}
onBackground() {
console.log(TAG2 + 'onBackground');
commonEvent.publish(listPush2 + "onBackground", (err) => {
console.log(TAG2 + listPush2 + "onBackground");
});
}
};
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability';
import commonEvent from '@ohos.commonEvent';
var TAG3 = 'StageOnAndOffScreen:MainAbility3:';
var listPush3 = "StageOnAndOffScreen_MainAbility3_";
export default class MainAbility3 extends Ability {
onCreate(want, launchParam) {
console.log(TAG3 + 'onCreate');
}
onDestroy() {
console.log(TAG3 + 'onDestroy');
}
onWindowStageCreate(windowStage) {
console.log(TAG3 + 'onWindowStageCreate');
windowStage.loadContent("pages/third", (err, data) => {
if (err.code) {
console.log(TAG3 + 'Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
console.log(TAG3 + 'Succeeded in loading the content. Data: ' + JSON.stringify(data));
});
}
onWindowStageDestroy() {
console.log(TAG3 + 'onWindowStageDestroy');
}
onForeground() {
console.log(TAG3 + 'onForeground');
commonEvent.publish(listPush3 + "onForeground", (err) => {
console.log(TAG3 + listPush3 + "onForeground");
});
}
onBackground() {
console.log(TAG3 + 'onBackground');
commonEvent.publish(listPush3 + "onBackground", (err) => {
console.log(TAG3 + listPush3 + "onBackground");
});
}
};
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'Hello World StageOnAndOffScreen 1'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Row() {
Button() {
Text('StageOnAndOffScreen_MainAbility1')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('30%')
.height('5%')
.onClick(()=>{
})
}
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Second {
@State message: string = 'Hello World StageOnAndOffScreen 2'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Row() {
Button() {
Text('StageOnAndOffScreen_MainAbility2')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('30%')
.height('5%')
.onClick(()=>{
})
}
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Third {
@State message: string = 'Hello World StageOnAndOffScreen 3'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Row() {
Button() {
Text('StageOnAndOffScreen_MainAbility3')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('30%')
.height('5%')
.onClick(()=>{
})
}
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "entry",
"type": "entry",
"srcEntrance": "./ets/Application/MyAbilityStage.ts",
"description": "$string:entry_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"launchType": "singleton",
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
},
{
"name": "MainAbility2",
"srcEntrance": "./ets/MainAbility2/MainAbility2.ts",
"description": "$string:MainAbility2_desc",
"icon": "$media:icon",
"label": "$string:MainAbility2_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"launchType": "singleton"
},
{
"name": "MainAbility3",
"srcEntrance": "./ets/MainAbility3/MainAbility3.ts",
"description": "$string:MainAbility3_desc",
"icon": "$media:icon",
"label": "$string:MainAbility3_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"launchType": "singleton"
}
]
}
}
\ No newline at end of file
{
"color": [
{
"name": "white",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "StageOnAndOffScreen"
},
{
"name": "MainAbility2_desc",
"value": "description"
},
{
"name": "MainAbility2_label",
"value": "label"
},
{
"name": "MainAbility3_desc",
"value": "description"
},
{
"name": "MainAbility3_label",
"value": "label"
}
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册