提交 521d0bc3 编写于 作者: C chengxingzhen

元能力用例自动化

Signed-off-by: Nchengxingzhen <chengxingzhen@huawei.com>
上级 4303d0b5
......@@ -48,6 +48,7 @@ group("ability_runtime") {
"non_concurrent:non_concurrent",
"processmultiinstance:processmultiinstance",
"stage:stage",
"supportfunctiontest:supportfunctiontest",
"want:want",
"workercontextcover:workercontextcover",
......
# Copyright (c) 2021 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")
group("supportfunctiontest") {
testonly = true
if (is_standard_system) {
deps = [
"fasupportfunction:fasupportfunction",
"fasupportfunctionthree:fasupportfunctionthree",
"stagesupportfunction:StageSupportFunction",
"supportfunction:SupportFunction",
]
}
}
# Copyright (c) 2021 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")
group("fasupportfunction") {
testonly = true
if (is_standard_system) {
deps = [
"entry:FaSupportFunction",
"fasupportfunctiontwo:FaSupportFunctionTwo",
]
}
}
# 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("FaSupportFunction") {
hap_name = "FaSupportFunction"
hap_profile = "src/main/config.json"
testonly = true
deps = [
":fasupportfunction_resources",
":fasupportfunction_ts_assets",
]
certificate_profile = "../signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("fasupportfunction_ts_assets") {
source_dir = "src/main/ets"
hap_profile = "src/main/config.json"
ets2abc = true
}
ohos_resources("fasupportfunction_resources") {
sources = [ "src/main/resources" ]
hap_profile = "src/main/config.json"
}
{
"app": {
"bundleName": "ohos.acts.aafwk.test.fasupportfunction",
"vendor": "huawei",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 9,
"target": 9
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.aafwk.test.fasupportfunction",
"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": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility2",
"srcLanguage": "ets",
"srcPath": "MainAbility2",
"icon": "$media:icon",
"description": "$string:MainAbility2_desc",
"label": "$string:MainAbility2_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility3",
"srcLanguage": "ets",
"srcPath": "MainAbility3",
"icon": "$media:icon",
"description": "$string:MainAbility3_desc",
"label": "$string:MainAbility3_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility4",
"srcLanguage": "ets",
"srcPath": "MainAbility4",
"icon": "$media:icon",
"description": "$string:MainAbility4_desc",
"label": "$string:MainAbility4_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility5",
"srcLanguage": "ets",
"srcPath": "MainAbility5",
"icon": "$media:icon",
"description": "$string:MainAbility5_desc",
"label": "$string:MainAbility5_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility6",
"srcLanguage": "ets",
"srcPath": "MainAbility6",
"icon": "$media:icon",
"description": "$string:MainAbility6_desc",
"label": "$string:MainAbility6_label",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility2",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility3",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility4",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility5",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility6",
"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:SupportFunction:MainAbility:";
var listPush1 = "Fa_SupportFunction_MainAbility_";
var lifeList = [];
export default {
onCreate() {
console.log(TAG1 + 'onCreate');
lifeList.push('onCreate');
ability_featureAbility.getWant().then((data) => {
console.log(TAG1 + "getWant data = " + JSON.stringify(data));
if(data.parameters.number == 1) {
try {
ability_featureAbility.getContext().setWakeUpScreen(true).then((data) => {
console.log(TAG1 + "setWakeUpScreen data = " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG1 + "setWakeUpScreen error = " + JSON.stringify(error));
})
} catch(error) {
console.log(TAG1 + "setWakeUpScreen catch error = " + JSON.stringify(error));
}
}
if(data.parameters.number == 2) {
ability_featureAbility.getContext().setWakeUpScreen(true, (error, data) => {
console.log(TAG1 + "setWakeUpScreen data = " + JSON.stringify(data));
console.log(TAG1 + "setWakeUpScreen error = " + JSON.stringify(error));
})
}
if(data.parameters.number == 3) {
try {
ability_featureAbility.getContext().setWakeUpScreen(false).then((data) => {
console.log(TAG1 + "setWakeUpScreen data = " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG1 + "setWakeUpScreen error = " + JSON.stringify(error));
})
} catch(error) {
console.log(TAG1 + "setWakeUpScreen catch error = " + JSON.stringify(error));
}
}
}).catch((error) => {
console.log(TAG1 + "getWant error = " + JSON.stringify(error));
})
},
onDestroy() {
console.log(TAG1 + 'onDestroy');
},
onActive() {
console.log(TAG1 + 'onActive');
lifeList.push('onActive');
let options = {
parameters: {
lifeList: lifeList
}
}
commonEvent.publish(listPush1 + "onActive", options, (err) => {
console.log(TAG1 + listPush1 + "onActive");
});
},
onInactive() {
console.log(TAG1 + 'onInactive');
},
onShow() {
console.log(TAG1 + 'onShow');
},
onHide() {
console.log(TAG1 + 'onHide');
},
onNewWant(want) {
console.log(TAG1 + 'onNewWant');
},
onStartContinuation() {
console.log(TAG1 + 'onStartContinuation');
return true;
},
onSaveData(data) {
console.log(TAG1 + 'onSaveData');
return true;
},
onCompleteContinuation(number) {
console.log(TAG1 + 'onCompleteContinuation');
},
onRestoreData(data) {
console.log(TAG1 + 'onRestoreData');
},
onRemoteTerminated() {
console.log(TAG1 + 'onRemoteTerminated');
},
onSaveAbilityState(outState) {
console.log(TAG1 + 'onSaveAbilityState');
},
onRestoreAbilityState(inState) {
console.log(TAG1 + 'onRestoreAbilityState');
},
onMemoryLevel(level) {
console.log(TAG1 + 'onMemoryLevel');
}
}
\ 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';
@Entry
@Component
struct Index {
@State message: string = 'Hello World FaSupportFunction 1'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Row() {
Button() {
Text('MainAbility1_setWakeUpScreen')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('30%')
.height('5%')
.onClick(()=>{
let wntNum = {
want: {
bundleName: "ohos.acts.aafwk.test.fasupportfunction",
abilityName: "ohos.acts.aafwk.test.fasupportfunction.ServiceAbility"
}
}
ability_featureAbility.startAbility(wntNum).then((data) => {
console.log('Fa:Auxiliary:MainAbility: ACTS_SerivceAbilityServer startAbility data:' + JSON.stringify(data));
}).catch((error) => {
console.log('Fa:Auxiliary:MainAbility: ACTS_SerivceAbilityServer startAbility error:' + JSON.stringify(error));
});
})
}
}
.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.
*/
import ability_featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
var TAG1 = "Fa:SupportFunction:MainAbility2:";
var listPush1 = "Fa_SupportFunction_MainAbility2_";
var lifeList = [];
export default {
onCreate() {
console.log(TAG1 + 'onCreate');
lifeList.push('onCreate');
ability_featureAbility.getWant().then((data) => {
console.log(TAG1 + "getWant data = " + JSON.stringify(data));
if(data.parameters.number == 1) {
setWakeUpScreenP(ability_featureAbility, undefined)
}
if(data.parameters.number == 2) {
setWakeUpScreenP(ability_featureAbility, 123)
}
if(data.parameters.number == 3) {
setWakeUpScreenP(ability_featureAbility, "true")
}
if(data.parameters.number == 4) {
setWakeUpScreenP(ability_featureAbility, [true, false])
}
if(data.parameters.number == 5) {
setWakeUpScreenP(ability_featureAbility, {status1: true, status2: true})
}
}).catch((error) => {
console.log(TAG1 + "getWant error = " + JSON.stringify(error));
})
},
onDestroy() {
console.log(TAG1 + 'onDestroy');
},
onActive() {
console.log(TAG1 + 'onActive');
lifeList.push('onActive');
let options = {
parameters: {
lifeList: lifeList
}
}
commonEvent.publish(listPush1 + "onActive", options, (err) => {
console.log(TAG1 + listPush1 + "onActive");
});
},
onInactive() {
console.log(TAG1 + 'onInactive');
},
onShow() {
console.log(TAG1 + 'onShow');
},
onHide() {
console.log(TAG1 + 'onHide');
}
}
function setWakeUpScreenP(featureAbility, wakeUp) {
try {
console.log(TAG1 + "setWakeUpScreenP start");
featureAbility.getContext().setWakeUpScreen(wakeUp).then((data) => {
console.log(TAG1 + "setWakeUpScreen data = " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG1 + "setWakeUpScreen error = " + JSON.stringify(error));
})
} catch(error) {
console.log(TAG1 + "setWakeUpScreen catch error = " + JSON.stringify(error));
commonEvent.publish(listPush1 + "wakeUpErr", (err) => {
console.log(TAG1 + listPush1 + "wakeUpErr");
});
}
}
\ 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 FaSupportFunction 2'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Row() {
Button() {
Text('MainAbility2_setWakeUpScreen')
.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.
*/
import ability_featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
import bundle from '@ohos.bundle';
var TAG1 = "Fa:SupportFunction:MainAbility3:";
var listPush1 = "Fa_SupportFunction_MainAbility3_";
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');
let orientation = bundle.DisplayOrientation.UNSPECIFIED;
ability_featureAbility.getContext().getDisplayOrientation((error, displayOrientationBefore) => {
console.log(TAG1 + "getDisplayOrientation1 data = " + JSON.stringify(displayOrientationBefore));
console.log(TAG1 + "getDisplayOrientation1 error = " + JSON.stringify(error));
ability_featureAbility.getContext().setDisplayOrientation(orientation, (error, setDisplayOrientation) => {
console.log(TAG1 + "setDisplayOrientation data = " + JSON.stringify(setDisplayOrientation));
console.log(TAG1 + "setDisplayOrientation error = " + JSON.stringify(error));
ability_featureAbility.getContext().getDisplayOrientation((error, displayOrientationAfter) => {
console.log(TAG1 + "getDisplayOrientation2 data = " + JSON.stringify(displayOrientationAfter));
console.log(TAG1 + "getDisplayOrientation2 error = " + JSON.stringify(error));
let options = {
parameters: {
displayOrientationBefore: displayOrientationBefore,
displayOrientationAfter: displayOrientationAfter,
lifeList: lifeList,
setDisplayOrientation: setDisplayOrientation
}
}
commonEvent.publish(listPush1 + "onActive", options, (err) => {
console.log(TAG1 + listPush1 + "onActive");
});
})
})
})
},
onInactive() {
console.log(TAG1 + 'onInactive');
},
onShow() {
console.log(TAG1 + 'onShow');
},
onHide() {
console.log(TAG1 + 'onHide');
}
}
\ 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 FaSupportFunction 3'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Row() {
Button() {
Text('MainAbility3_setDisplayOrientation')
.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.
*/
import ability_featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
import bundle from '@ohos.bundle';
var TAG1 = "Fa:SupportFunction:MainAbility4:";
var listPush1 = "Fa_SupportFunction_MainAbility4_";
var lifeList = [];
export default {
onCreate() {
console.log(TAG1 + 'onCreate');
lifeList.push('onCreate');
},
onDestroy() {
console.log(TAG1 + 'onDestroy');
},
async onActive() {
console.log(TAG1 + 'onActive');
lifeList.push('onActive');
let displayOrientationBefore = undefined;
let displayOrientationAfter = undefined;
let setDisplayOrientation = undefined;
let orientation = undefined;
let number = undefined;
let wantNum = undefined;
await ability_featureAbility.getContext().getDisplayOrientation().then((data) => {
console.log(TAG1 + "getDisplayOrientation data = " + JSON.stringify(data));
displayOrientationBefore = data;
}).catch((error) => {
console.log(TAG1 + "getDisplayOrientation error = " + JSON.stringify(error));
})
await ability_featureAbility.getWant().then((data) => {
console.log(TAG1 + "getWant data = " + JSON.stringify(data));
number = data.parameters.number;
}).catch((error) => {
console.log(TAG1 + "getWant error = " + JSON.stringify(error));
})
if(number == 1) {
orientation = bundle.DisplayOrientation.LANDSCAPE;
}
if(number == 2) {
orientation = bundle.DisplayOrientation.PORTRAIT;
}
if(number == 3) {
orientation = bundle.DisplayOrientation.LANDSCAPE;
wantNum = {
want: {
bundleName: "ohos.acts.aafwk.test.fasupportfunction",
abilityName: "ohos.acts.aafwk.test.fasupportfunction.MainAbility5"
}
}
}
if(number == 4) {
orientation = bundle.DisplayOrientation.PORTRAIT;
wantNum = {
want: {
bundleName: "ohos.acts.aafwk.test.fasupportfunction",
abilityName: "ohos.acts.aafwk.test.fasupportfunction.MainAbility5"
}
}
}
if(number == 5) {
orientation = bundle.DisplayOrientation.LANDSCAPE;
wantNum = {
want: {
bundleName: "ohos.acts.aafwk.test.fasupportfunction",
abilityName: "ohos.acts.aafwk.test.fasupportfunctiontwo.MainAbility"
}
}
}
if(number == 6) {
orientation = bundle.DisplayOrientation.PORTRAIT;
wantNum = {
want: {
bundleName: "ohos.acts.aafwk.test.fasupportfunction",
abilityName: "ohos.acts.aafwk.test.fasupportfunctiontwo.MainAbility"
}
}
}
if(number == 7) {
orientation = bundle.DisplayOrientation.LANDSCAPE;
wantNum = {
want: {
bundleName: "ohos.acts.aafwk.test.fasupportfunctionthree",
abilityName: "ohos.acts.aafwk.test.fasupportfunctionthree.MainAbility"
}
}
}
if(number == 8) {
orientation = bundle.DisplayOrientation.PORTRAIT;
wantNum = {
want: {
bundleName: "ohos.acts.aafwk.test.fasupportfunctionthree",
abilityName: "ohos.acts.aafwk.test.fasupportfunctionthree.MainAbility"
}
}
}
await ability_featureAbility.getContext().setDisplayOrientation(orientation).then((data) => {
console.log(TAG1 + "setShowOnLockScreen data = " + JSON.stringify(data));
setDisplayOrientation = data;
}).catch((error) => {
console.log(TAG1 + "setShowOnLockScreen error = " + JSON.stringify(error));
})
await ability_featureAbility.getContext().getDisplayOrientation().then((data) => {
console.log(TAG1 + "getDisplayOrientation data = " + JSON.stringify(data));
displayOrientationAfter = data;
}).catch((error) => {
console.log(TAG1 + "getDisplayOrientation error = " + JSON.stringify(error));
})
let options = {
parameters: {
displayOrientationBefore: displayOrientationBefore,
displayOrientationAfter: displayOrientationAfter,
lifeList: lifeList,
setDisplayOrientation: setDisplayOrientation,
}
}
commonEvent.publish(listPush1 + "onActive", options, (err) => {
console.log(TAG1 + listPush1 + "onActive");
});
if (wantNum != undefined) {
await ability_featureAbility.startAbility(wantNum).then((data) => {
console.log(TAG1 + "startAbility data = " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG1 + "startAbility error = " + JSON.stringify(error));
})
}
},
onInactive() {
console.log(TAG1 + 'onInactive');
},
onShow() {
console.log(TAG1 + 'onShow');
},
onHide() {
console.log(TAG1 + 'onHide');
}
}
\ 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 FaSupportFunction 4'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Row() {
Button() {
Text('MainAbility4_setDisplayOrientation')
.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.
*/
import ability_featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
import bundle from '@ohos.bundle';
var TAG1 = "Fa:SupportFunction:MainAbility5:";
var listPush1 = "Fa_SupportFunction_MainAbility5_";
var lifeList = [];
export default {
onCreate() {
console.log(TAG1 + 'onCreate');
lifeList.push('onCreate');
},
onDestroy() {
console.log(TAG1 + 'onDestroy');
},
async onActive() {
console.log(TAG1 + 'onActive');
lifeList.push('onActive');
let displayOrientationBefore = undefined;
let displayOrientationAfter = undefined;
let setDisplayOrientation = undefined;
let orientation = bundle.DisplayOrientation.FOLLOW_RECENT;
await ability_featureAbility.getContext().getDisplayOrientation().then((data) => {
console.log(TAG1 + "getDisplayOrientation data = " + JSON.stringify(data));
displayOrientationBefore = data;
}).catch((error) => {
console.log(TAG1 + "getDisplayOrientation error = " + JSON.stringify(error));
})
await ability_featureAbility.getContext().setDisplayOrientation(orientation).then((data) => {
console.log(TAG1 + "setShowOnLockScreen data = " + JSON.stringify(data));
setDisplayOrientation = data;
}).catch((error) => {
console.log(TAG1 + "setShowOnLockScreen error = " + JSON.stringify(error));
})
await ability_featureAbility.getContext().getDisplayOrientation().then((data) => {
console.log(TAG1 + "getDisplayOrientation data = " + JSON.stringify(data));
displayOrientationAfter = data;
}).catch((error) => {
console.log(TAG1 + "getDisplayOrientation error = " + JSON.stringify(error));
})
let options = {
parameters: {
displayOrientationBefore: displayOrientationBefore,
displayOrientationAfter: displayOrientationAfter,
lifeList: lifeList,
setDisplayOrientation: setDisplayOrientation
}
}
commonEvent.publish(listPush1 + "onActive", options, (err) => {
console.log(TAG1 + listPush1 + "onActive");
});
},
onInactive() {
console.log(TAG1 + 'onInactive');
},
onShow() {
console.log(TAG1 + 'onShow');
},
onHide() {
console.log(TAG1 + 'onHide');
}
}
\ 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 FaSupportFunction 5'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Row() {
Button() {
Text('MainAbility5_setDisplayOrientation')
.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.
*/
import ability_featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
var TAG1 = "Fa:SupportFunction:MainAbility6:";
var listPush1 = "Fa_SupportFunction_MainAbility6_";
var lifeList = [];
export default {
onCreate() {
console.log(TAG1 + 'onCreate');
lifeList.push('onCreate');
ability_featureAbility.getWant().then((data) => {
console.log(TAG1 + "getWant data = " + JSON.stringify(data));
if(data.parameters.number == 1) {
setDisplayOrientationP(ability_featureAbility, undefined)
}
if(data.parameters.number == 2) {
setDisplayOrientationP(ability_featureAbility, -1)
}
if(data.parameters.number == 3) {
setDisplayOrientationP(ability_featureAbility, 4)
}
if(data.parameters.number == 4) {
setDisplayOrientationP(ability_featureAbility, "1")
}
if(data.parameters.number == 5) {
setDisplayOrientationP(ability_featureAbility, [1, 2])
}
if(data.parameters.number == 6) {
setDisplayOrientationP(ability_featureAbility, {number1: 1, number2: 2})
}
}).catch((error) => {
console.log(TAG1 + "getWant error = " + JSON.stringify(error));
})
},
onDestroy() {
console.log(TAG1 + 'onDestroy');
},
async onActive() {
console.log(TAG1 + 'onActive');
lifeList.push('onActive');
let options = {
parameters: {
lifeList: lifeList
}
}
commonEvent.publish(listPush1 + "onActive", options, (err) => {
console.log(TAG1 + listPush1 + "onActive");
});
},
onInactive() {
console.log(TAG1 + 'onInactive');
},
onShow() {
console.log(TAG1 + 'onShow');
},
onHide() {
console.log(TAG1 + 'onHide');
}
}
function setDisplayOrientationP(featureAbility, displayOrientationErr) {
try {
console.log(TAG1 + "setDisplayOrientationP start: " + JSON.stringify(displayOrientationErr));
featureAbility.getContext().setDisplayOrientation(displayOrientationErr).then((data) => {
console.log(TAG1 + "setDisplayOrientation data = " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG1 + "setDisplayOrientation error = " + JSON.stringify(error));
})
} catch(error) {
console.log(TAG1 + "setDisplayOrientation catch error = " + JSON.stringify(error));
commonEvent.publish(listPush1 + "displayOrientationErr", (err) => {
console.log(TAG1 + listPush1 + "displayOrientationErr");
});
}
}
\ 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 FaSupportFunction 6'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Row() {
Button() {
Text('MainAbility6_setDisplayOrientation')
.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": "FaSupportFunction"
},
{
"name": "MainAbility2_desc",
"value": "description"
},
{
"name": "MainAbility2_label",
"value": "label"
},
{
"name": "MainAbility3_desc",
"value": "description"
},
{
"name": "MainAbility3_label",
"value": "label"
},
{
"name": "MainAbility4_desc",
"value": "description"
},
{
"name": "MainAbility4_label",
"value": "label"
},
{
"name": "MainAbility5_desc",
"value": "description"
},
{
"name": "MainAbility5_label",
"value": "label"
},
{
"name": "MainAbility6_desc",
"value": "description"
},
{
"name": "MainAbility6_label",
"value": "label"
}
]
}
\ 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("FaSupportFunctionTwo") {
hap_name = "FaSupportFunctionTwo"
hap_profile = "./src/main/config.json"
testonly = true
deps = [
":fasupportfunctiontwo_resources",
":fasupportfunctiontwo_ts_assets",
]
ets2abc = true
certificate_profile = "../signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("fasupportfunctiontwo_ts_assets") {
source_dir = "./src/main/ets/MainAbility"
}
ohos_resources("fasupportfunctiontwo_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"app": {
"bundleName": "ohos.acts.aafwk.test.fasupportfunction",
"vendor": "huawei",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 9,
"target": 9
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.aafwk.test.fasupportfunctiontwo",
"name": ".fasupportfunctiontwo",
"mainAbility": ".MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "fasupportfunctiontwo",
"moduleType": "feature",
"installationFree": false
},
"abilities": [
{
"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": "standard"
}
],
"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';
import bundle from '@ohos.bundle';
var TAG1 = "Fa:SupportFunctionTwo:MainAbility:";
var listPush1 = "Fa_SupportFunctionTwo_MainAbility_";
var lifeList = [];
export default {
onCreate() {
console.log(TAG1 + 'onCreate');
lifeList.push('onCreate');
},
onDestroy() {
console.log(TAG1 + 'onDestroy');
},
async onActive() {
console.log(TAG1 + 'onActive');
lifeList.push('onActive');
let displayOrientationBefore = undefined;
let displayOrientationAfter = undefined;
let setDisplayOrientation = undefined;
let orientation = bundle.DisplayOrientation.FOLLOW_RECENT;
await ability_featureAbility.getContext().getDisplayOrientation().then((data) => {
console.log(TAG1 + "getDisplayOrientation data = " + JSON.stringify(data));
displayOrientationBefore = data;
}).catch((error) => {
console.log(TAG1 + "getDisplayOrientation error = " + JSON.stringify(error));
})
await ability_featureAbility.getContext().setDisplayOrientation(orientation).then((data) => {
console.log(TAG1 + "setShowOnLockScreen data = " + JSON.stringify(data));
setDisplayOrientation = data;
}).catch((error) => {
console.log(TAG1 + "setShowOnLockScreen error = " + JSON.stringify(error));
})
await ability_featureAbility.getContext().getDisplayOrientation().then((data) => {
console.log(TAG1 + "getDisplayOrientation data = " + JSON.stringify(data));
displayOrientationAfter = data;
}).catch((error) => {
console.log(TAG1 + "getDisplayOrientation error = " + JSON.stringify(error));
})
let options = {
parameters: {
displayOrientationBefore: displayOrientationBefore,
displayOrientationAfter: displayOrientationAfter,
lifeList: lifeList,
setDisplayOrientation: setDisplayOrientation
}
}
commonEvent.publish(listPush1 + "onActive", options, (err) => {
console.log(TAG1 + listPush1 + "onActive");
});
},
onInactive() {
console.log(TAG1 + 'onInactive');
},
onShow() {
console.log(TAG1 + 'onShow');
},
onHide() {
console.log(TAG1 + 'onHide');
}
}
\ 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 FaSupportFunctionTwo 1'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Row() {
Button() {
Text('Two_MainAbility_setDisplayOrientation')
.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
{
"string": [
{
"name": "FaSupportFunctionTwo_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "FaSupportFunctionTwo"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 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")
group("fasupportfunctionthree") {
testonly = true
if (is_standard_system) {
deps = [ "entry:FaSupportFunctionThree" ]
}
}
# 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("FaSupportFunctionThree") {
hap_name = "FaSupportFunctionThree"
hap_profile = "./src/main/config.json"
testonly = true
deps = [
":fasupportfunctionthree_resources",
":fasupportfunctionthree_ts_assets",
]
ets2abc = true
certificate_profile = "../signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("fasupportfunctionthree_ts_assets") {
source_dir = "./src/main/ets/MainAbility"
}
ohos_resources("fasupportfunctionthree_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"app": {
"bundleName": "ohos.acts.aafwk.test.fasupportfunctionthree",
"vendor": "huawei",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 9,
"target": 9
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.aafwk.test.fasupportfunctionthree",
"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": "standard"
}
],
"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';
import bundle from '@ohos.bundle';
var TAG1 = "Fa:SupportFunctionThree:MainAbility:";
var listPush1 = "Fa_SupportFunctionThree_MainAbility_";
var lifeList = [];
export default {
onCreate() {
console.log(TAG1 + 'onCreate');
lifeList.push('onCreate');
},
onDestroy() {
console.log(TAG1 + 'onDestroy');
},
async onActive() {
console.log(TAG1 + 'onActive');
lifeList.push('onActive');
let displayOrientationBefore = undefined;
let displayOrientationAfter = undefined;
let setDisplayOrientation = undefined;
let orientation = bundle.DisplayOrientation.FOLLOW_RECENT;
await ability_featureAbility.getContext().getDisplayOrientation().then((data) => {
console.log(TAG1 + "getDisplayOrientation data = " + JSON.stringify(data));
displayOrientationBefore = data;
}).catch((error) => {
console.log(TAG1 + "getDisplayOrientation error = " + JSON.stringify(error));
})
await ability_featureAbility.getContext().setDisplayOrientation(orientation).then((data) => {
console.log(TAG1 + "setShowOnLockScreen data = " + JSON.stringify(data));
setDisplayOrientation = data;
}).catch((error) => {
console.log(TAG1 + "setShowOnLockScreen error = " + JSON.stringify(error));
})
await ability_featureAbility.getContext().getDisplayOrientation().then((data) => {
console.log(TAG1 + "getDisplayOrientation data = " + JSON.stringify(data));
displayOrientationAfter = data;
}).catch((error) => {
console.log(TAG1 + "getDisplayOrientation error = " + JSON.stringify(error));
})
let options = {
parameters: {
displayOrientationBefore: displayOrientationBefore,
displayOrientationAfter: displayOrientationAfter,
lifeList: lifeList,
setDisplayOrientation: setDisplayOrientation,
}
}
commonEvent.publish(listPush1 + "onActive", options, (err) => {
console.log(TAG1 + listPush1 + "onActive");
});
},
onInactive() {
console.log(TAG1 + 'onInactive');
},
onShow() {
console.log(TAG1 + 'onShow');
},
onHide() {
console.log(TAG1 + 'onHide');
}
}
\ 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 FaSupportFunctionThree 1'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Row() {
Button() {
Text('Three_MainAbility_setDisplayOrientation')
.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": "FaSupportFunctionThree"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "ohos.acts.aafwk.test.stagesupportfunction",
"vendor": "huawei",
"versionCode": 1000000,
"versionName": "1.0.0",
"debug": false,
"icon": "$media:app_icon",
"label": "$string:app_name",
"description" : "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": 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("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("StageSupportFunction") {
hap_name = "StageSupportFunction"
hap_profile = "entry/src/main/module.json"
testonly = true
deps = [
":stagesupportfunction_js_assets",
":stagesupportfunction_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("stagesupportfunction_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("stagesupportfunction_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("stagesupportfunction_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":stagesupportfunction_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 = 'StageSupportFunction: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 = 'StageSupportFunction:MainAbility:';
var listPush1 = "Stage_SupportFunction_MainAbility_";
var status1 = undefined;
let status2 = undefined;
var lifeList = [];
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log(TAG1 + 'onCreate : status1 : ' + status1 + ' ,ifeList : ' + JSON.stringify(lifeList));
status1 = this.context.isTerminating();
lifeList.push('onCreate');
commonEvent.publish(listPush1 + "onCreate", (err) => {
console.log(TAG1 + listPush1 + "onCreate");
});
setTimeout(() => {
if (want.parameters.number == 1) {
this.context.terminateSelf().then((data) => {
console.log(TAG1 + "terminateSelfWithResult data = " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG1 + "terminateSelfWithResult error = " + JSON.stringify(error));
})
}
if (want.parameters.number == 2) {
let wantNum = {
want: {
bundleName: "ohos.acts.aafwk.test.stagesupportfunction",
abilityName:"MainAbility"
},
resultCode: 12120
}
this.context.terminateSelfWithResult(wantNum).then((data) => {
console.log(TAG1 + "terminateSelfWithResult data = " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG1 + "terminateSelfWithResult error = " + JSON.stringify(error));
})
}
}, 2000);
}
onDestroy() {
console.log(TAG1 + 'onDestroy');
lifeList.push('onDestroy');
status2 = this.context.isTerminating();
let options = {
parameters: {
isTerminating1: status1,
isTerminating2: status2,
lifeList: lifeList
}
}
commonEvent.publish(listPush1 + "onDestroy", options, (err) => {
console.log(TAG1 + listPush1 + "onDestroy");
});
}
onWindowStageCreate(windowStage) {
console.log(TAG1 + 'onWindowStageCreate');
lifeList.push('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');
}
onBackground() {
console.log(TAG1 + '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 StageSupportFunction 1'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.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": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"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"
}
]
}
}
\ 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": "StageSupportFunction"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.supportfunctionhaptest",
"vendor": "huawei",
"versionCode": 1000000,
"versionName": "1.0.0",
"debug": false,
"icon": "$media:app_icon",
"label": "$string:app_name",
"description" : "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
# 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_js_hap_suite("SupportFunction") {
hap_profile = "entry/src/main/module.json"
deps = [
":supportfunction_js_assets",
":supportfunction_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "SupportFunction"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("supportfunction_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("supportfunction_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("supportfunction_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":supportfunction_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for aceceshi Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.example.supportfunctionhaptest",
"module-name": "entry",
"shell-timeout": "600000",
"testcase-timeout":"30000"
},
"kits": [
{
"test-file-name": [
"SupportFunction.hap",
"FaSupportFunction.hap",
"FaSupportFunctionTwo.hap",
"FaSupportFunctionThree.hap",
"StageSupportFunction.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
/*
* 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 = 'SupportFunction:TestAbilityStage:';
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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
import { Hypium } from '@ohos/hypium';
import testsuite from '../test/List.test';
var TAG1 = 'SupportFunction:TestAbility:';
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log(TAG1 + 'onCreate');
globalThis.abilityTestContext = this.context;
globalThis.abilityWant = want;
globalThis.abilityWant.parameters.timeout = 15000;
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.log('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
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');
}
onBackground() {
console.log(TAG1 + '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 TestRunner from '@ohos.application.testRunner';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
var TAG = "SupportFunctionTest == "
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
console.log(TAG + "onAbilityCreateCallback");
}
async function addAbilityMonitorCallback(err: any) {
console.log(TAG + "addAbilityMonitorCallback : " + JSON.stringify(err))
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
console.log(TAG + "OpenHarmonyTestRunner OnPrepare ")
}
async onRun() {
console.log(TAG + 'OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
globalThis.abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var MainAbilityName = 'MainAbility'
let lMonitor = {
abilityName: MainAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
console.log(TAG + 'cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
console.log(TAG + 'executeShellCommand : err : ' + JSON.stringify(err));
console.log(TAG + 'executeShellCommand : data : ' + d.stdResult);
console.log(TAG + 'executeShellCommand : data : ' + d.exitCode);
})
console.log(TAG + 'OpenHarmonyTestRunner onRun end')
}
};
\ 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 {
aboutToAppear() {
console.log('SupportFunction MainAbility index aboutToAppear')
}
@State message: string = 'Hello World SupportFunction 1'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.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.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import commonEvent from '@ohos.commonEvent';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
export default function AbilityIsTerminatingTest() {
describe('AbilityIsTerminatingTest', function () {
let TAG = "";
let sleepTimeOne = 1000;
/*
* @tc.number : SUB_AA_OpenHarmony_IsTerminating_0100
* @tc.name : Verify the isTerminating interface
* @tc.desc : Terminate ability through terminateSelf.
*/
it('SUB_AA_OpenHarmony_IsTerminating_0100', 0, async function (done) {
TAG = 'SUB_AA_OpenHarmony_IsTerminating_0100 == ';
console.log(TAG + "begin");
let status1 = undefined;
let status2 = undefined;
let lifeList = [];
let listCheck = ["onCreate", "onWindowStageCreate", "onForeground", "onDestroy"];
let onDestroy = "Stage_SupportFunction_MainAbility_onDestroy";
var subscriber;
var subscribeInfo = {
events: [onDestroy]
}
await commonEvent.createSubscriber(subscribeInfo).then(async (data) => {
console.log(TAG + "createSubscriber data : " + JSON.stringify(data));
subscriber = data;
commonEvent.subscribe(subscriber, async (err, data) => {
console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data));
if (data.event == onDestroy) {
status1 = data.parameters.isTerminating1;
status2 = data.parameters.isTerminating2;
lifeList = data.parameters.lifeList;
setTimeout(async () => {
commonEvent.unsubscribe(subscriber, async (err, data) => {
console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data));
expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck));
expect(status1).assertFalse();
expect(status2).assertTrue();
done();
});
}, sleepTimeOne);
}
});
}).catch((error) => {
console.log(TAG + "createSubscriber data : " + JSON.stringify(error));
expect().assertFail();
done();
})
let wantNum = {
bundleName: "ohos.acts.aafwk.test.stagesupportfunction",
abilityName: "MainAbility",
parameters: {
number: 1
}
}
await globalThis.abilityTestContext.startAbility(wantNum).then((data) => {
console.log(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG + "startAbility error = " + JSON.stringify(error));
expect().assertFail();
done();
})
})
/*
* @tc.number : SUB_AA_OpenHarmony_IsTerminating_0200
* @tc.name : Verify the isTerminating interface
* @tc.desc : Terminate ability through terminateSelfWithResult.
*/
it('SUB_AA_OpenHarmony_IsTerminating_0200', 0, async function (done) {
TAG = 'SUB_AA_OpenHarmony_IsTerminating_0200 == ';
console.log(TAG + "begin");
let status1 = undefined;
let status2 = undefined;
let lifeList = [];
let listCheck = ["onCreate", "onWindowStageCreate", "onForeground", "onDestroy"];
let onDestroy = "Stage_SupportFunction_MainAbility_onDestroy";
var subscriber;
var subscribeInfo = {
events: [onDestroy]
}
await commonEvent.createSubscriber(subscribeInfo).then(async (data) => {
console.log(TAG + "createSubscriber data : " + JSON.stringify(data));
subscriber = data;
commonEvent.subscribe(subscriber, async (err, data) => {
console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data));
if (data.event == onDestroy) {
status1 = data.parameters.isTerminating1;
status2 = data.parameters.isTerminating2;
lifeList = data.parameters.lifeList;
setTimeout(async () => {
commonEvent.unsubscribe(subscriber, async (err, data) => {
console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data));
expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck));
expect(status1).assertFalse();
expect(status2).assertTrue();
done();
});
}, sleepTimeOne);
}
});
}).catch((error) => {
console.log(TAG + "createSubscriber data : " + JSON.stringify(error));
expect().assertFail();
done();
})
let wantNum = {
bundleName: "ohos.acts.aafwk.test.stagesupportfunction",
abilityName: "MainAbility",
parameters: {
number: 2
}
}
await globalThis.abilityTestContext.startAbility(wantNum).then((data) => {
console.log(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG + "startAbility error = " + JSON.stringify(error));
expect().assertFail();
done();
})
})
/*
* @tc.number : SUB_AA_OpenHarmony_IsTerminating_0500
* @tc.name : Verify the isTerminating interface
* @tc.desc : Terminate ability with the back key.
*/
it('SUB_AA_OpenHarmony_IsTerminating_0500', 0, async function (done) {
TAG = 'SUB_AA_OpenHarmony_IsTerminating_0500 == ';
console.log(TAG + "begin");
let status1 = undefined;
let status2 = undefined;
let lifeList = [];
let listCheck = ["onCreate", "onWindowStageCreate", "onForeground", "onDestroy"];
let onCreate = "Stage_SupportFunction_MainAbility_onCreate";
let onDestroy = "Stage_SupportFunction_MainAbility_onDestroy";
var subscriber;
var subscribeInfo = {
events: [onCreate, onDestroy]
}
await commonEvent.createSubscriber(subscribeInfo).then(async (data) => {
console.log(TAG + "createSubscriber data : " + JSON.stringify(data));
subscriber = data;
commonEvent.subscribe(subscriber, async (err, data) => {
console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data));
if (data.event == onCreate) {
let abilitydelegator = AbilityDelegatorRegistry.getAbilityDelegator();
let cmd = "uinput -K -d 2 -u 2";
await abilitydelegator.executeShellCommand(cmd).then((data) => {
console.log(TAG + "executeShellCommand : data : " + data.stdResult);
console.log(TAG + "executeShellCommand : data : " + data.exitCode);
}).catch((error) => {
console.log(TAG + "executeShellCommand error : " + JSON.stringify(error));
})
}
if (data.event == onDestroy) {
status1 = data.parameters.isTerminating1;
status2 = data.parameters.isTerminating2;
lifeList = data.parameters.lifeList;
setTimeout(async () => {
commonEvent.unsubscribe(subscriber, async (err, data) => {
console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data));
expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck));
expect(status1).assertFalse();
expect(status2).assertTrue();
done();
});
}, sleepTimeOne);
}
});
}).catch((error) => {
console.log(TAG + "createSubscriber data : " + JSON.stringify(error));
expect().assertFail();
done();
})
let wantNum = {
bundleName: "ohos.acts.aafwk.test.stagesupportfunction",
abilityName: "MainAbility"
}
await globalThis.abilityTestContext.startAbility(wantNum).then((data) => {
console.log(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG + "startAbility error = " + JSON.stringify(error));
expect().assertFail();
done();
})
})
})
}
\ 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 abilityIsTerminatingTest from './AbilityIsTerminating.test';
import faSetDisplayOrientation from './FaSetDisplayOrientation.test';
import faShowOnLock from './FaShowOnLock.test';
export default function testsuite() {
abilityIsTerminatingTest();
faSetDisplayOrientation();
faShowOnLock();
}
\ 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,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
]
}
}
\ 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": "SupportFunctionTest"
}
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册