diff --git a/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts index 950088fc292fc6cd326ff6121b47cf943ebbb19c..9962ff55df8eeb24c19a5ff74a6f330b99f6bc6d 100644 --- a/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -16,6 +16,15 @@ import Ability from '@ohos.application.Ability' import commonEvent from '@ohos.commonEvent' +function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } +} + export default class MainAbility extends Ability { onCreate(want, launchParam) { // Ability is creating, initialize resources for this ability @@ -48,6 +57,7 @@ export default class MainAbility extends Ability { } onForeground() { + sleep(1000) // Ability has brought to foreground console.log("ACTS_NewWant MainAbility onForeground") if (globalThis.abilityWant.action == 'startHapC') { diff --git a/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts index 70dd29e22def32f76e65823d8a300886ce0899a8..8e74ecba1184139d319dcacccca2bf5f5f1bd501 100644 --- a/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -16,6 +16,15 @@ import Ability from '@ohos.application.Ability' import commonEvent from '@ohos.commonEvent' +function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } +} + export default class MainAbility extends Ability { onCreate(want, launchParam) { // Ability is creating, initialize resources for this ability @@ -48,6 +57,7 @@ export default class MainAbility extends Ability { } onForeground() { + sleep(1000) // Ability has brought to foreground console.log("ACTS_NewWant MainAbility onForeground") if (globalThis.abilityWant.action == 'startHapB') { diff --git a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts index 8dbd22aa90fc244b2217842c1deaafb29e75d487..153190f2bd79b7052d7119b2c30b8786211f088e 100644 --- a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -16,6 +16,15 @@ import Ability from '@ohos.application.Ability' import commonEvent from '@ohos.commonEvent' +function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } +} + export default class MainAbility extends Ability { onCreate(want, launchParam) { // Ability is creating, initialize resources for this ability @@ -48,6 +57,7 @@ export default class MainAbility extends Ability { } onForeground() { + sleep(1000) // Ability has brought to foreground console.log("ACTS_NewWant MainAbility onForeground") if (globalThis.abilityWant.action == 'startStandard0400') { diff --git a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts index 9f0688daa9e0d7534fac867c7279eae255ba0a59..3faed4fc184b3e4259d26d18a1e86bb7ae43ac95 100644 --- a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts +++ b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts @@ -16,6 +16,15 @@ import Ability from '@ohos.application.Ability' import commonEvent from '@ohos.commonEvent' +function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } +} + export default class SecondAbility extends Ability { onCreate(want, launchParam) { @@ -48,6 +57,7 @@ export default class SecondAbility extends Ability { } onForeground() { + sleep(1000) // Ability has brought to foreground var connId; console.log("ACTS_NewWant SecondAbility onForeground") diff --git a/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js b/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js index 6de90a72c8e9be2d23aadccb2a3d9526f9b85faf..a0928b1c80d3add2f46b6abd7bf03e470899b71d 100644 --- a/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js @@ -13,6 +13,7 @@ * limitations under the License. */ import account from '@ohos.account.appAccount' +import featureAbility from '@ohos.ability.featureAbility' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' const NAMELIMIT = 512; @@ -22,6 +23,18 @@ const owner = 'com.example.accountauthenticator' export default function ActsAccountAppAccess() { describe('ActsAccountAuthenticator', function () { + function sleep(delay) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) + } + beforeAll(async function (done) { + done(); + }); /* * @tc.number : ActsAccountCheckAccountLabels_0100 * @tc.name : Check Account Labels callback form @@ -568,7 +581,21 @@ export default function ActsAccountAppAccess() { * @tc.desc : */ - it('ActsAccountSelectAccountByOptions_0100', 0, async function (done) { + it('ActsAccountSelectAccountByOptions_0100', 0, async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.example.accountauthenticator", + abilityName: "com.example.accountauthenticator.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + ) + await sleep(1000) console.debug("====>ActsAccountSelectAccountByOptions_0100 start===="); var appAccountManager = account.createAppAccountManager(); var select_options = {allowedAccounts:[{"name":name,"owner":owner}]} @@ -579,9 +606,9 @@ export default function ActsAccountAppAccess() { try { var data = await appAccountManager.selectAccountsByOptions(select_options) console.debug("====>ActsAccountSelectAccountByOptions_0100 data:" + JSON.stringify(data)); - expect(data.length).assertEqual(1) + expect(data.length).assertEqual(1) } catch(err) { - onsole.debug("====>ActsAccountSelectAccountByOptions_0100 err:" + JSON.stringify(err)); + console.debug("====>ActsAccountSelectAccountByOptions_0100 err:" + JSON.stringify(err)); expect(err).assertEqual(null) } try{ @@ -593,7 +620,7 @@ export default function ActsAccountAppAccess() { console.debug('====>ActsAccountSelectAccountByOptions_0100 deleteAccount_err') expect().assertFail() done(); - } + } }); }); @@ -604,6 +631,20 @@ export default function ActsAccountAppAccess() { */ it('ActsAccountSelectAccountByOptions_0200', 0, async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.example.accountauthenticator", + abilityName: "com.example.accountauthenticator.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + ) + await sleep(1000) console.debug("====>ActsAccountSelectAccountByOptions_0200 start===="); var appAccountManager = account.createAppAccountManager(); var select_options = {allowedOwners: [owner]} @@ -616,7 +657,7 @@ export default function ActsAccountAppAccess() { console.debug("====>ActsAccountSelectAccountByOptions_0200 data:" + JSON.stringify(data)); expect(data.length).assertEqual(3) } catch(err) { - onsole.debug("====>ActsAccountSelectAccountByOptions_0200 err:" + JSON.stringify(err)); + console.debug("====>ActsAccountSelectAccountByOptions_0200 err:" + JSON.stringify(err)); expect(err).assertEqual(null) } try{ @@ -640,6 +681,20 @@ export default function ActsAccountAppAccess() { */ it('ActsAccountSelectAccountByOptions_0300', 0, async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.example.accountauthenticator", + abilityName: "com.example.accountauthenticator.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + ) + await sleep(1000) console.debug("====>ActsAccountSelectAccountByOptions_0300 start===="); var appAccountManager = account.createAppAccountManager(); var options = {requiredLabels: ["male", "30-40"]} @@ -652,7 +707,7 @@ export default function ActsAccountAppAccess() { console.debug("====>ActsAccountSelectAccountByOptions_0300 data:" + JSON.stringify(data)); expect(data.length).assertEqual(1) } catch(err) { - onsole.debug("====>ActsAccountSelectAccountByOptions_0300 err:" + JSON.stringify(err)); + console.debug("====>ActsAccountSelectAccountByOptions_0300 err:" + JSON.stringify(err)); expect(err).assertEqual(null) } try{ diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/config.json b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/config.json index dd3a529063f3022a8dff5982d44d325e1970ed2f..6a26b1f9a889aa56fbaaf8e415f6356eb4c4c36d 100644 --- a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/config.json +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/config.json @@ -33,7 +33,7 @@ "orientation": "unspecified", "visible": true, "srcPath": "MainAbility", - "name": ".MainAbility", + "name": "com.example.accountauthenticator.MainAbility", "srcLanguage": "js", "icon": "$media:icon", "description": "$string:MainAbility_desc", diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js index dfb69f41b7cacdad4716664c5796c47096b6d287..7fb28fa798f5d0189e8358d3e0d703f07dc54b1c 100644 --- a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js @@ -12,6 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import account_appAccount from '@ohos.account.appAccount'; +import featureAbility from '@ohos.ability.featureAbility' export default { data: { @@ -20,4 +22,29 @@ export default { onInit() { this.title = this.$t('strings.world'); }, -} + onShow() { + console.info('ServiceAbility onStart'); + var accountMgr = account_appAccount.createAppAccountManager(); + console.info('ServiceAbility lcc addAccount 01 onStart'); + accountMgr.addAccount("zhangsan", "",(data)=>{ + console.info('ServiceAbility lcc enableAppAccess 01 onStart'); + accountMgr.enableAppAccess("zhangsan", "com.example.actsaccounttest"); + console.info('ServiceAbility lcc addAccount 02 onStart'); + accountMgr.addAccount("lisi", "",(err)=>{ + console.info('ServiceAbility lcc enableAppAccess 02 onStart'); + accountMgr.enableAppAccess("lisi", "com.example.actsaccounttest"); + console.info('ServiceAbility lcc addAccount 03 onStart'); + accountMgr.addAccount("wangwu", "",(err)=>{ + console.info('ServiceAbility lcc enableAppAccess 03 onStart'); + accountMgr.enableAppAccess("wangwu", "com.example.actsaccounttest",(err)=>{ + featureAbility.terminateSelf(); + console.info('ServiceAbility add end'); + }); + }); + }); + }); + console.info('ServiceAbility onStart end'); + }, + onReady() { + }, +} \ No newline at end of file diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/ServiceAbility/service.js b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/ServiceAbility/service.js index 2f531f3bbc0c731c45f8fcc156f89dcb1c1e2060..4eb1de03bc83a5fd5d1ca225ba2ba4172023f269 100644 --- a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/ServiceAbility/service.js +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/ServiceAbility/service.js @@ -13,25 +13,14 @@ * limitations under the License. */ import account_appAccount from '@ohos.account.appAccount'; +import featureAbility from '@ohos.ability.featureAbility' import {MyAuthenticator} from '../Common/utils' var TAG = "[AccountTest]" var authenticator = null export default { - async onStart(want) { + onStart(want) { console.info('ServiceAbility onStart'); - var accountMgr = account_appAccount.createAppAccountManager(); - try { - await accountMgr.addAccount("zhangsan", ""); - await accountMgr.enableAppAccess("zhangsan", "com.example.actsaccounttest"); - await accountMgr.addAccount("lisi", ""); - await accountMgr.enableAppAccess("lisi", "com.example.actsaccounttest"); - await accountMgr.addAccount("wangwu", ""); - await accountMgr.enableAppAccess("wangwu", "com.example.actsaccounttest"); - } catch(err) { - console.error(TAG + "addAccount or enableAppAccess failed, error: " + JSON.stringify(err)) - } - console.info('ServiceAbility onStart end'); }, async onStop() { console.info('ServiceAbility onStop'); diff --git a/arkui/BUILD.gn b/arkui/BUILD.gn index eb91b36276c270498e1d0bdebe11dcbdc56aa3cc..2b9d8b7ed3f4ea56bfb82d9339c2c057fdb4397b 100644 --- a/arkui/BUILD.gn +++ b/arkui/BUILD.gn @@ -25,6 +25,7 @@ group("arkui") { "ace_ets_test:ActsAceEtsTest", "ace_ets_third_test:ActsAceEtsThirdTest", "ace_ets_web_dev:ActsAceWebDevTest", + "ace_ets_web_dev_two:ActsAceWebDevTwoTest", "ace_ets_xcomponent:ActsAceXComponentEtsTest", "ace_js_attribute_api:ActsAceJsApiTest", "ace_napi_test:ActsAceNapiEtsTest", diff --git a/arkui/ace_ets_component_apilack/entry/src/main/config.json b/arkui/ace_ets_component_apilack/entry/src/main/config.json index 219294cdc3f6bb10248f0c4272502911d7560cfe..ce4b6c28f191b120efa90a1a09aee5dd309c8dbe 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/config.json +++ b/arkui/ace_ets_component_apilack/entry/src/main/config.json @@ -75,7 +75,26 @@ "pages/alphabetIndexer", "pages/checkBoxGroup", "pages/circle", - "pages/ellipse" + "pages/ellipse", + "pages/grid", + "pages/gridItem", + "pages/inspector", + "pages/lazyForEach", + "pages/navigator", + "pages/path", + "pages/polygon", + "pages/polyLine", + "pages/progress", + "pages/rect", + "pages/scroll", + "pages/search", + "pages/swiper", + "pages/tabs", + "pages/text", + "pages/textArea", + "pages/textInput", + "pages/textPicker", + "pages/video" ], "name": ".MainAbility", "window": { diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/grid.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/grid.ets new file mode 100644 index 0000000000000000000000000000000000000000..bf3fce866dbe7437c751c12d8d296ade1f3f5096 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/grid.ets @@ -0,0 +1,79 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct GridMaxCount { + @State Number: String[] = ['5', '6', '7', '8', '9'] + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear GridMaxCount start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear GridMaxCount end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("grid-MaxCount") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("maxCountText") + + + Column({ space: 5 }) { + Grid() { + ForEach(this.Number, (day: string) => { + ForEach(this.Number, (day: string) => { + GridItem() { + Text(day) + .fontSize(16) + .backgroundColor(0xF9CF93) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) + } + }, day => day) + }, day => day) + } + .columnsTemplate('1fr 1fr 1fr 1fr 1fr') + .rowsTemplate('1fr 1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .width('90%') + .backgroundColor(0xFAEEE0) + .height(300) + .maxCount(5) + .key("maxCountTest") + + } + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/gridItem.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/gridItem.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d64c6d1f912ed0ea4cd278aaf1ad77294efcd15 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/gridItem.ets @@ -0,0 +1,98 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +export default +struct GridItemOnSelect { + @State Number: String[] = ['5', '6', '7', '8', '9'] + @State isSelect: boolean = false; + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear GridItemOnSelect start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear GridItemOnSelect end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("gridItem-OnSelect") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("onSelectText") + + Column({ space: 5 }) { + Grid() { + ForEach(this.Number, (day: string) => { + ForEach(this.Number, (day: string) => { + GridItem() { + Text(day) + .fontSize(16) + .backgroundColor(0xF9CF93) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) + .key("onSelected") + }.onSelect((isSelect)=>{ + console.info("Select:" + isSelect) + //this.showToast("onSelect() " + index) + this.isSelect = true; + try { + var backData = { + data: { + "STATUS": this.isSelect + } + } + let backEvent = { + eventId: 10200, + priority: events_emitter.EventPriority.LOW + } + console.info("onSelect start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onSelect emit action state err: " + JSON.stringify(err)) + } + }) + }, day => day) + }, day => day) + } + .columnsTemplate('1fr 1fr 1fr 1fr 1fr') + .rowsTemplate('1fr 1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .width('90%') + .backgroundColor(0xFAEEE0) + .height(300) + } + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/inspector.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/inspector.ets new file mode 100644 index 0000000000000000000000000000000000000000..5ce6272c42d42f44a396f84ea52e563d3083d5f1 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/inspector.ets @@ -0,0 +1,158 @@ + +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +export default +struct Inspector { + @State message: string = 'test' + @State setColor:string = '#F9CF93' + @State catchStatus:string = "success" + + onPageShow() { + console.info('[inspector] page show called'); + var stateChangeEvent = { + eventId: 103, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + } + + private stateChangCallBack = (eventData) => { + console.info("[inspector] page stateChangCallBack"); + if (eventData != null) { + console.info("[inspector] page state change called:" + JSON.stringify(eventData)); + if (eventData.data.setColor != null) { + this.setColor = eventData.data.setColor; + } + } + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("inspector") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + + Row() { + Column() { + Text(this.message) + .key("inspectorApiOne") + .fontSize(50) + .fontWeight(FontWeight.Bold) + .onClick(()=> { + let getInspectorNodesObj = JSON.stringify(getInspectorNodes()) + try { + var backData = { + data: { + "getInspectorNodes": getInspectorNodesObj, + "result":"success" + } + } + let backEvent = { + eventId: 101, + priority: events_emitter.EventPriority.LOW + } + console.info("inspector_101 onClick start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("inspector_101 onClick emit action state err: " + JSON.stringify(err.message)) + } + }) + Text("inspectorApiTwo") + .key("inspectorApiTwo") + .fontSize(50) + .fontWeight(FontWeight.Bold) + .onClick(()=> { +// let getInspectorNodeByIdObj = JSON.stringify(getInspectorNodeById(1)) + try { + var backData1 = { + data: { + "result": "success", + "getInspectorNodeById":"getInspectorNodeByIdObj" + } + } + let backEvent1 = { + eventId: 102, + priority: events_emitter.EventPriority.LOW + } + console.info("inspector_102 onClick start to emit action state") + events_emitter.emit(backEvent1, backData1) + } catch (err) { + console.info("inspector_102 onClick emit action state err: " + JSON.stringify(err.message)) + } + }) + + Text("inspectorApiThree") + .key("inspectorApiThree") + .fontSize(50) + .fontWeight(FontWeight.Bold) + .onClick(()=> { + setAppBgColor('#F9CF93'); + }) + + Text("inspectorApiFour") + .key("inspectorApiFour") + .fontSize(50) + .fontWeight(FontWeight.Bold) + .onClick(()=> { + try{ + Profiler.registerVsyncCallback((info: string) => { + console.info("VsyncCallback" + info) + }); + Profiler.unregisterVsyncCallback(); + this.catchStatus = "callBackSuccess" + }catch(err){ + console.info("inspector_103 onClick err: " + JSON.stringify(err.message)) + this.catchStatus = "callBackFail" + } + try { + var backData2 = { + data: { + "catchStatus": this.catchStatus, + } + } + let backEvent2 = { + eventId: 103, + priority: events_emitter.EventPriority.LOW + } + console.info("inspector_103 onClick start to emit action state") + events_emitter.emit(backEvent2, backData2) + } catch (err) { + console.info("inspector_103 onClick emit action state err: " + JSON.stringify(err.message)) + } + }) + } + .width('100%') + } + .height('100%') + + }.width("100%").height("100%") + } +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/lazyForEach.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/lazyForEach.ets new file mode 100644 index 0000000000000000000000000000000000000000..6920afa5c63d9d0be3dc1890ff48a99da23ea390 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/lazyForEach.ets @@ -0,0 +1,386 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 events_emitter from '@ohos.events.emitter'; +import Log from '../common/Log.ets'; + +class BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = [] + + public totalCount(): number { + return 0 + } + public getData(index: number): any { + return undefined + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener') + this.listeners.push(listener) + } + } + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener') + this.listeners.splice(pos, 1) + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded() + }) + } + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index) + }) + } + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index) + }) + } + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index) + }) + } + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to) + }) + } +} + +class MyDataSource extends BasicDataSource { + private dataArray: string[] = ['/path/image0', '/path/image1', '/path/image2', '/path/image3'] + + public totalCount(): number { + return this.dataArray.length + } + public getData(index: number): any { + return this.dataArray[index] + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data) + var datatest=this.dataArray.length + console.info('lenghth = '+ datatest) + for(var i = 0; i index2){ + var temp = this.dataArray[index1] + for(var i = index1 ; i > index2; i--){ + this.dataArray[i] = this.dataArray[i-1] + } + this.dataArray[index2] = temp + + for(var j = 0 ; j < this.dataArray.length ; j++){ + console.info('after moving :' + this.dataArray[j]) + } + } + this.notifyDataMove(index1,index2) + } + + public popData(): void { + this.dataArray.pop() + this.notifyDataDelete(this.dataArray.length) + var datatest=this.dataArray.length + console.info('lenghth = '+ datatest) + for(var i = 0; i { + ListItem() { + Row() { + Image(item).width("30%").height(50) + Text(item).fontSize(20).margin({ left: 10 }) + }.margin({ left: 10, right: 10 }) + } + .key("listItemOne") + .onClick(() => { + try{ + this.data.pushData('/path/image' + this.data.totalCount()) + console.info("this.data.totalCount() is :" + this.data.totalCount()) + }catch(err){ + this.result_101 = false + console.info("LazyForEachOnDataAdd_101 onClick emit action err: " + JSON.stringify(err.message)) + } + + try { + var backData1 = { + data: { + "result1": this.result_101, + } + } + let backEvent1 = { + eventId: 201, + priority: events_emitter.EventPriority.LOW + } + console.info("LazyForEachOnDataAdd_101 onClick start to emit action") + events_emitter.emit(backEvent1, backData1) + } catch (err) { + console.info("LazyForEachOnDataAdd_101 onClick emit action err: " + JSON.stringify(err.message)) + } + }) + }, item => item) + } + + Text("lazyForEach-OnDataMove") + .width(300) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("onDataMoveText") + + List({ space: 3 }) { + LazyForEach(this.data, (item: string) => { + ListItem() { + Row() { + Image(item).width("30%").height(50) + Text(item).fontSize(20).margin({ left: 10 }) + }.margin({ left: 10, right: 10 }) + } + .key("listItemTwo") + .onClick(() => { + try{ + this.data.moveData(3, 1) + }catch(err){ + this.result_102 = false + console.info("LazyForEachOnDataAdd_102 onClick emit action err: " + JSON.stringify(err.message)) + } + + try { + var backData2 = { + data: { + "result2": this.result_102, + } + } + let backEvent2 = { + eventId: 202, + priority: events_emitter.EventPriority.LOW + } + console.info("LazyForEachOnDataAdd_102 onClick start to emit action") + events_emitter.emit(backEvent2, backData2) + } catch (err) { + console.info("LazyForEachOnDataAdd_102 onClick emit action err: " + JSON.stringify(err.message)) + } + }) + }, item => item) + } + + Text("lazyForEach-OnDataDelete") + .width(300) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("onDataDeleteText") + + List({ space: 3 }) { + LazyForEach(this.data, (item: string) => { + ListItem() { + Row() { + Image(item).width("30%").height(50) + Text(item).fontSize(20).margin({ left: 10 }) + }.margin({ left: 10, right: 10 }) + } + .key("listItemThree") + .onClick(() => { + try{ + this.data.popData() + }catch(err){ + this.result_103 = false + console.info("LazyForEachOnDataAdd_103 onClick emit action err: " + JSON.stringify(err.message)) + } + + try { + var backData3 = { + data: { + "result3": this.result_103, + } + } + let backEvent3 = { + eventId: 203, + priority: events_emitter.EventPriority.LOW + } + console.info("LazyForEachOnDataAdd_103 onClick start to emit action") + events_emitter.emit(backEvent3, backData3) + } catch (err) { + console.info("LazyForEachOnDataAdd_103 onClick emit action err: " + JSON.stringify(err.message)) + } + + }) + }, item => item) + } + + Text("lazyForEach-OnDataChange") + .width(300) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("onDataChangeText") + + List({ space: 3 }) { + LazyForEach(this.data, (item: string) => { + ListItem() { + Row() { + Image(item).width("30%").height(50) + Text(item).fontSize(20).margin({ left: 10 }) + }.margin({ left: 10, right: 10 }) + } + .key("listItemFour") + .onClick(() => { + try{ + this.data.changeData(2) + }catch(err){ + this.result_104 = false + console.info("LazyForEachOnDataAdd_104 onClick emit action err: " + JSON.stringify(err.message)) + } + + try { + var backData4 = { + data: { + "result4": this.result_104, + } + } + let backEvent4 = { + eventId: 204, + priority: events_emitter.EventPriority.LOW + } + console.info("LazyForEachOnDataAdd_104 onClick start to emit action") + events_emitter.emit(backEvent4, backData4) + } catch (err) { + console.info("LazyForEachOnDataAdd_104 onClick emit action err: " + JSON.stringify(err.message)) + } + }) + }, item => item) + } + }.width("100%").height("100%") + } + } + } + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/navigator.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/navigator.ets new file mode 100644 index 0000000000000000000000000000000000000000..ecd76d5e343d6a8db4ecc41c851789b1ae7b54f2 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/navigator.ets @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct NavigatorTarget { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear NavigatorTarget start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear NavigatorTarget end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("navigator-Target") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("targetText") + + Navigator({ target: '', type: NavigationType.Push }) { + Text('Go to target page') + .width('100%').textAlign(TextAlign.Center) + }.params({ text: 'target' }).target('pages/index') + .key("Navigator") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/path.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/path.ets new file mode 100644 index 0000000000000000000000000000000000000000..c86731dfd0e504e480af07c4cae6cfff53f5681d --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/path.ets @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct PathNew { + private path: any = new Path({ + width: 100, + height: 100, + commands: 'M150 0 L300 300 L0 300 Z' + }) + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear PathNew start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear PathNew end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("path-New") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("neText") + + Path().width(100).height(100).commands('M150 0 L300 300 L0 300 Z') + .key("Path") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/polyLine.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/polyLine.ets new file mode 100644 index 0000000000000000000000000000000000000000..a5571de28565250924f5647afde864a657d2685a --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/polyLine.ets @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct PolyLineNe { + private polyline: PolylineAttribute = new Polyline({ + width: 100, + height: 100 + }) + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear PolyLineNe start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear PolyLineNe end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("polyLine-Ne") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("neText") + + Polyline().width(100).height(100).points([[0, 0], [0, 100], [100, 100]]) + .key("Polyline") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/polygon.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/polygon.ets new file mode 100644 index 0000000000000000000000000000000000000000..17d218ebbe57e9f3213061a7ef074346081a9a26 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/polygon.ets @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct PolygonNe { + private polygon: PolygonAttribute = new Polygon({ + width: 100, + height: 100 + }) + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear PolygonNe start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear PolygonNe end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("polygon-Ne") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("neText") + + Polygon({ width: 100, height: 100 }).points([[0, 0], [50, 100], [100, 0]]) + .key("Polygon") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/progress.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/progress.ets new file mode 100644 index 0000000000000000000000000000000000000000..95598b3857b61d01ba0979967caf584e923534d8 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/progress.ets @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct ProgressStyle { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear ProgressStyle start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear ProgressStyle end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("progress-Style") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("styleText") + Row({ space: 40 }) { + Progress({ value: 20, total: 150, type: ProgressType.Ring }) + .color(Color.Green).value(50).width(100) + .style({ strokeWidth: 20, scaleCount: 30, scaleWidth: 20 }) + .key("Progress") + } + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/rect.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/rect.ets new file mode 100644 index 0000000000000000000000000000000000000000..0c57c035a8096260b15a647557427500b30381d1 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/rect.ets @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct RectNe { + private rect: RectAttribute = new Rect({ + width: '90%', + height: 50, + radiusHeight: 20, + radiusWidth: 20 + }) + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear RectNe start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear RectNe end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("rect-Ne") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("neText") + + Rect({ width: '90%', height: 50 }).radiusHeight(20).radiusWidth(20) + .key("Rect") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/scroll.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/scroll.ets new file mode 100644 index 0000000000000000000000000000000000000000..8d997149f226eb3d3c3724a1b97c55c1adabf4fa --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/scroll.ets @@ -0,0 +1,87 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct ScrollOnScrollBegin { + scroller: Scroller = new Scroller() + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear ScrollOnScrollBegin start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear ScrollOnScrollBegin end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("scroll-OnScrollBegin") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("onScrollBeginText") + Scroll(this.scroller) { + Column() { + ForEach(this.arr, (item) => { + Text(item.toString()) + .width('90%') + .height(150) + .backgroundColor(0xFFFFFF) + .borderRadius(15) + .fontSize(16) + .textAlign(TextAlign.Center) + .margin({ top: 10 }) + }, item => item) + }.width('100%') + } + .scrollable(ScrollDirection.Vertical) + .onScrollBegin((dx: number, dy: number) => { + console.info('dx=' + dx + ",dy=" + dy) + return { dxRemain: dx, dyRemain: dy } + }) + .scrollBar(BarState.On) + .scrollBarColor(Color.Gray) + .scrollBarWidth(30) + .onScroll((xOffset: number, yOffset: number) => { + console.info(xOffset + ' ' + yOffset) + }) + .onScrollEdge((side: Edge) => { + console.info('To the edge') + }) + .onScrollEnd(() => { + console.info('Scroll Stop') + }) + .key("Scroll") + .width("100%") + .height("100%") + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/search.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/search.ets new file mode 100644 index 0000000000000000000000000000000000000000..64dc6cd51f55cf421d68a266eaeba45038d09be5 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/search.ets @@ -0,0 +1,106 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct SearchOnCut { + controller: SearchController = new SearchController() + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear SearchOnCut start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear SearchOnCut end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("search-OnCut") + .width(320) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("onCutText") + + Search({ value: '', placeholder: 'search-OnCut', controller: this.controller }) + .searchButton('Search') + .textFont({ size: 20 }) + .placeholderFont({ size: 20 }) + .onCut((value: string) => { + console.log('onCut: ' + value) + }) + .key("OnCut") + + Text("search-OnPaste") + .width(320) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("onPasteText") + + Search({ value: '', placeholder: 'search-OnPaste', controller: this.controller }) + .searchButton('Search') + .textFont({ size: 20 }) + .placeholderFont({ size: 20 }) + .onPaste((value: string) => { + console.log('onPaste: ' + value) + }) + .key("OnPaste") + + Text("search-CopyOption") + .width(320) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("copyOptionText") + + Search({ value: '', placeholder: 'search-CopyOption', controller: this.controller }) + .searchButton('Search') + .textFont({ size: 20 }) + .placeholderFont({ size: 20 }) +// 编译报错 +// .copyOption(CopyOption.InApp) + .key("CopyOption") + + }.width("100%").height("100%") + } +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/swiper.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/swiper.ets new file mode 100644 index 0000000000000000000000000000000000000000..43a9673ad5f2eb5ba1f71a9ea29f5a8dadb4ceda --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/swiper.ets @@ -0,0 +1,121 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +class MyDataSource implements IDataSource { + private list: number[] = [] + private listener: DataChangeListener + + constructor(list: number[]) { + this.list = list + } + + totalCount(): number { + return this.list.length + } + + getData(index: number): any { + return this.list[index] + } + + registerDataChangeListener(listener: DataChangeListener): void { + this.listener = listener + } + + unregisterDataChangeListener() { + } +} + + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct SwiperCurve { + + private swiperController: SwiperController = new SwiperController() + private data: MyDataSource = new MyDataSource([]) + + aboutToAppear(): void { + Log.showInfo(TAG, `aboutToAppear SwiperCurve start`) + let list = [] + for (var i = 1; i <= 10; i++) { + list.push(i.toString()); + } + this.data = new MyDataSource(list) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear SwiperCurve end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Column({ space: 5 }) { + + Swiper(this.swiperController) { + LazyForEach(this.data, (item: string) => { + Text(item).width('90%').height(160).backgroundColor(0xAFEEEE).textAlign(TextAlign.Center).fontSize(20) + }, item => item) + } + .cachedCount(2) + .index(1) + .autoPlay(true) + .interval(4000) + .indicator(true) // 默认开启指示点 + .loop(false) // 默认开启循环播放 + .duration(1000) + .vertical(false) // 默认横向切换 + .itemSpace(0) + .curve(Curve.Linear) // 动画曲线 + .onChange((index: number) => { + console.info(index.toString()) + }) + + Flex({ justifyContent: FlexAlign.SpaceAround }) { + Button('next') + .onClick(() => { + this.swiperController.showNext() + }) + Button('preview') + .onClick(() => { + this.swiperController.showPrevious() + }) + } + }.margin({ top: 5 }) + + + Text("swiper-Curve") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("curveText") + + }.width("100%").height("100%") + + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/tabs.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/tabs.ets new file mode 100644 index 0000000000000000000000000000000000000000..e4f3ae50adf44c20c3991c645dbb462c929ffcb2 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/tabs.ets @@ -0,0 +1,72 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct TabsBarPosition { + + private controller: TabsController = new TabsController() + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear TabsBarPosition start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear TabsBarPosition end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("tabs-BarPosition") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("barPositionText") + + + Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { + TabContent() { + Column().width('100%').height('100%').backgroundColor(Color.Pink) + }.tabBar('pink') + + TabContent() { + Column().width('100%').height('100%').backgroundColor(Color.Yellow) + }.tabBar('yellow') + + } + .vertical(true).scrollable(true).barMode(BarMode.Fixed) + .barWidth(70).barHeight(150).animationDuration(400) + .onChange((index: number) => { + console.info(index.toString()) + }) + .width('90%').backgroundColor(0xF5F5F5) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/text.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/text.ets new file mode 100644 index 0000000000000000000000000000000000000000..dbaf1e6c69ea955ae15d16570b4bb89c5448039b --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/text.ets @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct TextMinFontSize { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear TextMinFontSize start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear TextMinFontSize end `) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("text-MinFontSize") + .width(100) + .height(70) + .fontSize('30px') + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("minFontSizeText") + .minFontSize('50px') + + Text("text-CopyOption") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("copyOptionText") + .copyOption(0) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textArea.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textArea.ets new file mode 100644 index 0000000000000000000000000000000000000000..a97ff56708baade0b8fe8d98c480f4fa04a8d11b --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textArea.ets @@ -0,0 +1,89 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct TextAreaOnCut { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear TextAreaOnCut start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear TextAreaOnCut end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + TextArea({placeholder: "textArea-OnCut" }) + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + //input输入框中的文字被剪切时触发 + .onCut(() => { + console.log('onCut method is triggered'); + }) + .key("onCutText") + + TextArea({placeholder: "textArea-OnPaste" }) + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + //input输入框中的粘贴文字时触发 + .onPaste(() => { + console.log("onPaste method is triggered") + }) + .key("onPasteText") + + TextArea({placeholder: "textArea-CopyOption" }) + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + /**copyOption(value: boolean | CopyOption): + * 设置复制选项时调用 + * InApp = 0,Share in app. + * LocalDevice = 1,Share in local device. + * CrossDevice = 2,Share cross device. + */ + .copyOption(0) + .key("copyOptionText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textInput.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textInput.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee290598aa23a4a1f7bffdd718dc712b350c277e --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textInput.ets @@ -0,0 +1,115 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct TextInputOnEditChange { + @State num: number = 0 + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear TextInputOnEditChange start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear TextInputOnEditChange end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + TextInput({placeholder: "textInput-OnEditChange" }) + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .onEditChange(() => { + console.log(`Input state changed ${this.num++}`) + }) + .key("onEditChangeText") + + TextInput({placeholder:"textInput-OnCut"}) + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + //input输入框中的文字被剪切时触发 + .onCut(() =>{ + console.log("onCut method is triggered") + }) + .key("onCutText") + + TextInput({placeholder:"textInput-OnPaste"}) + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + //input输入框中的粘贴文字时触发 + .onPaste(() => { + console.log("onPaste method is triggered") + }) + .key("onPasteText") + + TextInput({placeholder:"textInput-CopyOption"}) + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + //设置复制选项时调用 + .copyOption(0) + .key("copyOptionText") + + TextInput({placeholder:"textInput-ShowPasswordIcon"}) + .type(InputType.Password) + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + //设置密码显示/隐藏图标时调用 + .showPasswordIcon(true) + .key("showPasswordIconText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textPicker.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textPicker.ets new file mode 100644 index 0000000000000000000000000000000000000000..cfc3d49e9593eef45ee5fa0b64ead8828dc6eca9 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textPicker.ets @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct TextPickerDefaultPickerItemHeight { + private select: number = 1 + private fruits: string[] = ['1.apple', '2.orange','3.peach', '4.grape'] + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear TextPickerDefaultPickerItemHeight start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear TextPickerDefaultPickerItemHeight end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + TextPicker({range: this.fruits, selected: this.select}) + .onChange((value: string, index: number) => { + console.info('Picker item changed, value: ' + value + ', index: ' + index) + }) + .defaultPickerItemHeight('80px') + .key("defaultPickerItemHeightText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/video.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/video.ets new file mode 100644 index 0000000000000000000000000000000000000000..fdbf5edceffb96a21f9e1dc0883b06f03523c880 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/video.ets @@ -0,0 +1,101 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct VideoOnFullscreenChange { + + @State srcs: Resource = $rawfile('videoTest.mp4'); + @State currentProgressRates: number = 1; + @State autoPlays: boolean = false; + controller: VideoController = new VideoController(); + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear VideoOnFullscreenChange start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear VideoOnFullscreenChange end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Video({ + src: this.srcs, + currentProgressRate: this.currentProgressRates, + controller: this.controller + }).width(600).height(400) + .autoPlay(this.autoPlays) + .key("onFullscreenChangeText") + .onStart(() => { + console.error('onStart'); + }) + .onFullscreenChange(() => { + console.log('screen is changed') + console.info('screen is changed') + console.error('screen is changed') + console.warn('screen is changed') + }) + .onPause(() => { + console.error('onPause'); + }) + .onFinish(() => { + console.error('onFinish'); + }) + .onError(() => { + console.error('onFinish'); + }) + .onPrepared((e) => { + console.error('onPrepared is ' + e.duration); + }) + .onSeeking((e) => { + console.error('onSeeking is ' + e.time); + }) + .onSeeked((e) => { + console.error('onSeekedis ' + e.time); + }) + .onUpdate((e) => { + console.error('onUpdateis ' + e.time); + }) + Row() { + Button("FullScreen").onClick(() => { + this.controller.requestFullscreen(true) + }); + Button("ExitFullScreen").onClick(() => { + this.controller.exitFullscreen() + }); + } + + Row() { + Button("start").onClick(() => { + this.controller.start(); + }); + Button("pause").onClick(() => { + this.controller.pause(); + }); + Button("stop").onClick(() => { + this.controller.stop(); + }); + } + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets index 3073a9643a3c23d4d937ffd06482fd9a1ffabb6d..36a51b42e9072ebcad4f9853489b2fdc3765d012 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets @@ -17,10 +17,48 @@ import alphabetIndexerOnSelectJsunit from './alphabetIndexer.test.ets'; import checkBoxGroupSelectAllJsunit from './checkBoxGroup.test.ets'; import circleNewJsunit from './circle.test.ets'; import ellipseNeJsunit from './ellipse.test.ets'; +import gridMaxCountJsunit from './grid.test.ets'; +import gridItemOnSelectJsunit from './gridItem.test.ets'; +import inspectorJsunit from './inspector.test.ets' +import lazyForEachOnDataAddJsunit from './lazyForEach.test.ets'; +import navigatorTargetJsunit from './navigator.test.ets' +import pathNewTest from './path.test.ets'; +import polygonNewJsunit from './polygon.test.ets'; +import polyLineNeJsunit from './polyLine.test.ets'; +import progressScaleCountJsunit from './progress.test.ets'; +import rectNeJsunit from './rect.test.ets'; +import scrollOnScrollBeginJsunit from './scroll.test.ets'; +import searchOnCutJsunit from './search.test.ets' +import swiperCurveJsunit from './swiper.test.ets'; +import tabsBarPositionJsunit from './tabs.test.ets'; +import textMinFontSizeJsunit from './text.test.ets'; +import textAreaOnCutJsunit from './textArea.test.ets'; +import textInputOnEditChangeJsunit from './textInput.test.ets'; +import textPickerDefaultPickerItemHeightJsunit from './textPicker.test.ets'; +import videoOnFullscreenChangeJsunit from './video.test.ets'; export default function testsuite() { + lazyForEachOnDataAddJsunit() alphabetIndexerOnSelectJsunit() checkBoxGroupSelectAllJsunit() circleNewJsunit() ellipseNeJsunit() + gridMaxCountJsunit() + gridItemOnSelectJsunit() + inspectorJsunit() + navigatorTargetJsunit() + pathNewTest() + polygonNewJsunit() + polyLineNeJsunit() + progressScaleCountJsunit() + rectNeJsunit() + scrollOnScrollBeginJsunit() + searchOnCutJsunit() + swiperCurveJsunit() + tabsBarPositionJsunit() + textMinFontSizeJsunit() + textAreaOnCutJsunit() + textInputOnEditChangeJsunit() + textPickerDefaultPickerItemHeightJsunit() + videoOnFullscreenChangeJsunit() } \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/grid.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/grid.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..137a40f4813114592cc0c84d03d3b1699b7e3bd3 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/grid.test.ets @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function gridMaxCountJsunit() { + describe('gridMaxCountTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/grid', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get grid state success " + JSON.stringify(pages)); + if (!("grid" == pages.name)) { + console.info("get grid state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push grid page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push grid page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("gridMaxCount after each called"); + }); + + it('testcheckgridMaxCount0001', 0, async function (done) { + console.info('testcheckgridMaxCount testcheckgridMaxCount0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('maxCountTest'); + console.info("[testcheckgridMaxCount0001] component selectedMaxcount strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Grid'); + expect(obj.$attrs.maxCount).assertEqual("5"); + console.info("[testcheckgridMaxCount0001] selectedMaxCount value :" + obj.$attrs.maxCount); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/gridItem.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/gridItem.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9a77215e1c9d17c038122871429f28fe1dbc9fd4 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/gridItem.test.ets @@ -0,0 +1,74 @@ + +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' +import events_emitter from '@ohos.events.emitter'; + +export default function gridItemOnSelectJsunit() { + describe('gridItemOnSelectTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/gridItem', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get gridItem state success " + JSON.stringify(pages)); + if (!("gridItem" == pages.name)) { + console.info("get gridItem state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push gridItem page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push gridItem page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("gridItemOnSelect after each called"); + }); + + + it('testgridItemOnSelect0001', 0, async function (done) { + console.info('testgridItemOnSelect testgridItemOnSelect0001 START'); + await Utils.sleep(2000); + let callback = (indexEvent) => { + console.info("onSelect_0001 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.STATUS).assertEqual(true); + done(); + } + let indexEvent = { + eventId: 10200, + priority: events_emitter.EventPriority.LOW + } + sendEventByKey('onSelected', 10, "") + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("onSelect_0001 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testgridItemOnSelect0001 END'); + done(); + }); + + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/inspector.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/inspector.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fef7406ca3812dc6ef18ad07fd947c136fd4d103 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/inspector.test.ets @@ -0,0 +1,200 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function inspectorJsunit() { + describe('inspectorTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/inspector', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get inspector state success " + JSON.stringify(pages)); + if (!("inspector" == pages.name)) { + console.info("get inspector state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push inspector page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push inspector page error: " + err); + } + done() + }); + + afterEach(async function () { + console.info("inspectorTest after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testlazyForEachOnDataAdd0001 + * @tc.desic acelazyForEachOnDataAddEtsTest0001 + */ + it('testInspectorTestAdd0001', 0, async function (done) { + console.info('Inspector testInspectorTestAdd0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('inspectorApiOne'); + console.info("[testInspectorTestAdd0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("50.00fp"); + console.info("[testInspectorTestAdd0001] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testInspectorTestAdd0002 + * @tc.desic aceTestInspectorTestAdd0002 + */ + it('testInspectorTestAdd0002', 0, async function (done) { + console.info('Inspector testInspectorTestAdd0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('inspectorApiOne'); + console.info("[testInspectorTestAdd0002] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontWeight).assertEqual("FontWeight.Bold"); + console.info("[testInspectorTestAdd0002] fontWeight value :" + obj.$attrs.fontWeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testInspectorTestAdd0003 + * @tc.desic aceTestInspectorTestAdd0003 + */ + it('testInspectorTestAdd0003', 0, async function (done) { + console.info("testInspectorTestAdd0003 start test"); + var innerEvent1 = { + eventId: 101, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("eventData.data.getInspectorNodes result is: " + eventData.data.getInspectorNodes); + try{ + console.info("callback1 success" ); + console.info("inspector_101 eventData.data.result result is: " + eventData.data.result); + expect(eventData.data.result).assertEqual("success"); + console.info("inspector_101 end: "); + if(eventData.data.getInspectorNodes != null){ + console.info("eventData.data.result result is: " + eventData.data.result); + expect(eventData.data.result).assertEqual("success"); + } + }catch(err){ + console.info("inspector_101 on events_emitter err : " + JSON.stringify(err)); + } + done(); + } + try { + events_emitter.on(innerEvent1, callback1); + console.info("inspector_101 click result is: " + JSON.stringify(sendEventByKey('inspectorApiOne', 10, ""))); + } catch (err) { + console.info("inspector_101 on events_emitter err : " + JSON.stringify(err)); + } + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testInspectorTestAdd0004 + * @tc.desic aceTestInspectorTestAdd0004 + */ + it('testInspectorTestAdd0004', 0, async function (done) { + var innerEvent2 = { + eventId: 102, + priority: events_emitter.EventPriority.LOW + } + var callback2 = (eventData) => { + console.info("eventData.data.getInspectorNodeById result is: " + eventData.data.getInspectorNodeById); + try{ + console.info("callback2 success" ); + console.info("inspector_102 eventData.data.result result is: " + eventData.data.result); + expect(eventData.data.result).assertEqual("success"); + console.info("inspector_102 end"); + }catch(err){ + console.info("inspector_102 on events_emitter err : " + JSON.stringify(err)); + } + done(); + } + try{ + console.info("inspector_102 click result is: " + JSON.stringify(sendEventByKey('inspectorApiTwo', 10, ""))); + events_emitter.on(innerEvent2, callback2); + }catch(err){ + console.info("inspector_102 on events_emitter err : " + JSON.stringify(err)); + } + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testInspectorTestAdd0005 + * @tc.desic aceTestInspectorTestAdd0005 + */ + it('testInspectorTestAdd0005', 0, async function (done) { + console.info('testInspectorTestAdd0005 START'); + try { + var eventData = { + data: { + "setColor": 'red' + } + } + var innerEvent = { + eventId: 103, + priority: events_emitter.EventPriority.LOW + } + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testInspectorTestAdd0005] change component data error: " + err.message); + } + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testInspectorTestAdd0006 + * @tc.desic aceTestInspectorTestAdd0006 + */ + it('testInspectorTestAdd0006', 0, async function (done) { + var innerEvent3 = { + eventId: 103, + priority: events_emitter.EventPriority.LOW + } + var callback3 = (eventData) => { + try{ + console.info("callback2 success" ); + console.info("inspector_103 eventData.data.result result is: " + eventData.data.catchStatus); + expect(eventData.data.catchStatus).assertEqual("callBackSuccess"); + console.info("inspector_103 end"); + }catch(err){ + console.info("inspector_103 on events_emitter err : " + JSON.stringify(err)); + } + done(); + } + try{ + console.info("inspector_103 click result is: " + JSON.stringify(sendEventByKey('inspectorApiFour', 10, ""))); + events_emitter.on(innerEvent3, callback3); + }catch(err){ + console.info("inspector_103 on events_emitter err : " + JSON.stringify(err)); + } + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/lazyForEach.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/lazyForEach.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..04f59487328857752b355d7e69c237fd34dc2935 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/lazyForEach.test.ets @@ -0,0 +1,177 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 events_emitter from '@ohos.events.emitter'; +import router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function lazyForEachOnDataAddJsunit() { + describe('lazyForEachOnDataAddTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/lazyForEach', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get lazyForEach state success " + JSON.stringify(pages)); + if (!("lazyForEach" == pages.name)) { + console.info("get lazyForEach state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push lazyForEach page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push lazyForEach page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("lazyForEachOnDataAdd after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testlazyForEachOnDataAdd0001 + * @tc.desic acelazyForEachOnDataAddEtsTest0001 + */ + it('testlazyForEachOnDataAdd0001', 0, async function (done) { + console.info('lazyForEachOnDataAdd testlazyForEachOnDataAdd0001 START'); + + var innerEvent1 = { + eventId: 201, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("eventData.data.result1 result is: " + eventData.data.result1); + try{ + console.info("callback1 success" ); + console.info("Lazy_101 eventData.data.result1 result is: " + eventData.data.result1); + expect(eventData.data.result1).assertEqual(true); + console.info('lazyForEachOnDataAdd testlazyForEachOnDataAdd0001 END'); + }catch(err){ + console.info("Lazy_101 on events_emitter err : " + JSON.stringify(err)); + } + done(); + } + try{ + console.info("Lazy_101 click result is:" + JSON.stringify(sendEventByKey('listItemOne', 10, ""))); + events_emitter.on(innerEvent1, callback1); + }catch(err){ + console.info("Lazy_101 on events_emitter err : " + JSON.stringify(err)); + } + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testlazyForEachOnDataAdd0002 + * @tc.desic acelazyForEachOnDataAddEtsTest0002 + */ + it('testlazyForEachOnDataAdd0002', 0, async function (done) { + console.info('lazyForEachOnDataAdd testlazyForEachOnDataAdd0002 START'); + + var innerEvent2 = { + eventId: 202, + priority: events_emitter.EventPriority.LOW + } + var callback2 = (eventData) => { + console.info("eventData.data.result2 result is: " + eventData.data.result2); + try{ + console.info("callback2 success" ); + console.info("Lazy_102 eventData.data.result2 result is: " + eventData.data.result2); + expect(eventData.data.result2).assertEqual(true); + console.info('lazyForEachOnDataAdd testlazyForEachOnDataAdd0002 END'); + }catch(err){ + console.info("Lazy_102 on events_emitter err : " + JSON.stringify(err)); + } + done(); + } + try{ + console.info("Lazy_102 click result is:" + JSON.stringify(sendEventByKey('listItemTwo', 10, ""))); + events_emitter.on(innerEvent2, callback2); + }catch(err){ + console.info("Lazy_102 on events_emitter err : " + JSON.stringify(err)); + } + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testlazyForEachOnDataAdd0003 + * @tc.desic acelazyForEachOnDataAddEtsTest0003 + */ + it('testlazyForEachOnDataAdd0003', 0, async function (done) { + console.info('lazyForEachOnDataAdd testlazyForEachOnDataAdd0003 START'); + + var innerEvent3 = { + eventId: 203, + priority: events_emitter.EventPriority.LOW + } + var callback3 = (eventData) => { + console.info("eventData.data.result3 result is: " + eventData.data.result3); + try{ + console.info("callback3 success" ); + console.info("Lazy_103 eventData.data.result3 result is: " + eventData.data.result3); + expect(eventData.data.result3).assertEqual(true); + console.info('lazyForEachOnDataAdd testlazyForEachOnDataAdd0003 END'); + }catch(err){ + console.info("Lazy_103 on events_emitter err : " + JSON.stringify(err)); + } + done(); + } + try{ + console.info("Lazy_103 click result is:" + JSON.stringify(sendEventByKey('listItemThree', 10, ""))); + events_emitter.on(innerEvent3, callback3); + }catch(err){ + console.info("Lazy_103 on events_emitter err : " + JSON.stringify(err)); + } + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testlazyForEachOnDataAdd0004 + * @tc.desic acelazyForEachOnDataAddEtsTest0004 + */ + it('testlazyForEachOnDataAdd0004', 0, async function (done) { + console.info('lazyForEachOnDataAdd testlazyForEachOnDataAdd0004 START'); + + var innerEvent4 = { + eventId: 204, + priority: events_emitter.EventPriority.LOW + } + var callback4 = (eventData) => { + console.info("eventData.data.result4 result is: " + eventData.data.result4); + try{ + console.info("callback4 success" ); + console.info("Lazy_104 eventData.data.result4 result is: " + eventData.data.result4); + expect(eventData.data.result4).assertEqual(true); + console.info('lazyForEachOnDataAdd testlazyForEachOnDataAdd0004 END'); + }catch(err){ + console.info("Lazy_104 on events_emitter err : " + JSON.stringify(err)); + } + done(); + } + try{ + console.info("Lazy_104 click result is:" + JSON.stringify(sendEventByKey('listItemFour', 10, ""))); + events_emitter.on(innerEvent4, callback4); + }catch(err){ + console.info("Lazy_104 on events_emitter err : " + JSON.stringify(err)); + } + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/navigator.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/navigator.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..540890439a82bd6e9d07bb4d07c0de06d79d560e --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/navigator.test.ets @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function navigatorTargetJsunit() { + describe('navigatorTargetTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/navigator', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get navigator state success " + JSON.stringify(pages)); + if (!("navigator" == pages.name)) { + console.info("get navigator state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push navigator page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push navigator page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("navigatorTarget after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testnavigatorTarget0001 + * @tc.desic acenavigatorTargetEtsTest0001 + */ + it('testnavigatorTarget0001', 0, async function (done) { + console.info('navigatorTarget testnavigatorTarget0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Navigator'); + console.info("[testnavigatorTarget0001] component strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Navigator'); + expect(obj.$attrs.target).assertEqual("pages/index"); + console.info("[testnavigatorTarget0001] target value :" + obj.$attrs.target); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/path.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/path.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6333b60052e4da62d8990bde659c63e8a327d1a4 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/path.test.ets @@ -0,0 +1,99 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function pathNewTest() { + describe('pathNewTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/path', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get path state success " + JSON.stringify(pages)); + if (!("path" == pages.name)) { + console.info("get path state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push path page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push path page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("pathNe after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testpathNe0001 + * @tc.desic acepathNeEtsTest0001 + */ + it('testpathNe0001', 0, async function (done) { + console.info('pathNe testpathNe0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Path'); + console.info("[testpathNe0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.width).assertEqual("150.00px"); + console.info("[testpathNe0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testpathNe0002 + * @tc.desic acepathNeEtsTest0002 + */ + it('testpathNe0002', 0, async function (done) { + console.info('pathNe testpathNe0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Path'); + console.info("[testpathNe0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.height).assertEqual("150.00px"); + console.info("[testpathNe0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testpathNe0003 + * @tc.desic acepathNeEtsTest0003 + */ + it('testpathNe0003', 0, async function (done) { + console.info('pathNe testpathNe0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Path'); + console.info("[testpathNe0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.commands).assertEqual("M150 0 L300 300 L0 300 Z"); + console.info("[testpathNe0003] commands value :" + obj.$attrs.commands); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/polyLine.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/polyLine.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a7e14236bcc3b9a24685d88772ab326608f0465c --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/polyLine.test.ets @@ -0,0 +1,82 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function polyLineNeJsunit() { + describe('polyLineNeTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/polyLine', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get polyLine state success " + JSON.stringify(pages)); + if (!("polyLine" == pages.name)) { + console.info("get polyLine state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push polyLine page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push polyLine page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("polyLineNe after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testpolyLineNe0001 + * @tc.desic acepolyLineNeEtsTest0001 + */ + it('testpolyLineNe0001', 0, async function (done) { + console.info('polyLineNe testpolyLineNe0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Polyline'); + console.info("[testpolyLineNe0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.width).assertEqual("150.00px"); + console.info("[testpolyLineNe0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testpolyLineNe0002 + * @tc.desic acepolyLineNeEtsTest0002 + */ + it('testpolyLineNe0002', 0, async function (done) { + console.info('polyLineNe testpolyLineNe0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Polyline'); + console.info("[testpolyLineNe0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.height).assertEqual("150.00px"); + console.info("[testpolyLineNe0002] height value :" + obj.$attrs.height); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/polygon.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/polygon.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae620e5edea01d6becd105ae16f1fe360a1e03b1 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/polygon.test.ets @@ -0,0 +1,82 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function polygonNewJsunit() { + describe('polygonNewJsunit', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/polygon', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get polygon state success " + JSON.stringify(pages)); + if (!("polygon" == pages.name)) { + console.info("get polygon state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push polygon page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push polygon page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("polygonNe after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testpolygonNe0001 + * @tc.desic acepolygonNeEtsTest0001 + */ + it('testpolygonNe0001', 0, async function (done) { + console.info('polygonNe testpolygonNe0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Polygon'); + console.info("[testpolygonNe0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.width).assertEqual("150.00px"); + console.info("[testpolygonNe0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testpolygonNe0002 + * @tc.desic acepolygonNeEtsTest0002 + */ + it('testpolygonNe0002', 0, async function (done) { + console.info('polygonNe testpolygonNe0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Polygon'); + console.info("[testpolygonNe0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.height).assertEqual("150.00px"); + console.info("[testpolygonNe0002] height value :" + obj.$attrs.height); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/progress.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/progress.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a01034c224cc8c3a2c46db398abbc6323d9b5945 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/progress.test.ets @@ -0,0 +1,150 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function progressStyleJsunit() { + describe('progressStyleTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/progress', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get progress state success " + JSON.stringify(pages)); + if (!("progress" == pages.name)) { + console.info("get progress state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push progress page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push progress page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("progressStyle after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testprogressStyle0001 + * @tc.desic aceprogressStyleEtsTest0001 + */ + it('testprogressStyle0001', 0, async function (done) { + console.info('progressStyle testprogressStyle0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Progress'); + console.info("[testprogressStyle0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Progress'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testprogressStyle0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testprogressStyle0002 + * @tc.desic aceprogressStyleEtsTest0002 + */ + it('testprogressStyle0002', 0, async function (done) { + console.info('progressStyle testprogressStyle0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Progress'); + console.info("[testprogressStyle0002] component color strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Progress'); + expect(obj.$attrs.color).assertEqual("#FF008000"); + console.info("[testprogressStyle0002] color value :" + obj.$attrs.color); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testprogressStyle0003 + * @tc.desic aceprogressStyleEtsTest0003 + */ + it('testprogressStyle0003', 0, async function (done) { + console.info('progressStyle testprogressStyle0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Progress'); + console.info("[testprogressStyle0003] component value strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Progress'); + expect(obj.$attrs.value).assertEqual("50.000000"); + console.info("[testprogressStyle0003] value value :" + obj.$attrs.value); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testprogressStyle0004 + * @tc.desic aceprogressStyleEtsTest0004 + */ + it('testprogressStyle0004', 0, async function (done) { + console.info('progressStyle testprogressStyle0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Progress'); + console.info("[testprogressStyle0004] component style strokeWidth strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Progress'); + expect(obj.$attrs.style.strokeWidth).assertEqual("20.00vp"); + console.info("[testprogressStyle0004] style strokeWidth value :" + obj.$attrs.style.strokeWidth); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testprogressStyle0005 + * @tc.desic aceprogressStyleEtsTest0005 + */ + it('testprogressStyle0005', 0, async function (done) { + console.info('progressStyle testprogressStyle0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Progress'); + console.info("[testprogressStyle0005] component style scaleCount strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Progress'); + expect(obj.$attrs.style.scaleCount).assertEqual("30"); + console.info("[testprogressStyle0005] style scaleCount value :" + obj.$attrs.style.scaleCount); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testprogressStyle0006 + * @tc.desic aceprogressStyleEtsTest0006 + */ + it('testprogressStyle0006', 0, async function (done) { + console.info('progressStyle testprogressStyle0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Progress'); + console.info("[testprogressStyle0006] component style scaleWidth strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Progress'); + expect(obj.$attrs.style.scaleWidth).assertEqual("20.00vp"); + console.info("[testprogressStyle0006] style scaleWidth value :" + obj.$attrs.style.scaleWidth); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/rect.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/rect.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3fbc3a8e067c5cdf01311315f111324443157113 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/rect.test.ets @@ -0,0 +1,82 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function rectNeJsunit() { + describe('rectNeTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/rect', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get rect state success " + JSON.stringify(pages)); + if (!("rect" == pages.name)) { + console.info("get rect state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push rect page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push rect page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("rectNe after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testrectNe0001 + * @tc.desic acerectNeEtsTest0001 + */ + it('testrectNe0001', 0, async function (done) { + console.info('rectNe testrectNe0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Rect'); + console.info("[testrectNe0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.width).assertEqual("90.00%"); + console.info("[testrectNe0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testrectNe0002 + * @tc.desic acerectNeEtsTest0002 + */ + it('testrectNe0002', 0, async function (done) { + console.info('rectNe testrectNe0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Rect'); + console.info("[testrectNe0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.height).assertEqual("75.00px"); + console.info("[testrectNe0002] height value :" + obj.$attrs.height); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/scroll.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/scroll.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..867a4feb0d32fb4e7108cc53a17057ff51548743 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/scroll.test.ets @@ -0,0 +1,162 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' +import events_emitter from '@ohos.events.emitter'; + +export default function scrollOnScrollBeginJsunit() { + describe('scrollOnScrollBeginTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/scroll', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get scroll state success " + JSON.stringify(pages)); + if (!("scroll" == pages.name)) { + console.info("get scroll state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push scroll page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push scroll page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("scrollOnScrollBegin after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testscrollOnScrollBegin0001 + * @tc.desic acescrollOnScrollBeginEtsTest0001 + */ + it('testscrollOnScrollBegin0001', 0, async function (done) { + console.info('scrollOnScrollBegin testscrollOnScrollBegin0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Scroll'); + console.info("[testscrollOnScrollBegin0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Scroll'); + expect(obj.$attrs.width).assertEqual("100.00%"); + console.info("[testscrollOnScrollBegin0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testscrollOnScrollBegin0002 + * @tc.desic acescrollOnScrollBeginEtsTest0002 + */ + it('testscrollOnScrollBegin0002', 0, async function (done) { + console.info('scrollOnScrollBegin testscrollOnScrollBegin0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Scroll'); + console.info("[testscrollOnScrollBegin0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Scroll'); + expect(obj.$attrs.height).assertEqual("100.00%"); + console.info("[testscrollOnScrollBegin0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testscrollOnScrollBegin0003 + * @tc.desic acescrollOnScrollBeginEtsTest0003 + */ + it('testscrollOnScrollBegin0003', 0, async function (done) { + console.info('scrollOnScrollBegin testscrollOnScrollBegin0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Scroll'); + console.info("[testscrollOnScrollBegin0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Scroll'); + expect(obj.$attrs.scrollBar).assertEqual("BarState.On"); + console.info("[testscrollOnScrollBegin0003] scrollBar value :" + obj.$attrs.scrollBar); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testscrollOnScrollBegin0004 + * @tc.desic acescrollOnScrollBeginEtsTest0004 + */ + it('testscrollOnScrollBegin0004', 0, async function (done) { + console.info('scrollOnScrollBegin testscrollOnScrollBegin0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Scroll'); + console.info("[testscrollOnScrollBegin0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Scroll'); + expect(obj.$attrs.scrollBarColor).assertEqual("#FF808080"); + console.info("[testscrollOnScrollBegin0004] scrollBarColor value :" + obj.$attrs.scrollBarColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testscrollOnScrollBegin0005 + * @tc.desic acescrollOnScrollBeginEtsTest0005 + */ + it('testscrollOnScrollBegin0005', 0, async function (done) { + console.info('scrollOnScrollBegin testscrollOnScrollBegin0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Scroll'); + console.info("[testscrollOnScrollBegin0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Scroll'); + expect(obj.$attrs.scrollBarWidth).assertEqual("30.00px"); + console.info("[testscrollOnScrollBegin0005] scrollBarWidth value :" + obj.$attrs.scrollBarWidth); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0012 + * @tc.name testscrollOnScrollBegin0005 + * @tc.desic acescrollOnScrollBeginEtsTest0006 + */ + it('testscrollOnScrollBegin0006', 0, async function (done) { + console.info('scrollOnScrollBegin testscrollOnScrollBegin0006 START'); + await Utils.sleep(2000); + + let callback = (indexEvent) => { + console.info("scrollOnScrollBegin get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.STATUS).assertEqual(true); + } + let indexEvent = { + eventId: 10086, + priority: events_emitter.EventPriority.LOW + } + sendEventByKey('Scroll', 10, "") + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("scrollOnScrollBegin on events_emitter err : " + JSON.stringify(err)); + } + console.info('testscrollOnScrollBegin0006 END'); + done(); + + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/search.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/search.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..567a45048076c18d9b7e42936d9204bc297ab421 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/search.test.ets @@ -0,0 +1,201 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function searchOnCutJsunit() { + describe('searchOnCutTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/search', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get search state success " + JSON.stringify(pages)); + if (!("search" == pages.name)) { + console.info("get search state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push search page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push search page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("searchOnCut after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testsearchOnCut0001 + * @tc.desic acesearchOnCutEtsTest0001 + */ + it('testsearchOnCut0001', 0, async function (done) { + console.info('searchOnCut testsearchOnCut0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("320.00vp"); + console.info("[testsearchOnCut0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testsearchOnCut0002 + * @tc.desic acesearchOnCutEtsTest0002 + */ + it('testsearchOnCut0002', 0, async function (done) { + console.info('searchOnCut testsearchOnCut0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testsearchOnCut0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testsearchOnCut0003 + * @tc.desic acesearchOnCutEtsTest0003 + */ + it('testsearchOnCut0003', 0, async function (done) { + console.info('searchOnCut testsearchOnCut0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testsearchOnCut0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testsearchOnCut0004 + * @tc.desic acesearchOnCutEtsTest0004 + */ + it('testsearchOnCut0004', 0, async function (done) { + console.info('searchOnCut testsearchOnCut0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testsearchOnCut0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testsearchOnCut0005 + * @tc.desic acesearchOnCutEtsTest0005 + */ + it('testsearchOnCut0005', 0, async function (done) { + console.info('searchOnCut testsearchOnCut0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testsearchOnCut0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testsearchOnCut0006 + * @tc.desic acesearchOnCutEtsTest0006 + */ + it('testsearchOnCut0006', 0, async function (done) { + console.info('searchOnCut testsearchOnCut0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testsearchOnCut0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testsearchOnCut0007 + * @tc.desic acesearchOnCutEtsTest0007 + */ + it('testsearchOnCut0007', 0, async function (done) { + console.info('searchOnCut testsearchOnCut0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testsearchOnCut0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testsearchOnCut0009 + * @tc.desic acesearchOnCutEtsTest0009 + */ + it('testsearchOnCut0009', 0, async function (done) { + console.info('searchOnCut testsearchOnCut009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testsearchOnCut0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testsearchOnCut0010 + * @tc.desic acesearchOnCutEtsTest0010 + */ + it('testsearchOnCut0010', 0, async function (done) { + console.info('searchOnCut testsearchOnCut0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testsearchOnCut0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/swiper.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/swiper.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4c83f088f504e550a4c2a5f44dcacb36df99c2db --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/swiper.test.ets @@ -0,0 +1,201 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function swiperCurveJsunit() { + describe('swiperCurveTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/swiper', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get swiper state success " + JSON.stringify(pages)); + if (!("swiper" == pages.name)) { + console.info("get swiper state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push swiper page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push swiper page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("swiperCurve after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testswiperCurve0001 + * @tc.desic aceswiperCurveEtsTest0001 + */ + it('testswiperCurve0001', 0, async function (done) { + console.info('swiperCurve testswiperCurve0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testswiperCurve0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testswiperCurve0002 + * @tc.desic aceswiperCurveEtsTest0002 + */ + it('testswiperCurve0002', 0, async function (done) { + console.info('swiperCurve testswiperCurve0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testswiperCurve0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testswiperCurve0003 + * @tc.desic aceswiperCurveEtsTest0003 + */ + it('testswiperCurve0003', 0, async function (done) { + console.info('swiperCurve testswiperCurve0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testswiperCurve0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testswiperCurve0004 + * @tc.desic aceswiperCurveEtsTest0004 + */ + it('testswiperCurve0004', 0, async function (done) { + console.info('swiperCurve testswiperCurve0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testswiperCurve0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testswiperCurve0005 + * @tc.desic aceswiperCurveEtsTest0005 + */ + it('testswiperCurve0005', 0, async function (done) { + console.info('swiperCurve testswiperCurve0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testswiperCurve0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testswiperCurve0006 + * @tc.desic aceswiperCurveEtsTest0006 + */ + it('testswiperCurve0006', 0, async function (done) { + console.info('swiperCurve testswiperCurve0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testswiperCurve0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testswiperCurve0007 + * @tc.desic aceswiperCurveEtsTest0007 + */ + it('testswiperCurve0007', 0, async function (done) { + console.info('swiperCurve testswiperCurve0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testswiperCurve0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testswiperCurve0009 + * @tc.desic aceswiperCurveEtsTest0009 + */ + it('testswiperCurve0009', 0, async function (done) { + console.info('swiperCurve testswiperCurve009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testswiperCurve0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testswiperCurve0010 + * @tc.desic aceswiperCurveEtsTest0010 + */ + it('testswiperCurve0010', 0, async function (done) { + console.info('swiperCurve testswiperCurve0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testswiperCurve0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/tabs.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/tabs.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b65cbfd51b84c77e6b72786781350a93559b7a45 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/tabs.test.ets @@ -0,0 +1,201 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function tabsBarPositionJsunit() { + describe('tabsBarPositionTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/tabs', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get tabs state success " + JSON.stringify(pages)); + if (!("tabs" == pages.name)) { + console.info("get tabs state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push tabs page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push tabs page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("tabsBarPosition after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testtabsBarPosition0001 + * @tc.desic acetabsBarPositionEtsTest0001 + */ + it('testtabsBarPosition0001', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testtabsBarPosition0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testtabsBarPosition0002 + * @tc.desic acetabsBarPositionEtsTest0002 + */ + it('testtabsBarPosition0002', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testtabsBarPosition0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testtabsBarPosition0003 + * @tc.desic acetabsBarPositionEtsTest0003 + */ + it('testtabsBarPosition0003', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testtabsBarPosition0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testtabsBarPosition0004 + * @tc.desic acetabsBarPositionEtsTest0004 + */ + it('testtabsBarPosition0004', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testtabsBarPosition0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testtabsBarPosition0005 + * @tc.desic acetabsBarPositionEtsTest0005 + */ + it('testtabsBarPosition0005', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testtabsBarPosition0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testtabsBarPosition0006 + * @tc.desic acetabsBarPositionEtsTest0006 + */ + it('testtabsBarPosition0006', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testtabsBarPosition0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testtabsBarPosition0007 + * @tc.desic acetabsBarPositionEtsTest0007 + */ + it('testtabsBarPosition0007', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testtabsBarPosition0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testtabsBarPosition0009 + * @tc.desic acetabsBarPositionEtsTest0009 + */ + it('testtabsBarPosition0009', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testtabsBarPosition0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testtabsBarPosition0010 + * @tc.desic acetabsBarPositionEtsTest0010 + */ + it('testtabsBarPosition0010', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testtabsBarPosition0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/text.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/text.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8e28cd9054c6c3a9e9748c7bb10e22a0c419edd5 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/text.test.ets @@ -0,0 +1,202 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function textMinFontSizeJsunit() { + describe('textMinFontSizeTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/text', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get text state success " + JSON.stringify(pages)); + if (!("text" == pages.name)) { + console.info("get text state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push text page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push text page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("textMinFontSize after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testtextMinFontSize0001 + * @tc.desic acetextMinFontSizeEtsTest0001 + */ + it('testtextMinFontSize0001', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testtextMinFontSize0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testtextMinFontSize0002 + * @tc.desic acetextMinFontSizeEtsTest0002 + */ + it('testtextMinFontSize0002', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testtextMinFontSize0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testtextMinFontSize0003 + * @tc.desic acetextMinFontSizeEtsTest0003 + */ + it('testtextMinFontSize0003', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("30.00px"); + console.info("[testtextMinFontSize0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testtextMinFontSize0004 + * @tc.desic acetextMinFontSizeEtsTest0004 + */ + it('testtextMinFontSize0004', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testtextMinFontSize0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testtextMinFontSize0005 + * @tc.desic acetextMinFontSizeEtsTest0005 + */ + it('testtextMinFontSize0005', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testtextMinFontSize0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testtextMinFontSize0006 + * @tc.desic acetextMinFontSizeEtsTest0006 + */ + it('testtextMinFontSize0006', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testtextMinFontSize0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testtextMinFontSize0007 + * @tc.desic acetextMinFontSizeEtsTest0007 + */ + it('testtextMinFontSize0007', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testtextMinFontSize0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testtextMinFontSize0009 + * @tc.desic acetextMinFontSizeEtsTest0009 + */ + it('testtextMinFontSize0009', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testtextMinFontSize0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testtextMinFontSize0010 + * @tc.desic acetextMinFontSizeEtsTest0010 + */ + it('testtextMinFontSize0010', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testtextMinFontSize0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textArea.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textArea.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8e8b7f850d4e97d4db3da092622f8ab0fdaa6042 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textArea.test.ets @@ -0,0 +1,203 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function textAreaOnCutJsunit() { + describe('textAreaOnCutTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/textArea', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get textArea state success " + JSON.stringify(pages)); + if (!("textArea" == pages.name)) { + console.info("get textArea state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push textArea page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push textArea page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("textAreaOnCut after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testtextAreaOnCut0001 + * @tc.desic acetextAreaOnCutEtsTest0001 + */ + it('testtextAreaOnCut0001', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testtextAreaOnCut0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testtextAreaOnCut0002 + * @tc.desic acetextAreaOnCutEtsTest0002 + */ + it('testtextAreaOnCut0002', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testtextAreaOnCut0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testtextAreaOnCut0003 + * @tc.desic acetextAreaOnCutEtsTest0003 + */ + it('testtextAreaOnCut0003', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testtextAreaOnCut0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testtextAreaOnCut0004 + * @tc.desic acetextAreaOnCutEtsTest0004 + */ + it('testtextAreaOnCut0004', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testtextAreaOnCut0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testtextAreaOnCut0005 + * @tc.desic acetextAreaOnCutEtsTest0005 + */ + it('testtextAreaOnCut0005', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testtextAreaOnCut0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testtextAreaOnCut0006 + * @tc.desic acetextAreaOnCutEtsTest0006 + */ + it('testtextAreaOnCut0006', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testtextAreaOnCut0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testtextAreaOnCut0007 + * @tc.desic acetextAreaOnCutEtsTest0007 + */ + it('testtextAreaOnCut0007', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.lineHeight).assertEqual(undefined); + console.info("[testtextAreaOnCut0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testtextAreaOnCut0009 + * @tc.desic acetextAreaOnCutEtsTest0009 + */ + it('testtextAreaOnCut0009', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.padding).assertEqual("0.00px"); + console.info("[testtextAreaOnCut0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testtextAreaOnCut0010 + * @tc.desic acetextAreaOnCutEtsTest0010 + */ + it('testtextAreaOnCut0010', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Center"); + console.info("[testtextAreaOnCut0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + + + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textInput.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textInput.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a860bd99a0109169fb5175ca73a2ac18a0fd1574 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textInput.test.ets @@ -0,0 +1,201 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function textInputOnEditChangeJsunit() { + describe('textInputOnEditChangeTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/textInput', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get textInput state success " + JSON.stringify(pages)); + if (!("textInput" == pages.name)) { + console.info("get textInput state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push textInput page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push textInput page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("textInputOnEditChange after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testtextInputOnEditChange0001 + * @tc.desic acetextInputOnEditChangeEtsTest0001 + */ + it('testtextInputOnEditChange0001', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testtextInputOnEditChange0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testtextInputOnEditChange0002 + * @tc.desic acetextInputOnEditChangeEtsTest0002 + */ + it('testtextInputOnEditChange0002', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testtextInputOnEditChange0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testtextInputOnEditChange0003 + * @tc.desic acetextInputOnEditChangeEtsTest0003 + */ + it('testtextInputOnEditChange0003', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testtextInputOnEditChange0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testtextInputOnEditChange0004 + * @tc.desic acetextInputOnEditChangeEtsTest0004 + */ + it('testtextInputOnEditChange0004', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testtextInputOnEditChange0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testtextInputOnEditChange0005 + * @tc.desic acetextInputOnEditChangeEtsTest0005 + */ + it('testtextInputOnEditChange0005', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testtextInputOnEditChange0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testtextInputOnEditChange0006 + * @tc.desic acetextInputOnEditChangeEtsTest0006 + */ + it('testtextInputOnEditChange0006', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testtextInputOnEditChange0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testtextInputOnEditChange0007 + * @tc.desic acetextInputOnEditChangeEtsTest0007 + */ + it('testtextInputOnEditChange0007', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.lineHeight).assertEqual(undefined); + console.info("[testtextInputOnEditChange0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testtextInputOnEditChange0009 + * @tc.desic acetextInputOnEditChangeEtsTest0009 + */ + it('testtextInputOnEditChange0009', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.padding).assertEqual("0.00px"); + console.info("[testtextInputOnEditChange0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testtextInputOnEditChange0010 + * @tc.desic acetextInputOnEditChangeEtsTest0010 + */ + it('testtextInputOnEditChange0010', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.textAlign).assertEqual(undefined); + console.info("[testtextInputOnEditChange0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textPicker.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textPicker.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..da74d1508c3d727e071c1e961f49a8408d063d78 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textPicker.test.ets @@ -0,0 +1,201 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function textPickerDefaultPickerItemHeightJsunit() { + describe('textPickerDefaultPickerItemHeightTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/textPicker', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get textPicker state success " + JSON.stringify(pages)); + if (!("textPicker" == pages.name)) { + console.info("get textPicker state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push textPicker page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push textPicker page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("textPickerDefaultPickerItemHeight after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testtextPickerDefaultPickerItemHeight0001 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0001 + */ + it('testtextPickerDefaultPickerItemHeight0001', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.width).assertEqual("-"); + console.info("[testtextPickerDefaultPickerItemHeight0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testtextPickerDefaultPickerItemHeight0002 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0002 + */ + it('testtextPickerDefaultPickerItemHeight0002', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.height).assertEqual("-"); + console.info("[testtextPickerDefaultPickerItemHeight0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testtextPickerDefaultPickerItemHeight0003 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0003 + */ + it('testtextPickerDefaultPickerItemHeight0003', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.fontSize).assertEqual(undefined); + console.info("[testtextPickerDefaultPickerItemHeight0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testtextPickerDefaultPickerItemHeight0004 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0004 + */ + it('testtextPickerDefaultPickerItemHeight0004', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testtextPickerDefaultPickerItemHeight0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testtextPickerDefaultPickerItemHeight0005 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0005 + */ + it('testtextPickerDefaultPickerItemHeight0005', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.align).assertEqual("Alignment.Center"); + console.info("[testtextPickerDefaultPickerItemHeight0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testtextPickerDefaultPickerItemHeight0006 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0006 + */ + it('testtextPickerDefaultPickerItemHeight0006', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.fontColor).assertEqual(undefined); + console.info("[testtextPickerDefaultPickerItemHeight0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testtextPickerDefaultPickerItemHeight0007 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0007 + */ + it('testtextPickerDefaultPickerItemHeight0007', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.lineHeight).assertEqual(undefined); + console.info("[testtextPickerDefaultPickerItemHeight0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testtextPickerDefaultPickerItemHeight0009 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0009 + */ + it('testtextPickerDefaultPickerItemHeight0009', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.padding).assertEqual("0.00px"); + console.info("[testtextPickerDefaultPickerItemHeight0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testtextPickerDefaultPickerItemHeight0010 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0010 + */ + it('testtextPickerDefaultPickerItemHeight0010', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.textAlign).assertEqual(undefined); + console.info("[testtextPickerDefaultPickerItemHeight0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/video.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/video.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..85ae48faaf816faa7f09a833ec450c8b267624c3 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/video.test.ets @@ -0,0 +1,201 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function videoOnFullscreenChangeJsunit() { + describe('videoOnFullscreenChangeTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/video', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get video state success " + JSON.stringify(pages)); + if (!("video" == pages.name)) { + console.info("get video state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push video page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push video page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("videoOnFullscreenChange after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testvideoOnFullscreenChange0001 + * @tc.desic acevideoOnFullscreenChangeEtsTest0001 + */ + it('testvideoOnFullscreenChange0001', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.width).assertEqual("600.00vp"); + console.info("[testvideoOnFullscreenChange0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testvideoOnFullscreenChange0002 + * @tc.desic acevideoOnFullscreenChangeEtsTest0002 + */ + it('testvideoOnFullscreenChange0002', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.height).assertEqual("400.00vp"); + console.info("[testvideoOnFullscreenChange0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testvideoOnFullscreenChange0003 + * @tc.desic acevideoOnFullscreenChangeEtsTest0003 + */ + it('testvideoOnFullscreenChange0003', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.fontSize).assertEqual(undefined); + console.info("[testvideoOnFullscreenChange0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testvideoOnFullscreenChange0004 + * @tc.desic acevideoOnFullscreenChangeEtsTest0004 + */ + it('testvideoOnFullscreenChange0004', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testvideoOnFullscreenChange0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testvideoOnFullscreenChange0005 + * @tc.desic acevideoOnFullscreenChangeEtsTest0005 + */ + it('testvideoOnFullscreenChange0005', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.align).assertEqual("Alignment.Center"); + console.info("[testvideoOnFullscreenChange0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testvideoOnFullscreenChange0006 + * @tc.desic acevideoOnFullscreenChangeEtsTest0006 + */ + it('testvideoOnFullscreenChange0006', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.fontColor).assertEqual(undefined); + console.info("[testvideoOnFullscreenChange0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testvideoOnFullscreenChange0007 + * @tc.desic acevideoOnFullscreenChangeEtsTest0007 + */ + it('testvideoOnFullscreenChange0007', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.lineHeight).assertEqual(undefined); + console.info("[testvideoOnFullscreenChange0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testvideoOnFullscreenChange0009 + * @tc.desic acevideoOnFullscreenChangeEtsTest0009 + */ + it('testvideoOnFullscreenChange0009', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.padding).assertEqual("0.00px"); + console.info("[testvideoOnFullscreenChange0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testvideoOnFullscreenChange0010 + * @tc.desic acevideoOnFullscreenChangeEtsTest0010 + */ + it('testvideoOnFullscreenChange0010', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.textAlign).assertEqual(undefined); + console.info("[testvideoOnFullscreenChange0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/SpanJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/SpanJsunit.test.ets index 07b836bb7407c5f7058e5e4cf3cdc9ecb0b9c7d4..0447b70f2cf15dcb0c8997e16036f922ebea6bfd 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/SpanJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/SpanJsunit.test.ets @@ -231,7 +231,7 @@ export default function spanJsunit() { console.info("[testSpan009] component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("[testSpan009] fontColor:" + obj); - expect(obj.$attrs.fontColor).assertEqual('#FFFFFFFF'); + expect(obj.$attrs.fontColor).assertEqual('#FF000000'); done(); }); }) diff --git a/arkui/ace_ets_web_dev_two/AppScope/app.json b/arkui/ace_ets_web_dev_two/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a76ab24e0556f48bfbce8e0200a07fff24b0bd08 --- /dev/null +++ b/arkui/ace_ets_web_dev_two/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.open.harmony.acewebtwotest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon": "$media:icon", + "label": "$string:app_name", + "description": "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_web_dev_two/AppScope/resources/base/element/string.json b/arkui/ace_ets_web_dev_two/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ee69f9a861d9dc269ed6638735d52674583498e1 --- /dev/null +++ b/arkui/ace_ets_web_dev_two/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"ohosProject" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_web_dev_two/AppScope/resources/base/media/app_icon.png b/arkui/ace_ets_web_dev_two/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/arkui/ace_ets_web_dev_two/AppScope/resources/base/media/app_icon.png differ diff --git a/arkui/ace_ets_web_dev_two/BUILD.gn b/arkui/ace_ets_web_dev_two/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..27fcae480e40ec0b1ae6ee824963ae3f9647b0a8 --- /dev/null +++ b/arkui/ace_ets_web_dev_two/BUILD.gn @@ -0,0 +1,41 @@ +# 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") + +ohos_js_hap_suite("ActsAceWebDevTwoTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":ace_ets_web_dev_js_assets", + ":ace_ets_web_dev_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAceWebDevTwoTest" +} + +ohos_app_scope("ace_ets_web_dev_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("ace_ets_web_dev_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("ace_ets_web_dev_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":ace_ets_web_dev_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/arkui/ace_ets_web_dev_two/Test.json b/arkui/ace_ets_web_dev_two/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..f66e3d0874f68ab69efdeeec4c8653ed422d3ea9 --- /dev/null +++ b/arkui/ace_ets_web_dev_two/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.open.harmony.acewebtwotest", + "module-name": "phone", + "shell-timeout": "600000", + "testcase-timeout": 70000 + }, + "kits": [{ + "test-file-name": [ + "ActsAceWebDevTwoTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }] +} \ No newline at end of file diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/ets/Application/AbilityStage.ts b/arkui/ace_ets_web_dev_two/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e3fdadfebeeeb676df2ce8f78f4b59e26fae9cf0 --- /dev/null +++ b/arkui/ace_ets_web_dev_two/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,9 @@ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + globalThis.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/MainAbility.ts b/arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..59523bc6f264d3bd1e38c03be90358e12f7f5c28 --- /dev/null +++ b/arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,37 @@ +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want,launchParam){ + // Ability is creating, initialize resources for this ability + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate windowStage="+ windowStage) + globalThis.windowStage = windowStage + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "MainAbility/pages/web", null) + } + + onWindowStageDestroy() { + //Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/pages/web.ets b/arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/pages/web.ets new file mode 100644 index 0000000000000000000000000000000000000000..3d230c7467b182c9a7028ec7f5a6fc832b0b4338 --- /dev/null +++ b/arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/pages/web.ets @@ -0,0 +1,256 @@ +/* + * 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 events_emitter from '@ohos.events.emitter'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../../test/List.test'; +import Utils from '../../test/Utils'; +import web_webview from '@ohos.web.webview'; + +let loadedUrl; +@Entry +@Component +struct Index { + controller:WebController = new WebController() + responseweb: WebResourceResponse = new WebResourceResponse() + @State str:string="emitStoreWebArchive" + @State text:string="" + @State textRatio:number=100 + @State zoomAccessValue:boolean=true + host: string = "www.spincast.org" + realm: string = "protected example" + username_password: string[] + origin: string="file:///" + onPageShow(){ + let valueChangeEvent={ + eventId:10, + priority:events_emitter.EventPriority.LOW + } + events_emitter.on(valueChangeEvent,this.valueChangeCallBack) + } + private valueChangeCallBack=(eventData)=>{ + console.info("web page valueChangeCallBack"); + if(eventData != null){ + console.info("valueChangeCallBack:"+ JSON.stringify(eventData)); + if(eventData.data.ACTION != null){ + this.str = eventData.data.ACTION; + } + } + } + private jsObj={ + test:(res)=>{ + Utils.emitEvent(res,102); + }, + toString:(str)=>{ + console.info("ets toString:"+String(str)); + }, + register:(res)=>{ + Utils.emitEvent(res,86); + return "web222" + } + } + aboutToAppear(){ + let abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + let abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + build(){ + Column(){ + Web({src:$rawfile('index.html'),controller:this.controller}) + .databaseAccess(true) + .zoomAccess(this.zoomAccessValue) + .textZoomRatio(this.textRatio) + .onConsole((event) => { + let level = event.message.getMessageLevel() + let msg = event.message.getMessage() + let lineNumber = event.message.getLineNumber().toString() + let sourceId = event.message.getSourceId() + console.log("lineNumber:" + lineNumber) + setTimeout(()=>{ + Utils.emitEvent(lineNumber,420) + },3000) + setTimeout(()=>{ + Utils.emitEvent(sourceId,422) + },3000) + return false + }) + .onSearchResultReceive(ret=>{ + var searchResult = ret.activeMatchOrdinal.toString() + + ret.numberOfMatches.toString() + console.log("searchResult" + searchResult) + setTimeout(()=>{ + Utils.emitEvent(searchResult,426) + },3000) + }) + Row(){ + Button("web click").key('webcomponent').onClick(async ()=>{ + console.info("key==>"+this.str) + switch(this.str){ + case "emitStoreWebArchive":{ + let webAsyncController = new web_webview.WebAsyncController(this.controller) + webAsyncController.storeWebArchive("/data/storage/el2/base/",true,(filename) => { + if(filename != null) { + Utils.emitEvent(filename,400) + } + }) + break; + } + case "emitAllowGeolocation":{ + web_webview.GeolocationPermissions.allowGeolocation("file:///") + web_webview.GeolocationPermissions.getAccessibleGeolocation(this.origin, (error, result) => { + if (error) { + console.log('error:' + JSON.stringify(error)); + this.text = this.origin + ",error ," + JSON.stringify(error); + return; + } + this.text = this.origin + ", result: " + result; + Utils.emitEvent(this.text,402) + }) + break; + } + case "emitDeleteGeolocation":{ + web_webview.GeolocationPermissions.deleteGeolocation("file:///") + web_webview.GeolocationPermissions.getStoredGeolocation((error,origins) => { + if (error) { + console.log('error:' + JSON.stringify(error)); + this.text = origins + ",error ," + JSON.stringify(error); + return; + } + this.text = origins.join(); + Utils.emitEvent(this.text,404) + }) + break; + } + case "emitDeleteAllGeolocation":{ + web_webview.GeolocationPermissions.allowGeolocation("file:///") + web_webview.GeolocationPermissions.deleteAllGeolocation() + web_webview.GeolocationPermissions.getStoredGeolocation((error,origins) => { + if (error) { + console.log('error:' + JSON.stringify(error)); + this.text = origins + ",error ," + JSON.stringify(error); + return; + } + this.text = origins.join(); + Utils.emitEvent(this.text,406) + }) + break; + } + case "emitIsCookieAllowed":{ + web_webview.WebCookieManager.putAcceptCookieEnabled(false); + setTimeout(()=>{ + Utils.emitEvent(web_webview.WebCookieManager.isCookieAllowed(),408) + },3000) + break; + } + case "emitSaveCookieAsync":{ + web_webview.WebCookieManager.saveCookieAsync(function(result){ + Utils.emitEvent(result,410) + }) + break; + } + case "emitIsThirdPartyCookieAllowed":{ + web_webview.WebCookieManager.putAcceptThirdPartyCookieEnabled(false); + setTimeout(()=>{ + var result = web_webview.WebCookieManager.isThirdPartyCookieAllowed(); + console.log(result.toString()); + Utils.emitEvent(web_webview.WebCookieManager.isThirdPartyCookieAllowed(),412) + },3000) + break; + } + case "emitExistCookie":{ + this.controller.getCookieManager().deleteEntireCookie(); + setTimeout(()=>{ + var result = web_webview.WebCookieManager.existCookie(); + console.log(result.toString()); + Utils.emitEvent(result,414) + },3000) + break ; + } + case "emitOnConsole":{ + this.controller.runJavaScript({script:"consoleTest()"}) + break; + } + case "emitLoaData":{ + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"}) + setTimeout(()=>{ + this.controller.loadData({ + data: "index", + mimeType: "text/html", + encoding: "UTF-8" + }) + },3000) + setTimeout(()=>{ + this.text = this.controller.getTitle(); + Utils.emitEvent(this.text,424) + },4000) + break ; + } + case "emitZoomAccess":{ + this.zoomAccessValue = false + this.controller.refresh() + var origin = this.controller.getPageHeight() + var zoomInCalled = false + setTimeout(()=>{ + this.controller.zoomIn() + if (this.controller.getPageHeight() > origin) { + zoomInCalled = true + } + console.log("final" + this.controller.getPageHeight()) + Utils.emitEvent(zoomInCalled,428); + },3000); + break ; + } + case "emitSaveHttpAuthCredentials":{ + web_webview.WebDataBase.saveHttpAuthCredentials(this.host, this.realm, "Stromgol", "Laroche"); + setTimeout(()=>{ + let result = web_webview.WebDataBase.existHttpAuthCredentials(); + Utils.emitEvent(result,442) + },3000) + break; + } + case "emitGetHttpAuthCredentials":{ + this.username_password = web_webview.WebDataBase.getHttpAuthCredentials(this.host, this.realm); + setTimeout(()=>{ + let result = this.username_password[0]; + Utils.emitEvent(result,444) + },3000) + break; + } + case "emitDeleteHttpAuthCredentials":{ + web_webview.WebDataBase.deleteHttpAuthCredentials(); + setTimeout(()=>{ + let result = web_webview.WebDataBase.existHttpAuthCredentials(); + Utils.emitEvent(result,446) + },3000) + break; + } + case "emitSearchAllAsync":{ + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"}) + setTimeout(()=>{ + this.controller.searchAllAsync("首页"); + },3000) + break ; + } + default: + console.info("can not match case") + } + }) + } + } + } +} diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/arkui/ace_ets_web_dev_two/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..a4ee2f1652b3d04ce83ece64ef70f8dfa62a2dc8 --- /dev/null +++ b/arkui/ace_ets_web_dev_two/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +/* + * 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 + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a com.example.myapplication.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_web_dev_two/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..079023dd24ba05f62f21dacf79f7077bb41b6e0d --- /dev/null +++ b/arkui/ace_ets_web_dev_two/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * 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 webJsunit from './WebJsunit.test' + +export default function testsuite() { + webJsunit() +} \ No newline at end of file diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/ets/test/Utils.ets b/arkui/ace_ets_web_dev_two/entry/src/main/ets/test/Utils.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a90ba6aedd9cd4c5662f10bd0f033f6136cb61a --- /dev/null +++ b/arkui/ace_ets_web_dev_two/entry/src/main/ets/test/Utils.ets @@ -0,0 +1,135 @@ +/* + * 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 events_emitter from '@ohos.events.emitter'; +import { expect } from "@ohos/hypium"; +export default class Utils { + static sleep(time){ + return new Promise((resolve,reject)=>{ + setTimeout(()=>{ + resolve("ok") + },time) + }).then(()=>{ + console.info(`sleep ${time} over...`) + }) + } + static registerEvent(testCaseName,expectedValue,eventId,done){ + console.info(`[${testCaseName}] START`); + try{ + let callBack=(backData)=>{ + console.info(`${testCaseName} get result is:`+JSON.stringify(backData)); + expect(backData.data.ACTION).assertEqual(expectedValue); + console.info(`[${testCaseName}] END`); + done() + } + let innerEvent = { + eventId:eventId, + priority:events_emitter.EventPriority.LOW + } + events_emitter.on(innerEvent,callBack) + }catch(err){ + console.info(`[${testCaseName}] err:`+JSON.stringify(err)); + } + } + static emitEvent(actualValue,eventId){ + try { + let backData = { + data: { + "ACTION": actualValue + } + } + let backEvent = { + eventId:eventId, + priority:events_emitter.EventPriority.LOW + } + console.info("webFlag start to emit action state"); + events_emitter.emit(backEvent, backData); + } catch (err) { + console.info("webFlag emit action state err: " + JSON.stringify(err)); + } + } + static registerEventTwo(testCaseName,eventId,done){ + console.info(`[${testCaseName}] START`); + try{ + let callBack=(backData)=>{ + console.info(`${testCaseName} get result is:`+JSON.stringify(backData)); + expect(backData.data.actualValue).assertLarger(backData.data.expectedValue-100); + expect(backData.data.actualValue).assertLess(backData.data.expectedValue-(-100)); + console.info(`[${testCaseName}] END`); + done() + } + let innerEvent = { + eventId:eventId, + priority:events_emitter.EventPriority.LOW + } + events_emitter.on(innerEvent,callBack) + }catch(err){ + console.info(`[${testCaseName}] err:`+JSON.stringify(err)); + } + } + static emitEventTwo(expectedValue,actualValue,eventId){ + try { + let backData = { + data: { + "expectedValue":expectedValue, + "actualValue":actualValue + } + } + let backEvent = { + eventId:eventId, + priority:events_emitter.EventPriority.LOW + } + console.info("webFlag start to emit action state"); + events_emitter.emit(backEvent, backData); + } catch (err) { + console.info("webFlag emit action state err: " + JSON.stringify(err)); + } + } + static registerContainEvent(testCaseName,expectedValue,eventId,done){ + console.info(`[${testCaseName}] START`); + try{ + let callBack=(backData)=>{ + console.info(`${testCaseName} get result is:`+JSON.stringify(backData)); + expect(backData.data.ACTION).assertContain(expectedValue); + console.info(`[${testCaseName}] END`); + done() + } + let innerEvent = { + eventId:eventId, + priority:events_emitter.EventPriority.LOW + } + events_emitter.on(innerEvent,callBack) + }catch(err){ + console.info(`[${testCaseName}] err:`+JSON.stringify(err)); + } + } + static commitKey(emitKey){ + try { + let backData = { + data: { + "ACTION": emitKey + } + } + let backEvent = { + eventId:10, + priority:events_emitter.EventPriority.LOW + } + console.info("start send emitKey"); + events_emitter.emit(backEvent, backData); + } catch (err) { + console.info("emit emitKey err: " + JSON.stringify(err)); + } + } +} diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/ets/test/WebJsunit.test.ets b/arkui/ace_ets_web_dev_two/entry/src/main/ets/test/WebJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..deea6fda97ae0eaa363fc455cde30e788b6100f9 --- /dev/null +++ b/arkui/ace_ets_web_dev_two/entry/src/main/ets/test/WebJsunit.test.ets @@ -0,0 +1,208 @@ +/* + * 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. + */ +// @ts-nocheck +import { describe, beforeEach, afterEach, it, expect } from "@ohos/hypium"; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils.ets'; +let emitKey = "emitUserAgent"; +export default function webJsunit() { + describe('ActsAceWebDevTest', function () { + beforeEach(async function (done) { + await Utils.sleep(2000); + console.info("web beforeEach start"); + done(); + }) + afterEach(async function (done) { + console.info("web afterEach start:"+emitKey); + try { + let backData = { + data: { + "ACTION": emitKey + } + } + let backEvent = { + eventId:10, + priority:events_emitter.EventPriority.LOW + } + console.info("start send emitKey"); + events_emitter.emit(backEvent, backData); + } catch (err) { + console.info("emit emitKey err: " + JSON.stringify(err)); + } + await Utils.sleep(2000); + done(); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_066 + *tc.name storeWebArchive + *tc.desic Save current page + */ + it('storeWebArchive',0,async function(done){ + emitKey="emitAllowGeolocation"; + Utils.registerContainEvent("storeWebArchive","/data/storage/el2/base/",400,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_067 + *tc.name allowGeolocation + *tc.desic allow specific url to access the geolocation + */ + it('allowGeolocation',0,async function(done){ + emitKey="emitDeleteGeolocation"; + Utils.registerEvent("allowGeolocation","file:///, result: true",402,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_068 + *tc.name deleteGeolocation + *tc.desic delete specific restored geolocation + */ + it('deletGeolocation',0,async function(done){ + emitKey="emitDeleteAllGeolocation"; + Utils.registerEvent("deletGeolocation","",404,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_069 + *tc.name deletAllGeolocation + *tc.desic delete all restored geolocation + */ + it('deletAllGeolocation',0,async function(done){ + emitKey="emitIsCookieAllowed"; + Utils.registerEvent("deletAllGeolocation","",406,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_070 + *tc.name isCookieAllowed + *tc.desic return whether the cookie is allowed + */ + it('isCookieAllowed',0,async function(done){ + emitKey="emitSaveCookieAsync"; + Utils.registerEvent("isCookieAllowed",false,408,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_071 + *tc.name saveCookieAsync + *tc.desic return whether the cookie is allowed + */ + it('saveCookieAsync',0,async function(done){ + emitKey="emitIsThirdPartyCookieAllowed"; + Utils.registerEvent("saveCookieAsync",true,410,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_072 + *tc.name isThirdPartyCookieAllowed + *tc.desic return whether the third party cookie is allowed + */ + it('isThirdPartyCookieAllowed',0,async function(done){ + emitKey="emitExistCookie"; + Utils.registerEvent("isThirdPartyCookieAllowed",false,412,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_073 + *tc.name existCookie + *tc.desic return whether there exits cookie + */ + it('existCookie',0,async function(done){ + emitKey="emitOnConsole"; + Utils.registerEvent("existCookie",false,414,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_076 + *tc.name getLineNumber + *tc.desic return the number of console message lines + */ + it('getLineNumber',0,async function(done){ + emitKey="emitOnConsole"; + Utils.registerEvent("getLineNumber","51",420,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_077 + *tc.name getSourceId + *tc.desic return the source url + */ + it('getSourceId',0,async function(done){ + emitKey="emitLoaData"; + Utils.registerEvent("getSourceId","file:///data/storage/el1/bundle/phone/resources/rawfile/index.html",422,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_078 + *tc.name loadData + *tc.desic load specific strings + */ + it('loadData',0,async function(done){ + emitKey="emitZoomAccess"; + Utils.registerEvent("loadData","index",424,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_080 + *tc.name zoomAccess + *tc.desic set whether it is allowed to zoom + */ + it('zoomAccess',0,async function(done){ + emitKey="emitSaveHttpAuthCredentials"; + Utils.registerEvent("zoomAccess",false,428,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_087 + *tc.name saveHttpAuthCredentials + *tc.desic save credentials + */ + it('saveHttpAuthCredentials',0,async function(done){ + emitKey="emitGetHttpAuthCredentials"; + Utils.registerEvent("saveHttpAuthCredentials",true,442,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_088 + *tc.name getHttpAuthCredentials + *tc.desic delete credentials + */ + it('getHttpAuthCredentials',0,async function(done){ + emitKey="emitDeleteHttpAuthCredentials"; + Utils.registerEvent("getHttpAuthCredentials","Stromgol",444,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_089 + *tc.name deleteHttpAuthCredentials + *tc.desic delete credentials + */ + it('deleteHttpAuthCredentials',0,async function(done){ + emitKey="emitSearchAllAsync"; + Utils.registerEvent("deleteHttpAuthCredentials",false,446,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_079 + *tc.name searchAllAsync + *tc.desic search specific words + */ + it('searchAllAsync',0,async function(done){ + emitKey="emitSearchAllAsync"; + Utils.registerEvent("searchAllAsync","01",426,done); + sendEventByKey('webcomponent',10,''); + }) + }) +} diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/module.json b/arkui/ace_ets_web_dev_two/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..1caeca096d756373af7eff5cea74a02a2c054cd0 --- /dev/null +++ b/arkui/ace_ets_web_dev_two/entry/src/main/module.json @@ -0,0 +1,41 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "com.example.myapplication.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [{ + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + }] + }], + "requestPermissions": [ + { + "name": "ohos.permission.LOCATION" + }, + { + "name": "ohos.permission.INTERNET" + } + ] + } +} diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/resources/base/element/string.json b/arkui/ace_ets_web_dev_two/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2977b612ec4595b13eaaffe3e8fc578e83c42d48 --- /dev/null +++ b/arkui/ace_ets_web_dev_two/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsContextTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "serviceability_description", + "value": "my whether" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + } + ] +} diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/resources/base/media/icon.png b/arkui/ace_ets_web_dev_two/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/arkui/ace_ets_web_dev_two/entry/src/main/resources/base/media/icon.png differ diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/resources/base/profile/main_pages.json b/arkui/ace_ets_web_dev_two/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..accbf272408dce05ff15f78a1adf077bafc62174 --- /dev/null +++ b/arkui/ace_ets_web_dev_two/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/web" + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/extra.html b/arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/extra.html new file mode 100644 index 0000000000000000000000000000000000000000..cefc3262907470c309ab76c57114eaf91ff95a9f --- /dev/null +++ b/arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/extra.html @@ -0,0 +1,7 @@ + + + +
+

This is a link

+ + \ No newline at end of file diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/icon.png b/arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/icon.png differ diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/index.html b/arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/index.html new file mode 100644 index 0000000000000000000000000000000000000000..bd56a8209695b0732a480ccf0b5ed2eced1ae3ab --- /dev/null +++ b/arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/index.html @@ -0,0 +1,70 @@ + + + + + + + index + + + +
首页
+
+ 打开rawfile文件 + icon + + + diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/second.html b/arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/second.html new file mode 100644 index 0000000000000000000000000000000000000000..3017554b2ab0ca8725fd3acf1711c6d9b6aab02b --- /dev/null +++ b/arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/second.html @@ -0,0 +1,12 @@ + + + + + + + second + + +
second pages
+ + \ No newline at end of file diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/webstorage.html b/arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/webstorage.html new file mode 100644 index 0000000000000000000000000000000000000000..397ebc4118ebf6a48c31c9a60174b9cebdfed13a --- /dev/null +++ b/arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/webstorage.html @@ -0,0 +1,39 @@ + + + + + + + + + +
状态信息
+ + + \ No newline at end of file diff --git a/arkui/ace_ets_web_dev_two/signature/openharmony_sx.p7b b/arkui/ace_ets_web_dev_two/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/arkui/ace_ets_web_dev_two/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibilityextensioncontext/entry/src/main/ets/AccessibilityExtAbility/ExtensionContextTest.ts b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/AccessibilityExtAbility/ExtensionContextTest.ts index 2408768b5e91292fd82f9fb7b20f71a5a18ec77d..5e52d0690df45e10a44b53dc23eae1fa5baafc2a 100644 --- a/barrierfree/accessibilityextensioncontext/entry/src/main/ets/AccessibilityExtAbility/ExtensionContextTest.ts +++ b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/AccessibilityExtAbility/ExtensionContextTest.ts @@ -138,46 +138,22 @@ export class ExtensionContextTest { displayId = -1; this.getWindowsByIdPromise(caseName, displayId); break; - case 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3500': - await this.setAccessibilityFocus(); - this.getFocusElementCallback(caseName, true); - break; - case 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3600': - await this.clearAccessibilityFocus(); - this.getFocusElementCallback(caseName, false); - break; case 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3700': await this.setAccessibilityFocus(); this.getFocusElementByTypeCallback(caseName, true, true); break; - case 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3800': - await this.setAccessibilityFocus(); - this.getFocusElementByTypeCallback(caseName, true, false); - break; case 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3900': await this.clearAccessibilityFocus(); this.getFocusElementByTypeCallback(caseName, false, true); break; - case 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_4000': - await this.clearAccessibilityFocus(); - this.getFocusElementByTypeCallback(caseName, false, false); - break; case 'AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4100': await this.setAccessibilityFocus(); this.getFocusElementByTypePromise(caseName, true, true); break; - case 'AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4200': - await this.setAccessibilityFocus(); - this.getFocusElementByTypePromise(caseName, true, false); - break; case 'AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4300': await this.clearAccessibilityFocus(); this.getFocusElementByTypePromise(caseName, false, true); break; - case 'AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4400': - await this.clearAccessibilityFocus(); - this.getFocusElementByTypePromise(caseName, false, false); - break; case 'AccessibilityExtensionContextTest_gestureInject_asyncCallback_4500': gesturePos1 = {positionX: 10, positionY: 10}; gesturePath = {points: [gesturePos1], durationTime: 100}; diff --git a/barrierfree/accessibilityextensioncontext/entry/src/main/ets/test/AccessibilityExtensionContext.test.ets b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/test/AccessibilityExtensionContext.test.ets index 7b132331a8cae679ad52e0f3491958c094c88ce1..9984f0498fa0c6959b239b2236e07ef2d04c0f18 100644 --- a/barrierfree/accessibilityextensioncontext/entry/src/main/ets/test/AccessibilityExtensionContext.test.ets +++ b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/test/AccessibilityExtensionContext.test.ets @@ -751,73 +751,6 @@ export default function abilityTest() { } }) - /* - * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3500 - * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3500 - * @tc.desc The parameter input is null, test the getFocusElement() function, - * The result of getFocusElement() should be AccessibilityElement type. - * @tc.size SmallTest - * @tc.type User - */ - it('AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3500', 0, async function (done) { - let caseName = 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3500'; - console.info(caseName + 'start'); - - if (isConnect) { - publishCaseExecute(caseName); - - setTimeout(() => { - if (caseResult != undefined) { - console.info(caseName + ':' + caseResult.data); - expect(passStr).assertEqual(caseResult.data); - expect(caseName).assertEqual(caseResult.parameters.case); - } else { - console.info(caseName + ': caseResult is undefined'); - expect(null).assertFail(); - } - done(); - }, 5500); - } else { - console.error(caseName + ': extension not connected'); - expect(null).assertFail(); - done(); - } - }) - - /* - * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3600 - * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3600 - * @tc.desc The parameter input is null, test the getFocusElement() function, - * The result of getFocusElement() should be AccessibilityElement type. - * @tc.size SmallTest - * @tc.type User - */ - it('AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3600', 0, async function (done) { - let caseName = 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3600'; - console.info(caseName + 'start'); - - if (isConnect) { - publishCaseExecute(caseName); - - setTimeout(() => { - if (caseResult != undefined) { - console.info(caseName + ':' + caseResult.data); - expect(passStr).assertEqual(caseResult.data); - expect(caseName).assertEqual(caseResult.parameters.case); - } else { - console.info(caseName + ': caseResult is undefined'); - expect(null).assertFail(); - } - done(); - }, 5500); - } else { - console.error(caseName + ': extension not connected'); - expect(null).assertFail(); - done(); - } - }) - - /* * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3700 * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3700 @@ -851,39 +784,6 @@ export default function abilityTest() { } }) - /* - * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3800 - * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3800 - * @tc.desc The parameter input is false, test the getFocusElement() function, - * The result of getFocusElement() should be AccessibilityElement type. - * @tc.size SmallTest - * @tc.type User - */ - it('AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3800', 0, async function (done) { - let caseName = 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3800'; - console.info(caseName + 'start'); - - if (isConnect) { - publishCaseExecute(caseName); - - setTimeout(() => { - if (caseResult != undefined) { - console.info(caseName + ':' + caseResult.data); - expect(passStr).assertEqual(caseResult.data); - expect(caseName).assertEqual(caseResult.parameters.case); - } else { - console.info(caseName + ': caseResult is undefined'); - expect(null).assertFail(); - } - done(); - }, 5500); - } else { - console.error(caseName + ': extension not connected'); - expect(null).assertFail(); - done(); - } - }) - /* * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3900 * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3900 @@ -917,39 +817,6 @@ export default function abilityTest() { } }) - /* - * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncCallback_4000 - * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncCallback_4000 - * @tc.desc The parameter input is false, test the getFocusElement() function, - * The result of getFocusElement() should be AccessibilityElement type. - * @tc.size SmallTest - * @tc.type User - */ - it('AccessibilityExtensionContextTest_getFocusElement_asyncCallback_4000', 0, async function (done) { - let caseName = 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_4000'; - console.info(caseName + 'start'); - - if (isConnect) { - publishCaseExecute(caseName); - - setTimeout(() => { - if (caseResult != undefined) { - console.info(caseName + ':' + caseResult.data); - expect(passStr).assertEqual(caseResult.data); - expect(caseName).assertEqual(caseResult.parameters.case); - } else { - console.info(caseName + ': caseResult is undefined'); - expect(null).assertFail(); - } - done(); - }, 5500); - } else { - console.error(caseName + ': extension not connected'); - expect(null).assertFail(); - done(); - } - }) - /* * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4100 * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4100 @@ -983,40 +850,6 @@ export default function abilityTest() { } }) - - /* - * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4200 - * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4200 - * @tc.desc The parameter input is false, test the getFocusElement() function, - * The result of getFocusElement() should be AccessibilityElement type. - * @tc.size SmallTest - * @tc.type User - */ - it('AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4200', 0, async function (done) { - let caseName = 'AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4200'; - console.info(caseName + 'start'); - - if (isConnect) { - publishCaseExecute(caseName); - - setTimeout(() => { - if (caseResult != undefined) { - console.info(caseName + ':' + caseResult.data); - expect(passStr).assertEqual(caseResult.data); - expect(caseName).assertEqual(caseResult.parameters.case); - } else { - console.info(caseName + ': caseResult is undefined'); - expect(null).assertFail(); - } - done(); - }, 5500); - } else { - console.error(caseName + ': extension not connected'); - expect(null).assertFail(); - done(); - } - }) - /* * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4300 * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4300 @@ -1050,39 +883,6 @@ export default function abilityTest() { } }) - /* - * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4400 - * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4400 - * @tc.desc The parameter input is false, test the getFocusElement() function, - * The result of getFocusElement() should be AccessibilityElement type. - * @tc.size SmallTest - * @tc.type User - */ - it('AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4400', 0, async function (done) { - let caseName = 'AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4400'; - console.info(caseName + 'start'); - - if (isConnect) { - publishCaseExecute(caseName); - - setTimeout(() => { - if (caseResult != undefined) { - console.info(caseName + ':' + caseResult.data); - expect(passStr).assertEqual(caseResult.data); - expect(caseName).assertEqual(caseResult.parameters.case); - } else { - console.info(caseName + ': caseResult is undefined'); - expect(null).assertFail(); - } - done(); - }, 5500); - } else { - console.error(caseName + ': extension not connected'); - expect(null).assertFail(); - done(); - } - }) - /* * @tc.number AccessibilityExtensionContextTest_gestureInject_asyncCallback_4500 * @tc.name AccessibilityExtensionContextTest_gestureInject_asyncCallback_4500 diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/test/ActsBmsAccessTokenTest.test.js b/bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/test/ActsBmsAccessTokenTest.test.js index e43327dd8a38a8768b4a043a1af34e6076be604e..024b465e5dc7ff7946722181d3a7902d563e911d 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/test/ActsBmsAccessTokenTest.test.js +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/test/ActsBmsAccessTokenTest.test.js @@ -37,11 +37,11 @@ describe('ActsBmsAccessTokenTest', function () { }); /* - * @tc.number: bms_AccessTokenId_0100 - * @tc.name: test accessTokenId + * @tc.number: BMS_SECURITY_INITIALIZE_0004 + * @tc.name: getAccessTokenIdOfEntry * @tc.desc: get the accessTokenId */ - it('bms_AccessTokenId_0100', 0, async function (done) { + it('getAccessTokenIdOfEntry', 0, async function (done) { await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_DEFAULT, userId) .then(applicationInfo => { console.info('accessTokenId: ' + applicationInfo.accessTokenId); @@ -55,11 +55,11 @@ describe('ActsBmsAccessTokenTest', function () { }); /* - * @tc.number: bms_AccessTokenId_0200 - * @tc.name: test reqPermissionStates + * @tc.number: SUB_BMS_APPINFO_QUERYPERMISSION_0001 + * @tc.name: getReqPermissionOfEntry * @tc.desc: get the reqPermissions and reqPermissionStates */ - it('bms_AccessTokenId_0200', 0, async function (done) { + it('getReqPermissionOfEntry', 0, async function (done) { await bundle.getBundleInfo(BUNDLE_NAME3, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION) .then(bundleInfo => { expect(bundleInfo.name).assertEqual(BUNDLE_NAME3); @@ -79,11 +79,11 @@ describe('ActsBmsAccessTokenTest', function () { }); /* - * @tc.number: bms_AccessTokenId_0300 - * @tc.name: test reqPermissionStates + * @tc.number: SUB_BMS_APPINFO_QUERYPERMISSION_0008 + * @tc.name: getReqPermissionUpdateEntry * @tc.desc: get the reqPermissions and reqPermissionStates */ - it('bms_AccessTokenId_0300', 0, async function (done) { + it('getReqPermissionUpdateEntry', 0, async function (done) { await bundle.getBundleInfo(BUNDLE_NAME2, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION) .then(bundleInfo => { expect(bundleInfo.name).assertEqual(BUNDLE_NAME2); @@ -107,11 +107,11 @@ describe('ActsBmsAccessTokenTest', function () { }); /* - * @tc.number: bms_AccessTokenId_0400 - * @tc.name: test reqPermissionStates + * @tc.number: SUB_BMS_APPINFO_QUERYPERMISSION_0003 + * @tc.name: getReqPermissionUpdateEntryAndFeature * @tc.desc: get the reqPermissions and reqPermissionStates */ - it('bms_AccessTokenId_0400', 0, async function (done) { + it('getReqPermissionUpdateEntryAndFeature', 0, async function (done) { await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION) .then(bundleInfo => { expect(bundleInfo.name).assertEqual(BUNDLE_NAME1); @@ -137,14 +137,14 @@ describe('ActsBmsAccessTokenTest', function () { }); /** - * @tc.number bms_AccessTokenId_0500 - * @tc.name BUNDLE::getBundleInfos + * @tc.number BMS_SECURITY_INITIALIZE_0013 + * @tc.name getAccessTokenIdWithDefault * @tc.desc Test getBundleInfos interfaces with with a flag */ - it("bms_AccessTokenId_0500", 0, async function (done) { + it("getAccessTokenIdWithDefault", 0, async function (done) { await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_DEFAULT) .then((applicationInfo) => { - console.info("bms_AccessTokenId_0500 accessTokenId: " + applicationInfo.accessTokenId); + console.info("getAccessTokenIdWithDefault accessTokenId: " + applicationInfo.accessTokenId); expect(applicationInfo.name).assertEqual(BUNDLE_NAME1); expect(applicationInfo.accessTokenId).assertLarger(0); done(); @@ -155,14 +155,14 @@ describe('ActsBmsAccessTokenTest', function () { }); /** - * @tc.number bms_AccessTokenId_0600 - * @tc.name BUNDLE::getBundleInfos + * @tc.number BMS_SECURITY_INITIALIZE_0014 + * @tc.name getAccessTokenIdWithGetAbilities * @tc.desc Test getBundleInfos interfaces with a flag */ - it("bms_AccessTokenId_0600", 0, async function (done) { + it("getAccessTokenIdWithGetAbilities", 0, async function (done) { await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES) .then((applicationInfo) => { - console.info("bms_AccessTokenId_0600 accessTokenId: " + applicationInfo.accessTokenId); + console.info("getAccessTokenIdWithGetAbilities accessTokenId: " + applicationInfo.accessTokenId); expect(applicationInfo.name).assertEqual(BUNDLE_NAME1); expect(applicationInfo.accessTokenId).assertLarger(0); done(); @@ -173,14 +173,14 @@ describe('ActsBmsAccessTokenTest', function () { }); /** - * @tc.number bms_AccessTokenId_0700 - * @tc.name BUNDLE::getBundleInfos + * @tc.number BMS_SECURITY_INITIALIZE_0015 + * @tc.name getAccessTokenIdWithGetPermission * @tc.desc Test getBundleInfos interfaces with a flag */ - it("bms_AccessTokenId_0700", 0, async function (done) { + it("getAccessTokenIdWithGetPermission", 0, async function (done) { await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION) .then((applicationInfo) => { - console.info("bms_AccessTokenId_0700 accessTokenId: " + applicationInfo.accessTokenId); + console.info("getAccessTokenIdWithGetPermission accessTokenId: " + applicationInfo.accessTokenId); expect(applicationInfo.name).assertEqual(BUNDLE_NAME1); expect(applicationInfo.accessTokenId).assertLarger(0); done(); diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/ets/test/ActsBmsEtsModuleNameTest.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/ets/test/ActsBmsEtsModuleNameTest.test.ets index c9c53e02e64c83c4756f01180de2432a57977804..25556553579cb8866b5b01991d96d52ad8f6a6c0 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/ets/test/ActsBmsEtsModuleNameTest.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/ets/test/ActsBmsEtsModuleNameTest.test.ets @@ -66,335 +66,335 @@ export default function actsBmsJsModuleNameTest() { }); /* - * @tc.number: GetabilityInfo_0100 - * @tc.name: test getAbilityInfo + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0030 + * @tc.name: getAbilityInfoEmptyModule * @tc.desc: test empty moduleName */ - it('GetabilityInfo_0100', 0, async function (done) { + it('getAbilityInfoEmptyModule', 0, async function (done) { await bundle.getAbilityInfo(BUNDLE_NAME, MODULE_NAME1, ABILITY_NAME) .then(data => { expect(data).assertFail(); }).catch((err) => { - console.error('[GetabilityInfo_0100]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[getAbilityInfoEmptyModule]Operation failed. Err: ' + JSON.stringify(err)); expect(err).assertEqual(INVALID_CODE); }); bundle.getAbilityInfo(BUNDLE_NAME, MODULE_NAME1, ABILITY_NAME, (err, data) => { expect(err).assertEqual(INVALID_CODE); if (err) { - console.error('[GetabilityInfo_0100]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[getAbilityInfoEmptyModule]Operation failed. Err: ' + JSON.stringify(err)); } - console.info("'[GetabilityInfo_0100]Return data: " + JSON.stringify(data)); + console.info("'[getAbilityInfoEmptyModule]Return data: " + JSON.stringify(data)); done(); }); }); /* - * @tc.number: GetabilityInfo_0200 - * @tc.name: test getAbilityInfo + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0020 + * @tc.name: getAbilityInfoInvalidModule * @tc.desc: test non-existent moduleName */ - it('GetabilityInfo_0200', 0, async function (done) { + it('getAbilityInfoInvalidModule', 0, async function (done) { await bundle.getAbilityInfo(BUNDLE_NAME, MODULE_NAME2, ABILITY_NAME) .then(data => { expect(data).assertFail(); }).catch((err) => { - console.error('[GetabilityInfo_0200]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[getAbilityInfoInvalidModule]Operation failed. Err: ' + JSON.stringify(err)); expect(err).assertEqual(INVALID_CODE); }); bundle.getAbilityInfo(BUNDLE_NAME, MODULE_NAME2, ABILITY_NAME, (err, data) => { expect(err).assertEqual(INVALID_CODE); if (err) { - console.error('[GetabilityInfo_0200]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[getAbilityInfoInvalidModule]Operation failed. Err: ' + JSON.stringify(err)); } - console.info("'[GetabilityInfo_0200]Return data : " + JSON.stringify(data)); + console.info("'[getAbilityInfoInvalidModule]Return data : " + JSON.stringify(data)); done(); }); }); /* - * @tc.number: GetabilityInfo_0300 - * @tc.name: test getAbilityInfo + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0018 + * @tc.name: getAbilityInfoHasModule * @tc.desc: test existent moduleName */ - it('GetabilityInfo_0300', 0, async function (done) { + it('getAbilityInfoHasModule', 0, async function (done) { await bundle.getAbilityInfo(BUNDLE_NAME, MODULE_NAME3, ABILITY_NAME) .then(data => { - console.info('[GetabilityInfo_0300]Return data successful: ' + JSON.stringify(data)); + console.info('[getAbilityInfoHasModule]Return data successful: ' + JSON.stringify(data)); checkDataInfo(data); }).catch((err) => { - console.error('[GetabilityInfo_0300]Operation . Err: ' + JSON.stringify(err)); + console.error('[getAbilityInfoHasModule]Operation . Err: ' + JSON.stringify(err)); expect(err).assertFail(); }); bundle.getAbilityInfo(BUNDLE_NAME, MODULE_NAME3, ABILITY_NAME, (err, data) => { checkDataInfo(data); expect(err).assertEqual(SUCCESS_CODE); if (err) { - console.error('[GetabilityInfo_0300]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[getAbilityInfoHasModule]Operation failed. Err: ' + JSON.stringify(err)); } - console.info("'[GetabilityInfo_0300]Return data: " + JSON.stringify(data)); + console.info("'[getAbilityInfoHasModule]Return data: " + JSON.stringify(data)); done(); }); }); /* - * @tc.number: GetAbilityIcon_0100 - * @tc.name: test getAbilityIcon + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0031 + * @tc.name: getAbilityIconEmptyModule * @tc.desc: test empty moduleName */ - it('GetAbilityIcon_0100', 0, async function (done) { + it('getAbilityIconEmptyModule', 0, async function (done) { await bundle.getAbilityIcon(BUNDLE_NAME, MODULE_NAME1, ABILITY_NAME) .then(data => { expect(data).assertFail(); }).catch((err) => { - console.error('[GetAbilityIcon_0100]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[getAbilityIconEmptyModule]Operation failed. Err: ' + JSON.stringify(err)); expect(err).assertEqual(INVALID_CODE); }); bundle.getAbilityIcon(BUNDLE_NAME, MODULE_NAME1, ABILITY_NAME, (err, data) => { expect(err).assertEqual(INVALID_CODE); if (err) { - console.error('[GetAbilityIcon_0100]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[getAbilityIconEmptyModule]Operation failed. Err: ' + JSON.stringify(err)); } - console.info("'[GetAbilityIcon_0100]Return data: " + JSON.stringify(data)); + console.info("'[getAbilityIconEmptyModule]Return data: " + JSON.stringify(data)); done(); }); }); /* - * @tc.number: GetAbilityIcon_0200 - * @tc.name: test getAbilityIcon + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0028 + * @tc.name: getAbilityIconInvalidModule * @tc.desc: test non-existent moduleName */ - it('GetAbilityIcon_0200', 0, async function (done) { + it('getAbilityIconInvalidModule', 0, async function (done) { await bundle.getAbilityIcon(BUNDLE_NAME, MODULE_NAME2, ABILITY_NAME) .then(data => { expect(data).assertFail(); }).catch((err) => { - console.error('[GetAbilityIcon_0200]Operation successful. Err: ' + JSON.stringify(err)); + console.error('[getAbilityIconInvalidModule]Operation successful. Err: ' + JSON.stringify(err)); expect(err).assertEqual(INVALID_CODE); }); bundle.getAbilityIcon(BUNDLE_NAME, MODULE_NAME2, ABILITY_NAME, (err, data) => { expect(err).assertEqual(INVALID_CODE); if (err) { - console.error('[GetAbilityIcon_0200]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[getAbilityIconInvalidModule]Operation failed. Err: ' + JSON.stringify(err)); } - console.info("'[GetAbilityIcon_0200]Return data: " + JSON.stringify(data)); + console.info("'[getAbilityIconInvalidModule]Return data: " + JSON.stringify(data)); done(); }); }); /* - * @tc.number: GetAbilityIcon_0300 - * @tc.name: test getAbilityIcon + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0026 + * @tc.name: getAbilityIconHasModule * @tc.desc: test existent moduleName */ - it('GetAbilityIcon_0300', 0, async function (done) { + it('getAbilityIconHasModule', 0, async function (done) { await bundle.getAbilityIcon(BUNDLE_NAME, MODULE_NAME3, ABILITY_NAME) .then(data => { - console.info('[GetAbilityIcon_0300]Return data successful: ' + JSON.stringify(data)); + console.info('[getAbilityIconHasModule]Return data successful: ' + JSON.stringify(data)); expect(data.getBytesNumberPerRow()).assertLarger(0); }).catch((err) => { - console.error('[GetAbilityIcon_0300]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[getAbilityIconHasModule]Operation failed. Err: ' + JSON.stringify(err)); expect(err).assertFail(); }); bundle.getAbilityIcon(BUNDLE_NAME, MODULE_NAME3, ABILITY_NAME, (err, data) => { expect(err).assertEqual(SUCCESS_CODE); expect(data.getBytesNumberPerRow()).assertLarger(0); if (err) { - console.error('[GetAbilityIcon_0300]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[getAbilityIconHasModule]Operation failed. Err: ' + JSON.stringify(err)); } - console.info("'[GetAbilityIcon_0300]Return data: " + JSON.stringify(data)); + console.info("'[getAbilityIconHasModule]Return data: " + JSON.stringify(data)); done(); }); }); /* - * @tc.number: GetAbilityLabel_0100 - * @tc.name: test getAbilityLabel + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0032 + * @tc.name: getAbilityLabelEmptyModule * @tc.desc: test empty moduleName */ - it('GetAbilityLabel_0100', 0, async function (done) { + it('getAbilityLabelEmptyModule', 0, async function (done) { await bundle.getAbilityLabel(BUNDLE_NAME, MODULE_NAME1, ABILITY_NAME) .then(data => { expect(data).assertFail(); }).catch((err) => { - console.error('[GetAbilityLabel_0100]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[getAbilityLabelEmptyModule]Operation failed. Err: ' + JSON.stringify(err)); expect(err).assertEqual(INVALID_CODE); }); bundle.getAbilityLabel(BUNDLE_NAME, MODULE_NAME1, ABILITY_NAME, (err, data) => { expect(err).assertEqual(INVALID_CODE); if (err) { - console.error('[GetAbilityLabel_0100]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[getAbilityLabelEmptyModule]Operation failed. Err: ' + JSON.stringify(err)); } - console.info("'[GetAbilityLabel_0100]Return data: " + JSON.stringify(data)); + console.info("'[getAbilityLabelEmptyModule]Return data: " + JSON.stringify(data)); done(); }); }); /* - * @tc.number: GetAbilityLabel_0200 - * @tc.name: test getAbilityLabel + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0024 + * @tc.name: getAbilityLabelInvalidModule * @tc.desc: test non-existent moduleName */ - it('GetAbilityLabel_0200', 0, async function (done) { + it('getAbilityLabelInvalidModule', 0, async function (done) { await bundle.getAbilityLabel(BUNDLE_NAME, MODULE_NAME2, ABILITY_NAME) .then(data => { expect(data).assertFail(); }).catch((err) => { - console.error('[GetAbilityLabel_0200]Operation . Err: ' + JSON.stringify(err)); + console.error('[getAbilityLabelInvalidModule]Operation . Err: ' + JSON.stringify(err)); expect(err).assertEqual(INVALID_CODE); }); bundle.getAbilityLabel(BUNDLE_NAME, MODULE_NAME2, ABILITY_NAME, (err, data) => { expect(err).assertEqual(INVALID_CODE); if (err) { - console.error('[GetAbilityLabel_0200]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[getAbilityLabelInvalidModule]Operation failed. Err: ' + JSON.stringify(err)); } - console.info("'[GetAbilityLabel_0200]Return data: " + JSON.stringify(data)); + console.info("'[getAbilityLabelInvalidModule]Return data: " + JSON.stringify(data)); done(); }); }); /* - * @tc.number: GetAbilityLabel_0300 - * @tc.name: test getAbilityLabel + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0022 + * @tc.name: getAbilityLabelHasModule * @tc.desc: test existent moduleName */ - it('GetAbilityLabel_0300', 0, async function (done) { + it('getAbilityLabelHasModule', 0, async function (done) { await bundle.getAbilityLabel(BUNDLE_NAME, MODULE_NAME3, ABILITY_NAME) .then(data => { - console.info('[GetAbilityLabel_0300]Return data successful: ' + JSON.stringify(data)); + console.info('[getAbilityLabelHasModule]Return data successful: ' + JSON.stringify(data)); expect(data).assertEqual("bmsfirstright"); }).catch((err) => { - console.error('[GetAbilityLabel_0300]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[getAbilityLabelHasModule]Operation failed. Err: ' + JSON.stringify(err)); expect(err).assertFail(); }); bundle.getAbilityLabel(BUNDLE_NAME, MODULE_NAME3, ABILITY_NAME, (err, data) => { expect(err).assertNull(); if (err) { - console.error('[GetAbilityLabel_0300]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[getAbilityLabelHasModule]Operation failed. Err: ' + JSON.stringify(err)); } expect(data).assertEqual("bmsfirstright"); - console.info("'[GetAbilityLabel_0300]Return data: " + JSON.stringify(data)); + console.info("'[getAbilityLabelHasModule]Return data: " + JSON.stringify(data)); done(); }); }); /* - * @tc.number: IsAbilityEnabled_0100 - * @tc.name: test isAbilityEnabled + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0010 + * @tc.name: isAbilityEnabledEmptyModule * @tc.desc: test empty moduleName */ - it('IsAbilityEnabled_0100', 0, async function (done) { + it('isAbilityEnabledEmptyModule', 0, async function (done) { let abilityInfo = generateAbilityInfoForTest(ABILITY_INFO_ONE.bundleName, ABILITY_INFO_ONE.name, ABILITY_INFO_ONE.moduleName); await bundle.isAbilityEnabled(abilityInfo) .then(data => { - console.info('[IsAbilityEnabled_0100]Return data successful: ' + JSON.stringify(data)); + console.info('[isAbilityEnabledEmptyModule]Return data successful: ' + JSON.stringify(data)); expect(data).assertTrue(); }).catch((err) => { - console.error('[IsAbilityEnabled_0100]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[isAbilityEnabledEmptyModule]Operation failed. Err: ' + JSON.stringify(err)); expect(err).assertFail(); }); bundle.isAbilityEnabled(abilityInfo, (err, data) => { expect(err).assertEqual(SUCCESS_CODE); if (err) { - console.error('[IsAbilityEnabled_0100]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[isAbilityEnabledEmptyModule]Operation failed. Err: ' + JSON.stringify(err)); } expect(data).assertTrue(); - console.info("'[IsAbilityEnabled_0100]Return data: " + JSON.stringify(data)); + console.info("'[isAbilityEnabledEmptyModule]Return data: " + JSON.stringify(data)); done(); }); }); /* - * @tc.number: IsAbilityEnabled_0200 - * @tc.name: test isAbilityEnabled + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0011 + * @tc.name: isAbilityEnabledInvalidModule * @tc.desc: test non-existent moduleName */ - it('IsAbilityEnabled_0200', 0, async function (done) { + it('isAbilityEnabledInvalidModule', 0, async function (done) { let abilityInfo = generateAbilityInfoForTest(ABILITY_INFO_TWO.bundleName, ABILITY_INFO_TWO.name, ABILITY_INFO_TWO.moduleName); await bundle.isAbilityEnabled(abilityInfo) .then(data => { expect(data).assertEqual(false); }).catch((err) => { - console.error('[IsAbilityEnabled_0200]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[isAbilityEnabledInvalidModule]Operation failed. Err: ' + JSON.stringify(err)); expect(err).assertFail(); }); bundle.isAbilityEnabled(abilityInfo, (err, data) => { expect(data).assertEqual(false); if (err) { - console.error('[IsAbilityEnabled_0200]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[isAbilityEnabledInvalidModule]Operation failed. Err: ' + JSON.stringify(err)); } expect(err).assertEqual(SUCCESS_CODE); - console.info("'[IsAbilityEnabled_0200]Return data: " + JSON.stringify(data)); + console.info("'[isAbilityEnabledInvalidModule]Return data: " + JSON.stringify(data)); done(); }); }); /* - * @tc.number: IsAbilityEnabled_0300 - * @tc.name: test isAbilityEnabled + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0008 + * @tc.name: isAbilityEnabledHasModule * @tc.desc: test existent moduleName */ - it('IsAbilityEnabled_0300', 0, async function (done) { + it('isAbilityEnabledHasModule', 0, async function (done) { let abilityInfo = generateAbilityInfoForTest(ABILITY_INFO_THREE.bundleName, ABILITY_INFO_THREE.name, ABILITY_INFO_THREE.moduleName); await bundle.isAbilityEnabled(abilityInfo) .then(data => { - console.info('[IsAbilityEnabled_0300]Return data successful: ' + JSON.stringify(data)); + console.info('[isAbilityEnabledHasModule]Return data successful: ' + JSON.stringify(data)); expect(data).assertTrue(); }).catch((err) => { - console.error('[IsAbilityEnabled_0300]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[isAbilityEnabledHasModule]Operation failed. Err: ' + JSON.stringify(err)); expect(err).assertFail(); }); bundle.isAbilityEnabled(abilityInfo, (err, data) => { expect(err).assertEqual(SUCCESS_CODE); if (err) { - console.error('[IsAbilityEnabled_0300]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[isAbilityEnabledHasModule]Operation failed. Err: ' + JSON.stringify(err)); } expect(data).assertTrue(); - console.info("'[IsAbilityEnabled_0300]Return data: " + JSON.stringify(data)); + console.info("'[isAbilityEnabledHasModule]Return data: " + JSON.stringify(data)); done(); }); }); /* - * @tc.number: IsAbilityEnabled_0400 - * @tc.name: test isAbilityEnabled + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0012 + * @tc.name: isAbilityEnabledUndefinedModule * @tc.desc: test empty moduleName */ - it('IsAbilityEnabled_0400', 0, async function (done) { + it('isAbilityEnabledUndefinedModule', 0, async function (done) { let abilityInfo = generateAbilityInfoForTest(ABILITY_INFO_FOUR.bundleName, ABILITY_INFO_FOUR.name, ABILITY_INFO_FOUR.moduleName); await bundle.isAbilityEnabled(abilityInfo) .then(data => { expect(data).assertFail(); }).catch((err) => { - console.error('[IsAbilityEnabled_0400]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[isAbilityEnabledUndefinedModule]Operation failed. Err: ' + JSON.stringify(err)); expect(err).assertEqual(INVALID_PARAM); }); bundle.isAbilityEnabled(abilityInfo, (err, data) => { expect(data).assertEqual(undefined); if (err) { - console.error('[IsAbilityEnabled_0400]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[isAbilityEnabledUndefinedModule]Operation failed. Err: ' + JSON.stringify(err)); } expect(err).assertEqual(INVALID_PARAM); - console.info("'[IsAbilityEnabled_0400]Return data: " + JSON.stringify(data)); + console.info("'[isAbilityEnabledUndefinedModule]Return data: " + JSON.stringify(data)); done(); }); }); /* - * @tc.number: QueryAbilityByWant_0100 - * @tc.name: test queryAbilityByWant + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0033 + * @tc.name: queryAbilityByWantEmptyModule * @tc.desc: test empty moduleName */ - it('QueryAbilityByWant_0100', 0, async function (done) { + it('queryAbilityByWantEmptyModule', 0, async function (done) { await bundle.queryAbilityByWant({ bundleName: BUNDLE_NAME, abilityName: ABILITY_NAME, moduleName: MODULE_NAME1 }, DEFAULT_FLAG, userId).then(data => { checkDataInfo(data[0]); - console.info("'[QueryAbilityByWant_0100]Return data : " + JSON.stringify(data)); + console.info("'[queryAbilityByWantEmptyModule]Return data : " + JSON.stringify(data)); }).catch(err => { - console.info("[QueryAbilityByWant_0100]Operation failed. Err: " + JSON.stringify(err)); + console.info("[queryAbilityByWantEmptyModule]Operation failed. Err: " + JSON.stringify(err)); expect(err).assertFail(); }); bundle.queryAbilityByWant({ @@ -404,20 +404,20 @@ export default function actsBmsJsModuleNameTest() { }, DEFAULT_FLAG, userId, (err, data) => { expect(err).assertEqual(SUCCESS_CODE); if (err) { - console.error('[QueryAbilityByWant_0100]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[queryAbilityByWantEmptyModule]Operation failed. Err: ' + JSON.stringify(err)); } checkDataInfo(data[0]); - console.info("'[QueryAbilityByWant_0100]Return data : " + JSON.stringify(data)); + console.info("'[queryAbilityByWantEmptyModule]Return data : " + JSON.stringify(data)); done(); }); }); /* - * @tc.number: QueryAbilityByWant_0200 - * @tc.name: test queryAbilityByWant + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0002 + * @tc.name: queryAbilityByWantInvalidModule * @tc.desc: test non-existent moduleName */ - it('QueryAbilityByWant_0200', 0, async function (done) { + it('queryAbilityByWantInvalidModule', 0, async function (done) { await bundle.queryAbilityByWant({ bundleName: BUNDLE_NAME, abilityName: ABILITY_NAME, @@ -425,7 +425,7 @@ export default function actsBmsJsModuleNameTest() { }, DEFAULT_FLAG, userId).then(data => { expect(data).assertFail(); }).catch(err => { - console.error('[QueryAbilityByWant_0200]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[queryAbilityByWantInvalidModule]Operation failed. Err: ' + JSON.stringify(err)); expect(err).assertEqual(INVALID_CODE); }); bundle.queryAbilityByWant({ @@ -433,29 +433,29 @@ export default function actsBmsJsModuleNameTest() { abilityName: ABILITY_NAME, moduleName: MODULE_NAME2 }, DEFAULT_FLAG, userId, (err, data) => { - console.info("'[QueryAbilityByWant_0200]Return data " + JSON.stringify(data)); + console.info("'[queryAbilityByWantInvalidModule]Return data " + JSON.stringify(data)); expect(data).assertEqual("QueryAbilityInfos failed"); - console.error('[QueryAbilityByWant_0200]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[queryAbilityByWantInvalidModule]Operation failed. Err: ' + JSON.stringify(err)); expect(err).assertEqual(INVALID_CODE); done(); }); }); /* - * @tc.number: QueryAbilityByWant_0300 - * @tc.name: test queryAbilityByWant + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0001 + * @tc.name: queryAbilityByWantHasModule * @tc.desc: test existent moduleName */ - it('QueryAbilityByWant_0300', 0, async function (done) { + it('queryAbilityByWantHasModule', 0, async function (done) { await bundle.queryAbilityByWant({ bundleName: BUNDLE_NAME, abilityName: ABILITY_NAME, moduleName: MODULE_NAME3 }, DEFAULT_FLAG, userId).then(data => { checkDataInfo(data[0]); - console.info("'[QueryAbilityByWant_0300]Return data : " + JSON.stringify(data)); + console.info("'[queryAbilityByWantHasModule]Return data : " + JSON.stringify(data)); }).catch(err => { - console.info("[QueryAbilityByWant_0300]Operation failed. Err: " + JSON.stringify(err)); + console.info("[queryAbilityByWantHasModule]Operation failed. Err: " + JSON.stringify(err)); expect(err).assertFail(); }); bundle.queryAbilityByWant({ @@ -465,10 +465,10 @@ export default function actsBmsJsModuleNameTest() { }, DEFAULT_FLAG, userId, (err, data) => { expect(err).assertEqual(SUCCESS_CODE); if (err) { - console.error('[QueryAbilityByWant_0300]Operation failed. Err: ' + JSON.stringify(err)); + console.error('[queryAbilityByWantHasModule]Operation failed. Err: ' + JSON.stringify(err)); } checkDataInfo(data[0]); - console.info("'[QueryAbilityByWant_0300]Return data : " + JSON.stringify(data)); + console.info("'[queryAbilityByWantHasModule]Return data : " + JSON.stringify(data)); done(); }); }); diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets index fc885350d2ffd08e1a586313475e4fefffff810d..68d6dcd43b24924e3ac7b46faae13440b309aab3 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets @@ -44,10 +44,10 @@ export default function actsBmsJsUnPermissionTest() { /** * @tc.number getApplicationInfos_1300 - * @tc.name getApplicationInfos_1300 + * @tc.name getApplicationInfosUnPermission * @tc.desc test getAllApplicationInfo */ - it('getApplicationInfos_1300', 0, async function (done) { + it('getApplicationInfosUnPermission', 0, async function (done) { await bundle.getAllApplicationInfo(DEFAULT_FLAG).then(data => { expect().assertFail(); }).catch(err => { @@ -62,10 +62,10 @@ export default function actsBmsJsUnPermissionTest() { /** * @tc.number getBundleInfo_2000 - * @tc.name getBundleInfo_2000 + * @tc.name getBundleInfoUnPermission * @tc.desc test getBundleInfo */ - it('getBundleInfo_2000', 0, async function (done) { + it('getBundleInfoUnPermission', 0, async function (done) { await bundle.getBundleInfo(BUNDLE_NAME_OTHER, DEFAULT_FLAG, { userId: userId }).then(data => { expect().assertFail(); }).catch(err => { @@ -80,10 +80,10 @@ export default function actsBmsJsUnPermissionTest() { /** * @tc.number getApplicationInfo_1800 - * @tc.name getApplicationInfo_1800 + * @tc.name getApplicationInfoUnPermission * @tc.desc test getApplicationInfo */ - it('getApplicationInfo_1800', 0, async function (done) { + it('getApplicationInfoUnPermission', 0, async function (done) { await bundle.getApplicationInfo(BUNDLE_NAME_OTHER, DEFAULT_FLAG).then(data => { expect().assertFail(); }).catch(err => { @@ -98,10 +98,10 @@ export default function actsBmsJsUnPermissionTest() { /* * @tc.number: SUB_BMS_HAP_STATUS_0011 - * @tc.name: test hasInstalled + * @tc.name: hasInstalledUnPermissionSelf * @tc.desc: test hasInstalled without permission */ - it('SUB_BMS_HAP_STATUS_0011', 0, async function (done) { + it('hasInstalledUnPermissionSelf', 0, async function (done) { let flag = 0; pkg.hasInstalled({ bundleName: SELF_BUNDLENAME, @@ -124,10 +124,10 @@ export default function actsBmsJsUnPermissionTest() { /* * @tc.number: SUB_BMS_HAP_STATUS_0012 - * @tc.name: test hasInstalled + * @tc.name: hasInstalledUnPermissionOther * @tc.desc: test hasInstalled without permission */ - it('SUB_BMS_HAP_STATUS_0012', 0, async function (done) { + it('hasInstalledUnPermissionOther', 0, async function (done) { let flag = 0; pkg.hasInstalled({ bundleName: BUNDLE_NAME_OTHER, @@ -150,10 +150,10 @@ export default function actsBmsJsUnPermissionTest() { /* * @tc.number: SUB_BMS_APPINFO_GETABILITYICON_0006 - * @tc.name: test getAbilityIcon + * @tc.name: getAbilityIconUnPermission * @tc.desc: test getAbilityIcon without permission */ - it('SUB_BMS_APPINFO_GETABILITYICON_0006', 0, async function (done) { + it('getAbilityIconUnPermission', 0, async function (done) { await bundle.getAbilityIcon(BUNDLE_NAME_OTHER, ABILITIY_NAME_OTHER).then(pixelmap => { expect(pixelmap).assertFail(); }).catch(err => { @@ -166,8 +166,8 @@ export default function actsBmsJsUnPermissionTest() { }); /* - * @tc.number: getAbilityInfo_100 - * @tc.name: test getAbilityInfo + * @tc.number: SUB_BMS_APPINFO_GETABILITYINFO_0008 + * @tc.name: getAbilityInfoUnPermissionSelf * @tc.desc: test getAbilityInfo */ it('getAbilityInfo_200', 0, async function (done) { @@ -199,10 +199,10 @@ export default function actsBmsJsUnPermissionTest() { /* * @tc.number: SUB_BMS_APPINFO_EXTENSION_0019 - * @tc.name: test queryExtensionAbilityInfos api + * @tc.name: queryExtensionAbilityInfosUnPermission * @tc.desc: test queryExtensionAbilityInfos no permission */ - it('SUB_BMS_APPINFO_EXTENSION_0019', 0, async function (done) { + it('queryExtensionAbilityInfosUnPermission', 0, async function (done) { await bundle.queryExtensionAbilityInfos( { "bundleName": BUNDLE_NAME1, diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/js/test/ActsBmsGetBackGroundModes.test.js b/bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/js/test/ActsBmsGetBackGroundModes.test.js index 965fc8dac4d73f885b08f65edd6edc7441ddc771..2a8b890c99e56aa27e50acdc4cd9327b24d1d9d4 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/js/test/ActsBmsGetBackGroundModes.test.js +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/js/test/ActsBmsGetBackGroundModes.test.js @@ -58,11 +58,11 @@ describe('ActsBmsGetBackGroundModes', function () { }); /* - * @tc.number: bms_backGroundModes_0100 - * @tc.name: Get the backgroundModes information of the application through queryAbilityByWant + * @tc.number: SUB_BMS_APPINFO_QUERY_0085 + * @tc.name: getBackgroundModesMultiAbility * @tc.desc: Get the information of the background modes from multi-ability application */ - it('bms_backGroundModes_0100', 0, async function (done) { + it('getBackgroundModesMultiAbility', 0, async function (done) { let dataInfos = await bundle.queryAbilityByWant({ action: 'action.system.home', entities: ['entity.system.home'], @@ -100,12 +100,12 @@ describe('ActsBmsGetBackGroundModes', function () { }); /* - * @tc.number: bms_backGroundModes_0200 - * @tc.name: Get the backgroundModes information of the application through queryAbilityByWant + * @tc.number: SUB_BMS_APPINFO_QUERY_0086 + * @tc.name: getBackgroundModesAllModes * @tc.desc: Get all background modes information, and each ability of the application * contains one of the background mode */ - it('bms_backGroundModes_0200', 0, async function (done) { + it('getBackgroundModesAllModes', 0, async function (done) { let dataInfos = await bundle.queryAbilityByWant({ action: 'action.system.home', entities: ['entity.system.home'], @@ -121,11 +121,11 @@ describe('ActsBmsGetBackGroundModes', function () { }); /* - * @tc.number: bms_backGroundModes_0300 - * @tc.name: Get the backgroundModes information of the application through queryAbilityByWant + * @tc.number: SUB_BMS_APPINFO_QUERY_0087 + * @tc.name: getBackgroundModesInvalidModes * @tc.desc: Read the backgroundModes information of the app's ability and replace invalid attributes */ - it('bms_backGroundModes_0300', 0, async function (done) { + it('getBackgroundModesInvalidModes', 0, async function (done) { let dataInfos = await bundle.queryAbilityByWant({ action: 'action.system.home', entities: ['entity.system.home'], @@ -160,11 +160,11 @@ describe('ActsBmsGetBackGroundModes', function () { }); /* - * @tc.number: bms_backGroundModes_0400 - * @tc.name: Get the backgroundModes information of the application through queryAbilityByWant + * @tc.number: SUB_BMS_APPINFO_QUERY_0088 + * @tc.name: getBackgroundModesNotModes * @tc.desc: Read the backgroundModes information of the app's ability and replace invalid attributes */ - it('bms_backGroundModes_0400', 0, async function (done) { + it('getBackgroundModesNotModes', 0, async function (done) { let dataInfos = await bundle.queryAbilityByWant({ action: 'action.system.home', entities: ['entity.system.home'], @@ -181,11 +181,11 @@ describe('ActsBmsGetBackGroundModes', function () { }); /* - * @tc.number: bms_backGroundModes_0500 - * @tc.name: Get the backgroundModes information of the application through queryAbilityByWant + * @tc.number: SUB_BMS_APPINFO_QUERY_0089 + * @tc.name: getBackgroundModesMultiHap * @tc.desc: Get the backgroundModes information of the multi-hap package of the application */ - it('bms_backGroundModes_0500', 0, async function (done) { + it('getBackgroundModesMultiHap', 0, async function (done) { let dataInfos = await bundle.queryAbilityByWant({ action: 'action.system.home', entities: ['entity.system.home'], diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/js/test/ActsBmsQueryAbilityByWant.test.js b/bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/js/test/ActsBmsQueryAbilityByWant.test.js index 6a62d66b5d57dd0dea654a93efc5838099596a43..7f2bf11513976df12a35a7d1aae77eab5c20bb33 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/js/test/ActsBmsQueryAbilityByWant.test.js +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/js/test/ActsBmsQueryAbilityByWant.test.js @@ -38,12 +38,12 @@ describe('ActsBmsQueryAbilityByWant', function () { }); /* - * @tc.number: bms_queryAbilityByWant_0100 - * @tc.name: queryAbilityByWant callback by other callback + * @tc.number: SUB_BMS_APPINFO_QUERYSYS_0008 + * @tc.name: queryAbilityByWantThirdApp * @tc.desc: 1.queryAbilityByWant callback * 2.queryAbilityByWant for third app */ - it('bms_queryAbilityByWant_0100', 0, async function (done) { + it('queryAbilityByWantThirdApp', 0, async function (done) { await bundle.queryAbilityByWant({ action: ACTION_NAME, entities: [ENTITY_NAME], @@ -67,12 +67,12 @@ describe('ActsBmsQueryAbilityByWant', function () { }); /* - * @tc.number: bms_queryAbilityByWant_0200 - * @tc.name: queryAbilityByWant callback by other callback + * @tc.number: SUB_BMS_APPINFO_QUERYSYS_0007 + * @tc.name: queryAbilityByWantSystemApp * @tc.desc: 1.queryAbilityByWant callback * 2.queryAbilityByWant for systemapp */ - it('bms_queryAbilityByWant_0200', 0, async function (done) { + it('queryAbilityByWantSystemApp', 0, async function (done) { await bundle.queryAbilityByWant( { action: ACTION_NAME, @@ -107,11 +107,11 @@ describe('ActsBmsQueryAbilityByWant', function () { }); /* - * @tc.number: bms_queryAbilityByEntities_0300 - * @tc.name: Use the implicit query method in queryAbilityByWant to get abilityInfos + * @tc.number: SUB_BMS_APPINFO_QUERY_0084 + * @tc.name: queryAbilityByWantImplicitByEntities * @tc.desc: The entities in the parameter want pass in the new field, and use the implicit query to get abilitInfos */ - it('bms_queryAbilityByEntities_0300', 0, async function (done) { + it('queryAbilityByWantImplicitByEntities', 0, async function (done) { let dataInfos = await bundle.queryAbilityByWant({ action: ACTION_NAME, entities: ["entity.app.music", diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/src/main/js/test/ActsBmsJsUnPermissionTest.test.js b/bundlemanager/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/src/main/js/test/ActsBmsJsUnPermissionTest.test.js index 0ccf565026732161a012518377482212b709e4ee..f093db21d210344159a8af74f010c9e13fa5c576 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/src/main/js/test/ActsBmsJsUnPermissionTest.test.js +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/src/main/js/test/ActsBmsJsUnPermissionTest.test.js @@ -38,11 +38,11 @@ describe('ActsBmsJsUnPermissionTest', function () { }); /* - * @tc.number: getApplicationInfoTest_100 - * @tc.name: test getApplicationInfo + * @tc.number: getApplicationInfo_1900 + * @tc.name: getApplicationInfoUnPermissionUserId * @tc.desc: test getApplicationInfo */ - it('getApplicationInfoTest_100', 0, async function (done) { + it('getApplicationInfoUnPermissionUserId', 0, async function (done) { await bundle.getApplicationInfo(LAUNCHER_BUNDLE_NAME, DEFAULT_FLAG, userId).then(data => { expect().assertFail(); }).catch(err => { @@ -56,11 +56,11 @@ describe('ActsBmsJsUnPermissionTest', function () { }); /* - * @tc.number: getAllApplicationInfoTest_100 - * @tc.name: test getAllApplicationInfo + * @tc.number: getApplicationInfos_1500 + * @tc.name: getApplicationInfosUnPermissionUserId * @tc.desc: test getAllApplicationInfo */ - it('getAllApplicationInfoTest_100', 0, async function (done) { + it('getApplicationInfosUnPermissionUserId', 0, async function (done) { await bundle.getAllApplicationInfo(DEFAULT_FLAG, userId).then(data => { expect().assertFail(); }).catch(err => { @@ -74,11 +74,11 @@ describe('ActsBmsJsUnPermissionTest', function () { }); /* - * @tc.number: getBundleInfoTest_100 - * @tc.name: test getBundleInfo + * @tc.number: getBundleInfo_2300 + * @tc.name: getBundleInfoUnPermissionUserId * @tc.desc: test getBundleInfo */ - it('getBundleInfoTest_100', 0, async function (done) { + it('getBundleInfoUnPermissionUserId', 0, async function (done) { await bundle.getBundleInfo(LAUNCHER_BUNDLE_NAME, userId).then(data => { expect().assertFail(); }).catch(err => { @@ -92,11 +92,11 @@ describe('ActsBmsJsUnPermissionTest', function () { }); /* - * @tc.number: getAllBundleInfoTest_100 - * @tc.name: test getAllBundleInfo + * @tc.number: getBundleInfos_1000 + * @tc.name: getAllBundleInfoUnPermission * @tc.desc: test getAllBundleInfo */ - it('getAllBundleInfoTest_100', 0, async function (done) { + it('getAllBundleInfoUnPermission', 0, async function (done) { await bundle.getAllBundleInfo(DEFAULT_FLAG).then(data => { expect().assertFail(); }).catch(err => { @@ -110,11 +110,11 @@ describe('ActsBmsJsUnPermissionTest', function () { }); /* - * @tc.number: queryAbilityByWantTest_100 - * @tc.name: test queryAbilityByWant + * @tc.number: SUB_BMS_APPINFO_QUERY_0015 + * @tc.name: queryAbilityByWantUnPermission * @tc.desc: test queryAbilityByWant */ - it('queryAbilityByWantTest_100', 0, async function (done) { + it('queryAbilityByWantUnPermission', 0, async function (done) { await bundle.queryAbilityByWant({ bundleName: LAUNCHER_BUNDLE_NAME, abilityName: LAUNCHER_MAIN_ABILITY @@ -135,11 +135,11 @@ describe('ActsBmsJsUnPermissionTest', function () { }); /* - * @tc.number: getLaunchWantForBundleTest_100 - * @tc.name: test getLaunchWantForBundle + * @tc.number: SUB_BMS_APPINFO_QUERY_0010 + * @tc.name: getLaunchWantForBundleUnPermission * @tc.desc: test getLaunchWantForBundle */ - it('getLaunchWantForBundleTest_100', 0, async function (done) { + it('getLaunchWantForBundleUnPermission', 0, async function (done) { await bundle.getLaunchWantForBundle(LAUNCHER_BUNDLE_NAME).then(data => { expect().assertFail(); }).catch(err => { @@ -153,12 +153,12 @@ describe('ActsBmsJsUnPermissionTest', function () { }); /* - * @tc.number: getAbilityLabelTest_100 - * @tc.name: getAbilityLabel : Gets the specified ability label + * @tc.number: SUB_BMS_APPINFO_GETABILITYLABELP_0006 + * @tc.name: getAbilityLabelUnPermission * @tc.desc: Check the return value of the interface * @tc.level 0 */ - it('getAbilityLabelTest_100', 0, async function (done) { + it('getAbilityLabelUnPermission', 0, async function (done) { await bundle.getAbilityLabel(LAUNCHER_BUNDLE_NAME, LAUNCHER_MAIN_ABILITY) .then((data) => { expect().assertFail(); @@ -174,8 +174,8 @@ describe('ActsBmsJsUnPermissionTest', function () { }); /* - * @tc.number: getAbilityInfo_100 - * @tc.name: test getAbilityInfo + * @tc.number: SUB_BMS_APPINFO_GETABILITYINFO_0006 + * @tc.name: getAbilityInfoUnPermission * @tc.desc: test getAbilityInfo */ it('getAbilityInfo_100', 0, async function (done) { diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets index e1940cf0fa392a144bf358f0569e98eae673c338..b77df7d8ef5f586fe5c504e214166a283af03773 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets @@ -32,7 +32,7 @@ const PROFILE_JSON_STRING = "{\"src\":[\"MainAbility/pages/index/index\",\"MainA export default function getProfileByAbility() { describe('getProfileByAbility', function () { /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0021 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0011 * @tc.name: getProfileByAbilityInvalidModulePro * @tc.desc: Check the invalid moduleName (by promise) * @tc.level 0 @@ -50,7 +50,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0031 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0015 * @tc.name: getProfileByAbilityEmptyModulePro * @tc.desc: Check the empty moduleName (by promise) * @tc.level 0 @@ -68,7 +68,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0028 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0017 * @tc.name: getProfileByAbilityInvalidModuleCall * @tc.desc: Check the invalid moduleName (by callback) * @tc.level 0 @@ -87,7 +87,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0037 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0034 * @tc.name: getProfileByAbilityEmptyModuleCall * @tc.desc: Check the empty moduleName (by callback) * @tc.level 0 @@ -106,7 +106,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0013 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0012 * @tc.name: getProfileByAbilityInvalidAbilityPro * @tc.desc: Check the invalid abilityName (by promise) * @tc.level 0 @@ -124,7 +124,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0032 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0029 * @tc.name: getProfileByAbilityEmptyAbilityPro * @tc.desc: Check the empty abilityName (by promise) * @tc.level 0 @@ -142,7 +142,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0023 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0022 * @tc.name: getProfileByAbilityInvalidAbilityCall * @tc.desc: Check the invalid abilityName (by callback) * @tc.level 0 @@ -161,7 +161,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0038 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0029 * @tc.name: getProfileByAbilityEmptyAbilityCall * @tc.desc: Check the empty abilityName (by callback) * @tc.level 0 @@ -180,7 +180,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0025 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0024 * @tc.name: getProfileByAbilityCallback * @tc.desc: Check the valid metadataName (by callback) * @tc.level 0 @@ -200,7 +200,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0027 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0026 * @tc.name: getProfileByAbilityInvalidMetaDataCall * @tc.desc: Check the invalid metadataName (by callback) * @tc.level 0 @@ -219,7 +219,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0039 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0036 * @tc.name: getProfileByAbilityEmptyMetaDataCall * @tc.desc: Check the empty metadataName (by callback) * @tc.level 0 @@ -241,7 +241,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0003 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0002 * @tc.name: getProfileByAbilityPromise * @tc.desc: Check the valid metadataName (by promise) * @tc.level 0 @@ -261,7 +261,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0016 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0004 * @tc.name: getProfileByAbilityInvalidMetaDataPro * @tc.desc: Check the invalid metadataName (by promise) * @tc.level 0 @@ -279,7 +279,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0033 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0030 * @tc.name: getProfileByAbilityEmptyMetaDataPro * @tc.desc: Check the empty metadataName (by promise) * @tc.level 0 @@ -301,7 +301,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0010 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0009 * @tc.name: getProfileByAbilityNoMetaDataPro * @tc.desc: without metadataName (by promise) * @tc.level 0 @@ -323,7 +323,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0049 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0048 * @tc.name: getProfileByAbilityNoProfilePro * @tc.desc: no profile configured under the ability (by promise) * @tc.level 0 @@ -341,7 +341,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0043 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0045 * @tc.name: getProfileByAbilityNotPrefixPro * @tc.desc: resource has no prefix '$profile:' (by promise) * @tc.level 0 @@ -359,7 +359,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0042 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0044 * @tc.name: getProfileByAbilityNotPrefixCall * @tc.desc: resource has no prefix '$profile:' (by callback) * @tc.level 0 @@ -378,7 +378,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0019 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0007 * @tc.name: getProfileByAbilityNotSuffixPro * @tc.desc: profile is .txt suffix (by promise) * @tc.level 0 @@ -397,7 +397,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0041 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0040 * @tc.name: getProfileByAbilityNotSuffixCall * @tc.desc: profile is .txt suffix (by callback) * @tc.level 0 @@ -416,7 +416,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0020 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0008 * @tc.name: getProfileByAbilityNoJsonPro * @tc.desc: profile is invalid json format (by promise) * @tc.level 0 @@ -434,7 +434,7 @@ export default function getProfileByAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0047 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0046 * @tc.name: getProfileByAbilityNoJsonCall * @tc.desc: profile is invalid json format (by callback) * @tc.level 0 diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets index 249f42196f0d6327d588e7434a1154c6452422ef..0b543cb179005070d8d44cf8e8403818e76d98c5 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets @@ -32,7 +32,7 @@ const PROFILE_JSON_STRING = "{\"src\":[\"MainAbility/pages/index/index\",\"MainA export default function getProfileByExtensionAbility() { describe('getProfileByExtensionAbility', function () { /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0011 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0021 * @tc.name: getProfileByExtensionInvalidModulePro * @tc.desc: Check the invalid moduleName (by promise) * @tc.level 0 @@ -50,7 +50,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0015 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0031 * @tc.name: getProfileByExtensionEmptyModulePro * @tc.desc: Check the Empty moduleName (by promise) * @tc.level 0 @@ -68,7 +68,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0017 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0028 * @tc.name: getProfileByExtensionEmptyModuleCall * @tc.desc: Check the invalid moduleName (by callback) * @tc.level 0 @@ -87,7 +87,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0034 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0037 * @tc.name: getProfileByExtensionEmptyModuleCall * @tc.desc: Check the Empty moduleName (by callback) * @tc.level 0 @@ -106,7 +106,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0012 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0013 * @tc.name: getProfileByExtensionInvalidAbilityPro * @tc.desc: Check the invalid abilityName (by promise) * @tc.level 0 @@ -124,7 +124,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0029 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0032 * @tc.name: getProfileByExtensionEmptyAbilityPro * @tc.desc: Check the Empty abilityName (by promise) * @tc.level 0 @@ -142,7 +142,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0022 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0023 * @tc.name: getProfileByExtensionInvalidAbilityCall * @tc.desc: Check the invalid abilityName (by callback) * @tc.level 0 @@ -161,7 +161,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0035 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0038 * @tc.name: getProfileByExtensionEmptyAbilityCall * @tc.desc: Check the Empty abilityName (by callback) * @tc.level 0 @@ -180,7 +180,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0024 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0025 * @tc.name: getProfileByExtensionAbilityCallback * @tc.desc: Check the valid metadataName (by callback) * @tc.level 0 @@ -200,7 +200,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0026 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0027 * @tc.name: getProfileByExtensionInvalidMetaDataCall * @tc.desc: Check the invalid metadataName (by callback) * @tc.level 0 @@ -219,7 +219,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0036 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0039 * @tc.name: getProfileByExtensionEmptyMetaDataCall * @tc.desc: Check the empty metadataName (by callback) * @tc.level 0 @@ -241,7 +241,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0002 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0003 * @tc.name: getProfileByExtensionAbilityPromise * @tc.desc: Check the valid metadataName (by promise) * @tc.level 0 @@ -261,7 +261,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0004 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0016 * @tc.name: getProfileByExtensionInvalidMetaDataPro * @tc.desc: Check the invalid metadataName (by promise) * @tc.level 0 @@ -279,7 +279,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0030 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0033 * @tc.name: getProfileByExtensionEmptyMetaDataPro * @tc.desc: Check the empty metadataName (by promise) * @tc.level 0 @@ -301,7 +301,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0009 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0010 * @tc.name: getProfileByExtensionAbilityNoMetaDataPro * @tc.desc: without metadataName (by promise) * @tc.level 0 @@ -323,7 +323,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0048 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0049 * @tc.name: getProfileByExtensionAbilityNoProfilePro * @tc.desc: no profile configured under the ability (by promise) * @tc.level 0 @@ -341,7 +341,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0045 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0043 * @tc.name: getProfileByExtensionNotPrefixPro * @tc.desc: resource has no prefix '$profile:' (by promise) * @tc.level 0 @@ -359,7 +359,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0044 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0042 * @tc.name: getProfileByExtensionNotPrefixCall * @tc.desc: resource has no prefix '$profile:' (by callback) * @tc.level 0 @@ -378,7 +378,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0007 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0019 * @tc.name: getProfileByExtensionNotSuffixPro * @tc.desc: profile is .txt suffix (by promise) * @tc.level 0 @@ -397,7 +397,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0040 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0041 * @tc.name: getProfileByExtensionNotSuffixCall * @tc.desc: profile is .txt suffix (by callback) * @tc.level 0 @@ -416,7 +416,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0008 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0020 * @tc.name: getProfileByExtensionNoJsonPro * @tc.desc: profile is invalid json format (by promise) * @tc.level 0 @@ -434,7 +434,7 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0046 + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0047 * @tc.name: getProfileByExtensionNoJsonCall * @tc.desc: profile is invalid json format (by callback) * @tc.level 0 diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetInfoSync.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetInfoSync.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..d7c3449d82b3dd9717f70fac73df4173af01358b --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetInfoSync.test.ets @@ -0,0 +1,234 @@ +/** + * 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, it, expect } from 'hypium/index'; +import Utils from './Utils'; +import Bundle from '@ohos.bundle'; +import account from '@ohos.account.osAccount'; + +const BUNDLE_NAME = 'com.open.harmony.packagemag'; +const PATH = "/data/app/el1/bundle/public"; +let userId = 0; + +export default function GetInfoSync() { + + describe('GetInfoSync', function () { + + beforeAll(async function (done) { + await account.getAccountManager().getOsAccountLocalIdFromProcess().then(account => { + console.info("getOsAccountLocalIdFromProcess userid ==========" + account); + userId = account; + done(); + }).catch(err=>{ + console.info("getOsAccountLocalIdFromProcess err ==========" + JSON.stringify(err)); + done(); + }) + }); + + /** + * @tc.number: getApplicationInfoSync_0100 + * @tc.name: getApplicationSyncWithRightNameAndUserId + * @tc.desc: Test indicates the right bundleName, bundleFlags and userId + * returns the ApplicationInfo object + */ + it('getApplicationSyncWithRightNameAndUserId', 0, async function (done) { + var applicationInfo = Bundle.getApplicationInfoSync(BUNDLE_NAME, + Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId) + expect(typeof (applicationInfo)).assertEqual("object"); + getApplicationInfoSuccess("getApplicationSyncWithRightNameAndUserId", applicationInfo); + done(); + }) + + /** + * @tc.number: getApplicationInfoSync_0200 + * @tc.name: getApplicationSyncWithWrongNameAndUserId + * @tc.desc: Test indicates the wrong bundleName, bundleFlags and userId + * returns the ApplicationInfo undefined + */ + it('getApplicationSyncWithWrongNameAndUserId', 0, async function (done) { + let bundleName = "wrong"; + var applicationInfo = Bundle.getApplicationInfoSync(bundleName, + Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId); + expect(JSON.stringify(applicationInfo)).assertEqual(undefined); + done(); + }) + + /** + * @tc.number: getApplicationInfoSync_0300 + * @tc.name: getApplicationSyncWithRightName + * @tc.desc: Test indicates the right bundleName, bundleFlags + * returns the ApplicationInfo object + */ + it('getApplicationSyncWithRightName', 0, async function (done) { + let applicationInfo = Bundle.getApplicationInfoSync(BUNDLE_NAME, + Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION) + expect(typeof (applicationInfo)).assertEqual("object"); + getApplicationInfoSuccess("getApplicationSyncWithRightName", applicationInfo); + done(); + }) + + /** + * @tc.number: getApplicationInfoSync_0400 + * @tc.name: getApplicationSyncWithWrongName + * @tc.desc: Test indicates the wrong bundleName, bundleFlags + * returns the ApplicationInfo undefined + */ + it('getApplicationSyncWithWrongName', 0, async function (done) { + let bundleName = "wrong"; + let applicationInfo = Bundle.getApplicationInfoSync(bundleName, + Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION); + expect(JSON.stringify(applicationInfo)).assertEqual(undefined); + done(); + }) + + /** + * @tc.number: getBundleInfoSync_0100 + * @tc.name: getBundleInfoSyncWithRightNameAndUserId + * @tc.desc: Test indicates the right bundleName, bundleFlags, options + * returns the BundleInfo object + */ + it('getBundleInfoSyncWithRightNameAndUserId', 0, async function (done) { + let options = {userId : userId}; + let bundleInfo = Bundle.getBundleInfoSync(BUNDLE_NAME, + Bundle.BundleFlag.GET_BUNDLE_DEFAULT, options); + expect(typeof (bundleInfo)).assertEqual("object"); + getBundleInfoSuccess("getBundleInfoSyncWithRightNameAndUserId", bundleInfo); + done(); + }) + + /** + * @tc.number: getBundleInfoSync_0200 + * @tc.name: getBundleInfoSyncWithWrongNameAndUserId + * @tc.desc: Test indicates the right bundleName, bundleFlags, options + * returns the BundleInfo undefined + */ + it('getBundleInfoSyncWithWrongNameAndUserId', 0, async function (done) { + let options = {userId : userId}; + let bundleName = "wrong"; + let bundleInfo = Bundle.getBundleInfoSync(bundleName, + Bundle.BundleFlag.GET_BUNDLE_DEFAULT, options); + expect(JSON.stringify(bundleInfo)).assertEqual(undefined); + done(); + }) + + /** + * @tc.number: getBundleInfoSync_0300 + * @tc.name: getBundleInfoSyncWithRightName + * @tc.desc: Test indicates the right bundleName, bundleFlags + * returns the BundleInfo object + */ + it('getBundleInfoSyncWithRightName', 0, async function (done) { + let info = Bundle.getBundleInfoSync(BUNDLE_NAME, Bundle.BundleFlag.GET_BUNDLE_DEFAULT); + expect(typeof (info)).assertEqual("object"); + getBundleInfoSuccess("getBundleInfoSyncWithRightName", info); + done(); + }) + + /** + * @tc.number: getBundleInfoSync_0400 + * @tc.name: getBundleInfoSyncWithWrongName + * @tc.desc: Test indicates the right bundleName, bundleFlags + * returns the BundleInfo undefined + */ + it('getBundleInfoSyncWithWrongName', 0, async function (done) { + let bundleName = "wrong"; + let info = Bundle.getBundleInfoSync(bundleName, Bundle.BundleFlag.GET_BUNDLE_DEFAULT); + expect(JSON.stringify(info)).assertEqual(undefined); + done(); + }) + + function getBundleInfoSuccess(msg, data) { + expect(data.name).assertEqual(BUNDLE_NAME); + expect(data.type).assertEqual(""); + expect(data.appId).assertContain(BUNDLE_NAME); + expect(data.uid).assertLarger(0); + expect(data.installTime).assertLarger(0); + expect(data.updateTime).assertLarger(0); + expect(data.abilityInfos.length).assertEqual(0); + expect(data.appInfo.name).assertEqual(BUNDLE_NAME); + expect(data.appInfo.codePath).assertEqual(PATH + '/' + BUNDLE_NAME); + expect(data.appInfo.accessTokenId > 0).assertEqual(true); + expect(data.appInfo.description).assertEqual('$string:entry_description'); + expect(data.appInfo.descriptionId > 0).assertEqual(true); + expect(data.appInfo.icon).assertEqual('$media:icon'); + expect(data.appInfo.iconId > 0).assertEqual(true); + expect(data.appInfo.iconIndex > 0).assertEqual(true); + expect(data.appInfo.iconIndex).assertEqual(data.appInfo.iconId); + expect(data.appInfo.uid > 0).assertEqual(true); + expect(data.appInfo.label).assertEqual('$string:entry_MainAbility'); + expect(data.appInfo.labelId > 0).assertEqual(true); + expect(data.appInfo.labelIndex > 0).assertEqual(true); + expect(data.appInfo.labelIndex).assertEqual(data.appInfo.labelId); + expect(data.appInfo.systemApp).assertEqual(false); + expect(data.appInfo.supportedModes).assertEqual(0); + expect(data.appInfo.process).assertEqual(BUNDLE_NAME); + expect(data.appInfo.entryDir).assertEqual(PATH + '/' + BUNDLE_NAME + '/' + BUNDLE_NAME); + expect(data.appInfo.enabled).assertEqual(true); + expect(data.appInfo.entityType).assertEqual('unspecified'); + expect(data.appInfo.removable).assertEqual(true); + expect(data.appInfo.moduleInfos[0].moduleName).assertEqual('entry'); + expect(data.appInfo.moduleInfos[0].moduleSourceDir).assertEqual(PATH + '/' + BUNDLE_NAME + '/' + BUNDLE_NAME); + expect(data.appInfo.moduleSourceDirs[0]).assertEqual(PATH + '/' + BUNDLE_NAME + '/' + BUNDLE_NAME); + expect(data.appInfo.permissions.length).assertEqual(0); + expect(data.reqPermissions.length).assertEqual(0); + expect(data.reqPermissionDetails.length).assertEqual(0); + expect(data.vendor).assertEqual("ohos"); + expect(data.versionCode).assertEqual(1000000); + expect(data.versionName).assertEqual("1.0.0"); + expect(data.compatibleVersion).assertEqual(7); + expect(data.targetVersion).assertEqual(7); + expect(data.isCompressNativeLibs).assertEqual(true); + expect(data.entryModuleName).assertEqual("entry"); + expect(data.cpuAbi).assertEqual(""); + expect(data.isSilentInstallation.length).assertEqual(0); + expect(data.hapModuleInfos.length > 0).assertEqual(true); + expect(data.minCompatibleVersionCode).assertEqual(1000000); + expect(data.entryInstallationFree).assertEqual(false); + expect(data.reqPermissionStates.length).assertEqual(0); + expect(data.extensionAbilityInfo.length).assertEqual(0); + } + + function getApplicationInfoSuccess(msg, data) { + expect(data.name).assertEqual(BUNDLE_NAME); + expect(data.codePath).assertEqual(PATH + '/' + BUNDLE_NAME); + expect(data.accessTokenId > 0).assertEqual(true); + expect(data.description).assertEqual('$string:entry_description'); + expect(data.descriptionId > 0).assertEqual(true); + expect(data.icon).assertEqual('$media:icon'); + expect(data.iconId > 0).assertEqual(true); + expect(data.iconIndex > 0).assertEqual(true); + expect(data.iconIndex).assertEqual(data.iconId); + expect(data.uid > 0).assertEqual(true); + expect(data.label).assertEqual('$string:entry_MainAbility'); + expect(data.labelId > 0).assertEqual(true); + expect(data.labelIndex > 0).assertEqual(true); + expect(data.labelIndex).assertEqual(data.labelId); + expect(data.systemApp).assertEqual(false); + expect(data.supportedModes).assertEqual(0); + expect(data.process).assertEqual(BUNDLE_NAME); + expect(data.entryDir).assertEqual(PATH + '/' + BUNDLE_NAME + '/' + BUNDLE_NAME); + expect(data.enabled).assertEqual(true); + expect(data.entityType).assertEqual('unspecified'); + expect(data.removable).assertEqual(true); + expect(data.moduleInfos[0].moduleName).assertEqual('entry'); + expect(data.moduleInfos[0].moduleSourceDir).assertEqual(PATH + '/' + BUNDLE_NAME + '/' + BUNDLE_NAME); + expect(data.moduleSourceDirs[0]).assertEqual(PATH + '/' + BUNDLE_NAME + '/' + BUNDLE_NAME); + expect(data.permissions[0]).assertEqual("ohos.permission.GET_BUNDLE_INFO"); + expect(data.permissions[1]).assertEqual("ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"); + expect(data.permissions[2]).assertEqual("ohos.permission.USE_BLUETOOTH"); + console.log(msg + ' end ' + JSON.stringify(data)); + } + }); + +} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/List.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/List.test.ets index 5bec9e41af6ce21bc6b85b7aa1cf796476260df6..5c9e67285ee276b388168fc696793b6744986fac 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/List.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/List.test.ets @@ -27,6 +27,7 @@ import getQueryAbilityByWant from './GetQueryAbilityByWant.test.ets'; import isDefaultApplicationTest from './IsDefaultApplication.test.ets'; import getWindowPorperties from './getWindowProperties.test.ets'; import GetSecondModuleTest from './GetSecondModule.test.ets'; +import GetInfoSync from './GetInfoSync.test.ets'; export default function testsuite() { getBundleArchiveInfo(); @@ -48,4 +49,5 @@ export default function testsuite() { isApplicationEnabledETSUnit(); getWindowPorperties(); GetSecondModuleTest(); + GetInfoSync(); } \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanagertest/src/main/js/test/ExampleJsunit.test.js b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanagertest/src/main/js/test/ExampleJsunit.test.js index 32c019acddecd80fe49ec2ad4a926529f9cc7758..113ef2edcffb97b6fcafbb6fbe82765572c68165 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanagertest/src/main/js/test/ExampleJsunit.test.js +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanagertest/src/main/js/test/ExampleJsunit.test.js @@ -49,10 +49,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getBundleInfo_0100 - * @tc.name BUNDLEMGR::getBundleInfo + * @tc.name testGetBundleInfoReqPermissionPromise * @tc.desc Test getBundleInfo interfaces with one hap.(by promise) */ - it('getBundleInfo_0100', 0, async function (done) { + it('testGetBundleInfoReqPermissionPromise', 0, async function (done) { let datainfo = await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES | demo.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION); expect(datainfo.name).assertEqual(NAME1); @@ -103,11 +103,11 @@ describe('ActsBundleManagerTest', function () { }) /** - * @tc.number getBundleInfo_0200 - * @tc.name BUNDLEMGR::getBundleInfo + * @tc.number getBundleInfo_0600 + * @tc.name testGetBundeInfoReqPermissionCallback * @tc.desc Test getBundleInfo interfaces with one hap.(by callback) */ - it('getBundleInfo_0200', 0, async function (done) { + it('testGetBundeInfoReqPermissionCallback', 0, async function (done) { await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES | demo.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION, OnReceiveEvent); @@ -118,7 +118,7 @@ describe('ActsBundleManagerTest', function () { }) function checkBundleInfo0200(datainfo) { - console.info("getBundleInfo_0200 dataInfo ====" + datainfo); + console.info("testGetBundeInfoReqPermissionCallback dataInfo ====" + datainfo); expect(datainfo.name).assertEqual(NAME1); expect(datainfo.vendor).assertEqual("example"); expect(datainfo.versionCode).assertEqual(VERSIONCODE1); @@ -166,13 +166,13 @@ describe('ActsBundleManagerTest', function () { } /** - * @tc.number getBundleInfo_0300 - * @tc.name BUNDLE::getBundleInfo + * @tc.number getBundleInfo_0200 + * @tc.name testGetBundleInfoMultiHapPromise * @tc.desc Test getBundleInfo interfaces with two haps.(by promise) */ - it('getBundleInfo_0300', 0, async function (done) { + it('testGetBundleInfoMultiHapPromise', 0, async function (done) { let datainfo = await demo.getBundleInfo(NAME2, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES); - console.info("getBundleInfo_0300 dataInfo ====" + datainfo); + console.info("testGetBundleInfoMultiHapPromise dataInfo ====" + datainfo); expect(datainfo.name).assertEqual(NAME2); expect(datainfo.vendor).assertEqual("example"); expect(datainfo.versionCode).assertEqual(1); @@ -190,14 +190,14 @@ describe('ActsBundleManagerTest', function () { }) /** - * @tc.number getBundleInfo_0400 - * @tc.name BUNDLE::getBundleInfo + * @tc.number getBundleInfo_0700 + * @tc.name testGetBundleInfoMultiHapCallback * @tc.desc Test getBundleInfo interfaces with two haps.(by callback) */ - it('getBundleInfo_0400', 0, async function (done) { + it('testGetBundleInfoMultiHapCallback', 0, async function (done) { await demo.getBundleInfo(NAME2, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, OnReceiveEvent); function OnReceiveEvent(err, datainfo) { - console.info("getBundleInfo_0400 dataInfo ====" + datainfo); + console.info("testGetBundleInfoMultiHapCallback dataInfo ====" + datainfo); expect(datainfo.name).assertEqual(NAME2); expect(datainfo.vendor).assertEqual("example"); expect(datainfo.versionCode).assertEqual(1); @@ -216,13 +216,13 @@ describe('ActsBundleManagerTest', function () { }) /** - * @tc.number getBundleInfo_0500 - * @tc.name BUNDLE::getBundleInfo + * @tc.number getBundleInfo_0300 + * @tc.name testGetBundleInfoPromise * @tc.desc Test getBundleInfo interfaces with one hap. (by promise) */ - it('getBundleInfo_0500', 0, async function (done) { + it('testGetBundleInfoPromise', 0, async function (done) { let datainfo = await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES); - console.info("getBundleInfo_0500 dataInfo ====" + datainfo); + console.info("testGetBundleInfoPromise dataInfo ====" + datainfo); expect(datainfo.name).assertEqual(NAME1); expect(datainfo.vendor).assertEqual("example"); expect(datainfo.versionCode).assertEqual(VERSIONCODE1); @@ -259,15 +259,15 @@ describe('ActsBundleManagerTest', function () { }) /** - * @tc.number getBundleInfo_0600 - * @tc.name BUNDLE::getBundleInfo + * @tc.number getBundleInfo_0800 + * @tc.name testGetBundleInfoCallback * @tc.desc Test getBundleInfo interfaces with one hap. (by callback) */ - it('getBundleInfo_0600', 0, async function (done) { + it('testGetBundleInfoCallback', 0, async function (done) { await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES | demo.BundleFlag.GET_ABILITY_INFO_WITH_DISABLE, OnReceiveEvent); function OnReceiveEvent(err, datainfo) { - console.info("getBundleInfo_0600 dataInfo ====" + datainfo); + console.info("testGetBundleInfoCallback dataInfo ====" + datainfo); expect(datainfo.name).assertEqual(NAME1); expect(datainfo.vendor).assertEqual("example"); expect(datainfo.versionCode).assertEqual(VERSIONCODE1); @@ -305,54 +305,54 @@ describe('ActsBundleManagerTest', function () { }) /** - * @tc.number getBundleInfo_0700 - * @tc.name BUNDLE::getBundleInfo + * @tc.number getBundleInfo_0400 + * @tc.name testGetBundleInfoNotExistPromise * @tc.desc Test getBundleInfo interfaces with error hap. (by promise) */ - it('getBundleInfo_0700', 0, async function (done) { + it('testGetBundleInfoNotExistPromise', 0, async function (done) { await demo.getBundleInfo('error', demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES).then(datainfo => { - console.info("getBundleInfo_0700 success:" + JSON.stringify(datainfo)); + console.info("testGetBundleInfoNotExistPromise success:" + JSON.stringify(datainfo)); expect(datainfo).assertFail(); done(); }).catch(err => { - console.info("getBundleInfo_0700 err:" + JSON.stringify(err)); + console.info("testGetBundleInfoNotExistPromise err:" + JSON.stringify(err)); expect(err).assertEqual(1); done(); }); }) /** - * @tc.number getBundleInfo_0800 - * @tc.name BUNDLE::getBundleInfo + * @tc.number getBundleInfo_0900 + * @tc.name testGetBundleInfoNotExistCallback * @tc.desc Test getBundleInfo interfaces with error hap. (by callback) */ - it('getBundleInfo_0800', 0, async function (done) { + it('testGetBundleInfoNotExistCallback', 0, async function (done) { await demo.getBundleInfo('error', demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, OnReceiveEvent); function OnReceiveEvent(err, datainfo) { if (err) { - console.info("getBundleInfo_0800 err" + JSON.stringify(err)); + console.info("testGetBundleInfoNotExistCallback err" + JSON.stringify(err)); expect(err).assertEqual(1); done(); return; } - console.info("getBundleInfo_0800 success" + JSON.stringify(datainfo)); + console.info("testGetBundleInfoNotExistCallback success" + JSON.stringify(datainfo)); expect(datainfo).assertFail(); done(); } }) /** - * @tc.number getBundleInfo_0900 - * @tc.name BUNDLE::getBundleInfo + * @tc.number getBundleInfo_0500 + * @tc.name testGetBundleInfoInvalidParamPromise * @tc.desc Test getBundleInfo interfaces with none hap. (by promise) */ - it('getBundleInfo_0900', 0, async function (done) { + it('testGetBundleInfoInvalidParamPromise', 0, async function (done) { await demo.getBundleInfo(' ', demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES).then(datainfo => { - console.info("getBundleInfo_0900 success" + JSON.stringify(datainfo)); + console.info("testGetBundleInfoInvalidParamPromise success" + JSON.stringify(datainfo)); expect(datainfo).assertFail(); done(); }).catch(err => { - console.info("getBundleInfo_0900 fail" + JSON.stringify(err)); + console.info("testGetBundleInfoInvalidParamPromise fail" + JSON.stringify(err)); expect(err).assertEqual(1); done(); }); @@ -360,19 +360,19 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getBundleInfo_1000 - * @tc.name BUNDLE::getBundleInfo + * @tc.name testGetBundleInfoInvalidParamCallback * @tc.desc Test getBundleInfo interfaces with none hap. (by callback) */ - it('getBundleInfo_1000', 0, async function (done) { + it('testGetBundleInfoInvalidParamCallback', 0, async function (done) { await demo.getBundleInfo(' ', demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, OnReceiveEvent); function OnReceiveEvent(err, datainfo) { if (err) { - console.info("getBundleInfo_1000 err" + JSON.stringify(err)); + console.info("testGetBundleInfoInvalidParamCallback err" + JSON.stringify(err)); expect(err).assertEqual(1); done(); return; } - console.info("getBundleInfo_1000 success" + JSON.stringify(datainfo)); + console.info("testGetBundleInfoInvalidParamCallback success" + JSON.stringify(datainfo)); expect(datainfo).assertFail(); done(); } @@ -380,12 +380,12 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getBundleInfo_1100 - * @tc.name BUNDLE::getBundleInfo + * @tc.name testGetBundleInfoDifferentParamPromise * @tc.desc Test getBundleInfo interfaces with one hap and different param. (by promise) */ - it('getBundleInfo_1100', 0, async function (done) { + it('testGetBundleInfoDifferentParamPromise', 0, async function (done) { let datainfo = await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_DEFAULT) - console.info("getBundleInfo_1100 dataInfo ====" + datainfo); + console.info("testGetBundleInfoDifferentParamPromise dataInfo ====" + datainfo); expect(datainfo.name).assertEqual(NAME1); expect(datainfo.vendor).assertEqual("example"); expect(datainfo.versionCode).assertEqual(VERSIONCODE1); @@ -406,13 +406,13 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getBundleInfo_1200 - * @tc.name BUNDLE::getBundleInfo + * @tc.name testGetBundleInfoDifferentParamCallback * @tc.desc Test getBundleInfo interfaces with one hap and different param. (by callback) */ - it('getBundleInfo_1200', 0, async function (done) { + it('testGetBundleInfoDifferentParamCallback', 0, async function (done) { await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_DEFAULT, OnReceiveEvent) function OnReceiveEvent(err, datainfo) { - console.info("getBundleInfo_1200 dataInfo ====" + datainfo); + console.info("testGetBundleInfoDifferentParamCallback dataInfo ====" + datainfo); expect(datainfo.name).assertEqual(NAME1); expect(datainfo.vendor).assertEqual("example"); expect(datainfo.versionCode).assertEqual(VERSIONCODE1); @@ -437,23 +437,23 @@ describe('ActsBundleManagerTest', function () { }) /** - * @tc.number getBundleInfo_1400 - * @tc.name BUNDLE::getBundleInfo + * @tc.number getBundleInfo_1300 + * @tc.name testGetBundleInfoSystemAppCallback * @tc.desc Test getBundleInfo interfaces with systemApp.(by callback) */ - it('getBundleInfo_1400', 0, async function (done) { + it('testGetBundleInfoSystemAppCallback', 0, async function (done) { let bundleOptions = { userId: userId }; demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, bundleOptions, (err, datainfo) => { if (err) { - console.info("getBundleInfo_1400 fail:" + JSON.stringify(err)); + console.info("testGetBundleInfoSystemAppCallback fail:" + JSON.stringify(err)); expect(err).assertFail(); done(); return; } - console.info("getBundleInfo_1400 success:" + JSON.stringify(datainfo)); + console.info("testGetBundleInfoSystemAppCallback success:" + JSON.stringify(datainfo)); expect(datainfo.name).assertEqual(NAME1); expect(datainfo.vendor).assertEqual("example"); expect(datainfo.versionCode).assertEqual(1); @@ -469,17 +469,17 @@ describe('ActsBundleManagerTest', function () { }) /** - * @tc.number getBundleInfo_1500 - * @tc.name BUNDLEMGR::getBundleInfo + * @tc.number getBundleInfo_1400 + * @tc.name testGetBundleInfoCurrentUserIdPromise * @tc.desc Test getBundleInfo interface with current userId (by promise). */ - it('getBundleInfo_1500', 0, async function (done) { + it('testGetBundleInfoCurrentUserIdPromise', 0, async function (done) { let bundleOptions = { userId: userId }; let dataInfo = await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, bundleOptions); - console.info("getBundleInfo_1500 start --------"); - console.info("getBundleInfo_1500 dataInfo ====" + dataInfo); + console.info("testGetBundleInfoCurrentUserIdPromise start --------"); + console.info("testGetBundleInfoCurrentUserIdPromise dataInfo ====" + dataInfo); expect(dataInfo.name).assertEqual(NAME1); expect(dataInfo.vendor).assertEqual("example"); expect(dataInfo.versionCode).assertEqual(VERSIONCODE1); @@ -513,22 +513,22 @@ describe('ActsBundleManagerTest', function () { expect(dataInfo.appInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1); } expect(dataInfo.appInfo.enabled).assertEqual(true); - console.info("getBundleInfo_1500 end --------"); + console.info("testGetBundleInfoCurrentUserIdPromise end --------"); done(); }) /** - * @tc.number getBundleInfo_1600 - * @tc.name BUNDLE::getBundleInfo + * @tc.number getBundleInfo_1500 + * @tc.name testGetBundleInfoCurrentUserIdCallback * @tc.desc Test getBundleInfo interface with current userId (by callback). */ - it('getBundleInfo_1600', 0, async function (done) { + it('testGetBundleInfoCurrentUserIdCallback', 0, async function (done) { let bundleOptions = { userId: userId }; demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, bundleOptions, (err, dataInfo) => { - console.info("getBundleInfo_1600 start --------"); - console.info("getBundleInfo_1600 dataInfo ====" + dataInfo); + console.info("testGetBundleInfoCurrentUserIdCallback start --------"); + console.info("testGetBundleInfoCurrentUserIdCallback dataInfo ====" + dataInfo); expect(dataInfo.name).assertEqual(NAME1); expect(dataInfo.vendor).assertEqual("example"); expect(dataInfo.versionCode).assertEqual(VERSIONCODE1); @@ -561,46 +561,46 @@ describe('ActsBundleManagerTest', function () { expect(dataInfo.appInfo.moduleInfos[j].moduleName).assertEqual("entry"); expect(dataInfo.appInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1); } - console.info("getBundleInfo_1600 end --------"); + console.info("testGetBundleInfoCurrentUserIdCallback end --------"); done(); }); }) /** - * @tc.number getBundleInfo_1700 - * @tc.name BUNDLEMGR::getBundleInfo + * @tc.number getBundleInfo_2100 + * @tc.name testGetBundleInfoOtherUserIdPromise * @tc.desc Test getBundleInfo interface with other userId (by promise). */ - it('getBundleInfo_1700', 0, async function (done) { + it('testGetBundleInfoOtherUserIdPromise', 0, async function (done) { await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, { userId: 1 }).then(data => { - console.info("getBundleInfo_1700 success" + JSON.stringify(data)); + console.info("testGetBundleInfoOtherUserIdPromise success" + JSON.stringify(data)); expect(data).assertFail(); done(); }).catch(err => { - console.info("getBundleInfo_1700 err" + JSON.stringify(err)); + console.info("testGetBundleInfoOtherUserIdPromise err" + JSON.stringify(err)); expect(err).assertEqual(1); done(); }); }) /** - * @tc.number getBundleInfo_1800 - * @tc.name BUNDLE::getBundleInfo + * @tc.number getBundleInfo_2200 + * @tc.name testGetBundleInfoOtherUserIdCallback * @tc.desc Test getBundleInfo interface with other userId (by callback). */ - it('getBundleInfo_1800', 0, async function (done) { + it('testGetBundleInfoOtherUserIdCallback', 0, async function (done) { await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, { userId: 1 }, (err, dataInfo) => { if (err) { - console.info("getBundleInfo_1800 err" + JSON.stringify(err)); + console.info("testGetBundleInfoOtherUserIdCallback err" + JSON.stringify(err)); expect(err).assertEqual(1); done(); return; } - console.info("getBundleInfo_1800 success" + JSON.stringify(dataInfo)); + console.info("testGetBundleInfoOtherUserIdCallback success" + JSON.stringify(dataInfo)); expect(dataInfo).assertFail(); done(); }); @@ -608,10 +608,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getApplicationInfos_0100 - * @tc.name BUNDLE::getApplicationInfos + * @tc.name testGetAllApplicationInfoPromise * @tc.desc Test getApplicationInfos interfaces with one hap. */ - it('getApplicationInfos_0100', 0, async function (done) { + it('testGetAllApplicationInfoPromise', 0, async function (done) { let datainfo = await demo.getAllApplicationInfo(demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId); checkgetApplicationInfos(datainfo); done(); @@ -645,10 +645,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getApplicationInfos_0600 - * @tc.name BUNDLE::getApplicationInfos + * @tc.name testGetAllApplicationInfoCallback * @tc.desc Test getApplicationInfos interfaces with one hap. */ - it('getApplicationInfos_0600', 0, async function (done) { + it('testGetAllApplicationInfoCallback', 0, async function (done) { await demo.getAllApplicationInfo(demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId, (error, datainfo) => { expect(datainfo.length).assertLarger(0); @@ -668,10 +668,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getBundleInfos_0100 - * @tc.name BUNDLE::getBundleInfos + * @tc.name testGetAllBundleInfoPromise * @tc.desc Test getBundleInfos interfaces with one hap. */ - it('getBundleInfos_0100', 0, async function (done) { + it('testGetAllBundleInfoPromise', 0, async function (done) { let data = await demo.getAllBundleInfo(demo.BundleFlag.GET_BUNDLE_DEFAULT); expect(typeof data).assertEqual(OBJECT); expect(data.length).assertLarger(0); @@ -692,10 +692,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getApplicationInfo_0100 - * @tc.name BUNDLE::getApplicationInfo + * @tc.name testGetApplicationInfoMetaDataPromise * @tc.desc Test getApplicationInfo interfaces with one hap. (by promise) */ - it('getApplicationInfo_0100', 0, async function (done) { + it('testGetApplicationInfoMetaDataPromise', 0, async function (done) { await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION | demo.BundleFlag.GET_APPLICATION_INFO_WITH_METADATA, userId).then(datainfo => { @@ -731,22 +731,22 @@ describe('ActsBundleManagerTest', function () { }) /** - * @tc.number getApplicationInfo_0200 - * @tc.name BUNDLE::getApplicationInfo + * @tc.number getApplicationInfo_0600 + * @tc.name testGetApplicationInfoMetaDataCallback * @tc.desc Test getApplicationInfo interfaces with one hap. (by callback) */ - it('getApplicationInfo_0200', 0, async function (done) { + it('testGetApplicationInfoMetaDataCallback', 0, async function (done) { await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION | demo.BundleFlag.GET_APPLICATION_INFO_WITH_METADATA, userId, (error, datainfo) => { if (error) { - console.info("getApplicationInfo_0200 fail:" + JSON.stringify(error)); + console.info("testGetApplicationInfoMetaDataCallback fail:" + JSON.stringify(error)); expect(error).assertFail(); done(); return; } expect(typeof datainfo).assertEqual(OBJECT); - console.info("getApplicationInfo_0200 success:" + JSON.stringify(datainfo)); + console.info("testGetApplicationInfoMetaDataCallback success:" + JSON.stringify(datainfo)); expect(datainfo.moduleSourceDirs.length).assertLarger(0); expect(datainfo.moduleInfos.length).assertLarger(0); expect(datainfo.name).assertEqual(NAME1); @@ -773,14 +773,14 @@ describe('ActsBundleManagerTest', function () { }) /** - * @tc.number getApplicationInfo_0300 - * @tc.name BUNDLE::getApplicationInfo + * @tc.number getApplicationInfo_0200 + * @tc.name testGetApplicationInfoTwoHapPromise * @tc.desc Test getApplicationInfo interfaces with two haps. (by promise) */ - it('getApplicationInfo_0300', 0, async function (done) { + it('testGetApplicationInfoTwoHapPromise', 0, async function (done) { let datainfo = await demo.getApplicationInfo(NAME2, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId); - console.info("getApplicationInfo_0300 result" + JSON.stringify(datainfo)); + console.info("testGetApplicationInfoTwoHapPromise result" + JSON.stringify(datainfo)); expect(typeof datainfo).assertEqual(OBJECT); expect(datainfo.name.length).assertLarger(0); expect(datainfo.description.length).assertLarger(0); @@ -810,14 +810,14 @@ describe('ActsBundleManagerTest', function () { }) /** - * @tc.number getApplicationInfo_0400 - * @tc.name BUNDLE::getApplicationInfo + * @tc.number getApplicationInfo_0700 + * @tc.name testGetApplicationInfoTwoHapCallback * @tc.desc Test getApplicationInfo interfaces with two haps. (by callback) */ - it('getApplicationInfo_0400', 0, async function (done) { + it('testGetApplicationInfoTwoHapCallback', 0, async function (done) { await demo.getApplicationInfo(NAME2, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId, (error, datainfo) => { - console.info("getApplicationInfo_0400 result" + JSON.stringify(datainfo)); + console.info("testGetApplicationInfoTwoHapCallback result" + JSON.stringify(datainfo)); expect(typeof datainfo).assertEqual(OBJECT); expect(datainfo.name.length).assertLarger(0); expect(datainfo.description.length).assertLarger(0); @@ -848,14 +848,14 @@ describe('ActsBundleManagerTest', function () { }) /** - * @tc.number getApplicationInfo_0500 - * @tc.name BUNDLE::getApplicationInfo + * @tc.number getApplicationInfo_0300 + * @tc.name testGetApplicationInfoThereHapPromise * @tc.desc Test getApplicationInfo interfaces with three haps. (by promise) */ - it('getApplicationInfo_0500', 0, async function (done) { + it('testGetApplicationInfoThereHapPromise', 0, async function (done) { let datainfo = await demo.getApplicationInfo(NAME3, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId); - console.info("getApplicationInfo_0500 result" + JSON.stringify(datainfo)); + console.info("testGetApplicationInfoThereHapPromise result" + JSON.stringify(datainfo)); expect(datainfo.name).assertEqual(NAME3); expect(datainfo.label).assertEqual("$string:app_name"); expect(datainfo.icon).assertEqual("$media:icon"); @@ -872,14 +872,14 @@ describe('ActsBundleManagerTest', function () { }) /** - * @tc.number getApplicationInfo_0600 - * @tc.name BUNDLE::getApplicationInfo + * @tc.number getApplicationInfo_2000 + * @tc.name testGetApplicationInfoThereHapCallback * @tc.desc Test getApplicationInfo interfaces with three haps. (by callback) */ - it('getApplicationInfo_0600', 0, async function (done) { + it('testGetApplicationInfoThereHapCallback', 0, async function (done) { await demo.getApplicationInfo(NAME3, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId, (error, datainfo) => { - console.info("getApplicationInfo_0600 result" + JSON.stringify(datainfo)); + console.info("testGetApplicationInfoThereHapCallback result" + JSON.stringify(datainfo)); expect(datainfo.name).assertEqual(NAME3); expect(datainfo.label).assertEqual("$string:app_name"); expect(datainfo.icon).assertEqual("$media:icon"); @@ -897,56 +897,56 @@ describe('ActsBundleManagerTest', function () { }) /** - * @tc.number getApplicationInfo_0700 - * @tc.name BUNDLE::getApplicationInfo + * @tc.number getApplicationInfo_0400 + * @tc.name testGetApplicationInfoNotExistCallback * @tc.desc Test getApplicationInfo interfaces with error hap. (by promise) */ - it('getApplicationInfo_0700', 0, async function (done) { + it('testGetApplicationInfoNotExistCallback', 0, async function (done) { await demo.getApplicationInfo(ERROR, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId).then(datainfo => { - console.info("getApplicationInfo_0700 success" + JSON.stringify(datainfo)); + console.info("testGetApplicationInfoNotExistCallback success" + JSON.stringify(datainfo)); expect(datainfo).assertFail(); done(); }).catch(err => { - console.info("getApplicationInfo_0700 err" + JSON.stringify(err)); + console.info("testGetApplicationInfoNotExistCallback err" + JSON.stringify(err)); expect(err).assertEqual(1); done(); }); }) /** - * @tc.number getApplicationInfo_0800 - * @tc.name BUNDLE::getApplicationInfo + * @tc.number getApplicationInfo_0900 + * @tc.name testGetApplicationInfoNotExistPromise * @tc.desc Test getApplicationInfo interfaces with error hap. (by callback) */ - it('getApplicationInfo_0800', 0, async function (done) { + it('testGetApplicationInfoNotExistPromise', 0, async function (done) { await demo.getApplicationInfo(ERROR, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId, (error, datainfo) => { if (error) { - console.info("getApplicationInfo_0800 fail" + JSON.stringify(error)); + console.info("testGetApplicationInfoNotExistPromise fail" + JSON.stringify(error)); expect(error).assertEqual(1); done(); return; } - console.info("getApplicationInfo_0800 success" + JSON.stringify(datainfo)); + console.info("testGetApplicationInfoNotExistPromise success" + JSON.stringify(datainfo)); expect(datainfo).assertFail(); done(); }) }) /** - * @tc.number getApplicationInfo_0900 - * @tc.name BUNDLE::getApplicationInfo + * @tc.number getApplicationInfo_0500 + * @tc.name testGetApplicationInfoInvalidParamPromise * @tc.desc Test getApplicationInfo interfaces with none hap. (by promise) */ - it('getApplicationInfo_0900', 0, async function (done) { + it('testGetApplicationInfoInvalidParamPromise', 0, async function (done) { await demo.getApplicationInfo('', demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId).then(datainfo => { - console.info("getApplicationInfo_0900 success" + JSON.stringify(datainfo)); + console.info("testGetApplicationInfoInvalidParamPromise success" + JSON.stringify(datainfo)); expect(datainfo).assertFail(); done(); }).catch(error => { - console.info("getApplicationInfo_0900 err" + JSON.stringify(error)); + console.info("testGetApplicationInfoInvalidParamPromise err" + JSON.stringify(error)); expect(error).assertEqual(1); done(); }); @@ -954,19 +954,19 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getApplicationInfo_1000 - * @tc.name BUNDLE::getApplicationInfo + * @tc.name testGetApplicationInfoInvalidParamCallback * @tc.desc Test getApplicationInfo interfaces with none hap. (by callback) */ - it('getApplicationInfo_1000', 0, async function (done) { + it('testGetApplicationInfoInvalidParamCallback', 0, async function (done) { await demo.getApplicationInfo('', demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId, (error, datainfo) => { if (error) { - console.info("getApplicationInfo_1000 fail" + JSON.stringify(error)); + console.info("testGetApplicationInfoInvalidParamCallback fail" + JSON.stringify(error)); expect(error).assertEqual(1); done(); return; } - console.info("getApplicationInfo_1000 success" + JSON.stringify(datainfo)); + console.info("testGetApplicationInfoInvalidParamCallback success" + JSON.stringify(datainfo)); expect(datainfo).assertFail(); done(); }); @@ -974,10 +974,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getApplicationInfo_1100 - * @tc.name BUNDLE::getApplicationInfo + * @tc.name testGetApplicationInfoDifferentParamPromise * @tc.desc Test getApplicationInfo interfaces with one hap and different param. (by promise) */ - it('getApplicationInfo_1100', 0, async function (done) { + it('testGetApplicationInfoDifferentParamPromise', 0, async function (done) { await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_BUNDLE_DEFAULT, userId).then(datainfo => { console.info("getApplicationInfo_1100 success" + JSON.stringify(datainfo)); expect(typeof datainfo).assertEqual(OBJECT); @@ -992,7 +992,7 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.supportedModes).assertEqual(0); done(); }).catch(err => { - console.info("getApplicationInfo_1100 fail" + JSON.stringify(err)); + console.info("testGetApplicationInfoDifferentParamPromise fail" + JSON.stringify(err)); expect(err).assertFail(); done(); }) @@ -1000,18 +1000,18 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getApplicationInfo_1200 - * @tc.name BUNDLE::getApplicationInfo + * @tc.name testGetApplicationInfoDifferentParamCallback * @tc.desc Test getApplicationInfo interfaces with one hap and different param. (by callback) */ - it('getApplicationInfo_1200', 0, async function (done) { + it('testGetApplicationInfoDifferentParamCallback', 0, async function (done) { await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_BUNDLE_DEFAULT, userId, (error, datainfo) => { if (error) { - console.info("getApplicationInfo_1200 fail" + JSON.stringify(error)); + console.info("testGetApplicationInfoDifferentParamCallback fail" + JSON.stringify(error)); expect(error).assertFail(); done(); return; } - console.info("getApplicationInfo_1200 success" + JSON.stringify(datainfo)); + console.info("testGetApplicationInfoDifferentParamCallback success" + JSON.stringify(datainfo)); expect(typeof datainfo).assertEqual(OBJECT); expect(datainfo.name).assertEqual(NAME1); expect(datainfo.label).assertEqual("$string:app_name"); @@ -1028,13 +1028,13 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getApplicationInfo_1300 - * @tc.name BUNDLE::getApplicationInfo + * @tc.name testGetApplicationInfoPromise * @tc.desc Test getApplicationInfo interfaces with one hap. (by promise) */ - it('getApplicationInfo_1300', 0, async function (done) { + it('testGetApplicationInfoPromise', 0, async function (done) { await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId).then(datainfo => { - console.info("getApplicationInfo_1300 success:" + JSON.stringify(datainfo)); + console.info("testGetApplicationInfoPromise success:" + JSON.stringify(datainfo)); expect(typeof datainfo).assertEqual(OBJECT); expect(datainfo.name).assertEqual(NAME1); expect(datainfo.label).assertEqual("$string:app_name"); @@ -1052,7 +1052,7 @@ describe('ActsBundleManagerTest', function () { } done(); }).catch(error => { - console.info("getApplicationInfo_1300 fail:" + JSON.stringify(error)); + console.info("testGetApplicationInfoPromise fail:" + JSON.stringify(error)); expect(error).assertFail(); done(); }) @@ -1060,19 +1060,19 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getApplicationInfo_1400 - * @tc.name BUNDLE::getApplicationInfo + * @tc.name testGetApplicationInfoCallback * @tc.desc Test getApplicationInfo interfaces with one hap. (by callback) */ - it('getApplicationInfo_1400', 0, async function (done) { + it('testGetApplicationInfoCallback', 0, async function (done) { await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId, (error, datainfo) => { if (error) { - console.info("getApplicationInfo_1400 fail:" + JSON.stringify(error)); + console.info("testGetApplicationInfoCallback fail:" + JSON.stringify(error)); expect(error).assertFail(); done(); return; } - console.info("getApplicationInfo_1400 success:" + JSON.stringify(datainfo)); + console.info("testGetApplicationInfoCallback success:" + JSON.stringify(datainfo)); expect(typeof datainfo).assertEqual(OBJECT); expect(datainfo.name).assertEqual(NAME1); expect(datainfo.label).assertEqual("$string:app_name"); @@ -1094,10 +1094,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getBundleInfos_0600 - * @tc.name BUNDLE::getBundleInfos + * @tc.name testGetAllBundleInfoCallback * @tc.desc Test getBundleInfos interfaces with one hap. */ - it('getBundleInfos_0600', 0, async function (done) { + it('testGetAllBundleInfoCallback', 0, async function (done) { await demo.getAllBundleInfo(demo.BundleFlag.GET_BUNDLE_DEFAULT, (error, data) => { expect(typeof data).assertEqual(OBJECT); for (let i = 0; i < data.length; i++) { @@ -1118,10 +1118,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getApplicationInfos_0200 - * @tc.name BUNDLE::getApplicationInfos + * @tc.name testGetAllApplicationInfoTwoHapPromise * @tc.desc Test getApplicationInfos interfaces with two haps. */ - it('getApplicationInfos_0200', 0, async function (done) { + it('testGetAllApplicationInfoTwoHapPromise', 0, async function (done) { let datainfo = await demo.getAllApplicationInfo(demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId); console.info("==========ActsBmsGetInfosSecondScene is ==========" + JSON.stringify(datainfo)); checkgetApplicationInfos(datainfo); @@ -1130,10 +1130,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getApplicationInfos_0400 - * @tc.name BUNDLE::getApplicationInfos + * @tc.name testGetAllApplicationInfoDifferentParamPromise * @tc.desc Test getApplicationInfos interfaces with two haps and different param. */ - it('getApplicationInfos_0400', 0, async function (done) { + it('testGetAllApplicationInfoDifferentParamPromise', 0, async function (done) { let datainfo = await demo.getAllApplicationInfo(demo.BundleFlag.GET_BUNDLE_DEFAULT, userId); expect(datainfo.length).assertLarger(0); checkgetApplicationInfos(datainfo); @@ -1142,10 +1142,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getApplicationInfos_0700 - * @tc.name BUNDLE::getApplicationInfos + * @tc.name testGetAllApplicationInfoTwoHapCallback * @tc.desc Test getApplicationInfos interfaces with two haps. */ - it('getApplicationInfos_0700', 0, async function (done) { + it('testGetAllApplicationInfoTwoHapCallback', 0, async function (done) { await demo.getAllApplicationInfo(demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId, (error, datainfo) => { for (let i = 0; i < datainfo.length; i++) { @@ -1170,10 +1170,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getApplicationInfos_0800 - * @tc.name BUNDLE::getApplicationInfos + * @tc.name testGetAllApplicationInfoThereHapCallback * @tc.desc Test getApplicationInfos interfaces with three haps. */ - it('getApplicationInfos_0800', 0, async function (done) { + it('testGetAllApplicationInfoThereHapCallback', 0, async function (done) { await demo.getAllApplicationInfo(demo.BundleFlag.GET_BUNDLE_DEFAULT, userId, (error, datainfo) => { for (let i = 0; i < datainfo.length; i++) { expect(datainfo[i].name.length).assertLarger(0); @@ -1197,10 +1197,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getApplicationInfos_0900 - * @tc.name BUNDLE::getApplicationInfos + * @tc.name testGetAllApplicationInfoDifferentParamCallback * @tc.desc Test getApplicationInfos interfaces with two haps and different param. */ - it('getApplicationInfos_0900', 0, async function (done) { + it('testGetAllApplicationInfoDifferentParamCallback', 0, async function (done) { await demo.getAllApplicationInfo(demo.BundleFlag.GET_BUNDLE_DEFAULT, userId, (error, datainfo) => { for (let i = 0; i < datainfo.length; i++) { expect(datainfo[i].name.length).assertLarger(0); @@ -1224,10 +1224,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getBundleInfos_0200 - * @tc.name BUNDLE::getBundleInfos + * @tc.name testGetAllBundleInfoTwoHapPromise * @tc.desc Test getBundleInfos interfaces with two haps. */ - it('getBundleInfos_0200', 0, async function (done) { + it('testGetAllBundleInfoTwoHapPromise', 0, async function (done) { let data = await demo.getAllBundleInfo(demo.BundleFlag.GET_BUNDLE_DEFAULT); expect(typeof data).assertEqual(OBJECT); for (let i = 0; i < data.length; i++) { @@ -1247,10 +1247,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getBundleInfos_0400 - * @tc.name BUNDLE::getBundleInfos + * @tc.name testGetAllBundleInfoTwoHapDifferentParamPromise * @tc.desc Test getBundleInfos interfaces with two haps and different param. */ - it('getBundleInfos_0400', 0, async function (done) { + it('testGetAllBundleInfoTwoHapDifferentParamPromise', 0, async function (done) { let data = await demo.getAllBundleInfo(demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES); expect(typeof data).assertEqual(OBJECT); for (let i = 0; i < data.length; i++) { @@ -1271,10 +1271,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getBundleInfos_0700 - * @tc.name BUNDLE::getBundleInfos + * @tc.name testGetAllBundleInfoTwoHapCallback * @tc.desc Test getBundleInfos interfaces with two haps. */ - it('getBundleInfos_0700', 0, async function (done) { + it('testGetAllBundleInfoTwoHapCallback', 0, async function (done) { await demo.getAllBundleInfo(demo.BundleFlag.GET_BUNDLE_DEFAULT, (error, data) => { expect(typeof data).assertEqual(OBJECT); for (let i = 0; i < data.length; i++) { @@ -1295,10 +1295,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getBundleInfos_0900 - * @tc.name BUNDLE::getBundleInfos + * @tc.name testGetAllBundleInfoTwoHapDifferentParamCallback * @tc.desc Test getBundleInfos interfaces with two haps and different param. */ - it('getBundleInfos_0900', 0, async function (done) { + it('testGetAllBundleInfoTwoHapDifferentParamCallback', 0, async function (done) { await demo.getAllBundleInfo(demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, (error, data) => { expect(typeof data).assertEqual(OBJECT); for (let i = 0; i < data.length; i++) { @@ -1319,10 +1319,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getBundleInfos_0300 - * @tc.name BUNDLE::getBundleInfos + * @tc.name testGetAllBundleInfoThereHapPromise * @tc.desc Test getBundleInfos interfaces with three haps. */ - it('getBundleInfos_0300', 0, async function (done) { + it('testGetAllBundleInfoThereHapPromise', 0, async function (done) { let data = await demo.getAllBundleInfo(demo.BundleFlag.GET_BUNDLE_DEFAULT); for (let i = 0; i < data.length; i++) { expect(data[i].name.length).assertLarger(0); @@ -1341,10 +1341,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getBundleInfos_0500 - * @tc.name BUNDLE::getBundleInfos + * @tc.name testGetAllBundleInfoThereHapDifferentParamPromise * @tc.desc Test getBundleInfos interfaces with three haps and different param. */ - it('getBundleInfos_0500', 0, async function (done) { + it('testGetAllBundleInfoThereHapDifferentParamPromise', 0, async function (done) { let data = await demo.getAllBundleInfo(demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES); for (let i = 0; i < data.length; i++) { expect(data[i].name.length).assertLarger(0); @@ -1363,10 +1363,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number getBundleInfos_0800 - * @tc.name BUNDLE::getBundleInfos + * @tc.name testGetAllBundleInfoThereHapCallback * @tc.desc Test getBundleInfos interfaces with three haps. */ - it('getBundleInfos_0800', 0, async function (done) { + it('testGetAllBundleInfoThereHapCallback', 0, async function (done) { await demo.getAllBundleInfo(demo.BundleFlag.GET_BUNDLE_DEFAULT, (error, data) => { for (let i = 0; i < data.length; i++) { expect(data[i].name.length).assertLarger(0); @@ -1387,10 +1387,10 @@ describe('ActsBundleManagerTest', function () { /** * @tc.number queryAbilityByWant_0100 - * @tc.name BUNDLE::queryAbilityByWant + * @tc.name testQueryAbilityByWantPromise * @tc.desc Test queryAbilityByWant interfaces with none hap. (by promise) */ - it('queryAbilityByWant_0100', 0, async function (done) { + it('testQueryAbilityByWantPromise', 0, async function (done) { await demo.queryAbilityByWant( { "bundleName": "com.example.myapplication1", @@ -1402,7 +1402,7 @@ describe('ActsBundleManagerTest', function () { expect(data.length).assertLarger(0); for (let i = 0, len = data.length; i < len; i++) { let datainfo = data[i]; - console.info("queryAbilityByWant_0100 success:" + JSON.stringify(datainfo)); + console.info("testQueryAbilityByWantPromise success:" + JSON.stringify(datainfo)); expect(datainfo.name).assertEqual("com.example.myapplication1.MainAbility"); expect(datainfo.label).assertEqual("$string:app_name"); expect(datainfo.description).assertEqual(DESCRIPTION); @@ -1432,18 +1432,18 @@ describe('ActsBundleManagerTest', function () { } done(); }).catch(err => { - console.info("queryAbilityByWant_0100 err" + JSON.stringify(err)); + console.info("testQueryAbilityByWantPromise err" + JSON.stringify(err)); expect(err).assertFail(); done(); }) }) /** - * @tc.number queryAbilityByWant_0200 - * @tc.name BUNDLE::queryAbilityByWant + * @tc.number queryAbilityByWant_0500 + * @tc.name testQueryAbilityByWantCallback * @tc.desc Test queryAbilityByWant interfaces with none hap. (by callback) */ - it('queryAbilityByWant_0200', 0, async function (done) { + it('testQueryAbilityByWantCallback', 0, async function (done) { demo.queryAbilityByWant( { "bundleName": "com.example.myapplication1", @@ -1453,7 +1453,7 @@ describe('ActsBundleManagerTest', function () { demo.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, userId, (err, data) => { if (err) { - console.info("queryAbilityByWant_0200 err" + JSON.stringify(err)); + console.info("testQueryAbilityByWantCallback err" + JSON.stringify(err)); expect(err).assertFail(); done(); return; @@ -1461,7 +1461,7 @@ describe('ActsBundleManagerTest', function () { expect(data.length).assertLarger(0); for (let i = 0, len = data.length; i < len; i++) { let datainfo = data[i]; - console.info("queryAbilityByWant_0200 success:" + JSON.stringify(datainfo)); + console.info("testQueryAbilityByWantCallback success:" + JSON.stringify(datainfo)); expect(datainfo.name).assertEqual("com.example.myapplication1.MainAbility"); expect(datainfo.label).assertEqual("$string:app_name"); expect(datainfo.description).assertEqual(DESCRIPTION); @@ -1494,11 +1494,11 @@ describe('ActsBundleManagerTest', function () { }) /** - * @tc.number queryAbilityByWant_0300 - * @tc.name BUNDLE::queryAbilityByWant + * @tc.number queryAbilityByWant_0200 + * @tc.name testQueryAbilityByWantTwoHapPromise * @tc.desc Test queryAbilityByWant interfaces with two haps. (by promise) */ - it('queryAbilityByWant_0300', 0, async function (done) { + it('testQueryAbilityByWantTwoHapPromise', 0, async function (done) { let data = await demo.queryAbilityByWant( { "bundleName": "com.example.myapplication2", @@ -1507,7 +1507,7 @@ describe('ActsBundleManagerTest', function () { expect(data.length).assertLarger(0); for (let i = 0, len = data.length; i < len; i++) { let datainfo = data[i]; - console.info("queryAbilityByWant_0300 success:" + JSON.stringify(datainfo)); + console.info("testQueryAbilityByWantTwoHapPromise success:" + JSON.stringify(datainfo)); expect(datainfo.name.length).assertLarger(0); expect(datainfo.label).assertEqual("$string:app_name"); expect(datainfo.description).assertEqual(DESCRIPTION); @@ -1535,11 +1535,11 @@ describe('ActsBundleManagerTest', function () { }) /** - * @tc.number queryAbilityByWant_0400 - * @tc.name BUNDLE::queryAbilityByWant + * @tc.number queryAbilityByWant_0600 + * @tc.name testQueryAbilityByWantTwoHapCallback * @tc.desc Test queryAbilityByWant interfaces with two haps. (by callback) */ - it('queryAbilityByWant_0400', 0, async function (done) { + it('testQueryAbilityByWantTwoHapCallback', 0, async function (done) { await demo.queryAbilityByWant( { "bundleName": "com.example.myapplication2", @@ -1548,7 +1548,7 @@ describe('ActsBundleManagerTest', function () { expect(data.length).assertLarger(0); for (let i = 0, len = data.length; i < len; i++) { let datainfo = data[i]; - console.info("queryAbilityByWant_0400 success:" + JSON.stringify(datainfo)); + console.info("testQueryAbilityByWantTwoHapCallback success:" + JSON.stringify(datainfo)); expect(datainfo.name.length).assertLarger(0); expect(datainfo.label).assertEqual("$string:app_name"); expect(datainfo.description).assertEqual(DESCRIPTION); @@ -1577,18 +1577,18 @@ describe('ActsBundleManagerTest', function () { }) /** - * @tc.number queryAbilityByWant_0500 - * @tc.name BUNDLE::queryAbilityByWant + * @tc.number queryAbilityByWant_0300 + * @tc.name testQueryAbilityByWantThereHapPromise * @tc.desc Test queryAbilityByWant interfaces with three haps. (by promise) */ - it('queryAbilityByWant_0500', 0, async function (done) { + it('testQueryAbilityByWantThereHapPromise', 0, async function (done) { await demo.queryAbilityByWant({ entities: ['entity.system.home', 'entitiesentities'] }, 4, userId).then(data => { checkAbilityInfo0500(data) done(); }).catch(err => { - console.info("queryAbilityByWant_0500 err" + JSON.stringify(err)); + console.info("testQueryAbilityByWantThereHapPromise err" + JSON.stringify(err)); expect(err).assertFail(); done(); }) @@ -1598,7 +1598,7 @@ describe('ActsBundleManagerTest', function () { let queryResultCount = 0; for (let i = 0, len = data.length; i < len; i++) { let datainfo = data[i]; - console.info("queryAbilityByWant_0500 success:" + JSON.stringify(datainfo)); + console.info("testQueryAbilityByWantThereHapPromise success:" + JSON.stringify(datainfo)); if (datainfo.bundleName == NAME3) { expect(datainfo.name).assertEqual("com.example.myapplication.MainAbility"); expect(datainfo.label).assertEqual("$string:app_name"); @@ -1643,17 +1643,17 @@ describe('ActsBundleManagerTest', function () { } /** - * @tc.number queryAbilityByWant_0600 - * @tc.name BUNDLE::queryAbilityByWant + * @tc.number queryAbilityByWant_0700 + * @tc.name testQueryAbilityByWantThereHapCallback * @tc.desc Test queryAbilityByWant interfaces with three haps. (by callback) */ - it('queryAbilityByWant_0600', 0, async function (done) { + it('testQueryAbilityByWantThereHapCallback', 0, async function (done) { await demo.queryAbilityByWant( { entities: ['entity.system.home', 'entitiesentities'] }, 4, userId, (err, data) => { if (err) { - console.info("queryAbilityByWant_0600 err" + JSON.stringify(err)); + console.info("testQueryAbilityByWantThereHapCallback err" + JSON.stringify(err)); expect(err).assertFail(); done(); return; @@ -1667,7 +1667,7 @@ describe('ActsBundleManagerTest', function () { let queryResultCount = 0; for (let i = 0, len = data.length; i < len; i++) { let datainfo = data[i]; - console.info("queryAbilityByWant_0600 success:" + JSON.stringify(datainfo)); + console.info("testQueryAbilityByWantThereHapCallback success:" + JSON.stringify(datainfo)); if (datainfo.bundleName == NAME3) { expect(datainfo.name).assertEqual("com.example.myapplication.MainAbility"); expect(datainfo.label).assertEqual("$string:app_name"); @@ -1708,85 +1708,85 @@ describe('ActsBundleManagerTest', function () { } /** - * @tc.number queryAbilityByWant_0700 - * @tc.name BUNDLE::queryAbilityByWant + * @tc.number queryAbilityByWant_0800 + * @tc.name testQueryAbilityByWantNotExistHapPromise * @tc.desc Test queryAbilityByWant interfaces with one hap. (by promise) */ - it('queryAbilityByWant_0700', 0, async function (done) { + it('testQueryAbilityByWantNotExistHapPromise', 0, async function (done) { await demo.queryAbilityByWant( { "bundleName": "wrong name", "abilityName": "com.example.myapplication1.MainAbility" }, demo.BundleFlag.GET_BUNDLE_DEFAULT, userId).then(datainfo => { - console.info("queryAbilityByWant_0700 dataInfo : ===========" + datainfo); + console.info("testQueryAbilityByWantNotExistHapPromise dataInfo : ===========" + datainfo); expect(datainfo).assertFail(); done(); }).catch(err => { - console.info("queryAbilityByWant_0700 err : ===========" + err); + console.info("testQueryAbilityByWantNotExistHapPromise err : ===========" + err); expect(err).assertEqual(1); done(); }) }) /** - * @tc.number queryAbilityByWant_0800 - * @tc.name BUNDLE::queryAbilityByWant + * @tc.number queryAbilityByWant_0900 + * @tc.name testQueryAbilityByWantNotExistHapCallback * @tc.desc Test queryAbilityByWant interfaces with one hap. (by callback) */ - it('queryAbilityByWant_0800', 0, async function (done) { + it('testQueryAbilityByWantNotExistHapCallback', 0, async function (done) { await demo.queryAbilityByWant( { "bundleName": "wrong name", "abilityName": "com.example.myapplication1.MainAbility" }, demo.BundleFlag.GET_BUNDLE_DEFAULT, userId, (err, datainfo) => { if (err) { - console.info("queryAbilityByWant_0800 err : ===========" + err); + console.info("testQueryAbilityByWantNotExistHapCallback err : ===========" + err); expect(err).assertEqual(1); done(); return; } - console.info("queryAbilityByWant_0800 dataInfo : ===========" + datainfo); + console.info("testQueryAbilityByWantNotExistHapCallback dataInfo : ===========" + datainfo); expect(datainfo).assertFail(); done(); }) }) /** - * @tc.number queryAbilityByWant_0900 - * @tc.name BUNDLE::queryAbilityByWant - * @tc.desc Test queryAbilityByWant interfaces with system hap. (by callback) + * @tc.number queryAbilityByWant_0400 + * @tc.name testQueryAbilityByWantSystemHapPromise + * @tc.desc Test queryAbilityByWant interfaces with system hap. (by promise) */ - it('queryAbilityByWant_0900', 0, async function (done) { + it('testQueryAbilityByWantSystemHapPromise', 0, async function (done) { await demo.queryAbilityByWant( { bundleName: "wrong name", abilityName: "wrong name", }, 0, userId).then(datainfo => { - console.info("queryAbilityByWant_0900 dataInfo : ===========" + datainfo); + console.info("testQueryAbilityByWantSystemHapPromise dataInfo : ===========" + datainfo); expect(datainfo.length).assertLarger(0); done(); }).catch(err => { - console.info("queryAbilityByWant_0900 err : ===========" + err); + console.info("testQueryAbilityByWantSystemHapPromise err : ===========" + err); expect(err).assertEqual(1); done(); }) }) /** - * @tc.number queryAbilityByWant_1000 - * @tc.name BUNDLE::queryAbilityByWant + * @tc.number queryAbilityByWant_1100 + * @tc.name testQueryAbilityByWantSystemHapCallback * @tc.desc Test queryAbilityByWant interfaces with system hap. (by callback) */ - it('queryAbilityByWant_1000', 0, async function (done) { - demo.queryAbilityByWant( + it('testQueryAbilityByWantSystemHapCallback', 0, async function (done) { + demo.queryAbilityByWant( { bundleName: "wrong name", abilityName: "wrong name", }, 0, userId, OnReceiveEvent); function OnReceiveEvent(err, datainfo) { - console.info("queryAbilityByWant_1000 err : ===========" + err); - console.info("queryAbilityByWant_1000 dataInfo : ===========" + datainfo); + console.info("testQueryAbilityByWantSystemHapCallback err : ===========" + err); + console.info("testQueryAbilityByWantSystemHapCallback dataInfo : ===========" + datainfo); expect(err).assertEqual(1); expect(datainfo.length).assertLarger(0); done(); diff --git a/commonlibrary/BUILD.gn b/commonlibrary/BUILD.gn index 36dcfb3586c9f0d98e8003dd2ac13a4bdd00f6ae..95ed8868633de7abdf57a72ad4a4034eddebef56 100644 --- a/commonlibrary/BUILD.gn +++ b/commonlibrary/BUILD.gn @@ -15,6 +15,9 @@ import("//test/xts/tools/build/suite.gni") group("commonlibrary") { testonly = true if (is_standard_system) { - deps = [ "ets_utils:ets_utils" ] + deps = [ + "ets_utils:ets_utils", + "toolchain:toolchain", + ] } } diff --git a/commonlibrary/toolchain/BUILD.gn b/commonlibrary/toolchain/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..be6736db53843ade7285edfdbcbf87b29ff9f2bc --- /dev/null +++ b/commonlibrary/toolchain/BUILD.gn @@ -0,0 +1,123 @@ +# 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("//build/ohos_var.gni") +import("//test/xts/tools/build/suite.gni") + +group("toolchain") { + testonly = true + deps = [ "//third_party/musl:libctest" ] + if (is_standard_system) { + deps += [ ":tar_dllib" ] + } +} + +action("tar_testcases") { + testonly = true + deps = [ + "libc-test:ActToolChainTest", + "//third_party/musl:libctest", + ] + project_dir = rebase_path(".") + print("project_dir-58:", project_dir) + project_dird = rebase_path("tar_files.py", ".", root_out_dir) + print("project_dird-60:", project_dird) + + project_dirf = project_dir + "/" + project_dird + print("project_dirf-64:", project_dirf) + + test_path = string_replace(project_dirf, "/tar_files.py", "") + script = rebase_path( + "//test/xts/acts/commonlibrary/toolchain/libc-test/tar_files.py") + + _outputs = [ "$target_out_dir/libc-test.tar" ] + outputs = _outputs + + input_path = rebase_path("$test_path/tests/unittest/libc-test") + output_path = rebase_path("$test_path/suites/acts/testcases/libc-test.tar") + + print("root_build_dir-49", root_build_dir) + args = [ + "--input_path", + input_path, + "--output_path", + output_path, + "--temp_path", + "./libc-test", + ] +} + +action("tar_dllib") { + testonly = true + deps = [ ":tar_testcases" ] + project_dir = rebase_path(".") + print("project_dir-58:", project_dir) + project_dird = rebase_path("tar_files.py", ".", root_out_dir) + print("project_dird-60:", project_dird) + + project_dirf = project_dir + "/" + project_dird + print("project_dirf-64:", project_dirf) + + dllib_path = string_replace(project_dirf, "/tar_files.py", "") + script = rebase_path( + "//test/xts/acts/commonlibrary/toolchain/libc-test/tar_files.py") + + if (target_cpu == "arm") { + _outputs = [ "$target_out_dir/libc-test-lib.tar" ] + outputs = _outputs + + input_path = rebase_path("$dllib_path/musl/libc-test-lib") + output_path = + rebase_path("$dllib_path/suites/acts/testcases/libc-test-lib.tar") + + print("root_build_dir-49", root_build_dir) + args = [ + "--input_path", + input_path, + "--output_path", + output_path, + "--temp_path", + "./libc-test-lib", + ] + } else if (target_cpu == "arm64") { + _outputs = [ "$target_out_dir/libc-test-lib.tar" ] + outputs = _outputs + + input_path = rebase_path("$dllib_path/musl/libc-test-lib") + output_path = + rebase_path("$dllib_path/suites/acts/testcases/libc-test-lib.tar") + print("root_build_dir-49", root_build_dir) + args = [ + "--input_path", + input_path, + "--output_path", + output_path, + "--temp_path", + "./libc-test-lib", + ] + } else { + _outputs = [ "" ] + outputs = _outputs + + input_path = rebase_path("") + output_path = rebase_path("") + print("root_build_dir-49", root_build_dir) + args = [ + "--input_path", + input_path, + "--output_path", + output_path, + "--temp_path", + "./libc-test-lib", + ] + } +} diff --git a/commonlibrary/toolchain/libc-test/BUILD.gn b/commonlibrary/toolchain/libc-test/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..6005a9e89a0457c9d7141dfd59b330ef73c7832d --- /dev/null +++ b/commonlibrary/toolchain/libc-test/BUILD.gn @@ -0,0 +1,54 @@ +# 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("//build/test.gni") +import("//test/xts/tools/build/suite.gni") + +#module_output_path = "hits/huks_standard" +######################################################## +config("module_private_config") { + visibility = [ ":*" ] + include_dirs = [ + "//utils/native/base/include", + "//third_party/bounds_checking_function/include", + "//third_party/musl/porting/linux/user/include", + "//test/xts/acts/security_lite/huks/common/include", + ] +} + +######################################################## +ohos_moduletest_suite("ActToolChainTest") { + configs = [ ":module_private_config" ] + cflags_cc = [ "-DHILOG_ENABLE" ] + defines = [ "_STANDARD_SYSTEM_" ] + + sources = [ + "include/getfiles.cpp", + "include/setrlim.cpp", + "src/toolchaintest.cpp", + ] + + include_dirs = [ + "//utils/native/base/include", + "//third_party/bounds_checking_function/include", + "//third_party/musl/porting/linux/user/include/", + "//third_party/musl/porting/linux/user/src/sched", + "/third_party/musl/libc-test/src/commom", + "./include", + ] + + deps = [ + "//third_party/bounds_checking_function:libsec_static", + "//utils/native/base:utils", + ] +} diff --git a/commonlibrary/toolchain/libc-test/Test.json b/commonlibrary/toolchain/libc-test/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..5a5c259da581f2702b9ee15f28f174dd1a79d441 --- /dev/null +++ b/commonlibrary/toolchain/libc-test/Test.json @@ -0,0 +1,165 @@ +{ + "description": "Configuration for ActToolChainTest Tests", + "driver": { + "type": "CppTest", + "native-test-timeout": "3600000", + "module-name": "ActToolChainTest", + "runtime-hint": "100s", + "native-test-device-path": "/data/local/tmp" + }, + "kits": [ + { + "push": [ + "ActToolChainTest->/data/local/tmp/ActToolChainTest", + "libc-test.tar->/data/local/tmp/libc-test.tar", + "libc-test-lib.tar->/data/local/tmp/libc-test-lib.tar" + ], + "type": "PushKit", + "post-push": [ + "mkdir /tmp", + "mkdir /dev/shm", + "mkdir /src", + "mkdir /src/functional", + "tar -xf /data/local/tmp/libc-test.tar -C /data/local/tmp/", + "tar -xf /data/local/tmp/libc-test-lib.tar -C /data/local/tmp/", + "chmod a+x -R /data/local/tmp/libc-test-lib", + "chmod a+x -R /data/local/tmp/libc-test", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/misc/vsyslog", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/temp/mkstemps", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/temp/mkostemps", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/linux/syncfs", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/linux/sync_file_range", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/linux/tee", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/linux/sendfile ", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/linux/removexattr", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/linux/copy_file_range", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/linux/setxattr", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/linux/splice", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/mman/mremap", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/mman/mincore", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/mman/msync", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/dirent/rewinddir", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/dirent/scandir ", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/dirent/readdir_r", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/manual/termios/tcgetattr", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/manual/termios/tcsendbreak", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/manual/termios/tcgetsid", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/manual/termios/tcsetattr", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/manual/env/a_stack_chk_fail", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/manual/unistd/tcsetpgrp", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/manual/unistd/ttyname", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/manual/unistd/tcgetpgrp", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/manual/unistd/isatty", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/fcntl/posix_fallocate", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/fcntl/posix_fadvise", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/passwd/getgrnam_r", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/ipc/ftok", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/stdio/freopen", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/stdio/__fwritable", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/stdio/setbuffer", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/stdio/vfscanf", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/stdio/tmpfile", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/stdio/__fwriting", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/stdio/setbuf", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/stdio/getwc", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/stdio/ungetwc", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/stdio/setlinebuf", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/stdio/fputc", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/stdio/fputs", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/unistd/truncate", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/unistd/fchownat", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/unistd/fsync", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/unistd/linkat", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/unistd/lchown", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/unistd/faccessat", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/unistd/unlinkat", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/unistd/acct", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/unistd/exit", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/unistd/readlinkat", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/unistd/write", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/unistd/getpid", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/unistd/exittest02", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/unistd/unlink", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/unistd/readv", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/unistd/pread ", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/misc/syslog", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/misc/vsyslog", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/network/res_query", + "rm -rf /data/local/tmp/libc-test/src/functionalext/dlns/dlns_dlopen_test ", + "rm -rf /data/local/tmp/libc-test/src/functionalext/dlns/dlns_set_fun_test", + "rm -rf /data/local/tmp/libc-test/src/functionalext/dlns/dlns_inherit_test", + "rm -rf /data/local/tmp/libc-test/src/functionalext/dlns/dlns_dlsym_test", + "rm -rf /data/local/tmp/libc-test/src/functionalext/dlns/dlns_special_scene_test", + "rm -rf /data/local/tmp/libc-test/src/functionalext/dlns/dlns_separated_test", + "rm -rf /data/local/tmp/libc-test/src/functionalext/relro/dlopen_ext_relro_test", + "rm -rf /data/local/tmp/libc-test/src/functionalext/tgkill/tgkill", + "rm -rf /data/local/tmp/libc-test/src/functionalext/time/strptime", + "rm -rf /data/local/tmp/libc-test/src/functionalext/time/ctime", + "rm -rf /data/local/tmp/libc-test/src/functionalext/time/asctime", + "rm -rf /data/local/tmp/libc-test/src/functionalext/time/strftime_l", + "rm -rf /data/local/tmp/libc-test/src/functionalext/time/strftime", + "rm -rf /data/local/tmp/libc-test/src/functionalext/time/localtime_r", + "rm -rf /data/local/tmp/libc-test/src/functionalext/time/localtime", + "rm -rf /data/local/tmp/libc-test/src/functionalext/time/ctime_r", + "rm -rf /data/local/tmp/libc-test/src/functionalext/time/timegm", + "rm -rf /data/local/tmp/libc-test/src/functionalext/time/asctime_r", + "rm -rf /data/local/tmp/libc-test/src/functionalext/trace/trace_stresstest", + "rm -rf /data/local/tmp/libc-test/src/functionalext/ldso_randomization/ldso_randomization_test", + "rm -rf /data/local/tmp/libc-test/src/functionalext/ldso_randomization/ldso_randomization_manual", + "rm -rf /data/local/tmp/libc-test/src/functionalext/symver/dlsym", + "rm -rf /data/local/tmp/libc-test/src/functionalext/symver/dynlink", + "rm -rf /data/local/tmp/libc-test/src/functionalext/symver/reloc_symver", + "rm -rf /data/local/tmp/libc-test/src/functionalext/symver/dynlink_default", + "rm -rf /data/local/tmp/libc-test/src/functionalext/symver/dlvsym", + "rm -rf /data/local/tmp/libc-test/src/functional/sem_open", + "rm -rf /data/local/tmp/libc-test/src/functional/ipc_shm", + "rm -rf /data/local/tmp/libc-test/src/functional/tgkill", + "rm -rf /data/local/tmp/libc-test/src/functional/fcntl ", + "rm -rf /data/local/tmp/libc-test/src/functional/tls_init_dlopen", + "rm -rf /data/local/tmp/libc-test/src/functional/tls_align", + "rm -rf /data/local/tmp/libc-test/src/functional/dlopen_ns", + "rm -rf /data/local/tmp/libc-test/src/functional/tls_align_dlopen", + "rm -rf /data/local/tmp/libc-test/src/functional/utim", + "rm -rf /data/local/tmp/libc-test/src/functional/dlclose_reset", + "rm -rf /data/local/tmp/libc-test/src/functional/ipc_sem", + "rm -rf /data/local/tmp/libc-test/src/functional/ungetc", + "rm -rf /data/local/tmp/libc-test/src/functional/fscanf", + "rm -rf /data/local/tmp/libc-test/src/functional/pthread_cancel", + "rm -rf /data/local/tmp/libc-test/src/functional/tls_init", + "rm -rf /data/local/tmp/libc-test/src/functional/fdopen", + "rm -rf /data/local/tmp/libc-test/src/functional/fwscanf", + "rm -rf /data/local/tmp/libc-test/src/functional/dlopen", + "rm -rf /data/local/tmp/libc-test/src/functional/ipc_msg", + "rm -rf /data/local/tmp/libc-test/src/regression/ftello-unflushed-append", + "rm -rf /data/local/tmp/libc-test/src/regression/malloc-brk-fail", + "rm -rf /data/local/tmp/libc-test/src/regression/pthread_atfork-errno-clobber", + "rm -rf /data/local/tmp/libc-test/src/regression/fflush-exit", + "rm -rf /data/local/tmp/libc-test/src/regression/lseek-large", + "rm -rf /data/local/tmp/libc-test/src/regression/tls_get_new-dtv", + "rm -rf /data/local/tmp/libc-test/src/regression/flockfile-list", + "rm -rf /data/local/tmp/libc-test/src/math/rintf", + "rm -rf /data/local/tmp/libc-test/src/math/nearbyint", + "rm -rf /data/local/tmp/libc-test/src/math/fma", + "rm -rf /data/local/tmp/libc-test/src/math/fmal", + "rm -rf /data/local/tmp/libc-test/src/math/acoshl", + "rm -rf /data/local/tmp/libc-test/src/math/tgammal", + "rm -rf /data/local/tmp/libc-test/src/math/sqrtl", + "rm -rf /data/local/tmp/libc-test/src/math/erfcl", + "rm -rf /data/local/tmp/libc-test/src/math/rint", + "rm -rf /data/local/tmp/libc-test/src/math/lgammal", + "rm -rf /data/local/tmp/libc-test/src/math/nearbyintf", + "rm -rf /data/local/tmp/libc-test/src/math/fmaf", + "rm -rf /data/local/tmp/libc-test/src/math/sqrtf", + "rm -rf /data/local/tmp/libc-test/src/math/rintl", + "rm -rf /data/local/tmp/libc-test/src/math/sqrt", + "rm -rf /data/local/tmp/libc-test/src/math/nearbyintl", + "rm -rf /data/local/tmp/libc-test/src/math/fenv", + "rm -rf /data/local/tmp/libc-test/src/math/asinhl", + "rm -rf /data/local/tmp/libc-test/src/functionalext/info/fatal_message", + "rm -rf /data/local/tmp/libc-test/src/functional/utime", + "rm -rf /data/local/tmp/libc-test/src/functionalext/supplement/manual/network" + ], + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/commonlibrary/toolchain/libc-test/include/getfiles.cpp b/commonlibrary/toolchain/libc-test/include/getfiles.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0e2d4ea2ea6fa9c4a2ef9bcc216bd79aedcc7393 --- /dev/null +++ b/commonlibrary/toolchain/libc-test/include/getfiles.cpp @@ -0,0 +1,41 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include "gettestfiles.cpp" + +#include "runtest.h" +namespace OHOS { +using namespace std; + +static vector filenames; +std::vector runtest::GetFileNames(std::string path) +{ + vector tempName; + GetTestNames(path, tempName); + for (size_t i = 0; i < tempName.size(); i++) { + if ((tempName[i].find("stat", path.length()-1) != -1) || + (tempName[i].find("sem_close-unmap", path.length()-1) != -1) || + (tempName[i].find("runtest", path.length()-1) != -1)) { + continue; + } + filenames.push_back(tempName[i]); + } + return filenames; +} +} // namespace OHOS \ No newline at end of file diff --git a/commonlibrary/toolchain/libc-test/include/gettestfiles.cpp b/commonlibrary/toolchain/libc-test/include/gettestfiles.cpp new file mode 100644 index 0000000000000000000000000000000000000000..23b3c2013386af383a144fde942ae4c11c23f2c3 --- /dev/null +++ b/commonlibrary/toolchain/libc-test/include/gettestfiles.cpp @@ -0,0 +1,44 @@ +/* + * 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. + */ + +#include +#include +#include +#include + +#include "runtest.h" + +static void GetTestNames(std::string path, std::vector& tempName) +{ + DIR *pDir; + struct dirent* ptr; + std::string p; + if (!(pDir = opendir(path.c_str()))) { + std::cout << "Folder doesn't Exist!" << std::endl; + return; + } + while ((ptr = readdir(pDir)) != nullptr) { + if (ptr->d_type == DT_DIR) { + if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) { + GetTestNames(path + "/" + ptr->d_name, tempName); + } + } else { + if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) { + tempName.push_back(path + "/" + ptr->d_name); + } + } + } + closedir(pDir); +} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/List.test.js b/commonlibrary/toolchain/libc-test/include/runtest.h similarity index 57% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/test/List.test.js rename to commonlibrary/toolchain/libc-test/include/runtest.h index a49b1267843b4940264a0cd71217be4b0d948681..c9554b38b601599d0006cd9ba21f935b0ca75cd4 100644 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/List.test.js +++ b/commonlibrary/toolchain/libc-test/include/runtest.h @@ -1,25 +1,28 @@ -/* - * 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 ProfileAbnormalTestCallback from './ProfileAbnormalTestCallback.test.js' -import ProfileAbnormalTestPromise from './ProfileAbnormalTestPromise.test.js' -import ProfileTestCallback from './ProfileTestCallback.test.js' -import ProfileTestPromise from './ProfileTestPromise.test.js' -export default function testsuite() { -ProfileAbnormalTestCallback() -ProfileAbnormalTestPromise() -ProfileTestCallback() -ProfileTestPromise() -} +/* + * 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. + */ +#ifndef TOOLCHAIN_RUNTEST_H +#define TOOLCHAIN_RUNTEST_H + +#include +#include +#include +namespace OHOS { +class runtest { +public: + static int t_setrlim(int r, long lim); + static std::vector GetFileNames(std::string path); +}; +} // namespace OHOS +#endif // TOOLCHAIN_LIBC_TEST_INCLUDE_RUNTEST_H_ diff --git a/commonlibrary/toolchain/libc-test/include/setrlim.cpp b/commonlibrary/toolchain/libc-test/include/setrlim.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cb89e5198288c2c84a91e29b4ca0b8eda43854d5 --- /dev/null +++ b/commonlibrary/toolchain/libc-test/include/setrlim.cpp @@ -0,0 +1,44 @@ +/* + * 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. + */ +#include +#include +#include +#include + +#include "runtest.h" +namespace OHOS { +int runtest::t_setrlim(int r, long lim) +{ + struct rlimit rl; + //Gets the current stack size + if (getrlimit(r, &rl)) { + printf("getrlimit %d: %s\n", r, strerror(errno)); + return -1; + } + if (lim > rl.rlim_max) { + return -1; + } + if (lim == rl.rlim_max && lim == rl.rlim_cur) { + return 0; + } + rl.rlim_max = lim; + rl.rlim_cur = lim; + if (setrlimit(r, &rl)) { + printf("setrlimit(%d, %ld): %s\n", r, lim, strerror(errno)); + return -1; + } + return 0; +} +} // namespace OHOS \ No newline at end of file diff --git a/commonlibrary/toolchain/libc-test/src/toolchaintest.cpp b/commonlibrary/toolchain/libc-test/src/toolchaintest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a88b6aa0b8ec8d866f954f6984e9d44cd311533b --- /dev/null +++ b/commonlibrary/toolchain/libc-test/src/toolchaintest.cpp @@ -0,0 +1,141 @@ +/* + * 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. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "gtest/gtest.h" +#include "runtest.h" + +using namespace std; +using namespace testing::ext; +using namespace testing; +namespace OHOS { +class toolchaintest : public ::testing::TestWithParam {}; + +static string filepath = "/data/local/tmp/libc-test/src"; +static vector temp = runtest::GetFileNames(filepath); + +volatile int t_status = 0; + +static void handler(int sig) +{ +} + +static int start(const char *argvs) +{ + int pid, space_size = 100*1024; + //Create a child process + //Set the process stack space + pid = fork(); + if (pid == 0) { + runtest::t_setrlim(RLIMIT_STACK, space_size); + //Overloading the subprocess space + int exe = execl(argvs, "strptime", nullptr); + printf("exe:%d %s exec failed: %s\n", exe, argvs, strerror(errno)); + exit(1); + } + return pid; +} + +static int runTests(const char *argvs) +{ + int timeoutsec = 5, timeout = 0; + int status, pid; + sigset_t set; + void (*retfunc)(int); + //signal set + sigemptyset(&set); + sigaddset(&set, SIGCHLD); + sigprocmask(SIG_BLOCK, &set, nullptr); + retfunc = signal(SIGCHLD, handler); + if (retfunc == SIG_ERR) { + printf("signal triggering failed:%s\n", strerror(errno)); + } + pid = start(argvs); + //The function system call failed + if (pid == -1) { + printf("%s fork failed: %s\n", argvs, strerror(errno)); + printf("FAIL %s [internal]\n", argvs); + return -1; + } + struct timespec tp; + //Maximum blocking time + tp.tv_sec = timeoutsec; + tp.tv_nsec = 0; + if (sigtimedwait(&set, nullptr, &tp) == -1) { + //Call it again + if (errno == EAGAIN) { + timeout = 1; + } else { + printf("%s sigtimedwait failed: %s\n", argvs, strerror(errno)); + } + if (kill(pid, SIGKILL) == -1) { + printf("%s kill failed: %s\n", argvs, strerror(errno)); + } + } + //Waiting for the process to stop + if (waitpid(pid, &status, 0) != pid) { + printf("%s waitpid failed: %s\n", argvs, strerror(errno)); + printf("FAIL %s [internal]\n", argvs); + return -1; + } + //Process state + if (WIFEXITED(status)) { //The right exit + if (WEXITSTATUS(status) == 0) { //operate successfully + return t_status; + } + printf("FAIL %s [status %d]\n", argvs, WEXITSTATUS(status)); + } else if (timeout) { + printf("FAIL %s [timed out]\n", argvs); + } else if (WIFSIGNALED(status)) { + printf("FAIL %s [signal %s]\n", argvs, strsignal(WTERMSIG(status))); + } else { + printf("FAIL %s [unknown]\n", argvs); + } + return 1; +} + + +/** + * @tc.name : toolchaintest.LibcTest + * @tc.desc : start test + * @tc.level : Level 3 + */ +HWTEST_P(toolchaintest, LibcTest, Function | MediumTest | Level3) +{ + int ret; + string testName = GetParam(); + ret = runTests(testName.c_str()); + if (ret == 0) { + EXPECT_EQ(0, ret) << "test " << testName << " succeed" << endl; + } else { + EXPECT_EQ(1, ret) << "test " << testName << " failed" << endl; + EXPECT_EQ(-1, ret) << "test " << testName << " failed" << endl; + } +} +INSTANTIATE_TEST_SUITE_P(libcTest, toolchaintest, testing::ValuesIn(temp.begin(), temp.end())); +} // namespace OHOS \ No newline at end of file diff --git a/commonlibrary/toolchain/libc-test/tar_files.py b/commonlibrary/toolchain/libc-test/tar_files.py new file mode 100755 index 0000000000000000000000000000000000000000..1d745e6ebde81d5cf6df0be7c828ca0e9f9719f8 --- /dev/null +++ b/commonlibrary/toolchain/libc-test/tar_files.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Copyright (c) 2020-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 os +import argparse +import tarfile +import shutil + +copyFileCounts = 0 + +def copyFiles(sourceDir, targetDir): + global copyFileCounts + for f in os.listdir(sourceDir): + sourceF = os.path.join(sourceDir, f) + targetF = os.path.join(targetDir, f) + if not os.path.isfile(sourceF): + if os.path.isdir(sourceF): + copyFiles(sourceF, targetF) + elif os.path.isfile(sourceF): + if os.path.exists(targetDir): + copyFileCounts += 1 + open(targetF, "wb").write(open(sourceF, "rb").read()) + elif not os.path.exists(targetDir): + os.makedirs(targetDir) + copyFileCounts += 1 + open(targetF, "wb").write(open(sourceF, "rb").read()) + +def make_targz_one_by_one(output_filename, source_dir): + tar = tarfile.open(output_filename,"w") + for root,dir,files in os.walk(source_dir): + for file in files: + pathfile = os.path.join(root, file) + tar.add(pathfile) + tar.close() + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='manual to this script') + parser.add_argument("--input_path", type=str, default="0") + parser.add_argument("--output_path", type=str, default="0") + parser.add_argument("--temp_path", type=str, default="0") + args = parser.parse_args() + print(args.input_path) + print(args.output_path) + print(args.temp_path) + + copyFiles(args.input_path, args.temp_path) + make_targz_one_by_one(args.output_path, args.temp_path) + + shutil.rmtree(args.temp_path) #delete middle files \ No newline at end of file diff --git a/communication/dsoftbus/rpc/Test.json b/communication/dsoftbus/rpc/Test.json index d30fe8c61cd911076108bfb57128c2e73b6086c6..64b24131994477ff3cec9dd94382111ae24f2e17 100644 --- a/communication/dsoftbus/rpc/Test.json +++ b/communication/dsoftbus/rpc/Test.json @@ -13,7 +13,7 @@ { "test-file-name": [ "ActsRpcHapTest.hap", - "./testcases/ActsRpcHapServer.hap" + "ActsRpcHapServer.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/customization/TestExtensionAbility_001/BUILD.gn b/customization/TestExtensionAbility_001/BUILD.gn index 3370320005572208b4d69c6cf6672fac2d5e1e02..468dd66ea400cb150dcb22ff015e45dbcf36236e 100644 --- a/customization/TestExtensionAbility_001/BUILD.gn +++ b/customization/TestExtensionAbility_001/BUILD.gn @@ -13,7 +13,7 @@ import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("ExtensionZeroTest") { +ohos_hap_assist_suite("ExtensionZeroTest") { hap_profile = "entry/src/main/module.json" js_build_mode = "debug" deps = [ diff --git a/customization/TestExtensionAbility_001/Test.json b/customization/TestExtensionAbility_001/Test.json deleted file mode 100644 index 26909f2889de98a479f076f87725fed805c7a343..0000000000000000000000000000000000000000 --- a/customization/TestExtensionAbility_001/Test.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", -} - diff --git a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/DeviceKvStoreCallbackJsunit.test.js b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/DeviceKvStoreCallbackJsunit.test.js index fca5a86e32cb27a4744aa0d152146a16ec95485f..376824b1fdcefa76b3c88c5e3b4e289c1d743c07 100644 --- a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/DeviceKvStoreCallbackJsunit.test.js +++ b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/DeviceKvStoreCallbackJsunit.test.js @@ -1801,16 +1801,14 @@ describe('deviceKvStoreCallbackTest', function () { await kvStore.removeDeviceData('', function (err,data) { if (err == undefined) { console.info('testDeviceKvStoreRemoveDeviceData103 removeDeviceData success'); - expect(err == undefined).assertTrue(); - } else { - console.info('testDeviceKvStoreRemoveDeviceData103 removeDeviceData fail ' + err); expect(null).assertFail(); + } else { + console.info('testDeviceKvStoreRemoveDeviceData103 removeDeviceData fail'); } done(); }); }catch(e) { console.info('testDeviceKvStoreRemoveDeviceData103 e ' + e); - expect(null).assertFail(); done(); } }) diff --git a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/DeviceKvStorePromiseJsunit.test.js b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/DeviceKvStorePromiseJsunit.test.js index 239aa54f7f449d8b3d9c25efdb77913f8adc3e40..b57c72e111dc4dc572b0ca705dc498bc56f457e2 100644 --- a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/DeviceKvStorePromiseJsunit.test.js +++ b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/DeviceKvStorePromiseJsunit.test.js @@ -1987,14 +1987,14 @@ describe('deviceKvStorePromiseTest', function () { * @tc.name [JS-API8]DeviceKvStore.RemoveDeviceData() * @tc.desc Test Js Api DeviceKvStore.RemoveDeviceData() testcase 003 */ - it('testDeviceKvStoreRemoveDeviceData003', 0, async function (done) { + it('testDeviceKvStoreRemoveDeviceData003', 0, async function (done) { console.info('testDeviceKvStoreRemoveDeviceData003'); try { - await kvStore.removeDeviceData('').then(() => { + await kvStore.removeDeviceData('').then((data) => { console.info('testDeviceKvStoreRemoveDeviceData003 removeDeviceData success'); + expect(null).assertFail(); }).catch((err) => { console.info('testDeviceKvStoreRemoveDeviceData003 removeDeviceData fail ' + err); - expect(null).assertFail(); }); }catch(e) { console.info('testDeviceKvStoreRemoveDeviceData003 e ' + e); @@ -2010,7 +2010,7 @@ describe('deviceKvStorePromiseTest', function () { it('testDeviceKvStoreRemoveDeviceData004', 0, async function (done) { console.info('testDeviceKvStoreRemoveDeviceData004'); try { - await kvStore.removeDeviceData(null).then((err) => { + await kvStore.removeDeviceData(null).then((data) => { console.info('testDeviceKvStoreRemoveDeviceData004 removeDeviceData success'); expect(null).assertFail(); }).catch((err) => { diff --git a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/SingleKvStoreCallbackJsunit.test.js b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/SingleKvStoreCallbackJsunit.test.js index b4fe5e1c6012253395a47e6d661bebfd65340c20..acda93522ea62bfc281cea4de7d0e0231f438109 100644 --- a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/SingleKvStoreCallbackJsunit.test.js +++ b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/SingleKvStoreCallbackJsunit.test.js @@ -1760,16 +1760,14 @@ describe('singleKvStoreCallbackTest', function () { await kvStore.removeDeviceData('', function (err,data) { if (err == undefined) { console.info('testSingleKvStoreRemoveDeviceData103 removeDeviceData success'); - expect(err == undefined).assertTrue(); - } else { - console.info('testSingleKvStoreRemoveDeviceData103 removeDeviceData fail: ' + err); expect(null).assertFail(); + } else { + console.info('testSingleKvStoreRemoveDeviceData103 removeDeviceData fail'); } done(); }); }catch(e) { console.info('testSingleKvStoreRemoveDeviceData103 e ' + e); - expect(null).assertFail(); done(); } }) diff --git a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/SingleKvStorePromiseJsunit.test.js b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/SingleKvStorePromiseJsunit.test.js index 9e4f302e98aea814775be4b3994d978aa1e9a5a4..0c87d12f5878c20147b05589a9755d380e2deeb9 100644 --- a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/SingleKvStorePromiseJsunit.test.js +++ b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/SingleKvStorePromiseJsunit.test.js @@ -1956,14 +1956,14 @@ describe('singleKvStorePromiseTest', function () { * @tc.name [JS-API8]SingleKvStoreRemoveDeviceData. * @tc.desc Test Js Api SingleKvStoreRemoveDeviceData testcase 003 */ - it('testSingleKvStoreRemoveDeviceData003', 0, async function (done) { + it('testSingleKvStoreRemoveDeviceData003', 0, async function (done) { console.info('testSingleKvStoreRemoveDeviceData003'); try { - await kvStore.removeDeviceData('').then(() => { + await kvStore.removeDeviceData('').then((data) => { console.info('testSingleKvStoreRemoveDeviceData003 removeDeviceData success'); + expect(null).assertFail(); }).catch((err) => { console.info('testSingleKvStoreRemoveDeviceData003 removeDeviceData fail ' + err); - expect(null).assertFail(); }); }catch(e) { console.info('testSingleKvStoreRemoveDeviceData003 e ' + e); @@ -1971,6 +1971,7 @@ describe('singleKvStorePromiseTest', function () { done(); }) + /** * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_REMOVEDEVICEDATA_0400 * @tc.name [JS-API8]SingleKvStoreRemoveDeviceData. diff --git a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbStoreResultSetJsunit.test.js b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbStoreResultSetJsunit.test.js index 4197415cd812cbe7f960d0a1bd4fce465e8ab20e..a2fb7c9ae923be1607f7dd60149312f2e44fb078 100644 --- a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbStoreResultSetJsunit.test.js +++ b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbStoreResultSetJsunit.test.js @@ -1832,66 +1832,6 @@ describe('rdbResultSetTest', function () { console.log(TAG + "************* testBigData0001 end *************"); } }) - - /** - * @tc.name big resultSet data test - * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0251 - * @tc.desc big resultSet data test - */ - it('testBigData0002', 0, async function (done) { - console.log(TAG + "************* testBigData0002 start *************"); - { - await createBigData(500); - let resultSet = await rdbStore.querySql("SELECT * FROM test"); - let count = resultSet.rowCount; - expect(500).assertEqual(count); - - resultSet.goToLastRow(); - let i = resultSet.rowCount; - while (i >= 1) { - expect("test" + --i).assertEqual(resultSet.getString(1)) - resultSet.goToPreviousRow(); - } - - resultSet.close() - expect(true).assertEqual(resultSet.isClosed) - resultSet = null; - done(); - console.log(TAG + "************* testBigData0002 end *************"); - } - }) - - /** - * @tc.name big resultSet data test - * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0252 - * @tc.desc big resultSet data test - */ - it('testBigData0003', 0, async function (done) { - console.log(TAG + "************* testBigData0003 start *************"); - { - await createBigData(1); - let resultSet = await rdbStore.querySql("SELECT * FROM test"); - let count = resultSet.rowCount; - expect(1).assertEqual(count); - - resultSet.goToFirstRow(); - expect(true).assertEqual(resultSet.isStarted); - expect("test0").assertEqual(resultSet.getString(1)) - - let rows = [1, 2, -1, -2]; - for (const i of rows) { - resultSet.goToRow(i); - expect(true).assertEqual(resultSet.isStarted); - expect("").assertEqual(resultSet.getString(1)) - } - - resultSet.close() - expect(true).assertEqual(resultSet.isClosed) - resultSet = null; - done(); - console.log(TAG + "************* testBigData0003 end *************"); - } - }) console.info(TAG + '*************Unit Test End*************'); }) diff --git a/hiviewdfx/BUILD.gn b/hiviewdfx/BUILD.gn index 58e9d0a9bccc4d936ccbe7db72a96537b010b2a8..831800e06692c6a85cc7e634673b6abb90d7f688 100644 --- a/hiviewdfx/BUILD.gn +++ b/hiviewdfx/BUILD.gn @@ -21,6 +21,8 @@ group("hiviewdfxtestacts") { "hiappeventtest/hiappeventsubjstest:ActsHiAppeventSubTest", "hicheckertest/hicheckerjstest:hicheckerjstest", "hidebugtest/hidebugtestjstest:ActsHiDebugTest", + "hilogtest/hilogdomainofftest:ActsHilogDomainOffJsTest", + "hilogtest/hilogdomainontest:ActsHilogDomainOnJsTest", "hilogtest/hilogjstest:ActsHilogJsTest", "hilogtest/hilogndktest:ActsHilogndkTest", "hisyseventtest/hisyseventjstest:ActsHiSysEventJsTest", diff --git a/hiviewdfx/hiappeventtest/hiappeventcpptest/HiAppEventCPPTest.cpp b/hiviewdfx/hiappeventtest/hiappeventcpptest/HiAppEventCPPTest.cpp index 9f417ea11e7dddc271640acdc2af737e82b2c237..375165322fc1beafd38139e15936f79e9b8edd5a 100755 --- a/hiviewdfx/hiappeventtest/hiappeventcpptest/HiAppEventCPPTest.cpp +++ b/hiviewdfx/hiappeventtest/hiappeventcpptest/HiAppEventCPPTest.cpp @@ -778,9 +778,9 @@ HWTEST_F(HiAppEventCPPTest, DFX_DFT_HiviewKit_HiAppEvent_Native_2700, Function|M bool result = false; string getlogFile; string path; - int maxLen = 33; - string keys[maxLen]; - string values[maxLen]; + int maxLen = 32; + string keys[maxLen + 1]; + string values[maxLen + 1]; OHOS::HiviewDFX::HiAppEventConfig::GetInstance().SetStorageDir("/data/test/hiappevent/"); ParamList list = OH_HiAppEvent_CreateParamList(); for (int i = 0; i <= maxLen; i++) { diff --git a/multimedia/media/media_js_standard/recorderProfile/BUILD.gn b/hiviewdfx/hilogtest/hilogdomainofftest/BUILD.gn similarity index 71% rename from multimedia/media/media_js_standard/recorderProfile/BUILD.gn rename to hiviewdfx/hilogtest/hilogdomainofftest/BUILD.gn index e72aae52ecb2723b776d7cdbf385f6af4e64d012..cf5e3685283d66e25b13e3a86fbff470fbedddb8 100644 --- a/multimedia/media/media_js_standard/recorderProfile/BUILD.gn +++ b/hiviewdfx/hilogtest/hilogdomainofftest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Huawei Device Co., Ltd. +# 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 @@ -12,25 +12,22 @@ # limitations under the License. import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("recorder_profile_js_hap") { +ohos_js_hap_suite("ActsHilogDomainOffJsTest") { hap_profile = "./src/main/config.json" - js2abc = true deps = [ - ":profile_js_assets", - ":profile_resources", + ":hilog_js_assets", + ":hilog_resources", ] + certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsRecorderProfileJsTest" - subsystem_name = "multimedia" - part_name = "multimedia_player_framework" + hap_name = "ActsHilogDomainOffJsTest" } -ohos_js_assets("profile_js_assets") { +ohos_js_assets("hilog_js_assets") { js2abc = true hap_profile = "./src/main/config.json" source_dir = "./src/main/js" } -ohos_resources("profile_resources") { +ohos_resources("hilog_resources") { sources = [ "./src/main/resources" ] hap_profile = "./src/main/config.json" } diff --git a/hiviewdfx/hilogtest/hilogdomainofftest/Test.json b/hiviewdfx/hilogtest/hilogdomainofftest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..c0ef430131ae53c9f4f43151c549ca7bc6a0beba --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/Test.json @@ -0,0 +1,32 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "270000", + "shell-timeout": "60000", + "bundle-name": "ohos.acts.hiviewdfx.hilogdomainoff.function", + "package-name": "ohos.acts.hiviewdfx.hilogdomainoff.function" + }, + "kits": [ + { + "test-file-name": [ + "ActsHilogDomainOffJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "param set persist.sys.hilog.debug.on true", + "service_control stop hilogd", + "service_control start hilogd" + ], + "teardown-command": [ + "param set persist.sys.hilog.debug.on false", + "service_control stop hilogd", + "service_control start hilogd" + ] + } + ] +} \ No newline at end of file diff --git a/hiviewdfx/hilogtest/hilogdomainofftest/signature/openharmony_sx.p7b b/hiviewdfx/hilogtest/hilogdomainofftest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/hiviewdfx/hilogtest/hilogdomainofftest/signature/openharmony_sx.p7b differ diff --git a/hiviewdfx/hilogtest/hilogdomainofftest/src/main/config.json b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..511a9cbf9c67dd392ccf2ec2cdf9bd8c44629d2a --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/config.json @@ -0,0 +1,93 @@ +{ + "app": { + "bundleName": "ohos.acts.hiviewdfx.hilogdomainoff.function", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5 + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.acts.hiviewdfx.hilogdomainoff.function", + "name": ".entry", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + }, + "mainAbility": ".MainAbility", + "srcPath": "" + } +} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/app.js b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/app.js similarity index 91% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/app.js rename to hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/app.js index 8fe0b77dcef1db4bb1706399fd481541de8166cd..4b241cccbaa71f0c5cbd9e7dc437a0feb224c7d5 100644 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/app.js +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/app.js @@ -1,23 +1,22 @@ -/* - * 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. - */ - -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; +/* + * 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. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/i18n/en-US.json b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/i18n/en-US.json similarity index 91% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/i18n/en-US.json rename to hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/i18n/en-US.json index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..e63c70d978a3a53be988388c87182f81785e170c 100644 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/i18n/en-US.json +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/i18n/en-US.json @@ -1,6 +1,6 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } +{ + "strings": { + "hello": "Hello", + "world": "World" + } } \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/i18n/zh-CN.json b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/i18n/zh-CN.json similarity index 91% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/i18n/zh-CN.json rename to hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/i18n/zh-CN.json index b1c02368f72f929e4375a43170444de95dcc5984..de6ee5748322f44942c1b003319d8e66c837675f 100644 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/i18n/zh-CN.json +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/i18n/zh-CN.json @@ -1,6 +1,6 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } +{ + "strings": { + "hello": "您好", + "world": "世界" + } } \ No newline at end of file diff --git a/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/pages/index/index.css b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/pages/index/index.hml b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/pages/index/index.hml similarity index 95% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/pages/index/index.hml rename to hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/pages/index/index.hml index f629c71a9be857db6cdf94149652a191b9b272ea..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 100644 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/pages/index/index.hml +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/pages/index/index.hml @@ -1,5 +1,5 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
+
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/pages/index/index.js b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..152a4ed733ad9f51f9b906227fe1362ca5ae2960 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,34 @@ +/* + * 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 app from '@system.app' +import device from '@system.device' +import router from '@system.router' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + }, + onReady() { + }, +} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/app.js b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/app.js similarity index 97% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/app.js rename to hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/app.js index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..d5ee271df29e516d1c8929054283e5f2bf5c981c 100644 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/app.js +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/app.js @@ -1,31 +1,31 @@ -/* - * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from '@ohos/hypium' -import testsuite from '../test/List.test' - -export default { - onCreate() { - console.info('TestApplication onCreate') - var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - }, - onDestroy() { - console.info("TestApplication onDestroy"); - } -}; +/* + * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/i18n/en-US.json b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/i18n/en-US.json similarity index 91% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/i18n/en-US.json rename to hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/i18n/en-US.json index 3cb24b374b1d919ca8eac0638f361692b603a900..55561b83737c3c31d082fbfa11e5fc987a351104 100644 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/i18n/en-US.json +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/i18n/en-US.json @@ -1,8 +1,8 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } } \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/i18n/zh-CN.json b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/i18n/zh-CN.json similarity index 91% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/i18n/zh-CN.json rename to hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/i18n/zh-CN.json index c804e32c0c3103929baca5617cdac70be11fdba1..cce1af06761a42add0cac1a0567aa3237eda8cb4 100644 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/i18n/zh-CN.json +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/i18n/zh-CN.json @@ -1,8 +1,8 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } } \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/pages/index/index.css b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/pages/index/index.css similarity index 94% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/pages/index/index.css rename to hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/pages/index/index.css index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..b21c92c6290ea747bd891e2ab673721afc5521ed 100644 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/pages/index/index.css +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/pages/index/index.css @@ -1,30 +1,30 @@ -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} - -@media screen and (device-type: phone) and (orientation: landscape) { - .title { - font-size: 60px; - } -} - -@media screen and (device-type: tablet) and (orientation: landscape) { - .title { - font-size: 100px; - } +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } } \ No newline at end of file diff --git a/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/pages/index/index.hml b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/pages/index/index.js b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/pages/index/index.js similarity index 96% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/pages/index/index.js rename to hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/pages/index/index.js index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..d94b75c085fa1c16a0b2721609b18c57a7295476 100644 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/pages/index/index.js +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/pages/index/index.js @@ -1,26 +1,26 @@ -/* - * 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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - +/* + * 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. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestRunner/OpenHarmonyTestRunner.js similarity index 97% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/TestRunner/OpenHarmonyTestRunner.js rename to hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestRunner/OpenHarmonyTestRunner.js index c5fa8620ca77d381f20b65a903b833e6e3378c97..b9e78ce7cf73f1ade6ba52a408a44e33f5430f0d 100644 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -1,59 +1,59 @@ -/* - * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' - -function translateParamsToString(parameters) { - const keySet = new Set([ - '-s class', '-s notClass', '-s suite', '-s itName', - '-s level', '-s testType', '-s size', '-s timeout', - '-s package', '-s dryRun' - ]) - let targetParams = ''; - for (const key in parameters) { - if (keySet.has(key)) { - targetParams += ' ' + key + ' ' + parameters[key] - } - } - return targetParams.trim() -} - - export default { - onPrepare() { - console.info('OpenHarmonyTestRunner OnPrepare') - }, - onRun() { - console.log('OpenHarmonyTestRunner onRun run') - var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - - var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' - - var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName - cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) - var debug = abilityDelegatorArguments.parameters["-D"] - console.info('debug value : '+debug) - if (debug == 'true') - { - cmd += ' -D' - } - console.info('cmd : '+cmd) - abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + data.stdResult); - console.info('executeShellCommand : data : ' + data.exitCode); - }) - } -}; +/* + * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/test/HilogdomainoffJsTest.js b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/test/HilogdomainoffJsTest.js new file mode 100644 index 0000000000000000000000000000000000000000..f56d8986ea0b26aaf02c7a0a0925c7f260475ecc --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/test/HilogdomainoffJsTest.js @@ -0,0 +1,67 @@ +/* + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' +import hilog from '@ohos.hilog' + +export default function HilogdomainoffJsTest() { +describe('HilogdomainoffJsTest', function () { + + /** + * run before testClass + */ + beforeAll(function () { + console.info('beforeAll called'); + }) + + /** + * run after testClass + */ + afterAll(function () { + console.info('afterAll called'); + }) + + /** + * @tc.number DFX_DFT_Hilog_Domain_White_0700 + * @tc.name 验证关闭domain白名单,type为LOG_APP,domain id有效,日志正常打印 + * @tc.desc The log tool can read valid app log types when domain off. + */ + it('testHilogJsApi07', 2, function () { + console.info('testHilogJsApi01 start'); + try{ + hilog.error(0xffff, "HILOGTEST", "%{public}s", ['hilogJs0100']) + } catch (error){ + console.log(`testHilogJsApi07 got an error: ${JSON.stringify(error)}`) + expect().assertFail() + } + console.info('testHilogJsApi07 end'); + }) + + /** + * @tc.number DFX_DFT_Hilog_Domain_White_0800 + * @tc.name 验证关闭domain白名单,type为LOG_APP,domain id无效(在白名单内),日志正常打印 + * @tc.desc The log tool can read white app log types when domain off. + */ + it('testHilogJsApi08', 2, function () { + console.info('testHilogJsApi08 start'); + try{ + hilog.error(0xD003200, "HILOGTEST", "%{public}s", ['hilogJs0200']) + } catch (error){ + console.log(`testHilogJsApi08 got an error: ${JSON.stringify(error)}`) + expect().assertFail() + } + console.info('testHilogJsApi08 end'); + }) +}) +} \ No newline at end of file diff --git a/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/test/List.test.js b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..655b54dce595b7333642a847ba9aa94f1c04cefb --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/test/List.test.js @@ -0,0 +1,18 @@ +/* + * 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 HilogdomainoffJsTest from './HilogdomainoffJsTest.js' +export default function testsuite() { + HilogdomainoffJsTest() +} diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/element/string.json b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/resources/base/element/string.json similarity index 71% rename from multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/element/string.json rename to hiviewdfx/hilogtest/hilogdomainofftest/src/main/resources/base/element/string.json index 8afb12da3b72e7b085a608d62d98beb65fe83030..8ebd2d726f1e3f1c99efda585ced2c2c18ca3857 100644 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/element/string.json +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/resources/base/element/string.json @@ -1,28 +1,28 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "mainability_description", - "value": "JS_Empty Ability" - }, - { - "name": "MainAbility_desc", - "value": "description" - }, - { - "name": "MainAbility_label", - "value": "label" - }, - { - "name": "TestAbility_desc", - "value": "description" - }, - { - "name": "TestAbility_label", - "value": "label" - } - ] -} \ No newline at end of file +{ + "string": [ + { + "name": "app_name", + "value": "test2demo" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/media/icon.png b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/resources/base/media/icon.png similarity index 100% rename from multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/media/icon.png rename to hiviewdfx/hilogtest/hilogdomainofftest/src/main/resources/base/media/icon.png diff --git a/hiviewdfx/hilogtest/hilogdomainontest/BUILD.gn b/hiviewdfx/hilogtest/hilogdomainontest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8a58d20b4aabb1cfe12f8249e0fa42474ec88864 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/BUILD.gn @@ -0,0 +1,33 @@ +# 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") +ohos_js_hap_suite("ActsHilogDomainOnJsTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":hilog_js_assets", + ":hilog_resources", + ] + + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsHilogDomainOnJsTest" +} +ohos_js_assets("hilog_js_assets") { + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" +} +ohos_resources("hilog_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/hiviewdfx/hilogtest/hilogdomainontest/Test.json b/hiviewdfx/hilogtest/hilogdomainontest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..137436cd50e944295f7f190ad919c9e0bd00a6d9 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/Test.json @@ -0,0 +1,32 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "270000", + "shell-timeout": "60000", + "bundle-name": "ohos.acts.hiviewdfx.hilogdomainon.function", + "package-name": "ohos.acts.hiviewdfx.hilogdomainon.function" + }, + "kits": [ + { + "test-file-name": [ + "ActsHilogDomainOnJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "param set persist.sys.hilog.debug.on false", + "service_control stop hilogd", + "service_control start hilogd" + ], + "teardown-command": [ + "param set persist.sys.hilog.debug.on true", + "service_control stop hilogd", + "service_control start hilogd" + ] + } + ] +} \ No newline at end of file diff --git a/hiviewdfx/hilogtest/hilogdomainontest/signature/openharmony_sx.p7b b/hiviewdfx/hilogtest/hilogdomainontest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/hiviewdfx/hilogtest/hilogdomainontest/signature/openharmony_sx.p7b differ diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/config.json b/hiviewdfx/hilogtest/hilogdomainontest/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..a109a6243256430d9ef3296ed782d90787e1054b --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/config.json @@ -0,0 +1,93 @@ +{ + "app": { + "bundleName": "ohos.acts.hiviewdfx.hilogdomainon.function", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5 + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.acts.hiviewdfx.hilogdomainon.function", + "name": ".entry", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + }, + "mainAbility": ".MainAbility", + "srcPath": "" + } +} \ No newline at end of file diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/app.js b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..4b241cccbaa71f0c5cbd9e7dc437a0feb224c7d5 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/app.js @@ -0,0 +1,22 @@ +/* + * 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. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/i18n/en-US.json b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/i18n/zh-CN.json b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/pages/index/index.css b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/pages/index/index.hml b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/pages/index/index.js b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..152a4ed733ad9f51f9b906227fe1362ca5ae2960 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,34 @@ +/* + * 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 app from '@system.app' +import device from '@system.device' +import router from '@system.router' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + }, + onReady() { + }, +} \ No newline at end of file diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/app.js b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..d5ee271df29e516d1c8929054283e5f2bf5c981c --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/i18n/en-US.json b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/i18n/zh-CN.json b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/pages/index/index.css b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b21c92c6290ea747bd891e2ab673721afc5521ed --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,30 @@ +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/pages/index/index.hml b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/pages/index/index.js b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/pages/index/index.js similarity index 80% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/pages/index/index.js rename to hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/pages/index/index.js index 9f776a29eacf91263bacf9ddf404b13e8607bd60..d94b75c085fa1c16a0b2721609b18c57a7295476 100644 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/pages/index/index.js +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/pages/index/index.js @@ -1,29 +1,26 @@ -/* - * 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. - */ - - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - }, - onReady() { - }, -} \ 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. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 0000000000000000000000000000000000000000..b9e78ce7cf73f1ade6ba52a408a44e33f5430f0d --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/test/HilogdomainonJstest.js b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/test/HilogdomainonJstest.js new file mode 100644 index 0000000000000000000000000000000000000000..6b51ac852c1ee94590159e76505a244afa524d62 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/test/HilogdomainonJstest.js @@ -0,0 +1,67 @@ +/* + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' +import hilog from '@ohos.hilog' + +export default function HilogdomainonJstest() { +describe('HilogdomainonJstest', function () { + + /** + * run before testClass + */ + beforeAll(function () { + console.info('beforeAll called'); + }) + + /** + * run after testClass + */ + afterAll(function () { + console.info('afterAll called'); + }) + + /** + * @tc.number DFX_DFT_Hilog_Domain_White_0500 + * @tc.name 验证启用domain白名单,type为LOG_APP,domain id有效,日志正常打印 + * @tc.desc The log tool can read valid app log types when domain on. + */ + it('testHilogJsApi05', 2, function () { + console.info('testHilogJsApi01 start'); + try{ + hilog.error(0xffff, "HILOGTEST", "%{public}s", ['hilogJs0100']) + } catch (error){ + console.log(`testHilogJsApi05 got an error: ${JSON.stringify(error)}`) + expect().assertFail() + } + console.info('testHilogJsApi05 end'); + }) + + /** + * @tc.number DFX_DFT_Hilog_Domain_White_0600 + * @tc.name 验证启用domain白名单,type为LOG_APP,domain id无效(在白名单内),无日志打印 + * @tc.desc The log tool can't read white app log types when domain on. + */ + it('testHilogJsApi06', 2, function () { + console.info('testHilogJsApi02 start'); + try{ + hilog.error(0xD003200, "HILOGTEST", "%{public}s", ['hilogJs0200']) + } catch (error){ + console.log(`testHilogJsApi06 got an error: ${JSON.stringify(error)}`) + expect().assertFail() + } + console.info('testHilogJsApi06 end'); + }) +}) +} \ No newline at end of file diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/test/List.test.js b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..18ec161209d9032739fcb0c11de368ce326a1ed2 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/test/List.test.js @@ -0,0 +1,18 @@ +/* + * 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 HilogdomainonJstest from './HilogdomainonJstest.js' +export default function testsuite() { + HilogdomainonJstest() +} diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/resources/base/element/string.json b/hiviewdfx/hilogtest/hilogdomainontest/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8ebd2d726f1e3f1c99efda585ced2c2c18ca3857 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "test2demo" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} diff --git a/hiviewdfx/hilogtest/hilogdomainontest/src/main/resources/base/media/icon.png b/hiviewdfx/hilogtest/hilogdomainontest/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/hiviewdfx/hilogtest/hilogdomainontest/src/main/resources/base/media/icon.png differ diff --git a/multimedia/BUILD.gn b/multimedia/BUILD.gn index a2dbeb17bc49cad11a689180e8f45fc68de6155a..495fd62a5586f83eb65e2973073cb662b7cf4eb4 100644 --- a/multimedia/BUILD.gn +++ b/multimedia/BUILD.gn @@ -39,10 +39,10 @@ group("multimedia") { "image/image_js_standard/imageWebp:image_webp_js_hap", "image/image_js_standard/imageYUV:image_yuv_js_hap", "image/image_js_standard/image_ndk_test:image_pixelmap_ndk_hap", + "media/media_cpp_standard:ActsAvcodecNdkTest", "media/media_js_standard/audioPlayer:audio_player_js_hap", "media/media_js_standard/audioRecorder:audio_recorder_js_hap", "media/media_js_standard/recorderFormat:recorder_format_js_hap", - "media/media_js_standard/recorderProfile:recorder_profile_js_hap", "media/media_js_standard/videoPlayer:video_player_js_hap", "medialibrary/mediaLibrary_album:mediaLibrary_album_hap", "medialibrary/mediaLibrary_base:mediaLibrary_base_hap", diff --git a/multimedia/camera/camera_js_standard/BUILD.gn b/multimedia/camera/camera_js_standard/BUILD.gn index 21272074965d41b6d1bd0f2363476e32b8215e1b..ad6f315da604dbe4ecb4c5b71616b1971d84b8d4 100644 --- a/multimedia/camera/camera_js_standard/BUILD.gn +++ b/multimedia/camera/camera_js_standard/BUILD.gn @@ -23,7 +23,7 @@ ohos_js_hap_suite("camera_standard_ets_hap") { certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsCameraStandardETSTest" subsystem_name = "multimedia" - part_name = "multimedia_camera_standard" + part_name = "multimedia_camera_framework" } ohos_js_assets("camera_ets_assets") { source_dir = "./src/main/ets/MainAbility" diff --git a/multimedia/image/image_js_standard/image/src/main/js/test/addImage.test.js b/multimedia/image/image_js_standard/image/src/main/js/test/addImage.test.js index 5e9d459036c062b78284aa0b3e8f291e3b3710aa..9e2b3a2adb1ca86f7ed4116cc7cd39eb63356c80 100644 --- a/multimedia/image/image_js_standard/image/src/main/js/test/addImage.test.js +++ b/multimedia/image/image_js_standard/image/src/main/js/test/addImage.test.js @@ -13,42 +13,43 @@ * limitations under the License. */ -import image from '@ohos.multimedia.image' -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' -import { testPng } from './testImg' +import image from "@ohos.multimedia.image"; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index"; +import { testPng } from "./testImg"; export default function addImage() { - describe('addImage', function () { - + describe("addImage", function () { + const RGBA_8888 = image.PixelMapFormat.RGBA_8888; beforeAll(async function () { - console.info('beforeAll case'); - }) + console.info("beforeAll case"); + }); beforeEach(function () { - console.info('beforeEach case'); - }) + console.info("beforeEach case"); + }); afterEach(async function () { - console.info('afterEach case'); - }) + console.info("afterEach case"); + }); afterAll(async function () { - console.info('afterAll case'); - }) + console.info("afterAll case"); + }); function createPixMapPromise(done, testNum, opts) { const Color = new ArrayBuffer(96); - image.createPixelMap(Color, opts) - .then(pixelmap => { + image + .createPixelMap(Color, opts) + .then((pixelmap) => { expect(pixelmap != undefined).assertTrue(); console.info(`${testNum} success`); done(); }) - .catch(error => { + .catch((error) => { console.log(`${testNum} error: ` + error); expect(false).assertTrue(); done(); - }) + }); } function createPixMapCb(done, testNum, opts) { @@ -57,7 +58,114 @@ export default function addImage() { expect(pixelmap != undefined).assertTrue(); console.info(`${testNum} success`); done(); - }) + }); + } + + async function createIncrementalSourcePromise(done, testNum, type, opts) { + let testimagebuffer = testPng; + let incSouce; + console.info(`${testNum} 0001 ` + testimagebuffer.length); + let bufferSize = 5000; + let offset = 0; + if (type == "sourceOpts") { + console.info(`${testNum} have sourceopts`); + incSouce = image.createIncrementalSource(new ArrayBuffer(1), opts); + } else { + console.info(`${testNum} no sourceopts`); + incSouce = image.createIncrementalSource(new ArrayBuffer(1)); + } + let ret; + let isFinished = false; + while (offset < testimagebuffer.length) { + var oneStep = testimagebuffer.slice(offset, offset + bufferSize); + console.info(`${testNum} 0002 ` + oneStep.length); + if (oneStep.length < bufferSize) { + isFinished = true; + } + ret = await incSouce.updateData(oneStep, isFinished, 0, oneStep.length); + if (!ret) { + console.info(`${testNum} updateData failed`); + expect(ret).assertTrue(); + break; + } + offset = offset + oneStep.length; + console.info(`${testNum} 0003 ` + offset); + } + if (ret) { + console.info(`${testNum} updateData success `); + let decodingOptions = { + sampleSize: 1, + }; + incSouce.createPixelMap(decodingOptions, (err, pixelmap) => { + if (err) { + console.info(`${testNum} createPixelMap err: ` + err); + expect(false).assertTrue(); + done(); + return; + } + console.info(`${testNum} 0004` + pixelmap); + expect(pixelmap != undefined).assertTrue(); + done(); + }); + } else { + expect(false).assertTrue(); + done(); + } + } + + async function createIncrementalSourceCb(done, testNum, type, opts) { + let testimagebuffer = testPng; + let incSouce; + console.info(`${testNum} 0001 ` + testimagebuffer.length); + let bufferSize = 5000; + let offset = 0; + if (type == "sourceOpts") { + incSouce = image.createIncrementalSource(new ArrayBuffer(1), opts); + } else { + incSouce = image.createIncrementalSource(new ArrayBuffer(1)); + } + let ret; + let isFinished = false; + while (offset < testimagebuffer.length) { + var oneStep = testimagebuffer.slice(offset, offset + bufferSize); + console.info(`${testNum} 0002 ` + oneStep.length); + if (oneStep.length < bufferSize) { + isFinished = true; + } + ret = await new Promise((res) => { + incSouce.updateData(oneStep, isFinished, 0, oneStep.length, (err, ret) => { + res(ret); + }); + }); + + if (!ret) { + console.info(`${testNum} updateData failed`); + expect(ret).assertTrue(); + break; + } + offset = offset + oneStep.length; + console.info(`${testNum} 0003 ` + offset); + } + if (ret) { + console.info(`${testNum} updateData success `); + let decodingOptions = { + sampleSize: 1, + }; + incSouce.createPixelMap(decodingOptions, (err, pixelmap) => { + if (err) { + console.info(`${testNum} createPixelMap err: ` + err); + expect(false).assertTrue(); + done(); + return; + } + console.info(`${testNum} 0004` + pixelmap); + expect(pixelmap != undefined).assertTrue(); + done(); + }); + } else { + expect(false).assertTrue(); + done(); + } } /** @@ -71,10 +179,10 @@ export default function addImage() { * @tc.type : Functional * @tc.level : Level 0 */ - it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0100', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 1, alphaType: 0 } - createPixMapPromise(done, 'SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0100', opts); - }) + it("SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0100", 0, async function (done) { + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 1, alphaType: 0 }; + createPixMapPromise(done, "SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0100", opts); + }); /** * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0200 @@ -87,10 +195,10 @@ export default function addImage() { * @tc.type : Functional * @tc.level : Level 0 */ - it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0200', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 1, alphaType: 1 } - createPixMapPromise(done, 'SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0200', opts); - }) + it("SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0200", 0, async function (done) { + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 1, alphaType: 1 }; + createPixMapPromise(done, "SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0200", opts); + }); /** * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0300 @@ -103,10 +211,10 @@ export default function addImage() { * @tc.type : Functional * @tc.level : Level 0 */ - it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0300', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 0, alphaType: 2 } - createPixMapPromise(done, 'SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0300', opts); - }) + it("SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0300", 0, async function (done) { + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 0, alphaType: 2 }; + createPixMapPromise(done, "SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0300", opts); + }); /** * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0400 @@ -119,10 +227,10 @@ export default function addImage() { * @tc.type : Functional * @tc.level : Level 0 */ - it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0400', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 0, alphaType: 3 } - createPixMapPromise(done, 'SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0400', opts); - }) + it("SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0400", 0, async function (done) { + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 0, alphaType: 3 }; + createPixMapPromise(done, "SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0400", opts); + }); /** * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0100 @@ -135,10 +243,10 @@ export default function addImage() { * @tc.type : Functional * @tc.level : Level 0 */ - it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0100', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 0, alphaType: 0 } - createPixMapCb(done, 'SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0100', opts); - }) + it("SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0100", 0, async function (done) { + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 0, alphaType: 0 }; + createPixMapCb(done, "SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0100", opts); + }); /** * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0200 @@ -151,10 +259,10 @@ export default function addImage() { * @tc.type : Functional * @tc.level : Level 0 */ - it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0200', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 0, alphaType: 1 } - createPixMapCb(done, 'SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0200', opts); - }) + it("SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0200", 0, async function (done) { + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 0, alphaType: 1 }; + createPixMapCb(done, "SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0200", opts); + }); /** * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0300 @@ -167,10 +275,10 @@ export default function addImage() { * @tc.type : Functional * @tc.level : Level 0 */ - it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0300', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 1, alphaType: 2 } - createPixMapCb(done, 'SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0300', opts); - }) + it("SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0300", 0, async function (done) { + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 1, alphaType: 2 }; + createPixMapCb(done, "SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0300", opts); + }); /** * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0400 @@ -183,10 +291,10 @@ export default function addImage() { * @tc.type : Functional * @tc.level : Level 0 */ - it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0400', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 1, alphaType: 3 } - createPixMapCb(done, 'SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0400', opts); - }) + it("SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0400", 0, async function (done) { + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 1, alphaType: 3 }; + createPixMapCb(done, "SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0400", opts); + }); /** * @tc.number : SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0100 @@ -194,54 +302,17 @@ export default function addImage() { * @tc.desc : 1.create imagesource * 2.update data * 3.create pixelmap - * @tc.size : MEDIUM + * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0100', 0, async function (done) { - try { - let testimagebuffer = testPng; - console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0100 0003 ' + testimagebuffer.length); - let bufferSize = 5000; - let offset = 0; - const incSouce = image.createIncrementalSource(new ArrayBuffer(1)); - let ret; - let isFinished = false; - while (offset < testimagebuffer.length) { - console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0100 0006 ' + testimagebuffer.length); - var oneStep = testimagebuffer.slice(offset, offset + bufferSize); - console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0100 0007 ' + oneStep.length); - if (oneStep.length < bufferSize) { - isFinished = true; - } - ret = await incSouce.updateData(oneStep, isFinished, 0, oneStep.length); - if (!ret) { - console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0100 updateData failed'); - expect(ret).assertTrue(); - break; - } - offset = offset + oneStep.length; - console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0100 0011 ' + offset); - } - if (ret) { - console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0100 updateData success '); - let decodingOptions = { - sampleSize: 1 - }; - incSouce.createPixelMap(decodingOptions, (err, pixelmap) => { - console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0100 0014' + pixelmap); - expect(pixelmap != undefined).assertTrue(); - done(); - }) - } else { - expect(false).assertTrue(); - done(); - } - } catch (error) { - expect(false).assertTrue(); - console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0100 updateData failed ' + error); - } - }) + it("SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0100", 0, async function (done) { + createIncrementalSourcePromise( + done, + "SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0100", + "noSourceOpts" + ); + }); /** * @tc.number : SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0200 @@ -249,56 +320,56 @@ export default function addImage() { * @tc.desc : 1.create imagesource * 2.update data * 3.create pixelmap - * @tc.size : MEDIUM + * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0200', 0, async function (done) { - try { - let testimagebuffer = testPng; - console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0200 0001 ' + testimagebuffer.length); - let bufferSize = 5000; - let offset = 0; - const incSouce = image.createIncrementalSource(new ArrayBuffer(1)); - let ret; - let isFinished = false; - while (offset < testimagebuffer.length) { - var oneStep = testimagebuffer.slice(offset, offset + bufferSize); - console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0200 0002 ' + oneStep.length); - if (oneStep.length < bufferSize) { - isFinished = true; - } - ret = await new Promise(res => { - incSouce.updateData(oneStep, isFinished, 0, oneStep.length, (err, ret) => { - res(ret); - }) - }) - if (!ret) { - console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0200 updateData failed'); - expect(ret).assertTrue(); - break; - } - offset = offset + oneStep.length; - console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0200 0003 ' + offset); - } - if (ret) { - console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0200 updateData success '); - let decodingOptions = { - sampleSize: 1 - }; - incSouce.createPixelMap(decodingOptions, (err, pixelmap) => { - console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0200 0004' + pixelmap); - expect(pixelmap != undefined).assertTrue(); - done(); - }) - } else { - expect(false).assertTrue(); - done(); - } - } catch (error) { - expect(false).assertTrue(); - console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0200 updateData failed ' + error); - } - }) - }) -} \ No newline at end of file + it("SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0200", 0, async function (done) { + let opts = { sourceDensity: 240, pixelFormat: RGBA_8888, size: { height: 4, width: 6 } }; + createIncrementalSourcePromise( + done, + "SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0200", + "sourceOpts", + opts + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_CALLBACK_0100 + * @tc.name : createIncrementalSource-updateData-png-callback + * @tc.desc : 1.create imagesource + * 2.update data + * 3.create pixelmap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_CALLBACK_0100", 0, async function (done) { + createIncrementalSourceCb( + done, + "SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_CALLBACK_0100", + "noSourceOpts" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_CALLBACK_0200 + * @tc.name : createIncrementalSource-updateData-png-callback + * @tc.desc : 1.create imagesource + * 2.update data + * 3.create pixelmap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_CALLBACK_0200", 0, async function (done) { + let opts = { sourceDensity: 240, pixelFormat: RGBA_8888, size: { height: 4, width: 6 } }; + createIncrementalSourceCb( + done, + "SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_CALLBACK_0200", + "sourceOpts", + opts + ); + }); + }); +} diff --git a/multimedia/media/media_cpp_standard/Test.json b/multimedia/media/media_cpp_standard/Test.json index dfbea61c0eae3884b8fdf2326a6c899770323d82..644c2171d96a98d887edcdb94cf0e9b3df980cf5 100644 --- a/multimedia/media/media_cpp_standard/Test.json +++ b/multimedia/media/media_cpp_standard/Test.json @@ -22,6 +22,7 @@ "type": "ShellKit", "run-command": [ "hilog -Q pidoff", + "chmod 777 -R /data/local/tmp", "chmod 777 -R /data/media", "chmod 777 /data/media/*" ] diff --git a/multimedia/media/media_cpp_standard/audioDecEncNdk/include/ActsAudioDecEncNdkTest.h b/multimedia/media/media_cpp_standard/audioDecEncNdk/include/ActsAudioDecEncNdkTest.h deleted file mode 100644 index 149dd75b950a717bcc8dac247177ca0d779be968..0000000000000000000000000000000000000000 --- a/multimedia/media/media_cpp_standard/audioDecEncNdk/include/ActsAudioDecEncNdkTest.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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. - */ - -#ifndef ACTSAUDIODECODER_NDK_FUNC_TEST_H -#define ACTSAUDIODECODER_NDK_FUNC_TEST_H - -#include "gtest/gtest.h" -#include "ADecEncNdkSample.h" - -namespace OHOS { -namespace Media { -class ActsAudioDecEncNdkTest : public testing::Test { -public: - // Preset action of the test suite, which is executed before the first test case - static void SetUpTestCase(void) - { - printf("ActsAudioDecEncNdkTest::SetUpTestCase"); - } - // Test suite cleanup action, which is executed after the last test case - static void TearDownTestCase(void) - { - printf("ActsAudioDecEncNdkTest::TearDownTestCase"); - } - // Preset action of the test case - void SetUp(void) - { - printf("ActsAudioDecEncNdkTest::SetUp"); - } - // Cleanup action of the test case - virtual void TearDown(void) - { - printf("ActsAudioDecEncNdkTest::TearDown"); - } -}; -} -} -#endif // ACTSAUDIODECODER_NDK_FUNC_TEST_H \ No newline at end of file diff --git a/multimedia/media/media_cpp_standard/audioDecEncNdk/src/ActsAudioDecEncNdkTest.cpp b/multimedia/media/media_cpp_standard/audioDecEncNdk/src/ActsAudioDecEncNdkTest.cpp index 600fc1a68086b410a8d0c35bbe10d17f453d0213..bfb1fccead7e6ce6d6227406488a5e1b2ec998e9 100644 --- a/multimedia/media/media_cpp_standard/audioDecEncNdk/src/ActsAudioDecEncNdkTest.cpp +++ b/multimedia/media/media_cpp_standard/audioDecEncNdk/src/ActsAudioDecEncNdkTest.cpp @@ -20,7 +20,7 @@ #include "native_avcodec_audioencoder.h" #include "native_avcodec_base.h" #include "native_avformat.h" -#include "ActsAudioDecEncNdkTest.h" +#include "ADecEncNdkSample.h" using namespace std; using namespace testing::ext; @@ -28,113 +28,74 @@ using namespace OHOS; using namespace OHOS::Media; namespace { - uint32_t ES_AAC_48000_32_1[] = { - 283, 336, 291, 405, 438, 411, 215, 215, 313, 270, 342, 641, 554, 545, 545, 546, - 541, 540, 542, 552, 537, 533, 498, 472, 445, 430, 445, 427, 414, 386, 413, 370, 380, - 401, 393, 369, 391, 367, 395, 396, 396, 385, 391, 384, 395, 392, 386, 388, 384, 379, - 376, 381, 375, 373, 349, 391, 357, 384, 395, 384, 380, 386, 372, 386, 383, 378, 385, - 385, 384, 342, 390, 379, 387, 386, 393, 397, 362, 393, 394, 391, 383, 385, 377, 379, - 381, 369, 375, 379, 346, 382, 356, 361, 366, 394, 393, 385, 362, 406, 399, 384, 377, - 385, 389, 375, 346, 396, 388, 381, 383, 352, 357, 397, 382, 395, 376, 388, 373, 374, - 353, 383, 384, 393, 379, 348, 364, 389, 380, 381, 388, 423, 392, 381, 368, 351, 391, - 355, 358, 395, 390, 385, 382, 383, 388, 388, 389, 376, 379, 376, 384, 369, 354, 390, - 389, 396, 393, 382, 385, 353, 383, 381, 377, 411, 387, 390, 377, 349, 381, 390, 378, - 373, 375, 381, 351, 392, 381, 380, 381, 378, 387, 379, 383, 348, 386, 364, 386, 371, - 399, 399, 385, 380, 355, 397, 395, 382, 380, 386, 352, 387, 390, 373, 372, 388, 378, - 385, 368, 385, 370, 378, 373, 383, 368, 373, 388, 351, 384, 391, 387, 389, 383, 355, - 361, 392, 386, 354, 394, 392, 397, 392, 352, 381, 395, 349, 383, 390, 392, 350, 393, - 393, 385, 389, 393, 382, 378, 384, 378, 375, 373, 375, 389, 377, 383, 387, 373, 344, - 388, 379, 391, 373, 384, 358, 361, 391, 394, 363, 350, 361, 395, 399, 389, 398, 375, - 398, 400, 381, 354, 363, 366, 400, 400, 356, 370, 400, 394, 398, 385, 378, 372, 354, - 359, 393, 381, 363, 396, 396, 355, 390, 356, 355, 371, 399, 367, 406, 375, 377, 405, - 401, 390, 393, 392, 384, 386, 374, 358, 397, 389, 393, 385, 345, 379, 357, 388, 356, - 381, 389, 367, 358, 391, 360, 394, 396, 357, 395, 388, 394, 383, 357, 383, 392, 394, - 376, 379, 356, 386, 395, 387, 377, 377, 389, 377, 385, 351, 387, 350, 388, 384, 345, - 358, 368, 399, 394, 385, 384, 395, 378, 387, 386, 386, 376, 375, 382, 351, 359, 356, - 401, 388, 363, 406, 363, 374, 435, 366, 400, 393, 392, 371, 391, 359, 359, 397, 388, - 390, 420, 411, 369, 384, 382, 383, 383, 375, 381, 361, 380, 348, 379, 386, 379, 379, - 386, 371, 352, 378, 378, 388, 384, 385, 352, 355, 387, 383, 379, 362, 386, 399, 376, - 390, 350, 387, 357, 403, 398, 397, 360, 351, 394, 400, 399, 393, 388, 395, 370, 377, - 395, 360, 346, 381, 370, 390, 380, 391, 387, 382, 384, 383, 354, 349, 394, 358, 387, - 400, 386, 402, 354, 396, 387, 391, 365, 377, 359, 361, 365, 395, 388, 388, 384, 388, - 378, 374, 382, 376, 377, 389, 378, 341, 390, 376, 381, 375, 414, 368, 369, 387, 411, - 396, 391, 378, 389, 349, 383, 344, 381, 387, 380, 353, 361, 391, 365, 390, 396, 382, - 386, 385, 385, 409, 387, 386, 378, 372, 372, 374, 349, 388, 389, 348, 395, 380, 382, - 388, 375, 347, 383, 359, 389, 368, 361, 405, 398, 393, 395, 359, 360, 395, 395, 362, - 354, 388, 348, 388, 386, 390, 350, 388, 356, 369, 364, 404, 404, 391, 394, 385, 439, - 432, 375, 366, 441, 362, 367, 382, 374, 346, 391, 371, 354, 376, 390, 373, 382, 385, - 389, 378, 377, 347, 414, 338, 348, 385, 352, 385, 386, 381, 388, 387, 364, 465, 405, - 443, 387, 339, 376, 337, 379, 387, 370, 374, 358, 354, 357, 393, 356, 381, 357, 407, - 361, 397, 362, 394, 394, 392, 394, 391, 381, 386, 379, 354, 351, 392, 408, 393, 389, - 388, 385, 375, 388, 375, 388, 375, 354, 384, 379, 386, 394, 383, 359, 405, 395, 352, - 345, 403, 427, 373, 380, 350, 415, 378, 434, 385, 388, 387, 400, 405, 329, 391, 356, - 419, 358, 359, 375, 367, 391, 359, 369, 361, 376, 378, 379, 348, 390, 345, 388, 390, - 406, 349, 368, 364, 391, 384, 401, 384, 391, 361, 399, 359, 386, 392, 382, 386, 380, - 383, 345, 376, 393, 400, 395, 343, 352, 354, 381, 388, 357, 393, 389, 384, 389, 388, - 384, 404, 372, 358, 381, 352, 355, 485, 393, 371, 376, 389, 377, 391, 387, 376, 342, - 390, 375, 379, 396, 376, 402, 353, 392, 382, 383, 387, 386, 372, 377, 382, 388, 381, - 387, 357, 393, 385, 346, 389, 388, 357, 362, 404, 398, 397, 402, 371, 351, 370, 362, - 350, 388, 399, 402, 406, 377, 396, 359, 372, 390, 392, 368, 383, 346, 384, 381, 379, - 367, 384, 389, 381, 371, 358, 422, 372, 382, 374, 444, 412, 369, 362, 373, 389, 401, - 383, 380, 366, 365, 361, 379, 372, 345, 382, 375, 376, 375, 382, 356, 395, 383, 384, - 391, 361, 396, 407, 365, 351, 385, 378, 403, 344, 352, 387, 397, 399, 377, 371, 381, - 415, 382, 388, 368, 383, 405, 390, 386, 384, 374, 375, 381, 371, 372, 374, 377, 346, - 358, 381, 377, 359, 385, 396, 385, 390, 389, 391, 375, 357, 389, 390, 377, 370, 379, - 351, 381, 381, 380, 371, 386, 389, 389, 383, 362, 393, 388, 355, 396, 383, 352, 384, - 352, 383, 362, 396, 385, 396, 357, 388, 382, 377, 373, 379, 383, 386, 350, 393, 355, - 380, 401, 392, 391, 402, 391, 427, 407, 394, 332, 398, 367, 373, 343, 381, 383, 386, - 382, 349, 353, 393, 378, 386, 375, 390, 356, 392, 384, 387, 380, 381, 385, 386, 383, - 378, 379, 359, 381, 382, 388, 357, 357, 397, 358, 424, 382, 352, 409, 374, 368, 365, - 399, 352, 393, 389, 385, 352, 380, 398, 389, 385, 387, 387, 353, 402, 396, 386, 357, - 395, 368, 369, 407, 394, 383, 362, 380, 385, 368, 375, 365, 379, 377, 388}; - constexpr uint32_t ES_AAC_48000_32_1_Length = sizeof(ES_AAC_48000_32_1) / sizeof(uint32_t); - const string MIME_TYPE_AAC = "audio/mp4a-latm"; - constexpr uint32_t DEFAULT_SAMPLE_RATE = 44100; - constexpr uint32_t DEFAULT_CHANNELS = 2; - const char* READPATH = "/data/media/AAC_48000_32_1.aac"; - - bool CheckDecDesc(map InDesc, OH_AVFormat* OutDesc) - { - int32_t out ; - for (const auto& t: InDesc) { - bool res = OH_AVFormat_GetIntValue(OutDesc, t.first.c_str(), &out); - cout << "key: " << t.first << "; out: " << out < InDesc, OH_AVFormat* OutDesc) +{ + int32_t out ; + for (const auto& t: InDesc) { + bool res = OH_AVFormat_GetIntValue(OutDesc, t.first.c_str(), &out); + cout << "key: " << t.first << "; out: " << out < mediaDescription) - { - const char *key; - for (const auto& t: mediaDescription) { - key = t.first.c_str(); - if (not OH_AVFormat_SetIntValue(format, key, t.second)) { - cout << "OH_AV_FormatPutIntValue Fail. format key: " << t.first - << ", value: "<< t.second << endl; - return false; - } +bool SetFormat(struct OH_AVFormat *format, map mediaDescription) +{ + const char *key; + for (const auto& t: mediaDescription) { + key = t.first.c_str(); + if (not OH_AVFormat_SetIntValue(format, key, t.second)) { + cout << "OH_AV_FormatPutIntValue Fail. format key: " << t.first + << ", value: "<< t.second << endl; + return false; } - return true; } + return true; +} } /** - * @tc.number : ActsAudioDecEncNdkTest001 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0100 * @tc.name : stop at end of stream * @tc.desc : Basic function test */ -HWTEST_F(ActsAudioDecEncNdkTest, ActsAudioDecEncNdkTest001, Function | MediumTest | Level1) +HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0100, TestSize.Level1) { ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample(); @@ -181,11 +142,11 @@ HWTEST_F(ActsAudioDecEncNdkTest, ActsAudioDecEncNdkTest001, Function | MediumTes } /** - * @tc.number : ActsAudioDecEncNdkTest002 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0200 * @tc.name : reset at end of stream * @tc.desc : Basic function test */ -HWTEST_F(ActsAudioDecEncNdkTest, ActsAudioDecEncNdkTest002, Function | MediumTest | Level1) +HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0200, TestSize.Level1) { ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample(); @@ -221,11 +182,11 @@ HWTEST_F(ActsAudioDecEncNdkTest, ActsAudioDecEncNdkTest002, Function | MediumTes } /** - * @tc.number : ActsAudioDecEncNdkTest003 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0300 * @tc.name : release at end of stream * @tc.desc : Basic function test */ -HWTEST_F(ActsAudioDecEncNdkTest, ActsAudioDecEncNdkTest003, Function | MediumTest | Level1) +HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0300, TestSize.Level1) { ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample(); @@ -259,11 +220,11 @@ HWTEST_F(ActsAudioDecEncNdkTest, ActsAudioDecEncNdkTest003, Function | MediumTes } /** - * @tc.number : ActsAudioDecEncNdkTest004 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0400 * @tc.name : flush at running * @tc.desc : Basic function test */ -HWTEST_F(ActsAudioDecEncNdkTest, ActsAudioDecEncNdkTest004, Function | MediumTest | Level1) +HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0400, TestSize.Level1) { ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample(); @@ -286,7 +247,7 @@ HWTEST_F(ActsAudioDecEncNdkTest, ActsAudioDecEncNdkTest004, Function | MediumTes ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartEnc()); ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartDec()); - while (aDecEncSample->GetFrameCount() < 500) {}; + while (aDecEncSample->GetFrameCount() < 100) {}; ASSERT_EQ(AV_ERR_OK, aDecEncSample->FlushDec()); ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartDec()); @@ -301,11 +262,11 @@ HWTEST_F(ActsAudioDecEncNdkTest, ActsAudioDecEncNdkTest004, Function | MediumTes } /** - * @tc.number : ActsAudioDecEncNdkTest005 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0500 * @tc.name : flush decoder at eos * @tc.desc : Basic function test */ -HWTEST_F(ActsAudioDecEncNdkTest, ActsAudioDecEncNdkTest005, Function | MediumTest | Level1) +HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0500, TestSize.Level1) { ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample(); @@ -356,11 +317,11 @@ HWTEST_F(ActsAudioDecEncNdkTest, ActsAudioDecEncNdkTest005, Function | MediumTes /** - * @tc.number : ActsAudioDecEncNdkTest006 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0600 * @tc.name : stop at running and restart to eos * @tc.desc : Basic function test */ -HWTEST_F(ActsAudioDecEncNdkTest, ActsAudioDecEncNdkTest006, Function | MediumTest | Level1) +HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0600, TestSize.Level1) { ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample(); @@ -383,7 +344,7 @@ HWTEST_F(ActsAudioDecEncNdkTest, ActsAudioDecEncNdkTest006, Function | MediumTes ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartEnc()); ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartDec()); - while (aDecEncSample->GetFrameCount() < 500) {}; + while (aDecEncSample->GetFrameCount() < 100) {}; ASSERT_EQ(AV_ERR_OK, aDecEncSample->StopDec()); ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartDec()); ASSERT_EQ(AV_ERR_OK, aDecEncSample->CalcuError()); @@ -400,11 +361,11 @@ HWTEST_F(ActsAudioDecEncNdkTest, ActsAudioDecEncNdkTest006, Function | MediumTes /** - * @tc.number : ActsAudioDecEncNdkTest007 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0700 * @tc.name : stop dec at eos and restart to eos * @tc.desc : Basic function test */ -HWTEST_F(ActsAudioDecEncNdkTest, ActsAudioDecEncNdkTest007, Function | MediumTest | Level1) +HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0700, TestSize.Level1) { ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample(); diff --git a/multimedia/media/media_cpp_standard/videoDecEncNdk/include/ActsVideoDecEncNdkTest.h b/multimedia/media/media_cpp_standard/videoDecEncNdk/include/ActsVideoDecEncNdkTest.h deleted file mode 100644 index f934627e1d50ed64136f1e05e6e53533b1bc3a16..0000000000000000000000000000000000000000 --- a/multimedia/media/media_cpp_standard/videoDecEncNdk/include/ActsVideoDecEncNdkTest.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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. - */ - -#ifndef ACTSVIDEODECENC_NDK_FUNC_TEST_H -#define ACTSVIDEODECENC_NDK_FUNC_TEST_H - -#include "gtest/gtest.h" -#include "VDecEncNdkSample.h" - -namespace OHOS { -namespace Media { -class ActsVideoDecEncNdkTest : public testing::Test { -public: - // Preset action of the test suite, which is executed before the first test case - static void SetUpTestCase(void) - { - printf("ActsVideoDecEncNdkTest::SetUpTestCase"); - } - // Test suite cleanup action, which is executed after the last test case - static void TearDownTestCase(void) - { - printf("ActsVideoDecEncNdkTest::TearDownTestCase"); - } - // Preset action of the test case - void SetUp(void) - { - printf("ActsVideoDecEncNdkTest::SetUp"); - } - // Cleanup action of the test case - virtual void TearDown(void) - { - printf("ActsVideoDecEncNdkTest::TearDown"); - } -}; -} -} -#endif // ACTSVIDEODECENC_NDK_FUNC_TEST_H diff --git a/multimedia/media/media_cpp_standard/videoDecEncNdk/src/ActsVideoDecEncNdkTest.cpp b/multimedia/media/media_cpp_standard/videoDecEncNdk/src/ActsVideoDecEncNdkTest.cpp index 2f45af0ed01a3be6df56200923e1bc971131ffd8..4c3d29349dbabd2c6392ff39c6d344fba360a427 100644 --- a/multimedia/media/media_cpp_standard/videoDecEncNdk/src/ActsVideoDecEncNdkTest.cpp +++ b/multimedia/media/media_cpp_standard/videoDecEncNdk/src/ActsVideoDecEncNdkTest.cpp @@ -19,7 +19,7 @@ #include "native_avcodec_videoencoder.h" #include "native_avcodec_base.h" #include "native_avformat.h" -#include "ActsVideoDecEncNdkTest.h" +#include "VDecEncNdkSample.h" using namespace std; using namespace testing::ext; @@ -27,67 +27,78 @@ using namespace OHOS; using namespace OHOS::Media; namespace { - const string MIME_TYPE_AVC = "video/avc"; - const string MIME_TYPE_MPEG4 = "video/mp4v-es"; - constexpr uint32_t DEFAULT_WIDTH = 320; - constexpr uint32_t DEFAULT_HEIGHT = 240; - constexpr uint32_t DEFAULT_PIXELFORMAT = 2; - constexpr uint32_t DEFAULT_FRAMERATE = 60; - const char* READPATH = "/data/media/out_320_240_10s.h264"; - - - bool CheckDecDesc(map InDesc, OH_AVFormat* OutDesc) - { - int32_t out ; - for (const auto& t: InDesc) { - bool res = OH_AVFormat_GetIntValue(OutDesc, t.first.c_str(), &out); - cout << "key: " << t.first << "; out: " << out < InDesc, OH_AVFormat* OutDesc) +{ + int32_t out ; + for (const auto& t: InDesc) { + bool res = OH_AVFormat_GetIntValue(OutDesc, t.first.c_str(), &out); + cout << "key: " << t.first << "; out: " << out < mediaDescription) - { - const char *key; - for (const auto& t: mediaDescription) { - key = t.first.c_str(); - if (not OH_AVFormat_SetIntValue(format, key, t.second)) { - cout << "OH_AV_FormatPutIntValue Fail. format key: " << t.first - << ", value: "<< t.second << endl; - return false; - } +bool SetFormat(struct OH_AVFormat *format, map mediaDescription) +{ + const char *key; + for (const auto& t: mediaDescription) { + key = t.first.c_str(); + if (not OH_AVFormat_SetIntValue(format, key, t.second)) { + cout << "OH_AV_FormatPutIntValue Fail. format key: " << t.first + << ", value: "<< t.second << endl; + return false; } - return true; } + return true; +} - struct OH_AVFormat* createFormat() - { - OH_AVFormat *DefaultFormat = OH_AVFormat_Create(); - OH_AVFormat_SetIntValue(DefaultFormat, OH_MD_KEY_WIDTH, DEFAULT_WIDTH); - OH_AVFormat_SetIntValue(DefaultFormat, OH_MD_KEY_HEIGHT, DEFAULT_HEIGHT); - OH_AVFormat_SetIntValue(DefaultFormat, OH_MD_KEY_PIXEL_FORMAT, DEFAULT_PIXELFORMAT); - OH_AVFormat_SetIntValue(DefaultFormat, OH_MD_KEY_FRAME_RATE, DEFAULT_FRAMERATE); - return DefaultFormat; - } +struct OH_AVFormat* createFormat() +{ + OH_AVFormat *DefaultFormat = OH_AVFormat_Create(); + OH_AVFormat_SetIntValue(DefaultFormat, OH_MD_KEY_WIDTH, DEFAULT_WIDTH); + OH_AVFormat_SetIntValue(DefaultFormat, OH_MD_KEY_HEIGHT, DEFAULT_HEIGHT); + OH_AVFormat_SetIntValue(DefaultFormat, OH_MD_KEY_PIXEL_FORMAT, DEFAULT_PIXELFORMAT); + OH_AVFormat_SetIntValue(DefaultFormat, OH_MD_KEY_FRAME_RATE, DEFAULT_FRAMERATE); + return DefaultFormat; +} } /** - * @tc.number : ActsVideoDecEncNdkTest001 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0100 * @tc.name : stop at end of stream * @tc.desc : Basic function test */ -HWTEST_F(ActsVideoDecEncNdkTest, ActsVideoDecEncNdkTest001, Function | MediumTest | Level1) +HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0100, TestSize.Level1) { VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample(); @@ -137,11 +148,11 @@ HWTEST_F(ActsVideoDecEncNdkTest, ActsVideoDecEncNdkTest001, Function | MediumTes } /** - * @tc.number : ActsVideoDecEncNdkTest002 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0200 * @tc.name : reset at end of stream * @tc.desc : Basic function test */ -HWTEST_F(ActsVideoDecEncNdkTest, ActsVideoDecEncNdkTest002, Function | MediumTest | Level1) +HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0200, TestSize.Level1) { VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample(); @@ -176,11 +187,11 @@ HWTEST_F(ActsVideoDecEncNdkTest, ActsVideoDecEncNdkTest002, Function | MediumTes /** - * @tc.number : ActsVideoDecEncNdkTest003 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0300 * @tc.name : release at end of stream * @tc.desc : Basic function test */ -HWTEST_F(ActsVideoDecEncNdkTest, ActsVideoDecEncNdkTest003, Function | MediumTest | Level1) +HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0300, TestSize.Level1) { VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample(); @@ -212,11 +223,11 @@ HWTEST_F(ActsVideoDecEncNdkTest, ActsVideoDecEncNdkTest003, Function | MediumTes } /** -* @tc.number : ActsVideoDecEncNdkTest004 +* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0400 * @tc.name : flush at running * @tc.desc : Basic function test */ -HWTEST_F(ActsVideoDecEncNdkTest, ActsVideoDecEncNdkTest004, Function | MediumTest | Level1) +HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0400, TestSize.Level1) { VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample(); @@ -262,11 +273,11 @@ HWTEST_F(ActsVideoDecEncNdkTest, ActsVideoDecEncNdkTest004, Function | MediumTes /** - * @tc.number : ActsVideoDecEncNdkTest005 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0500 * @tc.name : flush dec at eos and restart * @tc.desc : Basic function test */ -HWTEST_F(ActsVideoDecEncNdkTest, ActsVideoDecEncNdkTest005, Function | MediumTest | Level1) +HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0500, TestSize.Level1) { VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample(); @@ -313,11 +324,11 @@ HWTEST_F(ActsVideoDecEncNdkTest, ActsVideoDecEncNdkTest005, Function | MediumTes /** - * @tc.number : ActsVideoDecEncNdkTest006 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0600 * @tc.name : stop at running and restart to eos * @tc.desc : Basic function test */ -HWTEST_F(ActsVideoDecEncNdkTest, ActsVideoDecEncNdkTest006, Function | MediumTest | Level1) +HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0600, TestSize.Level1) { VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample(); @@ -364,11 +375,11 @@ HWTEST_F(ActsVideoDecEncNdkTest, ActsVideoDecEncNdkTest006, Function | MediumTes /** - * @tc.number : ActsVideoDecEncNdkTest007 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0700 * @tc.name : stop dec at eos and restart to eos * @tc.desc : Basic function test */ -HWTEST_F(ActsVideoDecEncNdkTest, ActsVideoDecEncNdkTest007, Function | MediumTest | Level1) +HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0700, TestSize.Level1) { VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample(); diff --git a/multimedia/media/media_cpp_standard/videoDecEncNdk/src/VDecEncNdkSample.cpp b/multimedia/media/media_cpp_standard/videoDecEncNdk/src/VDecEncNdkSample.cpp index b69e8094286da08c016452de53ba25606b76eab1..432a636faf9700e38a92b6853130bc86a28f019a 100644 --- a/multimedia/media/media_cpp_standard/videoDecEncNdk/src/VDecEncNdkSample.cpp +++ b/multimedia/media/media_cpp_standard/videoDecEncNdk/src/VDecEncNdkSample.cpp @@ -33,16 +33,7 @@ namespace { 128, 1697, 168, 149, 117, 1938, 170, 141, 142, 1830, 106, 161, 122, 1623, 160, 154, 156, 1998, 230, 177, 139, 1650, 186, 128, 134, 1214, 122, 1411, 120, 1184, 128, 1591, 195, 145, 105, 1587, 169, 140, 118, 1952, 177, 150, 161, 1437, 159, 123, 1758, 180, 165, 144, 1936, 214, 191, 175, 2122, 180, 179, - 160, 1927, 161, 184, 119, 1973, 218, 210, 129, 1962, 196, 127, 154, 2308, 173, 127, 1572, 142, 122, - 2065, 262, 159, 206, 2251, 269, 179, 170, 2056, 308, 168, 191, 2090, 303, 191, 110, 1932, 272, 162, - 122, 1877, 245, 167, 141, 1908, 294, 162, 118, 1493, 132, 1782, 273, 184, 133, 1958, 274, 180, 149, - 2070, 216, 169, 143, 1882, 224, 149, 139, 1749, 277, 184, 139, 2141, 197, 170, 140, 2002, 269, 162, - 140, 1862, 202, 179, 131, 1868, 214, 164, 140, 1546, 226, 150, 130, 1707, 162, 146, 1824, 181, 147, - 130, 1898, 209, 143, 131, 1805, 180, 148, 106, 1776, 147, 141, 1572, 177, 130, 105, 1776, 178, 144, - 122, 1557, 142, 124, 114, 1436, 143, 126, 1326, 127, 1755, 169, 127, 105, 1807, 177, 131, 134, 1613, - 187, 137, 136, 1314, 134, 118, 2005, 194, 129, 147, 1566, 185, 132, 131, 1236, 174, 137, 106, 11049, - 574, 126, 1242, 188, 130, 119, 1450, 187, 137, 141, 1116, 124, 1848, 138, 122, 1605, 186, 127, 140, - 1798, 170, 124, 121, 1666, 157, 128, 130, 1678, 135, 118, 1804, 169, 135, 125, 1837, 168, 124, 124}; + 160, 1927, 161, 184, 119, 1973, 218, 210, 129, 1962, 196, 127, 154, 2308, 173, 127, 1572, 142, 122}; constexpr uint32_t ES_LENGTH = sizeof(ES) / sizeof(uint32_t); constexpr int32_t STOPNUM = 10000; diff --git a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js index 703bab5267d35dd069a1ec2a9da802a1b7e8d9bf..39df063192e3fd8d154a5fa5589a60339b66839c 100644 --- a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js +++ b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js @@ -241,14 +241,14 @@ describe('PlayerLocalTestAudioAPI', function () { } /* * - * @tc.number : SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SRC_API_0100 * @tc.name : fd is wrong * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SRC_API_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); fileDescriptor.fd = -1; let mySteps = new Array(ERROR_STATE, END_STATE); @@ -258,14 +258,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SRC_API_0200 * @tc.name : offset is -1 * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SRC_API_0200', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); fileDescriptor.offset = 1; let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, END_STATE); @@ -275,14 +275,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SRC_API_0300 * @tc.name : length is -1 * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SRC_API_0300', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); fileDescriptor.length = -1; let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, END_STATE); @@ -292,14 +292,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SRC_API_0400 * @tc.name : fdSrc is undefined * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0400', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SRC_API_0400', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(ERROR_STATE, END_STATE); initAudioPlayer(); @@ -308,14 +308,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_PLAY_API_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_PLAY_API_0100 * @tc.name : 01.pause->play * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_PLAY_API_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_PLAY_API_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); console.info(`case update`); let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, END_STATE); @@ -325,14 +325,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_PLAY_API_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_PLAY_API_0200 * @tc.name : 02.stop->play * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_PLAY_API_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_PLAY_API_0200', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, PLAY_STATE, ERROR_STATE, END_STATE); initAudioPlayer(); @@ -341,14 +341,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_PLAY_API_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_PLAY_API_0300 * @tc.name : 03.seek->play * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_PLAY_API_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_PLAY_API_0300', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, SEEK_TIME, PLAY_STATE, END_STATE); initAudioPlayer(); @@ -357,14 +357,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_PLAY_API_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_PLAY_API_0400 * @tc.name : 04.reset->play * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_PLAY_API_0400', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_PLAY_API_0400', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, RESET_STATE, PLAY_STATE, ERROR_STATE, END_STATE); initAudioPlayer(); @@ -373,14 +373,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_PAUSE_API_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_PAUSE_API_0100 * @tc.name : 01.createAudioPlayer->play * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_PAUSE_API_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_PAUSE_API_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(PAUSE_STATE, ERROR_STATE, END_STATE); initAudioPlayer(); @@ -389,14 +389,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_PAUSE_API_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_PAUSE_API_0200 * @tc.name : 02.play->pause * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_PAUSE_API_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_PAUSE_API_0200', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, END_STATE); initAudioPlayer(); @@ -405,14 +405,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_PAUSE_API_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_PAUSE_API_0300 * @tc.name : 03.stop->pause * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_PAUSE_API_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_PAUSE_API_0300', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(PLAY_STATE, STOP_STATE, PAUSE_STATE, ERROR_STATE, END_STATE); initAudioPlayer(); @@ -421,14 +421,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_PAUSE_API_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_PAUSE_API_0400 * @tc.name : 04.seek->pause * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_PAUSE_API_0400', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_PAUSE_API_0400', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, PAUSE_STATE, END_STATE); initAudioPlayer(); @@ -437,14 +437,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_STOP_API_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_STOP_API_0100 * @tc.name : 01.play->stop * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_STOP_API_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_STOP_API_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, END_STATE); initAudioPlayer(); @@ -453,14 +453,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_STOP_API_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_STOP_API_0200 * @tc.name : 02.pause->stop * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_STOP_API_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_STOP_API_0200', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, STOP_STATE, END_STATE); initAudioPlayer(); @@ -469,14 +469,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_STOP_API_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_STOP_API_0300 * @tc.name : 03.seek->stop * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_STOP_API_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_STOP_API_0300', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, STOP_STATE, END_STATE); initAudioPlayer(); @@ -485,14 +485,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_SEEK_API_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SEEK_API_0100 * @tc.name : 01.play->seek * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_SEEK_API_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SEEK_API_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, END_STATE); initAudioPlayer(); @@ -501,14 +501,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_SEEK_API_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SEEK_API_0200 * @tc.name : 02.pause->seek * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_SEEK_API_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SEEK_API_0200', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, SEEK_TIME, END_STATE); initAudioPlayer(); @@ -517,14 +517,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_SEEK_API_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SEEK_API_0300 * @tc.name : 03.seek(0) * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_SEEK_API_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SEEK_API_0300', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, 0, END_STATE); initAudioPlayer(); @@ -533,14 +533,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_RESET_API_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_RESET_API_0100 * @tc.name : 01.play->reset * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_RESET_API_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_RESET_API_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, RESET_STATE, END_STATE); initAudioPlayer(); @@ -549,14 +549,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_RESET_API_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_RESET_API_0200 * @tc.name : 02.pause->reset * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_RESET_API_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_RESET_API_0200', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, RESET_STATE, END_STATE); initAudioPlayer(); @@ -565,14 +565,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_SETVOLUME_API_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SETVOLUME_API_0100 * @tc.name : 01.createAudioPlayer->setVolume * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_SETVOLUME_API_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SETVOLUME_API_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); var mySteps = new Array(VOLUME_STATE, VOLUME_VALUE, END_STATE); initAudioPlayer(); @@ -581,14 +581,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_SETVOLUME_API_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SETVOLUME_API_0200 * @tc.name : 02.play->setVolume * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_SETVOLUME_API_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SETVOLUME_API_0200', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); var mySteps = new Array(SRC_STATE, PLAY_STATE, VOLUME_STATE, VOLUME_VALUE, END_STATE); initAudioPlayer(); @@ -597,14 +597,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_SETVOLUME_API_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SETVOLUME_API_0300 * @tc.name : 03.pause->setVolume * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_SETVOLUME_API_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_SETVOLUME_API_0300', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); var mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, VOLUME_STATE, VOLUME_VALUE, END_STATE); initAudioPlayer(); @@ -613,14 +613,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_RELEASE_API_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_RELEASE_API_0100 * @tc.name : 01.play->release * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_RELEASE_API_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_RELEASE_API_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, RELEASE_STATE, END_STATE); initAudioPlayer(); @@ -629,14 +629,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_RELEASE_API_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_RELEASE_API_0200 * @tc.name : 02.pause->release * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_RELEASE_API_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_RELEASE_API_0200', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, RELEASE_STATE, END_STATE); initAudioPlayer(); @@ -645,14 +645,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_RELEASE_API_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_RELEASE_API_0300 * @tc.name : 03.stop->release * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_RELEASE_API_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_RELEASE_API_0300', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, RELEASE_STATE, END_STATE); initAudioPlayer(); @@ -661,14 +661,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_RELEASE_API_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_RELEASE_API_0400 * @tc.name : 04.seek->release * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_RELEASE_API_0400', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_RELEASE_API_0400', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, RELEASE_STATE, END_STATE); initAudioPlayer(); @@ -677,14 +677,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_RELEASE_API_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_RELEASE_API_0400 * @tc.name : 05.reset->release * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_RELEASE_API_0400', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_RELEASE_API_0400', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, RESET_STATE, RELEASE_STATE, END_STATE); initAudioPlayer(); @@ -693,14 +693,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_TIME_API_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_TIME_API_0100 * @tc.name : 01.get parameters after createAudioPlayer * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_TIME_API_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_TIME_API_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); initAudioPlayer(); expect(audioPlayer.src).assertEqual(''); @@ -712,14 +712,14 @@ describe('PlayerLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_AUDIOPLAYER_TIME_API_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_TIME_API_0200 * @tc.name : 02.get parameters after src * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_PLAYER_AUDIOPLAYER_TIME_API_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_TIME_API_0200', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); initAudioPlayer(); audioPlayer.src = fdHead + fileDescriptor.fd; diff --git a/multimedia/media/media_js_standard/audioRecorder/src/main/js/test/RecorderLocalTestAudioAPI.test.js b/multimedia/media/media_js_standard/audioRecorder/src/main/js/test/RecorderLocalTestAudioAPI.test.js index 62f6e8de6cb8ef16cc19e676adf0381ad2b0d24d..98f94a872ff24787e5301718dba57bb032e30d1c 100644 --- a/multimedia/media/media_js_standard/audioRecorder/src/main/js/test/RecorderLocalTestAudioAPI.test.js +++ b/multimedia/media/media_js_standard/audioRecorder/src/main/js/test/RecorderLocalTestAudioAPI.test.js @@ -167,14 +167,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_0200 * @tc.name : 02.start->prepare * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_0200', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(START_STATE, ERROR_STATE, PRE_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -182,14 +182,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_0300 * @tc.name : 03.pause->prepare * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_0300', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, PRE_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -198,14 +198,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_0400 * @tc.name : 04.resume->prepare * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_0400', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_0400', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, PRE_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -214,14 +214,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_0500 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_0500 * @tc.name : 05.stop->prepare * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_0500', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_0500', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RESET_STATE, PRE_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -229,14 +229,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_0600 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_0600 * @tc.name : 06.reset->prepare * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_0600', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_0600', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, PRE_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -244,14 +244,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_0800 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_0800 * @tc.name : 08.all steps->prepare * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_0800', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_0800', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PRE_STATE, ERROR_STATE, STOP_STATE, PRE_STATE, RESET_STATE, PRE_STATE, RELEASE_STATE, END_STATE); @@ -260,14 +260,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_0900 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_0900 * @tc.name : 09.prepare called three times * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_0900', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_0900', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, PRE_STATE, ERROR_STATE, PRE_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -275,14 +275,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_1000 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_1000 * @tc.name : 10.channel:-1 * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_1000', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_1000', 0, async function (done) { audioConfig.numberOfChannels = -1; audioConfig.audioSampleRate = 22050; audioConfig.audioEncodeBitRate = 22050; @@ -293,14 +293,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_1100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_1100 * @tc.name : 11.channel:-1 * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_1100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_1100', 0, async function (done) { audioConfig.numberOfChannels = CHANNEL_TWO; audioConfig.audioSampleRate = -1; audioConfig.audioEncodeBitRate = 22050; @@ -311,14 +311,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_1200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_1200 * @tc.name : 12.channel:-1 * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_Prepare_API_1200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PREPARE_API_1200', 0, async function (done) { audioConfig.numberOfChannels = CHANNEL_TWO; audioConfig.audioSampleRate = 22050; audioConfig.audioEncodeBitRate = -1; @@ -329,14 +329,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_START_API_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_START_API_0100 * @tc.name : 01.creatAudioRecorder->start * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_START_API_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_START_API_0100', 0, async function (done) { audioConfig.numberOfChannels = CHANNEL_TWO; audioConfig.audioSampleRate = 22050; audioConfig.audioEncodeBitRate = 22050; @@ -347,14 +347,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_START_API_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_START_API_0200 * @tc.name : 02.prepare->start * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_START_API_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_START_API_0200', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -362,14 +362,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_START_API_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_START_API_0300 * @tc.name : 03.pause->start * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_START_API_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_START_API_0300', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, START_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -378,14 +378,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_START_API_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_START_API_0400 * @tc.name : 04.resume->start * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_START_API_0400', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_START_API_0400', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, START_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -394,14 +394,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_START_API_0500 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_START_API_0500 * @tc.name : 05.stop->start * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_START_API_0500', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_START_API_0500', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, START_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -410,14 +410,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_START_API_0600 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_START_API_0600 * @tc.name : 06.reset->start * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_START_API_0600', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_START_API_0600', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, START_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -426,14 +426,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_START_API_0800 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_START_API_0800 * @tc.name : 08.all steps->start * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_START_API_0800', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_START_API_0800', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, START_STATE, ERROR_STATE, PRE_STATE, START_STATE, RESET_STATE, START_STATE, ERROR_STATE, PRE_STATE, START_STATE, @@ -443,14 +443,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_START_API_0900 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_START_API_0900 * @tc.name : 09.start called three times * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_START_API_0900', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_START_API_0900', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, START_STATE, ERROR_STATE, START_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -459,14 +459,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_PAUSE_API_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PAUSE_API_0100 * @tc.name : 01.creatAudioRecorder->pause * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_PAUSE_API_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PAUSE_API_0100', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PAUSE_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -474,14 +474,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_PAUSE_API_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PAUSE_API_0200 * @tc.name : 02.prepare->pause * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_PAUSE_API_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PAUSE_API_0200', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, PAUSE_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -489,14 +489,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_PAUSE_API_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PAUSE_API_0300 * @tc.name : 03.start->pause * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_PAUSE_API_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PAUSE_API_0300', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -504,14 +504,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_PAUSE_API_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PAUSE_API_0400 * @tc.name : 04.resume->pause * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_PAUSE_API_0400', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PAUSE_API_0400', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, PAUSE_STATE, RELEASE_STATE, END_STATE); @@ -520,14 +520,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_PAUSE_API_0500 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PAUSE_API_0500 * @tc.name : 05.stop->pause * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_PAUSE_API_0500', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PAUSE_API_0500', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, PAUSE_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -536,14 +536,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_PAUSE_API_0600 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PAUSE_API_0600 * @tc.name : 06.reset->pause * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_PAUSE_API_0500', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PAUSE_API_0500', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, PAUSE_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -552,14 +552,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_PAUSE_API_0800 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PAUSE_API_0800 * @tc.name : 08.all step->pause * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_PAUSE_API_0800', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PAUSE_API_0800', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, PAUSE_STATE, STOP_STATE, PAUSE_STATE, ERROR_STATE, RESET_STATE, PAUSE_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -568,14 +568,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_PAUSE_API_0900 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PAUSE_API_0900 * @tc.name : 09.pause three times * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_PAUSE_API_0900', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_PAUSE_API_0900', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, PAUSE_STATE, ERROR_STATE, PAUSE_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -584,14 +584,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RESUME_API_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESUME_API_0100 * @tc.name : 01.creatAudioRecorder->resume * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RESUME_API_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESUME_API_0100', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(RESUME_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -599,14 +599,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RESUME_API_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESUME_API_0200 * @tc.name : 02.prepare->resume * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RESUME_API_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESUME_API_0200', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, RESUME_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -614,14 +614,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RESUME_API_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESUME_API_0300 * @tc.name : 03.start->resume * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RESUME_API_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESUME_API_0300', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, RESUME_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -629,14 +629,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RESUME_API_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESUME_API_0400 * @tc.name : 04.pause->resume * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RESUME_API_0400', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESUME_API_0400', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -644,14 +644,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RESUME_API_0500 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESUME_API_0500 * @tc.name : 05.stop->resume * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RESUME_API_0500', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESUME_API_0500', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RESUME_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -660,14 +660,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RESUME_API_0600 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESUME_API_0600 * @tc.name : 06.reset->resume * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RESUME_API_0600', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESUME_API_0600', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, RESUME_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -676,14 +676,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RESUME_API_0800 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESUME_API_0800 * @tc.name : 08.all->resume * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RESUME_API_0800', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESUME_API_0800', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, RESUME_STATE, ERROR_STATE, PAUSE_STATE, RESUME_STATE, STOP_STATE, RESUME_STATE, ERROR_STATE, @@ -693,14 +693,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RESUME_API_0900 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESUME_API_0900 * @tc.name : 09.resume threee times * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RESUME_API_0900', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESUME_API_0900', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, RESUME_STATE, ERROR_STATE, RESUME_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -709,14 +709,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_STOP_API_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_STOP_API_0100 * @tc.name : 01.creatAudioRecorder->stop * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_STOP_API_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_STOP_API_0100', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(STOP_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -724,14 +724,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_STOP_API_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_STOP_API_0200 * @tc.name : 02.prepare->stop * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_STOP_API_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_STOP_API_0200', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, STOP_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -739,14 +739,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_STOP_API_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_STOP_API_0300 * @tc.name : 03.start->stop * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_STOP_API_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_STOP_API_0300', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -754,14 +754,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_STOP_API_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_STOP_API_0400 * @tc.name : 04.pause->stop * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_STOP_API_0400', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_STOP_API_0400', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, STOP_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -769,14 +769,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_STOP_API_0500 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_STOP_API_0500 * @tc.name : 05.resume->stop * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_STOP_API_0500', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_STOP_API_0500', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, STOP_STATE, RELEASE_STATE, END_STATE); @@ -785,14 +785,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_STOP_API_0600 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_STOP_API_0600 * @tc.name : 06.reset->stop * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_STOP_API_0600', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_STOP_API_0600', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, STOP_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -801,14 +801,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_STOP_API_0800 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_STOP_API_0800 * @tc.name : 08.all steps->stop * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_STOP_API_0800', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_STOP_API_0800', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, STOP_STATE, ERROR_STATE, RESET_STATE, PRE_STATE, START_STATE, STOP_STATE, RESET_STATE, PRE_STATE, RESET_STATE, STOP_STATE, ERROR_STATE, PRE_STATE, RELEASE_STATE, END_STATE); @@ -817,14 +817,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_STOP_API_0900 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_STOP_API_0900 * @tc.name : 09.stop called three times * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_STOP_API_0900', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_STOP_API_0900', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, STOP_STATE, ERROR_STATE, STOP_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -833,14 +833,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RESET_API_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESET_API_0100 * @tc.name : 01.creatAudioRecorder->reset * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RESET_API_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESET_API_0100', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(RESET_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -848,14 +848,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RESET_API_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESET_API_0200 * @tc.name : 02.prepare->reset * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RESET_API_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESET_API_0200', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, RESET_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -863,14 +863,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RESET_API_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESET_API_0300 * @tc.name : 03.start->reset * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RESET_API_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESET_API_0300', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -878,14 +878,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RESET_API_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESET_API_0400 * @tc.name : 04.pause->reset * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RESET_API_0400', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESET_API_0400', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESET_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -893,14 +893,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RESET_API_0500 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESET_API_0500 * @tc.name : 05.resume->reset * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RESET_API_0500', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESET_API_0500', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, RESET_STATE, RELEASE_STATE, END_STATE); @@ -909,14 +909,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RESET_API_0600 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESET_API_0600 * @tc.name : 06.stop->reset * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RESET_API_0600', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESET_API_0600', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RESET_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -924,14 +924,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RESET_API_0800 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESET_API_0800 * @tc.name : 08.all steps->reset * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RESET_API_0800', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESET_API_0800', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, RESET_STATE, PRE_STATE, START_STATE, RESET_STATE, PRE_STATE, START_STATE, STOP_STATE, RESET_STATE, PRE_STATE, START_STATE, RELEASE_STATE, END_STATE); @@ -940,14 +940,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RESET_API_0900 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESET_API_0900 * @tc.name : 09.reset callend three times * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RESET_API_0900', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RESET_API_0900', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, RESET_STATE, RESET_STATE, RELEASE_STATE, END_STATE); @@ -956,14 +956,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RELEASE_API_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RELEASE_API_0100 * @tc.name : 01.creatAudioRecorder->release * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RELEASE_API_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RELEASE_API_0100', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -972,14 +972,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RELEASE_API_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RELEASE_API_0200 * @tc.name : 02.prepare->release * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RELEASE_API_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RELEASE_API_0200', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -987,14 +987,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RELEASE_API_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RELEASE_API_0300 * @tc.name : 03.start->release * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RELEASE_API_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RELEASE_API_0300', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -1002,14 +1002,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RELEASE_API_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RELEASE_API_0400 * @tc.name : 04.pause->release * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RELEASE_API_0400', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RELEASE_API_0400', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -1017,14 +1017,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RELEASE_API_0500 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RELEASE_API_0500 * @tc.name : 05.resume->release * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RELEASE_API_0500', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RELEASE_API_0500', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -1032,14 +1032,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RELEASE_API_0600 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RELEASE_API_0600 * @tc.name : 06.stop->release * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RELEASE_API_0600', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RELEASE_API_0600', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); @@ -1047,14 +1047,14 @@ describe('RecorderLocalTestAudioAPI', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_AUDIORECORDER_RELEASE_API_0700 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RELEASE_API_0700 * @tc.name : 07.reset->release * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MEDIA_RECORDER_AUDIORECORDER_RELEASE_API_0700', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_RELEASE_API_0700', 0, async function (done) { initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, RELEASE_STATE, END_STATE); setCallback(mySteps, done); diff --git a/multimedia/media/media_js_standard/audioRecorder/src/main/js/test/RecorderLocalTestAudioFUNC.test.js b/multimedia/media/media_js_standard/audioRecorder/src/main/js/test/RecorderLocalTestAudioFUNC.test.js index c21c2701f6f9149590c87ce5888469b640bde340..77a979315642a20adb5fafca3c858bd5a01ee8f1 100644 --- a/multimedia/media/media_js_standard/audioRecorder/src/main/js/test/RecorderLocalTestAudioFUNC.test.js +++ b/multimedia/media/media_js_standard/audioRecorder/src/main/js/test/RecorderLocalTestAudioFUNC.test.js @@ -336,14 +336,14 @@ describe('RecorderLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_CODEC_AAC_0350 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_CODEC_AAC_0800 * @tc.name : 03.AAC_DifferentSampleRate 96000 * @tc.desc : Audio recordr control test * @tc.size : MediumTest * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MEDIA_RECORDER_CODEC_AAC_0350', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_CODEC_AAC_0800', 0, async function (done) { fdObject = await mediaTestBase.getAudioFd('audio_08.m4a'); fdPath = "fd://" + fdObject.fdNumber.toString(); audioConfig.uri = fdPath; @@ -479,14 +479,14 @@ describe('RecorderLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_RECORDER_FORMAT_MP4_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FORMAT_MP4_0100 * @tc.name : 02.AAC,mp4 * @tc.desc : Audio recordr control test * @tc.size : MediumTest * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_RECORDER_FORMAT_MP4_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FORMAT_MP4_0100', 0, async function (done) { fdObject = await mediaTestBase.getFd('audio_14.mp4'); fdPath = "fd://" + fdObject.fdNumber.toString(); audioConfig.uri = fdPath; @@ -503,14 +503,14 @@ describe('RecorderLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MEDIA_RECORDER_Format_M4A_Function_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FORMAT_M4A_0100 * @tc.name : 02.AAC,mp4 * @tc.desc : Audio recordr control test * @tc.size : MediumTest * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_RECORDER_FORMAT_MP4_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FORMAT_M4A_0100', 0, async function (done) { fdObject = await mediaTestBase.getAudioFd('audio_15.m4a'); fdPath = "fd://" + fdObject.fdNumber.toString(); audioConfig.uri = fdPath; diff --git a/multimedia/media/media_js_standard/recorderProfile/Test.json b/multimedia/media/media_js_standard/recorderProfile/Test.json deleted file mode 100644 index d36404479273e77b19bc1d8f4db9440c178b818d..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/recorderProfile/Test.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "description": "Configuration for profile Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "2000000", - "shell-timeout": "2000000", - "testcase-timeout": 60000, - "bundle-name": "ohos.acts.multimedia.recorder.profile", - "package-name": "ohos.acts.multimedia.recorder.profile" - }, - "kits": [ - { - "test-file-name": [ - "ActsRecorderProfileJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/pages/index/index.css b/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index a80eb6e2bd8ebee08149820f7eb31e2cdaa0077e..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ - -.container { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 100%; -} - -.title { - font-size: 40px; - color: #000000; - opacity: 0.9; -} - -@media screen and (device-type: tablet) and (orientation: landscape) { - .title { - font-size: 100px; - } -} - -@media screen and (device-type: wearable) { - .title { - font-size: 28px; - color: #FFFFFF; - } -} - -@media screen and (device-type: tv) { - .container { - background-image: url("/common/images/Wallpaper.png"); - background-size: cover; - background-repeat: no-repeat; - background-position: center; - } - - .title { - font-size: 100px; - color: #FFFFFF; - } -} - -@media screen and (device-type: phone) and (orientation: landscape) { - .title { - font-size: 60px; - } -} diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/pages/index/index.hml b/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 992653a1e597ed9216a711ead5671df909cd45cd..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestCallback.test.js b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestCallback.test.js deleted file mode 100644 index da4e873024eeed4b5ba3ce3fdafecf6a9f946c03..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestCallback.test.js +++ /dev/null @@ -1,342 +0,0 @@ -/* - * 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 media from '@ohos.multimedia.media' -import * as base from './ProfileTestBase.js'; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' - -export default function ProfileAbnormalTestCallback() { -describe('ProfileAbnormalTestCallback', function () { - beforeAll(function () { - console.info('beforeAll case'); - }) - - beforeEach(async function () { - console.info('beforeEach case'); - }) - - afterEach(function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - async function callbackAbnormalGetVideoProfile(sourceId, qualityLevel, done){ - media.getMediaCapability((err, mediaCaps) => { - expect(err).assertUndefined(); - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.getVideoRecorderProfile(sourceId, qualityLevel, (err, videoCapsArray) => { - expect(err).assertUndefined(); - base.checkVideoCapsArray(videoCapsArray); - console.info('getVideoRecorderProfile success'); - done(); - }) - } else { - console.info('mediaCaps is not defined'); - expect().assertFail(); - done(); - } - }) - } - - async function callbackAbnormalAudioRecorderConfigSupported(audioProfile, done) { - media.getMediaCapability((err, mediaCaps) => { - expect(err).assertUndefined(); - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.isAudioRecorderConfigSupported(audioProfile, (err, ean) => { - expect(err).assertUndefined(); - expect(ean).assertEqual(false); - console.info('isAudioRecorderConfigSupported: success'); - done(); - }) - } else { - console.info('mediaCaps is undefined'); - expect().assertFail(); - done(); - } - }) - } - - async function callbackAbnormalHasVideoProfile(sourceId, qualityLevel, done) { - media.getMediaCapability((err, mediaCaps) => { - expect(err).assertUndefined(); - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.hasVideoRecorderProfile(sourceId, qualityLevel, (err, ean) => { - expect(err).assertUndefined(); - expect(ean).assertEqual(false); - console.info('hasVideoRecorderProfile success'); - done(); - }) - } else { - console.info('mediaCaps is undefined'); - expect().assertFail(); - done(); - } - }) - } - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0100 - * @tc.name : test isAudioRecorderConfigSupported false - * @tc.desc : 5 args all set wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0100', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackAbnormalAudioRecorderConfigSupported(base.audioRecorderAbnormalAll, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0200 - * @tc.name : test isAudioRecorderConfigSupported false - * @tc.desc : FormatType is wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0200', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackAbnormalAudioRecorderConfigSupported(base.audioRecorderAbnormalFormatType, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0300 - * @tc.name : test isAudioRecorderConfigSupported fasle - * @tc.desc : CodecMimeType is wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0300', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackAbnormalAudioRecorderConfigSupported(base.audioRecorderAbnormalCodecMimeType, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0400 - * @tc.name : test isAudioRecorderConfigSupported false - * @tc.desc : bitrate is wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0400', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackAbnormalAudioRecorderConfigSupported(base.audioRecorderAbnormalBitrate, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0500 - * @tc.name : test isAudioRecorderConfigSupported false - * @tc.desc : sampleRate is wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0500', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackAbnormalAudioRecorderConfigSupported(base.audioRecorderAbnormalSampleRate, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0600 - * @tc.name : test isAudioRecorderConfigSupported false - * @tc.desc : channel is wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0600', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackAbnormalAudioRecorderConfigSupported(base.audioRecorderAbnormalSampleChannel, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0700 - * @tc.name : test hasVideoRecorderProfile - * @tc.desc : sourceId 1 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0700', 0, async function (done) { - console.info('test hasVideoRecorderProfile'); - callbackAbnormalHasVideoProfile(1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0800 - * @tc.name : test hasVideoRecorderProfile sourceId -1 - * @tc.desc : sourceId -1 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0800', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - callbackAbnormalHasVideoProfile(-1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0900 - * @tc.name : test hasVideoRecorderProfile qualityLevel -1 - * @tc.desc : sourceId 0 qualityLevel -1 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0900', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - callbackAbnormalHasVideoProfile(0, -1, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1000 - * @tc.name : test hasVideoRecorderProfile sourceId 65536 - * @tc.desc : sourceId 65535 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1000', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - callbackAbnormalHasVideoProfile(65535, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1100 - * @tc.name : test hasVideoRecorderProfile sourceId 65536 - * @tc.desc : sourceId 65536 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1100', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - callbackAbnormalHasVideoProfile(65536, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1200 - * @tc.name : test hasVideoRecorderProfile qualityLevel 65536 - * @tc.desc : sourceId 0 qualityLevel 65535 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1200', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - callbackAbnormalHasVideoProfile(0, 65535, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1300 - * @tc.name : test hasVideoRecorderProfile qualityLevel 65536 - * @tc.desc : sourceId 0 qualityLevel 65536 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1300', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - callbackAbnormalHasVideoProfile(0, 65536, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1400 - * @tc.name : test getVideoRecorderProfile sourceId -1 - * @tc.desc : sourceId -1 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1400', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - callbackAbnormalGetVideoProfile(-1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1500 - * @tc.name : test getVideoRecorderProfile qualityLevel -1 - * @tc.desc : sourceId 0 qualityLevel -1 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1500', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - callbackAbnormalGetVideoProfile(0, -1, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1600 - * @tc.name : test getVideoRecorderProfile sourceId 65535 - * @tc.desc : sourceId 65535 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1600', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - callbackAbnormalGetVideoProfile(65535, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1700 - * @tc.name : test getVideoRecorderProfile sourceId 65536 - * @tc.desc : sourceId 65536 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1700', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - callbackAbnormalGetVideoProfile(65536, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1800 - * @tc.name : test getVideoRecorderProfile qualityLevel 65535 - * @tc.desc : sourceId 0 qualityLevel 65535 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1800', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - callbackAbnormalGetVideoProfile(0, 65535, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1900 - * @tc.name : test getVideoRecorderProfile qualityLevel 65536 - * @tc.desc : sourceId 0 qualityLevel 65536 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1900', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - callbackAbnormalGetVideoProfile(0, 65536, done); - }) -})} diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestPromise.test.js b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestPromise.test.js deleted file mode 100644 index 97ece99da563b0892f098fd3986a72b0eb4d4cf1..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestPromise.test.js +++ /dev/null @@ -1,355 +0,0 @@ -/* - * 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 media from '@ohos.multimedia.media' -import * as base from './ProfileTestBase.js'; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' - -export default function ProfileAbnormalTestPromise() { -describe('ProfileAbnormalTestPromise', function () { - beforeAll(function () { - console.info('beforeAll case'); - }) - - beforeEach(async function () { - console.info('beforeEach case'); - }) - - afterEach(function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - async function promiseAbnormalGetVideoProfile(sourceId, qualityLevel, done) { - media.getMediaCapability().then(async (mediaCaps) => { - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.getVideoRecorderProfile(sourceId, qualityLevel).then(async (videoCapsArray) => { - base.checkVideoCapsArray(videoCapsArray); - console.info('getVideoRecorderProfile success'); - done(); - }, err => { - expect(err).assertUndefined(); - done(); - }) - } else { - console.info('mediaCaps is undefined'); - expect().assertFail(); - done(); - } - }, err => { - expect(err).assertUndefined(); - done(); - }) - } - - async function promiseAbnormalAudioRecoderConfigSupported(audioProfile, done) { - media.getMediaCapability().then(async (mediaCaps) => { - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.isAudioRecoderConfigSupported(audioProfile).then(async (ean) => { - console.info('isAudioRecoderConfigSupported: success' + ean); - expect(ean).assertEqual(false); - console.info('isAudioRecoderConfigSupported: success'); - done(); - }, err => { - expect(err).assertUndefined(); - done(); - }) - } else { - console.info('mediaCaps is undefined'); - expect().assertFail(); - done(); - } - }, err => { - expect(err).assertUndefined(); - done(); - }) - } - - async function promiseAbnormalHasVideoProfile(sourceId, qualityLevel, done) { - media.getMediaCapability().then(async (mediaCaps) => { - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.hasVideoRecorderProfile(sourceId, qualityLevel).then(async (ean) => { - expect(ean).assertEqual(false); - console.info('hasVideoRecorderProfile success'); - done(); - }, err => { - expect(err).assertUndefined(); - done(); - }) - } else { - console.info('mediaCaps is undefined'); - expect().assertFail(); - done(); - } - }, err => { - expect(err).assertUndefined(); - done(); - }) - } - - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0100 - * @tc.name : test isAudioRecoderConfigSupported false - * @tc.desc : 5 args all set wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0100', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalAll, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0200 - * @tc.name : test isAudioRecoderConfigSupported false - * @tc.desc : FormatType is wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0200', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalFormatType, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0300 - * @tc.name : test isAudioRecoderConfigSupported - * @tc.desc : CodecMimeType is wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0300', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalCodecMimeType, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0400 - * @tc.name : test isAudioRecoderConfigSupported - * @tc.desc : bitrate is wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0400', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalBitrate, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0500 - * @tc.name : test isAudioRecoderConfigSupported - * @tc.desc : sampleRate is wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0500', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalSampleRate, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0600 - * @tc.name : test isAudioRecoderConfigSupported - * @tc.desc : channel is wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0600', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalSampleChannel, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0700 - * @tc.name : test hasVideoRecorderProfile - * @tc.desc : sourceId 1 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0700', 0, async function (done) { - console.info('test hasVideoRecorderProfile'); - promiseAbnormalHasVideoProfile(1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0800 - * @tc.name : test hasVideoRecorderProfile sourceId -1 - * @tc.desc : sourceId -1 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0800', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - promiseAbnormalHasVideoProfile(-1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0900 - * @tc.name : test hasVideoRecorderProfile qualityLevel -1 - * @tc.desc : sourceId 0 qualityLevel -1 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0900', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - promiseAbnormalHasVideoProfile(0, -1, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1000 - * @tc.name : test hasVideoRecorderProfile sourceId 65536 - * @tc.desc : sourceId 65535 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1000', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - promiseAbnormalHasVideoProfile(65535, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1100 - * @tc.name : test hasVideoRecorderProfile sourceId 65536 - * @tc.desc : sourceId 65536 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1100', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - promiseAbnormalHasVideoProfile(65536, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1200 - * @tc.name : test hasVideoRecorderProfile qualityLevel 65536 - * @tc.desc : sourceId 0 qualityLevel 65535 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1200', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - promiseAbnormalHasVideoProfile(0, 65535, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1300 - * @tc.name : test hasVideoRecorderProfile qualityLevel 65536 - * @tc.desc : sourceId 0 qualityLevel 65536 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1300', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - promiseAbnormalHasVideoProfile(0, 65536, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1400 - * @tc.name : test getVideoRecorderProfile sourceId -1 - * @tc.desc : sourceId -1 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1400', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - promiseAbnormalGetVideoProfile(-1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1500 - * @tc.name : test getVideoRecorderProfile qualityLevel -1 - * @tc.desc : sourceId 0 qualityLevel -1 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1500', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - promiseAbnormalGetVideoProfile(0, -1, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1600 - * @tc.name : test getVideoRecorderProfile sourceId 65535 - * @tc.desc : sourceId 65535 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1600', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - promiseAbnormalGetVideoProfile(65535, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1700 - * @tc.name : test getVideoRecorderProfile sourceId 65536 - * @tc.desc : sourceId 65536 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1700', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - promiseAbnormalGetVideoProfile(65536, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1800 - * @tc.name : test getVideoRecorderProfile qualityLevel 65535 - * @tc.desc : sourceId 0 qualityLevel 65535 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1800', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - promiseAbnormalGetVideoProfile(0, 65535, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1900 - * @tc.name : test getVideoRecorderProfile qualityLevel 65536 - * @tc.desc : sourceId 0 qualityLevel 65536 - * @tc.size : MediumTest - * @tc.type : Abnormal test - * @tc.level : Level2 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1900', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - promiseAbnormalGetVideoProfile(0, 65536, done); - }) -}) -} diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestBase.js b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestBase.js deleted file mode 100644 index 33d23654fec4c00415e489abb5858ec7f9480c46..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestBase.js +++ /dev/null @@ -1,330 +0,0 @@ -/* - * 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 media from '@ohos.multimedia.media' -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' - -const audioRecorderCaps = { - outputFormat: media.ContainerFormatType.CFT_MPEG_4A, - audioEncoderMime: media.CodecMimeType.AUDIO_AAC, - sampleRates: [8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000], - bitrateRange: { min: 1, max: 384000 }, - channelRange: { min: 1, max: 2 }, -} -const audioRecorderCapsArray = [audioRecorderCaps]; - -const videoRecorderCaps = { - audioRecorderCaps, - outputFormat: media.ContainerFormatType.CFT_MPEG_4, - videoEncoderMime: media.CodecMimeType.VIDEO_MPEG4, - videoWidthRange: { min: 2, max: 1920 }, - videoBitrateRange: { min: 1, max: 3000000 }, - videoFramerateRange: { min: 1, max: 30 }, - videoHeightRange: { min: 2, max: 1080 }, -} -const videoRecorderCaps2 = { - audioRecorderCaps, - outputFormat: media.ContainerFormatType.CFT_MPEG_4, - videoEncoderMime: media.CodecMimeType.VIDEO_AVC, - videoWidthRange: { min: 2, max: 1920 }, - videoBitrateRange: { min: 1, max: 3000000 }, - videoFramerateRange: { min: 1, max: 30 }, - videoHeightRange: { min: 2, max: 1080 }, -} -const videoRecorderCapsArray = [videoRecorderCaps, videoRecorderCaps2]; - -export const recorderQualityLowPara = { - audioBitrate: 96000, - audioChannels: 2, - audioCodec: media.CodecMimeType.AUDIO_AAC, - audioSampleRate: 48000, - durationTime: 30, - fileFormat: media.ContainerFormatType.CFT_MPEG_4, - qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, - videoBitrate: 192000, - videoCodec: media.CodecMimeType.VIDEO_MPEG4, - videoFrameWidth: 176, - videoFrameHeight: 144, - videoFrameRate: 30 -}; - -export const recorderQualityHighPara = { - audioBitrate: 192000, - audioChannels: 2, - audioCodec: media.CodecMimeType.AUDIO_AAC, - audioSampleRate: 48000, - durationTime: 30, - fileFormat: media.ContainerFormatType.CFT_MPEG_4, - qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_HIGH, - videoBitrate: 17000000, - videoCodec: media.CodecMimeType.VIDEO_MPEG4, - videoFrameWidth: 1920, - videoFrameHeight: 1080, - videoFrameRate: 30 -}; - -export const recorderQualityQcifPara = { - audioBitrate: 96000, - audioChannels: 2, - audioCodec: media.CodecMimeType.AUDIO_AAC, - audioSampleRate: 48000, - durationTime: 30, - fileFormat: media.ContainerFormatType.CFT_MPEG_4, - qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_QCIF, - videoBitrate: 192000, - videoCodec: media.CodecMimeType.VIDEO_MPEG4, - videoFrameWidth: 176, - videoFrameHeight: 144, - videoFrameRate: 30 -}; - -export const recorderQualityCifPara = { - audioBitrate: 96000, - audioChannels: 2, - audioCodec: media.CodecMimeType.AUDIO_AAC, - audioSampleRate: 48000, - durationTime: 30, - fileFormat: media.ContainerFormatType.CFT_MPEG_4, - qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_CIF, - videoBitrate: 1536000, - videoCodec: media.CodecMimeType.VIDEO_MPEG4, - videoFrameWidth: 352, - videoFrameHeight: 288, - videoFrameRate: 30 -}; - -export const recorderQuality480PPara = { - audioBitrate: 96000, - audioChannels: 2, - audioCodec: media.CodecMimeType.AUDIO_AAC, - audioSampleRate: 48000, - durationTime: 30, - fileFormat: media.ContainerFormatType.CFT_MPEG_4, - qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_480P, - videoBitrate: 5000000, - videoCodec: media.CodecMimeType.VIDEO_MPEG4, - videoFrameWidth: 640, - videoFrameHeight: 480, - videoFrameRate: 30 -}; - -export const recorderQuality720PPara = { - audioBitrate: 192000, - audioChannels: 2, - audioCodec: media.CodecMimeType.AUDIO_AAC, - audioSampleRate: 48000, - durationTime: 30, - fileFormat: media.ContainerFormatType.CFT_MPEG_4, - qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_720P, - videoBitrate: 12000000, - videoCodec: media.CodecMimeType.VIDEO_MPEG4, - videoFrameWidth: 1280, - videoFrameHeight: 720, - videoFrameRate: 30 -}; - -export const recorderQuality1080PPara = { - audioBitrate: 192000, - audioChannels: 2, - audioCodec: media.CodecMimeType.AUDIO_AAC, - audioSampleRate: 48000, - durationTime: 30, - fileFormat: media.ContainerFormatType.CFT_MPEG_4, - qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_1080P, - videoBitrate: 17000000, - videoCodec: media.CodecMimeType.VIDEO_MPEG4, - videoFrameWidth: 1920, - videoFrameHeight: 1080, - videoFrameRate: 30 -}; - -export const recorderQualityQvgaPara = { - audioBitrate: 96000, - audioChannels: 2, - audioCodec: media.CodecMimeType.AUDIO_AAC, - audioSampleRate: 48000, - durationTime: 30, - fileFormat: media.ContainerFormatType.CFT_MPEG_4, - qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_QVGA, - videoBitrate: 1200000, - videoCodec: media.CodecMimeType.VIDEO_MPEG4, - videoFrameWidth: 320, - videoFrameHeight: 240, - videoFrameRate: 30 -}; - -export const recorderQualityLowParaSourceId1 = { - audioBitrate: 0, - audioChannels: 0, - audioCodec: '', - audioSampleRate: 0, - durationTime: 0, - fileFormat: '', - qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, - videoBitrate: 0, - videoCodec: '', - videoFrameWidth: 0, - videoFrameHeight: 0, - videoFrameRate: 0 -}; - -export const audioRecorderPara1 = { - outputFormat: media.ContainerFormatType.CFT_MPEG_4, - audioEncoderMime: media.CodecMimeType.AUDIO_AAC, - bitrate: 96000, - sampleRate: 48000, - channel: 2 -}; - -export const audioRecorderPara2 = { - outputFormat: media.ContainerFormatType.CFT_MPEG_4, - audioEncoderMime: media.CodecMimeType.AUDIO_AAC, - bitrate: 192000, - sampleRate: 48000, - channel: 2 -}; - -export const audioRecorderAbnormalAll = { - outputFormat: 'aaa', - audioEncoderMime: 'aaa', - bitrate: 655360, - sampleRate: 655360, - channel: 0 -}; - -export const audioRecorderAbnormalFormatType = { - outputFormat: 'aaa', - audioEncoderMime: media.CodecMimeType.AUDIO_AAC, - bitrate: 96000, - sampleRate: 48000, - channel: 2 -}; - -export const audioRecorderAbnormalCodecMimeType = { - outputFormat: media.ContainerFormatType.CFT_MPEG_4, - audioEncoderMime: 'aaa', - bitrate: 96000, - sampleRate: 48000, - channel: 2 -}; - -export const audioRecorderAbnormalBitrate = { - outputFormat: media.ContainerFormatType.CFT_MPEG_4, - audioEncoderMime: media.CodecMimeType.AUDIO_AAC, - bitrate: 655360, - sampleRate: 48000, - channel: 2 -}; - -export const audioRecorderAbnormalSampleRate = { - outputFormat: media.ContainerFormatType.CFT_MPEG_4, - audioEncoderMime: media.CodecMimeType.AUDIO_AAC, - bitrate: 96000, - sampleRate: 655360, - channel: 2 -}; - -export const audioRecorderAbnormalSampleChannel = { - outputFormat: media.ContainerFormatType.CFT_MPEG_4, - audioEncoderMime: media.CodecMimeType.AUDIO_AAC, - bitrate: 96000, - sampleRate: 4800, - channel: 0 -}; - -export function checkVideoCapsArray(videoCapsArray) { - let expectProfile = { - audioBitrate: 0, - audioChannels: 0, - audioCodec:'', - audioSampleRate: 0, - durationTime: 0, - fileFormat: '', - qualityLevel: 0, - videoBitrate: 0, - videoCodec: '', - videoFrameWidth: 0, - videoFrameHeight: 0, - videoFrameRate: 0, - }; - expect(Object.keys(expectProfile).length).assertEqual(Object.keys(videoCapsArray).length); - let keys = Object.keys(videoCapsArray); - if (keys.length != 0) { - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - expect(videoCapsArray[key]).assertEqual(expectProfile[key]); - console.info('check videoCapsArray success'); - } - } else { - console.info('check videoCapsArray failed'); - } -} - -export function checkAudioArray(audioCapsArray, done) { - expect(audioCapsArray.length).assertEqual(audioRecorderCapsArray.length); - for (let i = 0; i < audioCapsArray.length; i++) { - expect(audioCapsArray[i].outputFormat).assertEqual(audioRecorderCapsArray[i].outputFormat); - expect(audioCapsArray[i].audioEncoderMime).assertEqual(audioRecorderCapsArray[i].audioEncoderMime); - for (let j = 0; j < audioCapsArray[i].sampleRates.length; j++) { - expect(audioCapsArray[i].sampleRates[j]).assertEqual(audioRecorderCapsArray[i].sampleRates[j]); - } - expect(audioCapsArray[i].bitrateRange.min).assertEqual(audioRecorderCapsArray[i].bitrateRange.min); - expect(audioCapsArray[i].bitrateRange.max).assertEqual(audioRecorderCapsArray[i].bitrateRange.max); - expect(audioCapsArray[i].channelRange.min).assertEqual(audioRecorderCapsArray[i].channelRange.min); - expect(audioCapsArray[i].channelRange.max).assertEqual(audioRecorderCapsArray[i].channelRange.max); - } - done(); -} - -export function checkVideoArray(videoCapsArray, done) { - expect(videoCapsArray.length).assertEqual(videoRecorderCapsArray.length); - for (let i = 0; i < videoCapsArray.length; i++) { - expect(videoCapsArray[i].audioEncoderMime).assertEqual - (videoRecorderCapsArray[i].audioRecorderCaps.audioEncoderMime); - for (let j = 0; j < videoCapsArray[i].audioSampleRates.length; j++) { - expect(videoCapsArray[i].audioSampleRates[j]).assertEqual - (videoRecorderCapsArray[i].audioRecorderCaps.sampleRates[j]); - } - expect(videoCapsArray[i].audioBitrateRange.min).assertEqual - (videoRecorderCapsArray[i].audioRecorderCaps.bitrateRange.min); - expect(videoCapsArray[i].audioBitrateRange.max).assertEqual - (videoRecorderCapsArray[i].audioRecorderCaps.bitrateRange.max); - expect(videoCapsArray[i].audioChannelRange.min).assertEqual - (videoRecorderCapsArray[i].audioRecorderCaps.channelRange.min); - expect(videoCapsArray[i].audioChannelRange.max).assertEqual - (videoRecorderCapsArray[i].audioRecorderCaps.channelRange.max); - expect(videoCapsArray[i].outputFormat).assertEqual - (videoRecorderCapsArray[i].outputFormat); - expect(videoCapsArray[i].videoWidthRange.min).assertEqual - (videoRecorderCapsArray[i].videoWidthRange.min); - expect(videoCapsArray[i].videoWidthRange.max).assertEqual - (videoRecorderCapsArray[i].videoWidthRange.max); - expect(videoCapsArray[i].videoBitrateRange.min).assertEqual - (videoRecorderCapsArray[i].videoBitrateRange.min); - expect(videoCapsArray[i].videoBitrateRange.max).assertEqual - (videoRecorderCapsArray[i].videoBitrateRange.max); - expect(videoCapsArray[i].videoFramerateRange.min).assertEqual - (videoRecorderCapsArray[i].videoFramerateRange.min); - expect(videoCapsArray[i].videoFramerateRange.max).assertEqual - (videoRecorderCapsArray[i].videoFramerateRange.max); - expect(videoCapsArray[i].videoHeightRange.min).assertEqual - (videoRecorderCapsArray[i].videoHeightRange.min); - expect(videoCapsArray[i].videoHeightRange.max).assertEqual - (videoRecorderCapsArray[i].videoHeightRange.max); - expect(videoCapsArray[i].videoEncoderMime).assertEqual - (videoRecorderCapsArray[i].videoEncoderMime); - } - done(); -} diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestCallback.test.js b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestCallback.test.js deleted file mode 100644 index 62b5af6f755730177f32216032828b0b01e66164..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestCallback.test.js +++ /dev/null @@ -1,342 +0,0 @@ -/* - * 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 media from '@ohos.multimedia.media' -import * as base from './ProfileTestBase.js'; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' - -export default function ProfileTestCallback() { -describe('ProfileTestCallback', function () { - beforeAll(function () { - console.info('beforeAll case'); - }) - - beforeEach(async function () { - console.info('beforeEach case'); - }) - - afterEach(function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - async function getAudioRecorderCapsTest(done) { - media.getMediaCapability((err, mediaCaps) => { - expect(err).assertUndefined(); - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.getAudioRecorderCaps((err, audioCapsArray) => { - expect(err).assertUndefined(); - console.info('getAudioRecorderCaps success'); - if (typeof (audioCapsArray) != 'undefined') { - base.checkAudioArray(audioCapsArray, done); - } else { - console.info('audioCaps is not defined'); - expect().assertFail(); - done(); - } - - }) - } else { - console.info('mediaCaps is not defined'); - expect().assertFail(); - done(); - } - }) - } - - async function getVideoRecorderCapsTest(done) { - media.getMediaCapability((err, mediaCaps) => { - expect(err).assertUndefined(); - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.getVideoRecorderCaps((err, videoCapsArray) => { - expect(err).assertUndefined(); - console.info('getVideoRecorderCapsTest success'); - if (typeof (videoCapsArray) != 'undefined') { - base.checkVideoArray(videoCapsArray, done); - } else { - console.info('videoCaps is not defined'); - expect().assertFail(); - done(); - } - }) - } else { - console.info('mediaCaps is not defined'); - expect().assertFail(); - done(); - } - }) - } - - async function callbackGetVideoProfile(sourceId, qualityLevel, expectProfile, done) { - media.getMediaCapability((err, mediaCaps) => { - expect(err).assertUndefined(); - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.getVideoRecorderProfile(sourceId, qualityLevel, (err, videoCapsArray) => { - expect(err).assertUndefined(); - console.info('getVideoRecorderProfile success'); - expect(Object.keys(expectProfile).length).assertEqual(Object.keys(videoCapsArray).length); - let keys = Object.keys(videoCapsArray); - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - expect(videoCapsArray[key]).assertEqual(expectProfile[key]); - } - done(); - }) - } else { - console.info('mediaCaps is undefined'); - expect().assertFail(); - done(); - } - }) - } - - async function callbackAudioRecoderConfigSupported(audioProfile, done) { - media.getMediaCapability((err, mediaCaps) => { - expect(err).assertUndefined(); - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.isAudioRecoderConfigSupported(audioProfile, (err, ean) => { - expect(err).assertUndefined(); - expect(ean).assertEqual(true); - console.info('isAudioRecoderConfigSupported: success'); - done(); - }) - } else { - console.info('mediaCaps is undefined'); - expect().assertFail(); - done(); - } - }) - } - - async function callbackHasVideoProfile(sourceId, qualityLevel, done) { - media.getMediaCapability((err, mediaCaps) => { - expect(err).assertUndefined(); - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.hasVideoRecorderProfile(sourceId, qualityLevel, (err, ean) => { - expect(err).assertUndefined(); - expect(ean).assertEqual(true); - console.info('hasVideoRecorderProfile success'); - done(); - }) - } else { - console.info('mediaCaps is undefined'); - expect().assertFail(); - done(); - } - }) - } - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0100 - * @tc.name : test getAudioRecorderCaps - * @tc.desc : outputFormat/audioEncoderMime/sampleRates/bitrateRange/channelRange - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0100', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - getAudioRecorderCapsTest(done); - console.info("test getAudioRecorderCaps success "); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0200 - * @tc.name : test getVideoRecorderCapsTest - * @tc.desc : outputFormat/audioEncoderMime/audioSampleRates/videoEncoderMime/audioBitrateRange/ - audioChannelRange/videoBitrateRange/videoFramerateRange/videoWidthRange/videoHeightRange - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0200', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - getVideoRecorderCapsTest(done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0300 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0300', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackGetVideoProfile(0,media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, - base.recorderQualityLowPara, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0400 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 1 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0400', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_HIGH, - base.recorderQualityHighPara, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0500 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0500', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_QCIF, - base.recorderQualityQcifPara, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0600 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 3 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0600', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_CIF, - base.recorderQualityCifPara, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0700 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 4 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0700', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_480P, - base.recorderQuality480PPara, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0800 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 5 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0800', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_720P, - base.recorderQuality720PPara, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0900 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 6 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0900', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_1080P, - base.recorderQuality1080PPara, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1000 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 7 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1000', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_QVGA, - base.recorderQualityQvgaPara, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1100 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 1 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1100', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackGetVideoProfile(1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, - base.recorderQualityLowParaSourceId1, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1200 - * @tc.name : test isAudioRecoderConfigSupported - * @tc.desc : isAudioRecoderConfigSupported true - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1200', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackAudioRecoderConfigSupported(base.audioRecorderPara1, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1300 - * @tc.name : test isAudioRecoderConfigSupported - * @tc.desc : isAudioRecoderConfigSupported true - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1300', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackAudioRecoderConfigSupported(base.audioRecorderPara2, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1400 - * @tc.name : test hasVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1400', 0, async function (done) { - console.info('test hasVideoRecorderProfile'); - callbackHasVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - -})} diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestPromise.test.js b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestPromise.test.js deleted file mode 100644 index 105485c119939367c53cb2a054d006f517ee0255..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestPromise.test.js +++ /dev/null @@ -1,363 +0,0 @@ -/* - * 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 media from '@ohos.multimedia.media' -import * as base from './ProfileTestBase.js'; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' - -export default function ProfileTestPromise() { -describe('ProfileTestPromise', function () { - beforeAll(function () { - console.info('beforeAll case'); - }) - - beforeEach(async function () { - console.info('beforeEach case'); - }) - - afterEach(function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - async function getAudioRecorderCapsTest(done) { - media.getMediaCapability().then(async (mediaCaps) => { - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.getAudioRecorderCaps().then(async (audioCapsArray) => { - console.info('getAudioRecorderCaps success'); - if (typeof (audioCapsArray) != 'undefined') { - base.checkAudioArray(audioCapsArray, done); - } else { - console.info('audioCaps is undefined'); - expect().assertFail(); - done(); - } - }, err => { - expect(err).assertUndefined(); - done(); - }) - } else { - console.info('mediaCaps is undefined'); - expect().assertFail(); - done(); - } - }, err => { - expect(err).assertUndefined(); - done(); - }) - } - - async function getVideoRecorderCapsTest(done) { - media.getMediaCapability().then(async (mediaCaps) => { - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.getVideoRecorderCaps().then(async (videoCapsArray) => { - console.info('getVideoRecorderCaps success'); - if (typeof (videoCapsArray) != 'undefined') { - base.checkVideoArray(videoCapsArray, done); - } else { - console.info('audioCaps is undefined'); - expect().assertFail(); - done(); - } - }, err => { - expect(err).assertUndefined(); - done(); - }) - } else { - console.info('mediaCaps is undefined'); - expect().assertFail(); - done(); - } - }, err => { - expect(err).assertUndefined(); - done(); - }) - } - - async function promiseGetVideoProfile(sourceId, qualityLevel, expectProfile, done) { - media.getMediaCapability().then(async (mediaCaps) => { - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.getVideoRecorderProfile(sourceId, qualityLevel).then(async (videoCapsArray) => { - console.info('getVideoRecorderProfile success'); - expect(Object.keys(expectProfile).length).assertEqual(Object.keys(videoCapsArray).length); - let keys = Object.keys(videoCapsArray); - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - expect(videoCapsArray[key]).assertEqual(expectProfile[key]); - } - done(); - }, err => { - expect(err).assertUndefined(); - done(); - }) - } else { - console.info('mediaCaps is undefined'); - expect().assertFail(); - done(); - } - }, err => { - expect(err).assertUndefined(); - done(); - }) - } - - async function promiseAudioRecoderConfigSupported(audioProfile, done) { - media.getMediaCapability().then(async (mediaCaps) => { - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.isAudioRecoderConfigSupported(audioProfile).then(async (ean) => { - console.info('isAudioRecoderConfigSupported: success' + ean); - expect(ean).assertEqual(true); - console.info('isAudioRecoderConfigSupported: success'); - done(); - }, err => { - expect(err).assertUndefined(); - done(); - }) - } else { - console.info('mediaCaps is undefined'); - expect().assertFail(); - done(); - } - }, err => { - expect(err).assertUndefined(); - done(); - }) - } - - async function promiseHasVideoProfile(sourceId, qualityLevel, done) { - media.getMediaCapability().then(async (mediaCaps) => { - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.hasVideoRecorderProfile(sourceId, qualityLevel).then(async (ean) => { - expect(ean).assertEqual(true); - console.info('hasVideoRecorderProfile success'); - done(); - }, err => { - expect(err).assertUndefined(); - done(); - }) - } else { - console.info('mediaCaps is undefined'); - expect().assertFail(); - done(); - } - }, err => { - expect(err).assertUndefined(); - done(); - }) - } - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0100 - * @tc.name : test getAudioRecorderCaps - * @tc.desc : outputFormat/audioEncoderMime/sampleRates/bitrateRange/channelRange - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0100', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - getAudioRecorderCapsTest(done); - console.info("test getAudioRecorderCaps success "); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0200 - * @tc.name : test getVideoRecorderCapsTest - * @tc.desc : outputFormat/audioEncoderMime/audioSampleRates/videoEncoderMime/audioBitrateRange/ - audioChannelRange/videoBitrateRange/videoFramerateRange/videoWidthRange/videoHeightRange - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0200', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - getVideoRecorderCapsTest(done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0300 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0300', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseGetVideoProfile(0,media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, - base.recorderQualityLowPara, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0400 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 1 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0400', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_HIGH, - base.recorderQualityHighPara, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0500 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 2 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0500', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_QCIF, - base.recorderQualityQcifPara, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0600 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 3 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0600', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_CIF, - base.recorderQualityCifPara, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0700 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 4 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0700', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_480P, - base.recorderQuality480PPara, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0800 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 5 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0800', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_720P, - base.recorderQuality720PPara, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0900 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 6 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0900', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_1080P, - base.recorderQuality1080PPara, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1000 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 7 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1000', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_QVGA, - base.recorderQualityQvgaPara, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1100 - * @tc.name : test getVideoRecorderProfile - * @tc.desc : sourceId 1 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1100', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseGetVideoProfile(1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, - base.recorderQualityLowParaSourceId1, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1200 - * @tc.name : test isAudioRecoderConfigSupported - * @tc.desc : isAudioRecoderConfigSupported true - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1200', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseAudioRecoderConfigSupported(base.audioRecorderPara1, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1300 - * @tc.name : test isAudioRecoderConfigSupported - * @tc.desc : isAudioRecoderConfigSupported true - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1300', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseAudioRecoderConfigSupported(base.audioRecorderPara2, done); - }) - - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1400 - * @tc.name : test hasVideoRecorderProfile - * @tc.desc : sourceId 0 qualityLevel 0 - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1400', 0, async function (done) { - console.info('test hasVideoRecorderProfile'); - promiseHasVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - -}) -} diff --git a/notification/ans_standard/BUILD.gn b/notification/ans_standard/BUILD.gn index 983edd21c1d2532d454c75aea5556c6079815705..5e1fd41bd6d02e52c740e1a738ad0a68967b4ca1 100644 --- a/notification/ans_standard/BUILD.gn +++ b/notification/ans_standard/BUILD.gn @@ -16,6 +16,7 @@ group("ans_standard") { testonly = true if (is_standard_system) { deps = [ + "actsNotificationDistributedTest:ActsNotificationDistributedTest", "actsNotificationSlotTest:ActsNotificationSlotTest", "actsNotificationWantAgentTest:ActsNotificationWantAgentTest", "actsnotificationshow:ActsNotificationShowTest", diff --git a/notification/ans_standard/actsNotificationDistributedTest/BUILD.gn b/notification/ans_standard/actsNotificationDistributedTest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..52609ab77755f8c5dbb436b881adb66ab5163ab8 --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/BUILD.gn @@ -0,0 +1,34 @@ +# 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") + +ohos_js_hap_suite("ActsNotificationDistributedTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsNotificationDistributedTest" + subsystem_name = "notification" + part_name = "distributed_notification_service" +} +ohos_js_assets("hjs_demo_js_assets") { + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/notification/ans_standard/actsNotificationDistributedTest/Test.json b/notification/ans_standard/actsNotificationDistributedTest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..9f1c049575b4f522b1637529f3ffb3910d04e4c6 --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "180000", + "shell-timeout": "180000", + "bundle-name": "com.example.actsnotificationdistributed", + "package-name": "com.example.actsnotificationdistributed" + }, + "kits": [ + { + "test-file-name": [ + "ActsNotificationDistributedTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/signature/openharmony_sx.p7b b/notification/ans_standard/actsNotificationDistributedTest/signature/openharmony_sx.p7b similarity index 84% rename from multimedia/media/media_js_standard/recorderProfile/signature/openharmony_sx.p7b rename to notification/ans_standard/actsNotificationDistributedTest/signature/openharmony_sx.p7b index 02772ce36b607a459e0e124b0240997e7e0c5523..c21526ed6d8aa59d47b67380df6fec1a7d8af9dd 100644 Binary files a/multimedia/media/media_js_standard/recorderProfile/signature/openharmony_sx.p7b and b/notification/ans_standard/actsNotificationDistributedTest/signature/openharmony_sx.p7b differ diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/config.json b/notification/ans_standard/actsNotificationDistributedTest/src/main/config.json similarity index 61% rename from multimedia/media/media_js_standard/recorderProfile/src/main/config.json rename to notification/ans_standard/actsNotificationDistributedTest/src/main/config.json index 0c8c8f09de6dcc3650e39ca3103226e44143bb14..48bb9950829934e606e412707bb2c00dcc5c9d67 100644 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/config.json +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/config.json @@ -1,124 +1,99 @@ -{ - "app": { - "apiVersion": { - "compatible": 6, - "releaseType": "Beta1", - "target": 7 - }, - "vendor": "acts", - "bundleName": "ohos.acts.multimedia.recorder.profile", - "version": { - "code": 1000000, - "name": "1.0.0" - } - }, - "deviceConfig": { - "default": { - "debug": true - } - }, - "module": { - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "formsEnabled": false, - "name": ".MainAbility", - "srcLanguage": "js", - "srcPath": "MainAbility", - "icon": "$media:icon", - "description": "$string:MainAbility_desc", - "label": "$string:MainAbility_label", - "type": "page", - "visible": true, - "launchType": "standard" - }, - { - "orientation": "unspecified", - "formsEnabled": false, - "name": ".TestAbility", - "srcLanguage": "js", - "srcPath": "TestAbility", - "icon": "$media:icon", - "description": "$string:TestAbility_desc", - "label": "$string:TestAbility_label", - "type": "page", - "visible": true, - "launchType": "standard" - } - ], - "deviceType": [ - "phone", - "tablet", - "tv", - "wearable" - ], - "reqPermissions": [ - { - "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", - "reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS" - }, - { - "name": "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS", - "reason": "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS" - }, - { - "name": "ohos.permission.MEDIA_LOCATION", - "reason": "use ohos.permission.MEDIA_LOCATION" - }, - { - "name": "ohos.permission.READ_MEDIA", - "reason": "use ohos.permission.READ_MEDIA" - }, - { - "name": "ohos.permission.WRITE_MEDIA", - "reason": "use ohos.permission.WRITE_MEDIA" - } - ], - "mainAbility": ".MainAbility", - "distro": { - "moduleType": "entry", - "installationFree": false, - "deliveryWithInstall": true, - "moduleName": "entry" - }, - "package": "ohos.acts.multimedia.recorder.profile", - "name": ".entry", - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": true - } - }, - { - "pages": [ - "pages/index/index" - ], - "name": ".TestAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ], - "testRunner": { - "name": "OpenHarmonyTestRunner", - "srcPath": "TestRunner" - }, - "srcPath": "" - } +{ + "app": { + "bundleName": "com.example.actsnotificationdistributed", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsnotificationdistributed", + "name": ".entry", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "reqPermissions": [ + { + "name": "ohos.permission.NOTIFICATION_CONTROLLER" + } + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + }, + "mainAbility": ".MainAbility", + "srcPath": "" + } } \ No newline at end of file diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/app.js b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..b58cf3c570b660c6f6f8cdcb1b317d67687deb29 --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/app.js @@ -0,0 +1,22 @@ +/* + * 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. + */ +export default { + onCreate() { + console.info("============== AceApplication onCreate =============="); + }, + onDestroy() { + console.info('=============AceApplication onDestroy============='); + } +}; diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b6c4207e3d98d227f135ee57bfa49b98cfb93faf --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,24 @@ +/* + * 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. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..153d713d137f27cf989ffbaee2e886f92898056e --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,21 @@ +/* + * 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. + */ + +
+ + Hello, World! + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..312c30c0c27535e4ee98fce4ca802506159ba2d1 --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,33 @@ +/* + * 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 file from '@system.file' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + }, + onReady() { + }, +} + diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/app.js b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..d5ee271df29e516d1c8929054283e5f2bf5c981c --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b21c92c6290ea747bd891e2ab673721afc5521ed --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,30 @@ +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d94b75c085fa1c16a0b2721609b18c57a7295476 --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * 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. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 0000000000000000000000000000000000000000..b9e78ce7cf73f1ade6ba52a408a44e33f5430f0d --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/ActsNotificationDistributedTest.js b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/ActsNotificationDistributedTest.js new file mode 100644 index 0000000000000000000000000000000000000000..c0c258d11fa7c856cf1da0d1a5e239c9bd642a47 --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/ActsNotificationDistributedTest.js @@ -0,0 +1,56 @@ +/* + * 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 notification from '@ohos.notification'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +export default function ActsNotificationDistributedTest() { + describe('SUB_NOTIFICATION_ANS_IS_DISTRIBUTED_ENABLED_TEST', function () { + let TAG = 'SUB_NOTIFICATION_ANS_IS_DISTRIBUTED_ENABLED_TEST ===>' + console.info(TAG + 'SUB_NOTIFICATION_ANS_IS_DISTRIBUTED_ENABLED_TEST START') + + it('SUB_NOTIFICATION_ANS_IS_DISTRIBUTED_ENABLED_TEST_0100', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_IS_DISTRIBUTED_ENABLED_TEST_0100 START`) + notification.isDistributedEnabled((err, data) => { + if (err.code) { + console.info(`${TAG} isDistributedEnabled AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} isDistributedEnabled AsyncCallback success: ${data}`) + expect(data).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_IS_DISTRIBUTED_ENABLED_TEST_0100 END`) + }) + + it('SUB_NOTIFICATION_ANS_IS_DISTRIBUTED_ENABLED_TEST_0200', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_IS_DISTRIBUTED_ENABLED_TEST_0200 START`) + notification.isDistributedEnabled().then((data) => { + console.info(`${TAG} isDistributedEnabled Promise success: ${data}`) + expect(data).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} isDistributedEnabled Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_IS_DISTRIBUTED_ENABLED_TEST_0200 END`) + }) + + console.info(TAG + 'SUB_NOTIFICATION_IS_DISTRIBUTED_ENABLED_TEST END') + }) + +} diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/List.test.js b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..92d4ca2ecbc6bfb2293c4563abd1040452d7f61a --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/List.test.js @@ -0,0 +1,18 @@ +/* + * 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 ActsNotificationDistributedTest from './ActsNotificationDistributedTest.js' +export default function testsuite() { + ActsNotificationDistributedTest() +} diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/resources/base/element/string.json b/notification/ans_standard/actsNotificationDistributedTest/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..054c46cf82e60c39de9ec845737cdda67a89676d --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/resources/base/media/icon.png b/notification/ans_standard/actsNotificationDistributedTest/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ans_standard/actsNotificationDistributedTest/src/main/resources/base/media/icon.png differ diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/src/main/js/test/ActsSubscriber_test_ordered.js b/notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/src/main/js/test/ActsSubscriber_test_ordered.js index 4a266e22439751e6461d353acad4712a04e5c825..869ec3ae15bddb82f55d156d0b808b9a8e337f6a 100644 --- a/notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/src/main/js/test/ActsSubscriber_test_ordered.js +++ b/notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/src/main/js/test/ActsSubscriber_test_ordered.js @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import Subscriber from '@ohos.commonEvent' +import commonEvent from '@ohos.commonEvent' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' export default function ActsSubscriberTestOrder() { @@ -124,28 +124,28 @@ export default function ActsSubscriberTestOrder() { }) } - Subscriber.createSubscriber( + commonEvent.createSubscriber( commonEventSubscribeInfo1 ).then((data)=>{ console.info('===============ActsSubscriberTestOrder_0100==========createSubscriber promise1'); commonEventSubscriber0100 = data; data.getSubscribeInfo().then(()=>{ console.info('===============ActsSubscriberTestOrder_0100=========getSubscribeInfo promise1'); - Subscriber.subscribe(commonEventSubscriber0100, subscriberCallBack0100); + commonEvent.subscribe(commonEventSubscriber0100, subscriberCallBack0100); }); }) - Subscriber.createSubscriber( + commonEvent.createSubscriber( commonEventSubscribeInfo2 ).then((data)=>{ console.info('===============ActsSubscriberTestOrder_0100==========createSubscriber promise2'); commonEventSubscriber0101 = data; data.getSubscribeInfo().then(()=>{ console.info('===============ActsSubscriberTestOrder_0100=========getSubscribeInfo promise2'); - Subscriber.subscribe(commonEventSubscriber0101, subscriberCallBack0101); + commonEvent.subscribe(commonEventSubscriber0101, subscriberCallBack0101); setTimeout(function(){ console.debug('===================ActsSubscriberTestOrder_0100 delay 100ms=================='); - Subscriber.publish('publish_event0100', commonEventPublishData, publishCallback); + commonEvent.publish('publish_event0100', commonEventPublishData, publishCallback); }, 100); }); }) @@ -222,36 +222,36 @@ export default function ActsSubscriberTestOrder() { }) } - Subscriber.createSubscriber( + commonEvent.createSubscriber( commonEventSubscribeInfo1, ).then((data)=>{ console.info('===============ActsSubscriberTestOrder_0200==========createSubscriber promise1'); commonEventSubscriber0200 = data; data.getSubscribeInfo().then(()=>{ console.info('===============ActsSubscriberTestOrder_0200=========getSubscribeInfo promise1'); - Subscriber.subscribe(commonEventSubscriber0200, subscriberCallBack0200); + commonEvent.subscribe(commonEventSubscriber0200, subscriberCallBack0200); }); }) - Subscriber.createSubscriber( + commonEvent.createSubscriber( commonEventSubscribeInfo2, ).then((data)=>{ console.info('===============ActsSubscriberTestOrder_0200==========createSubscriber promise2'); commonEventSubscriber0201 = data; data.getSubscribeInfo().then(()=>{ console.info('===============ActsSubscriberTestOrder_0200=========getSubscribeInfo promise2'); - Subscriber.subscribe(commonEventSubscriber0201, subscriberCallBack0201); + commonEvent.subscribe(commonEventSubscriber0201, subscriberCallBack0201); setTimeout(function(){ console.debug('===================ActsSubscriberTestOrder_0200 delay 100ms=================='); - Subscriber.unsubscribe(commonEventSubscriber0200, unsubscribeCallback); + commonEvent.unsubscribe(commonEventSubscriber0200, unsubscribeCallback); }, 100); setTimeout(function(){ console.debug('===================ActsSubscriberTestOrder_0200 delay 100ms=================='); - Subscriber.publish('publish_event0200', commonEventPublishData1, publishCallback); + commonEvent.publish('publish_event0200', commonEventPublishData1, publishCallback); }, 100); setTimeout(function(){ console.debug('===================ActsSubscriberTestOrder_0200 delay 100ms=================='); - Subscriber.publish('publish_event0201', commonEventPublishData2, publishCallback); + commonEvent.publish('publish_event0201', commonEventPublishData2, publishCallback); }, 100); }); }) @@ -336,30 +336,30 @@ export default function ActsSubscriberTestOrder() { }) } - Subscriber.createSubscriber( + commonEvent.createSubscriber( commonEventSubscribeInfo1, ).then((data)=>{ console.info('===============ActsSubscriberTestOrder_0300==========createSubscriber promise1'); commonEventSubscriber0300 = data; data.getSubscribeInfo().then(()=>{ console.info('===============ActsSubscriberTestOrder_0300=========getSubscribeInfo promise1'); - Subscriber.subscribe(commonEventSubscriber0300, subscriberCallBack0300); + commonEvent.subscribe(commonEventSubscriber0300, subscriberCallBack0300); }); }) - Subscriber.createSubscriber( + commonEvent.createSubscriber( commonEventSubscribeInfo2, ).then((data)=>{ console.info('===============ActsSubscriberTestOrder_0300==========createSubscriber promise2'); commonEventSubscriber0301 = data; data.getSubscribeInfo().then(()=>{ console.info('===============ActsSubscriberTestOrder_0300=========getSubscribeInfo promise2'); - Subscriber.subscribe(commonEventSubscriber0301, subscriberCallBack0301); + commonEvent.subscribe(commonEventSubscriber0301, subscriberCallBack0301); let numindex = 0; for (; numindex < 3; ++numindex) { setTimeout(function(){ console.debug('===================ActsSubscriberTestOrder_0300 delay 100ms=================='); - Subscriber.publish('publish_event0301', commonEventPublishData2, publishCallback); + commonEvent.publish('publish_event0301', commonEventPublishData2, publishCallback); }, 100); } }); @@ -421,7 +421,7 @@ export default function ActsSubscriberTestOrder() { expect().assertFail(); } - Subscriber.createSubscriber( + commonEvent.createSubscriber( commonEventSubscribeInfo1 ).then((data)=>{ console.info('===============ActsSubscriberTestOrder_0400==========createSubscriber promise1'); @@ -429,11 +429,11 @@ export default function ActsSubscriberTestOrder() { data.getSubscribeInfo().then((data)=>{ console.info('===============ActsSubscriberTestOrder_0400=========getSubscribeInfo promise1'); expect(data.events[0]).assertEqual('publish_eventOrder0400'); - Subscriber.subscribe(commonEventSubscriber0400, subscriberCallBack0400); + commonEvent.subscribe(commonEventSubscriber0400, subscriberCallBack0400); }) }) - Subscriber.createSubscriber( + commonEvent.createSubscriber( commonEventSubscribeInfo2 ).then((data)=>{ console.info('===============ActsSubscriberTestOrder_0400==========createSubscriber promise2'); @@ -441,10 +441,10 @@ export default function ActsSubscriberTestOrder() { data.getSubscribeInfo().then((data)=>{ console.info('===============ActsSubscriberTestOrder_0400=========getSubscribeInfo promise2'); expect(data.events[0]).assertEqual('publish_eventOrder0400'); - Subscriber.subscribe(commonEventSubscriber0401, subscriberCallBack0401); + commonEvent.subscribe(commonEventSubscriber0401, subscriberCallBack0401); setTimeout(function(){ console.debug('===================ActsSubscriberTestOrder_0400 delay 100mss=================='); - Subscriber.publish('publish_eventOrder0400', commonEventPublishData, publishCallback); + commonEvent.publish('publish_eventOrder0400', commonEventPublishData, publishCallback); }, 100); }) }) @@ -509,7 +509,7 @@ export default function ActsSubscriberTestOrder() { }) } - Subscriber.createSubscriber( + commonEvent.createSubscriber( commonEventSubscribeInfo1 ).then((data)=>{ console.info('===============ActsSubscriberTestOrder_0500==========createSubscriber promise1'); @@ -517,11 +517,11 @@ export default function ActsSubscriberTestOrder() { data.getSubscribeInfo().then((data)=>{ console.info('===============ActsSubscriberTestOrder_0500==========getSubscribeInfo promise1'); expect(data.events[0]).assertEqual('publish_event0500'); - Subscriber.subscribe(commonEventSubscriber0500, subscriberCallBack0500); + commonEvent.subscribe(commonEventSubscriber0500, subscriberCallBack0500); }) }) - Subscriber.createSubscriber( + commonEvent.createSubscriber( commonEventSubscribeInfo2 ).then((data)=>{ console.info('===============ActsSubscriberTestOrder_0500==========createSubscriber promise2'); @@ -529,10 +529,10 @@ export default function ActsSubscriberTestOrder() { data.getSubscribeInfo().then((data)=>{ console.info('===============ActsSubscriberTestOrder_0500==========getSubscribeInfo promise2'); expect(data.events[0]).assertEqual('publish_event0500'); - Subscriber.subscribe(commonEventSubscriber0501, subscriberCallBack0501); + commonEvent.subscribe(commonEventSubscriber0501, subscriberCallBack0501); setTimeout(function(){ console.debug('===================ActsSubscriberTestOrder_0500 delay 100ms=================='); - Subscriber.publish('publish_event0500', commonEventPublishData, publishCallback); + commonEvent.publish('publish_event0500', commonEventPublishData, publishCallback); }, 100); }) }) diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/test/ActsSubscriber_test_unorder.js b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/test/ActsSubscriber_test_unorder.js index 4ac2d1c7c0d40577559fc90f375b1b4921e0585c..47eb91853a42797c4dbb8a4f290c989dd87a8858 100644 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/test/ActsSubscriber_test_unorder.js +++ b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/test/ActsSubscriber_test_unorder.js @@ -159,7 +159,7 @@ export default function ActsSubscriberTestUnorderSystem() { commonEvent.Support.COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED, commonEvent.Support.COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED, commonEvent.Support.COMMON_EVENT_USER_ADDED, - // commonEvent.Support.COMMON_EVENT_USER_REMOVED, + commonEvent.Support.COMMON_EVENT_USER_REMOVED, commonEvent.Support.COMMON_EVENT_ABILITY_ADDED, commonEvent.Support.COMMON_EVENT_ABILITY_REMOVED, commonEvent.Support.COMMON_EVENT_ABILITY_UPDATED, @@ -176,7 +176,8 @@ export default function ActsSubscriberTestUnorderSystem() { commonEvent.Support.COMMON_EVENT_VOLUME_BAD_REMOVAL, commonEvent.Support.COMMON_EVENT_VOLUME_EJECT, commonEvent.Support.COMMON_EVENT_SLOT_CHANGE, - commonEvent.Support.COMMON_EVENT_SPN_INFO_CHANGED + commonEvent.Support.COMMON_EVENT_SPN_INFO_CHANGED, + commonEvent.Support.COMMON_EVENT_QUICK_FIX_APPLY_RESULT ] } let CommonEventSubscriber diff --git a/sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js b/sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js index 577e01ee0b74b87fc4869f7ec10b58f80fa9db69..4ff9d56542b766134246c1aac000de49765ce7e8 100644 --- a/sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js +++ b/sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js @@ -779,6 +779,107 @@ describe("VibratorJsTest_misc_3", function () { console.info("VibratorJsTest039 reject"); }) done(); + }) + /* + * @tc.name:VibratorJsTest040 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0500 + */ + it("VibratorJsTest040", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { + vibrator.vibrate({ + type: "time", + duration: 1000 + }, { + id:0, + usage: "unknown" + }, (error)=>{ + if (error) { + console.info('VibratorJsTest040 vibrator error'); + expect(false).assertTrue(); + } else { + console.info('VibratorJsTest040 vibrator success'); + expect(true).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + + /* + * @tc.name:VibratorJsTest041 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0510 + */ + it("VibratorJsTest041", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + vibrator.vibrate({ + type: "", + duration: 1000 + }, { + id:1, + usage: "unknown" + }, (error)=>{ + if (error) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + + /* + * @tc.name:VibratorJsTest042 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0520 + */ + it("VibratorJsTest042", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 1, + }, { + id:"xxx", + usage: "unknown" + }, (error)=>{ + if (error) { + console.info('VibratorJsTest042 vibrator error'); + expect(false).assertTrue(); + } else { + console.info('VibratorJsTest042 vibrator success'); + expect(true).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + + /* + * @tc.name:VibratorJsTest043 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0530 + */ + it("VibratorJsTest043", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + vibrator.vibrate({ + type: "preset", + effectId: "", + count: 3, + }, { + id:null, + usage: "unknown" + }, (error)=>{ + if (error) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); }) }) } diff --git a/storage/storagefilejstest/src/main/js/test/File.test.js b/storage/storagefilejstest/src/main/js/test/File.test.js index 46d045cee79578b0f157ac9cf8e99155dd39093a..99aaa3bd47f88ec7cf5660c8e49108731bf57db1 100644 --- a/storage/storagefilejstest/src/main/js/test/File.test.js +++ b/storage/storagefilejstest/src/main/js/test/File.test.js @@ -15,6 +15,7 @@ import fileio from '@ohos.fileio'; import file from '@system.file'; +import document from '@ohos.document'; import { describe, it, @@ -3823,5 +3824,114 @@ describe('fileTest', function () { } }); }); + /** + * @tc.number SUB_STORAGE_Document_Choose_0100 + * @tc.name Document_Choose_001 + * @tc.desc Function of API, choose file.The test file is exist. + */ + it('File_Document_Choose_001', 0, async function (done) { + try { + let types = []; + let code = await document.choose(types); + let str = 'Error'; + console.info("getFileUri===>" + code); + expect(str).assertTrue(); + done(); + } + catch (e) { + console.info('File_Document_Choose_001 has failed for ' + e.message); + expect(e.message == "error").assertTrue(); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_Document_Choose_0200 + * @tc.name Document_Choose_002 + * @tc.desc Function of API, choose file.The test file is exist. + */ + it('File_Document_Choose_002', 0, async function (done) { + try { + let uri = ""; + let code = await document.choose(function(err,uri){ + + }); + console.info("getFileUri===>" + code); + expect(uri).assertTrue(); + done(); + } + catch (e) { + console.info('File_Document_Choose_002 has failed for ' + e.message); + expect(e.message == "error").assertTrue(); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_Document_Choose_0300 + * @tc.name Document_Choose_003 + * @tc.desc Function of API, choose file.The test file is exist. + */ + it('File_Document_Choose_003', 0, async function (done) { + try { + let types = []; + let uri = ""; + let code = await document.choose(types,function(err,uri){ + + }); + console.info("getFileUri===>" + code); + expect().assertTrue(); + done(); + } + catch (e) { + console.info('File_Document_Choose_003 has failed for ' + e.message); + expect(e.message == "error").assertTrue(); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_Document_Show_0100 + * @tc.name Document_Show_001 + * @tc.desc Function of API, show file.The test file is exist. + */ + it('File_Document_Show_001', 0, async function (done) { + try { + let type = ""; + let uri = ""; + let code = await document.show(uri,type); + console.info("getFileUri===>" + code); + expect().assertTrue(); + done(); + } + catch (e) { + console.info('File_Document_Show_001 has failed for ' + e.message); + expect(e.message == "error").assertTrue(); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_Document_Show_0200 + * @tc.name Document_Show_002 + * @tc.desc Function of API, show file.The test file is exist. + */ + it('File_Document_Show_002', 0, async function (done) { + try { + let type = ""; + let uri =""; + let code = await document.show(uri,type,function(err){ + + }); + console.info("getFileUri===>" + code); + expect().assertTrue(); + done(); + } + catch (e) { + console.info('File_Document_Show_002 has failed for ' + e.message); + expect(e.message == "error").assertTrue(); + done(); + } + }); }); } diff --git a/telephony/telephonyjstest/netmanager_base/register/src/main/js/test/NetworkManagerRegister.test.js b/telephony/telephonyjstest/netmanager_base/register/src/main/js/test/NetworkManagerRegister.test.js index b96c31739cb512eea4c69701f80f052475b5b368..b7bb1a8bfd7d618885c91e57c894dcc430276201 100644 --- a/telephony/telephonyjstest/netmanager_base/register/src/main/js/test/NetworkManagerRegister.test.js +++ b/telephony/telephonyjstest/netmanager_base/register/src/main/js/test/NetworkManagerRegister.test.js @@ -54,60 +54,60 @@ let returnValue = 0; netConn.on('netAvailable', (value) => { if (value === undefined) { - console.info(`${caseName} on netAvailable fail`); + console.info("${caseName} on netAvailable fail"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable :` + value.netId); + console.info("${caseName} netAvailable :" + value.netId); returnValue = value.netId; } }); netConn.on('netCapabilitiesChange', (value) => { if (value === undefined) { - console.info(`${caseName} netCapabilitiesChange fail`); + console.info("${caseName} netCapabilitiesChange fail"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle =:` + value.handle.netId); - expect(value.handle.netId).assertEqual(ETH_100); + console.info("${caseName} netCapabilitiesChange handle =:" + value.netHandle.netId); + expect(value.netHandle.netId >= ETH_100).assertTrue(); } }); netConn.on('netConnectionPropertiesChange', (value) => { if (value === undefined) { - console.info(`${caseName} netConnectionPropertiesChange fail`); + console.info("${caseName} netConnectionPropertiesChange fail"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netLost', (value) => { if (error) { - console.info(`${caseName} netLost fail`); + console.info("${caseName} netLost fail"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost: ` + value.netId); + console.info("${caseName} netLost: " + value.netId); } }); netConn.register((error) => { if (error) { - console.info(JSON.stringify(error) + `${caseName} register fail: ${error}`); + console.info(JSON.stringify(error) + "${caseName} register fail: ${error}"); done(); } }); await sleep(DELAY); - console.info(`${caseName} returnVaule : ` + returnValue); + console.info("${caseName} returnVaule : " + returnValue); netConn.unregister((error) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); done(); } done(); }); done(); }); - + /** *@tc.number Telephony_NetworkManager_register_Async_0200 *@tc.name Enter bearerTypes and networkCap asempty, set class NetConnection, @@ -125,75 +125,76 @@ let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); netConn.on('netAvailable', (value) => { if (value === undefined) { - console.info(`${caseName} on netAvailable fail`); + console.info("${caseName} on netAvailable fail"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); returnValue = value.netId; } }); netConn.on('netCapabilitiesChange', (value) => { if (value === undefined) { - console.info(`${caseName} netCapabilitiesChange fail`); + console.info("${caseName} netCapabilitiesChange fail"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle =:` + value.handle.netId); - expect(value.handle.netId).assertEqual(ETH_100); + console.info("${caseName} netCapabilitiesChange handle =:" + value.netHandle.netId); + expect(value.netHandle.netId >= ETH_100).assertTrue(); + } }); netConn.on('netConnectionPropertiesChange', (value) => { if (value === undefined) { - console.info(`${caseName} netConnectionPropertiesChange fail`); + console.info("${caseName} netConnectionPropertiesChange fail"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle =:` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle =:" + value.netHandle.netId); } }); netConn.on('netLost', (value) => { if (error) { - console.info(`${caseName} netLost fail`); + console.info("${caseName} netLost fail"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost : ` + value.netId); + console.info("${caseName} netLost : " + value.netId); } }); netConn.on('netUnavailable', (value) => { if (error) { - console.info(`${caseName} netUnavailable fail`); + console.info("${caseName} netUnavailable fail"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable: ` + value.netId); + console.info("${caseName} netUnavailable: " + value.netId); } }); netConn.on('netBlockStatuschange', (value) => { if (error) { - console.info(`${caseName} netBlockStatusChange fail`); + console.info("${caseName} netBlockStatusChange fail"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange : ` + value.netId); + console.info("${caseName} netBlockStatusChange : " + value.netHandle.netId); } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); } }); await sleep(DELAY); netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregisterresult: ${error}` + JSON.stringify(error)); + console.info("${caseName} unregisterresult: ${error}" + JSON.stringify(error)); done(); } }); done(); }); - + /* *@tc.number Telephony_NetworkManager_register_Async_0300 *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, @@ -214,75 +215,75 @@ let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable:` + value.netId); + console.info("${caseName} netAvailable:" + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost = :` + value.netId); + console.info("${caseName} netLost = :" + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable = :` + value); + console.info("${caseName} netUnavailable = :" + value); netId = true; } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); } }); await sleep(DELAY); - console.info(`${caseName} netId : ${netId}`); + console.info("${caseName} netId : ${netId}"); expect(true).assertTrue() netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result: ${error}`); + console.info("${caseName} unregister result: ${error}"); } }); done(); }); - + /* *@tc.number Telephony_NetworkManager_register_Async_0400 *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, @@ -303,74 +304,74 @@ let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable:` + value.netId); + console.info("${caseName} netAvailable:" + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost = :` + value.netId); + console.info("${caseName} netLost = :" + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable = :` + value); + console.info("${caseName} netUnavailable = :" + value); netId = true; } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result: ${error.code},${error.message}`); + console.info("${caseName} unregister result: ${error.code},${error.message}"); } }); done(); }); - + /* *@tc.number Telephony_NetworkManager_register_Async_0500 *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, @@ -391,75 +392,75 @@ let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable:` + value.netId); + console.info("${caseName} netAvailable:" + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost = :` + value.netId); + console.info("${caseName} netLost = :" + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable = :` + value); + console.info("${caseName} netUnavailable = :" + value); netId = true; } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result: ${error}`); + console.info("${caseName} unregister result: ${error}"); } done(); }); done(); }); - + /* *@tc.number Telephony_NetworkManager_register_Async_0600 *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, @@ -480,75 +481,75 @@ let netId = 0; netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable:` + value.netId); + console.info("${caseName} netAvailable:" + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost = :` + value.netId); + console.info("${caseName} netLost = :" + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable = :` + value); + console.info("${caseName} netUnavailable = :" + value); netId = true; } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result: ${error}`); + console.info("${caseName} unregister result: ${error}"); } done(); }); done(); }); - + /* *@tc.number Telephony_NetworkManager_register_Async_0700 *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, @@ -569,75 +570,75 @@ let netId = 0; netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable:` + value.netId); + console.info("${caseName} netAvailable:" + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost = :` + value.netId); + console.info("${caseName} netLost = :" + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable = :` + value); + console.info("${caseName} netUnavailable = :" + value); netId = true; } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result: ${error}`); + console.info("${caseName} unregister result: ${error}"); } done(); }); done(); }); - + /* *@tc.number Telephony_NetworkManager_register_Async_0800 *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, @@ -658,75 +659,75 @@ let netId = 0; netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable:` + value.netId); + console.info("${caseName} netAvailable:" + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost = :` + value.netId); + console.info("${caseName} netLost = :" + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable = :` + value); + console.info("${caseName} netUnavailable = :" + value); netId = true; } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result: ${error}`); + console.info("${caseName} unregister result: ${error}"); } done(); }); done(); }); - + /* *@tc.number Telephony_NetworkManager_register_Async_0900 *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, @@ -747,78 +748,78 @@ let netId = 0; netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable:` + value.netId); + console.info("${caseName} netAvailable:" + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); + expect(value.netHandle.netId >= ETH_100).assertTrue(); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); + expect(value.netHandle.netId >= ETH_100).assertTrue(); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); + expect(value.netHandle.netId >= ETH_100).assertTrue(); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost = :` + value.netId); + console.info("${caseName} netLost = :" + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable = :` + value); + console.info("${caseName} netUnavailable = :" + value); netId = true; } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); } }); await sleep(10000); expect(true).assertTrue() netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result: ${error}`); + console.info("${caseName} unregister result: ${error}"); } done(); }); done(); }); - + /* *@tc.number Telephony_NetworkManager_register_Async_1000 *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, @@ -839,85 +840,85 @@ let netId = 0; netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable:` + value.netId); - expect(value.netId).assertEqual(ETH_100); + console.info("${caseName} netAvailable:" + value.netId); + expect(value.netId >= ETH_100).assertTrue(); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); + expect(value.netHandle.netId >= ETH_100).assertTrue(); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); + expect(value.netHandle.netId >= ETH_100).assertTrue(); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost = :` + value.netId); + console.info("${caseName} netLost = :" + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable = :` + value); + console.info("${caseName} netUnavailable = :" + value); netId = true; } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result: ${error}`); + console.info("${caseName} unregister result: ${error}"); } done(); }); done(); }); - + /** * @tc.number Telephony_NetworkManager_register_Async_1100 * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, * call Register () to activate the default network ,and see if the callback information is generated * @tc.desc Function test */ - + it('Telephony_NetworkManager_register_Async_1100', 0, async function (done) { let caseName = 'Telephony_NetworkManager_register_Async_1100'; let netSpecifier = { @@ -932,83 +933,83 @@ let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); + expect(value.netHandle.netId >= ETH_100).assertTrue(); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value.netId); + console.info("${caseName} netUnavailable " + value.netId); netId = true; } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); } done(); }); done(); }); - + /** * @tc.number Telephony_NetworkManager_register_Async_1200 * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, * call Register () to activate the default network ,and see if the callback information is generated * @tc.desc Function test */ - + it('Telephony_NetworkManager_register_Async_1200', 0, async function (done) { let caseName = 'Telephony_NetworkManager_register_Async_1200'; let netSpecifier = { @@ -1023,85 +1024,85 @@ let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); + expect(value.netHandle.netId >= ETH_100).assertTrue(); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); + expect(value.netHandle.netId >= ETH_100).assertTrue(); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value.netId); + console.info("${caseName} netUnavailable " + value.netId); netId = true; } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); } done(); }); done(); }); - - + + /** * @tc.number Telephony_NetworkManager_register_Async_1300 * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, * call Register () to activate the default network ,and see if the callback information is generated * @tc.desc Function test */ - + it('Telephony_NetworkManager_register_Async_1300', 0, async function (done) { let caseName = 'Telephony_NetworkManager_register_Async_1300'; let netSpecifier = { @@ -1115,85 +1116,85 @@ let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); expect(value.netId).assertEqual(ETH_100); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - expect(value.handle.netId).assertEqual(ETH_100); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); + expect(value.netHandle.netId >= ETH_100).assertTrue(); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - expect(value.handle.netId).assertEqual(ETH_100); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); + expect(value.netHandle.netId >= ETH_100).assertTrue(); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - expect(value.handle.netId).assertEqual(ETH_100); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); + expect(value.netHandle.netId >= ETH_100).assertTrue(); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value); + console.info("${caseName} netUnavailable " + value); } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); await sleep(DELAY); netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); } done(); }); done(); }); - - + + /** * @tc.number Telephony_NetworkManager_register_Async_1400 * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, * call Register () to activate the default network ,and see if the callback information is generated * @tc.desc Function test */ - + it('Telephony_NetworkManager_register_Async_1400', 0, async function (done) { let caseName = 'Telephony_NetworkManager_register_Async_1400'; let netSpecifier = { @@ -1208,82 +1209,82 @@ let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value.netId); + console.info("${caseName} netUnavailable " + value.netId); netId = true; } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); } done(); }); done(); }); - + /** * @tc.number Telephony_NetworkManager_register_Async_1500 * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, * call Register () to activate the default network ,and see if the callback information is generated * @tc.desc Function test */ - + it('Telephony_NetworkManager_register_Async_1500', 0, async function (done) { let caseName = 'Telephony_NetworkManager_register_Async_1500'; let netSpecifier = { @@ -1297,83 +1298,83 @@ let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); VALUE = value.netId; expect(VALUE).assertEqual(ETH_100); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value); + console.info("${caseName} netUnavailable " + value); } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); await sleep(DELAY); netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); } done(); }); done(); }); - - + + /** * @tc.number Telephony_NetworkManager_register_Async_1600 * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, * call Register () to activate the default network ,and see if the callback information is generated * @tc.desc Function test */ - + it('Telephony_NetworkManager_register_Async_1600', 0, async function (done) { let caseName = 'Telephony_NetworkManager_register_Async_1600'; let netSpecifier = { @@ -1388,82 +1389,82 @@ let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value); + console.info("${caseName} netUnavailable " + value); netId = true; } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); } done(); }); done(); }); - + /** * @tc.number Telephony_NetworkManager_register_Async_1700 * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, * call Register () to activate the default network ,and see if the callback information is generated * @tc.desc Function test */ - + it('Telephony_NetworkManager_register_Async_1700', 0, async function (done) { let caseName = 'Telephony_NetworkManager_register_Async_1700'; let netSpecifier = { @@ -1478,82 +1479,82 @@ let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value); + console.info("${caseName} netUnavailable " + value); netId = true; } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); } done(); }); done(); }); - + /** * @tc.number Telephony_NetworkManager_register_Async_1800 * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, * call Register () to activate the default network ,and see if the callback information is generated * @tc.desc Function test */ - + it('Telephony_NetworkManager_register_Async_1800', 0, async function (done) { let caseName = 'Telephony_NetworkManager_register_Async_1800'; let netSpecifier = { @@ -1568,69 +1569,69 @@ let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value); + console.info("${caseName} netUnavailable " + value); netId = true; } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); } done(); }); @@ -1638,82 +1639,82 @@ let netConn1 = connection.createNetConnection(netSpecifier, TIMEOUT); netConn1.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn1.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn1.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn1.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); } }); netConn1.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value); + console.info("${caseName} netUnavailable " + value); netId = true; } }); netConn1.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn1.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); } done(); }); done(); }); - + /** * @tc.number Telephony_NetworkManager_register_Async_1900 * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, * call Register () to activate the default network ,and see if the callback information is generated * @tc.desc Function test */ - + it('Telephony_NetworkManager_register_Async_1900', 0, async function (done) { let caseName = 'Telephony_NetworkManager_register_Async_1900'; let netSpecifier = { @@ -1727,75 +1728,75 @@ let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value); + console.info("${caseName} netUnavailable " + value); } }); netConn.register((error) => { if (error) { - + done(); } done(); }); done(); }); - + /** * @tc.number Telephony_NetworkManager_register_Async_2000 * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, * call Register () to activate the default network ,and see if the callback information is generated * @tc.desc Function test */ - + it('Telephony_NetworkManager_register_Async_2000', 0, async function (done) { let caseName = 'Telephony_NetworkManager_register_Async_2000'; let netSpecifier = { @@ -1833,18 +1834,18 @@ }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); await sleep(DELAY); netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); } }); done(); }); - + /** * @tc.number Telephony_NetworkManager_register_Async_2100 * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, @@ -1865,69 +1866,69 @@ let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value); + console.info("${caseName} netUnavailable " + value); netId = true; } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); } done(); }); @@ -1942,75 +1943,75 @@ let netConn1 = connection.createNetConnection(netSpecifier1, TIMEOUT); netConn1.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); } }); netConn1.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn1.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn1.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn1.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); } }); netConn1.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value); + console.info("${caseName} netUnavailable " + value); netId = true; } }); netConn1.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn1.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); } done(); }); done(); }); - + /** * @tc.number Telephony_NetworkManager_register_Async_2200 * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, @@ -2031,69 +2032,69 @@ let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value.netId); + console.info("${caseName} netUnavailable " + value.netId); netId = true; } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); } done(); }); @@ -2108,75 +2109,75 @@ let netConn1 = connection.createNetConnection(netSpecifier1, TIMEOUT); netConn1.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); } }); netConn1.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); } }); netConn1.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); } }); netConn1.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); } }); netConn1.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); } }); netConn1.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value.netId); + console.info("${caseName} netUnavailable " + value.netId); netId = true; } }); netConn1.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); await sleep(DELAY); expect(true).assertTrue() netConn1.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); } done(); }); done(); }); - + /** * @tc.number Telephony_NetworkManager_register_Async_2300 * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, @@ -2189,59 +2190,59 @@ let returnValue = 0; netConn.on('netAvailable', (value) => { if (value === undefined) { - console.info(`${caseName} on netAvailable fail`); + console.info("${caseName} on netAvailable fail"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable` + value.netId); + console.info("${caseName} netAvailable" + value.netId); returnValue = value.netId; } }); netConn.on('netCapabilitiesChange', (value) => { if (value === undefined) { - console.info(`${caseName} on netCapabilitiesChange fail`); + console.info("${caseName} on netCapabilitiesChange fail"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle ` + value.netHandle.netId); + console.info("${caseName} netCapabilitiesChange handle " + value.netHandle.netId); expect(value.netHandle.netId >= ETH_100 ).assertTrue(); } }); netConn.on('netConnectionPropertiesChange', (value) => { if (value === undefined) { - console.info(`${caseName} on netConnectionPropertiesChange fail`); + console.info("${caseName} on netConnectionPropertiesChange fail"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange hdndle` + value.netHandle.netId); + console.info("${caseName} netConnectionPropertiesChange hdndle" + value.netHandle.netId); } }); netConn.on('netLost', (value) => { if (error) { - console.info(`${caseName} netLost fail`); + console.info("${caseName} netLost fail"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); await sleep(DELAY); - console.info(`${caseName} returnValue ` + returnValue); + console.info("${caseName} returnValue " + returnValue); netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); done(); } done(); }); done(); }); - + /** * @tc.number Telephony_NetworkManager_unregister_Async_0100 * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, @@ -2261,82 +2262,82 @@ let netConn = connection.createNetConnection(netSpecifier, TIMEOUT_1); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); done(); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); done(); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); done(); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); done(); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); done(); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value.netId); + console.info("${caseName} netUnavailable " + value.netId); done(); } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); expect().assertFail(); done(); } - + done(); }); done(); }); - - + + /** * @tc.number Telephony_NetworkManager_unregister_Async_0200 * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, @@ -2348,81 +2349,81 @@ let netConn = connection.createNetConnection(); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); done(); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); done(); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); done(); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); done(); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); done(); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value.netId); + console.info("${caseName} netUnavailable " + value.netId); done(); } }); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail ${error}`); + console.info("${caseName} register fail ${error}"); } }); netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); expect().assertFail(); done(); } - + done(); }); done(); }); - + /** * @tc.number Telephony_NetworkManager_unregister_Async_0300 * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, @@ -2434,67 +2435,67 @@ let netConn = connection.createNetConnection(); netConn.on('netAvailable', (error, value) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netAvailable : ` + value.netId); + console.info("${caseName} netAvailable : " + value.netId); done(); } }); netConn.on('netBlockStatusChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId); done(); } }); netConn.on('netCapabilitiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId); done(); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId); done(); } }); netConn.on('netLost', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netLost ` + value.netId); + console.info("${caseName} netLost " + value.netId); done(); } }); netConn.on('netUnavailable', (error, value) => { if (error) { - console.info(`${caseName} register fail :${error}`); + console.info("${caseName} register fail :${error}"); expect().assertFail(); done(); } else { - console.info(`${caseName} netUnavailable ` + value.netId); + console.info("${caseName} netUnavailable " + value.netId); done(); } }); netConn.unregister((error) => { if (error) { - console.info(`${caseName} unregister result : ${error}`); + console.info("${caseName} unregister result : ${error}"); expect().assertFail(); done(); } diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/src/main/js/test/SimManager.test.js b/telephony/telephonyjstest/sim/sim_manager_function_test/src/main/js/test/SimManager.test.js index 6d8a34bf3ffa9654cca910fe4447e79d87da6815..5a3ac37cee2747e406aee7f54c96712a89b13e63 100644 --- a/telephony/telephonyjstest/sim/sim_manager_function_test/src/main/js/test/SimManager.test.js +++ b/telephony/telephonyjstest/sim/sim_manager_function_test/src/main/js/test/SimManager.test.js @@ -287,7 +287,7 @@ describe('SimManagerTest', function () { const CASE_NAME = 'Telephony_Sim_isSimActive_Async_0700'; sim.isSimActive(env.SLOTID2, (err, data) => { console.info("isSimActive async err info :" + JSON.stringify(err) + "data:" + JSON.stringify(data)); - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); done(); }); }); @@ -307,7 +307,7 @@ describe('SimManagerTest', function () { done(); }).catch(err => { console.info("isSimActive promise err info :" + JSON.stringify(err)); - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); done(); }); }); @@ -322,7 +322,7 @@ describe('SimManagerTest', function () { const CASE_NAME = 'Telephony_Sim_hasSimCard_Async_0600'; sim.hasSimCard(env.SLOTID2, (err, data) => { if (err) { - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); console.info(`${CASE_NAME} fail, err: ${err.message}`); done(); return; @@ -342,7 +342,7 @@ describe('SimManagerTest', function () { try { let data = await sim.hasSimCard(env.SLOTID2); } catch (err) { - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); console.info(`${CASE_NAME} fail, err: ${err.message}`); done(); return; @@ -374,7 +374,7 @@ describe('SimManagerTest', function () { sim.getCardType(env.SLOTID2, (err, cardType) => { if (err) { console.info(`${CASE_NAME} GetCardType error: ${err.message}`); - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); done(); return; } @@ -395,7 +395,7 @@ describe('SimManagerTest', function () { console.info(`${CASE_NAME} test finish.`); } catch (err) { console.info(`${CASE_NAME} GetCardType error: ${err.message}`); - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); } done(); }); @@ -411,7 +411,7 @@ describe('SimManagerTest', function () { sim.hasOperatorPrivileges(env.SLOTID2, (error, result) => { if (error) { console.info(`${CASE_NAME} hasOperatorPrivileges error: ${error.message}`); - expect().assertFail(); + expect(error.code).assertEqual(202); done(); return; } @@ -435,10 +435,81 @@ describe('SimManagerTest', function () { console.info(`${CASE_NAME} test finish.`); } catch (error) { console.info(`${CASE_NAME} hasOperatorPrivileges error: ${error.message}`); - expect().assertFail(); + expect(error.code).assertEqual(202); } done(); }); + /** + * @tc.number Telephony_Sim_getOpKey_CallBack_0100 + * @tc.name Test getOpKey interface + * @tc.desc Obtains the opkey of the SIM card in a specified slot.Returns the opkey; + * returns "-1" if no SIM card is inserted or no opkey matched. + */ + it('Telephony_Sim_getOpKey_CallBack_0100', 0, async function (done) { + sim.getOpKey(0, (err, data) => { + console.info("Telephony_Sim_getOpKey_CallBack_0100 err = " + JSON.stringify(err) + " data = " + JSON.stringify(data)); + if(err){ + expect(err.code).assertEqual(-1); + done(); + return; + } + done(); + }); + }); + + /** + * @tc.number Telephony_Sim_getOpKey_Promise_0100 + * @tc.name Test getOpKey interface + * @tc.desc Obtains the opkey of the SIM card in a specified slot.Returns the opkey; + * returns "-1" if no SIM card is inserted or no opkey matched. + */ + it('Telephony_Sim_getOpKey_Promise_0100', 0, async function (done) { + let promise = sim.getOpKey(0); + promise.then(data => { + console.info("Telephony_Sim_getOpKey_Promise_0100 data = " + JSON.stringify(data)); + done(); + }).catch(err => { + console.info("Telephony_Sim_getOpKey_Promise_0100 err = " + JSON.stringify(err)); + expect(err.code).assertEqual(-1); + done(); + }); + }); + + /** + * @tc.number Telephony_Sim_getOpName_CallBack_0100 + * @tc.name Test getOpName interface + * @tc.desc Obtains the opname of the SIM card in a specified slot. + * returns null if no SIM card is inserted or no opname matched. + */ + it('Telephony_Sim_getOpName_CallBack_0100', 0, async function (done) { + sim.getOpName(0, (err, data) => { + console.info("Telephony_Sim_getOpName_CallBack_0100 err = " + JSON.stringify(err) + " data = " + JSON.stringify(data)); + if(err){ + expect(err.code).assertEqual(-1); + done(); + return; + } + done(); + }); + }); + + /** + * @tc.number Telephony_Sim_getOpName_Promise_0100 + * @tc.name Test getOpName interface + * @tc.desc Obtains the opname of the SIM card in a specified slot. + * returns null if no SIM card is inserted or no opname matched. + */ + it('Telephony_Sim_getOpName_Promise_0100', 0, async function (done) { + let promise = sim.getOpName(0); + promise.then(data => { + console.info("Telephony_Sim_getOpName_Promise_0100 data = " + JSON.stringify(data)); + done(); + }).catch(err => { + console.info("Telephony_Sim_getOpName_Promise_0100 err = " + JSON.stringify(err)); + expect(err.code).assertEqual(-1); + done(); + }); + }); }) }