diff --git a/ai/BUILD.gn b/ai/BUILD.gn index 0ef994f2e2647a19372af107fcd5ad110d5a0864..2d5f62cb75e5e3bba5822d3a964d8d4be5038b29 100755 --- a/ai/BUILD.gn +++ b/ai/BUILD.gn @@ -19,7 +19,6 @@ group("ai") { ] if (is_standard_system) { deps += [ - "intelligent_voice_framework:intelligentvoice_js_hap", "mindspore/mindsporectest:ActsMindSporeTest", "mindspore/mindsporejstest:ActsMindsporeJSTest", ] diff --git a/ai/intelligent_voice_framework/AppScope/app.json b/ai/intelligent_voice_framework/AppScope/app.json deleted file mode 100644 index 9ba8c02ae442c92fa90dd9e71e8166ac641a3bec..0000000000000000000000000000000000000000 --- a/ai/intelligent_voice_framework/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app":{ - "bundleName":"ohos.acts.ai.intelligentvoice", - "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":10, - "targetAPIVersion":10, - "car":{ - "apiCompatibleVersion":10, - "singleUser":false - } - } -} diff --git a/ai/intelligent_voice_framework/AppScope/resources/base/element/string.json b/ai/intelligent_voice_framework/AppScope/resources/base/element/string.json deleted file mode 100644 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/ai/intelligent_voice_framework/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/ai/intelligent_voice_framework/AppScope/resources/base/media/app_icon.png b/ai/intelligent_voice_framework/AppScope/resources/base/media/app_icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/ai/intelligent_voice_framework/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/ai/intelligent_voice_framework/BUILD.gn b/ai/intelligent_voice_framework/BUILD.gn deleted file mode 100644 index 918ad67f652cb670fdb5a2efffdd8b5c267dfb58..0000000000000000000000000000000000000000 --- a/ai/intelligent_voice_framework/BUILD.gn +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("intelligentvoice_js_hap") { - hap_profile = "src/main/module.json" - deps = [ - ":ActsIntelligentVocieTest_js_assets", - ":ActsIntelligentVocieTest_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsIntelligentVoiceTest" - subsystem_name = "ai" - part_name = "intelligent_voice_framework" -} - -ohos_app_scope("ActsIntelligentVoiceTest_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("ActsIntelligentVocieTest_js_assets") { - source_dir = "src/main/ets" -} - -ohos_resources("ActsIntelligentVocieTest_resources") { - sources = [ "src/main/resources" ] - deps = [ ":ActsIntelligentVoiceTest_app_profile" ] - hap_profile = "src/main/module.json" -} diff --git a/ai/intelligent_voice_framework/Test.json b/ai/intelligent_voice_framework/Test.json deleted file mode 100644 index 27aa6e718d84eeda0d39c2b19e01bbee57bc14d2..0000000000000000000000000000000000000000 --- a/ai/intelligent_voice_framework/Test.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "description": "Configuration for intelligent voice framework Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "1500000", - "testcase-timeout": "50000", - "bundle-name": "ohos.acts.ai.intelligentvoice", - "module-name": "entry_test", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsIntelligentVoiceTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "ShellKit", - "run-command": [ - "hilog -Q pidoff", - "power-shell wakeup", - "uinput -T -d 300 600 -m 300 600 300 100 -u 300 100", - "power-shell setmode 602" - ], - "teardown-command":[ - "power-shell setmode 600" - ], - "cleanup-apps": true - }, - { - "type": "PushKit", - "pre-push": [], - "push": [ - ] - } - ] -} \ No newline at end of file diff --git a/ai/intelligent_voice_framework/signature/openharmony_sx.p7b b/ai/intelligent_voice_framework/signature/openharmony_sx.p7b deleted file mode 100644 index c1204cf5272a1ad29b9da069e012bd7f5a1a719d..0000000000000000000000000000000000000000 Binary files a/ai/intelligent_voice_framework/signature/openharmony_sx.p7b and /dev/null differ diff --git a/ai/intelligent_voice_framework/src/main/ets/TestAbility/TestAbility.ets b/ai/intelligent_voice_framework/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100644 index 78a174cd4a419e0b2be4b61c012a748aa2bada44..0000000000000000000000000000000000000000 --- a/ai/intelligent_voice_framework/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2023 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 UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; -import Want from '@ohos.app.ability.Want'; -import AbilityConstant from '@ohos.app.ability.AbilityConstant'; - -export default class TestAbility extends UIAbility { - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/ai/intelligent_voice_framework/src/main/ets/TestAbility/pages/Index.ets b/ai/intelligent_voice_framework/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100644 index 40f0a77aebde46e8c079bd9975134e37d373c1f7..0000000000000000000000000000000000000000 --- a/ai/intelligent_voice_framework/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2023 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 hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/ai/intelligent_voice_framework/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ai/intelligent_voice_framework/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/ai/intelligent_voice_framework/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/ai/intelligent_voice_framework/src/main/ets/test/EnrollIntelligentVoiceEngine.test.ets b/ai/intelligent_voice_framework/src/main/ets/test/EnrollIntelligentVoiceEngine.test.ets deleted file mode 100644 index 531e4760a79b245b7cb69fcaea5a044464e74fb9..0000000000000000000000000000000000000000 --- a/ai/intelligent_voice_framework/src/main/ets/test/EnrollIntelligentVoiceEngine.test.ets +++ /dev/null @@ -1,538 +0,0 @@ -/* - * Copyright (c) 2023 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 intelligentVoice from '@ohos.ai.intelligentVoice'; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' - -export default function enrollIntelligentVoiceEngineTest() { -describe('ActsEnrollIntelligentVoiceEngineTest', function () { - let tag = "enrollIntelligentvoiceEngineTest"; - console.info(`${tag}: Create EnrollIntelligentvoiceEngine Object JS Framework`); - function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } - - function releaseEnrollEngine(enrollEngine, done) { - try { - enrollEngine.release(err => { - if (err) { - console.info(`${tag} releaseEnrollEngine err: ${JSON.stringify(err)}`); - done(); - return; - } else { - console.log(`${tag} releaseEnrollEngine success`); - done(); - } - }); - } catch (error) { - console.info(`${tag} failed to releaseEnrollEngine: ${JSON.stringify(error)}`); - done(); - } - } - - function getParameter(enrollEngine, key, done) { - try { - enrollEngine.getParameter(key, (err, data) => { - if (err) { - console.info(`${tag} get parameter err: ${JSON.stringify(err)}`); - done(); - return; - } else { - console.log(`${tag} get parameter success`); - let param = data; - expect(param).assertEqual('value'); - releaseEnrollEngine(enrollEngine, done); - } - }); - } catch (error) { - console.info(`${tag} failed to get parameter: ${JSON.stringify(error)}`); - done(); - } - } - - function setParameter(enrollEngine, key, value, done) { - try { - enrollEngine.setParameter(key, value, err => { - if (err) { - console.info(`${tag} set parameter err: ${JSON.stringify(err)}`); - done(); - return; - } else { - console.log(`${tag} set parameter success`); - getParameter(enrollEngine, 'key', done); - } - }); - } catch (error) { - console.info(`${tag} failed to set parameter: ${JSON.stringify(error)}`); - done(); - } - } - - function setSensibility(enrollEngine, sensibility, done) { - try { - enrollEngine.setSensibility(sensibility, err => { - if (err) { - console.info(`${tag} set sensibility err: ${JSON.stringify(err)}`); - done(); - return; - } else { - console.log(`${tag} set sensibility success`); - setParameter(enrollEngine, 'scene', '0', done); - } - }); - } catch (error) { - console.info(`${tag} failed to set sensibility: ${JSON.stringify(error)}`); - done(); - } - } - - function setWakeupHapInfo(enrollEngine, wakeupHapInfo, done) { - try { - enrollEngine.setWakeupHapInfo(wakeupHapInfo, err => { - if (err) { - console.info(`${tag} set wakeup hap info err: ${JSON.stringify(err)}`); - done(); - return; - } else { - console.log(`${tag} set wakeup hap info success`); - setSensibility(enrollEngine, intelligentVoice.SensibilityType.MIDDLE_SENSIBILITY, done); - } - }); - } catch (error) { - console.info(`${tag} failed to set wakeup hap info: ${JSON.stringify(error)}`); - done(); - } - } - - function commit(enrollEngine, done) { - try { - enrollEngine.commit((err, data) => { - if (err) { - console.log(`${tag} commit err: ${JSON.stringify(err)}`); - expect(false).assertTrue(); - done(); - } else { - console.log(`${tag} commit success`); - let wakeupHapInfo = { - bundleName: 'example_bundle_name', - abilityName: 'example_ability_name' - } - setWakeupHapInfo(enrollEngine, wakeupHapInfo, done); - } - }); - } catch(error) { - console.info(`${tag} failed to commit: ${JSON.stringify(error)}`); - done(); - } - } - - function stopEnrollEngine(enrollEngine, done) { - try { - enrollEngine.stop((err) => { - if (err) { - console.log(`${tag} stop enrollIntelligentvoiceEngine err: ${JSON.stringify(err)}`); - expect(false).assertTrue(); - done(); - } else { - console.log(`${tag} stop enrollIntelligentvoiceEngine success`); - releaseEnrollEngine(enrollEngine, done); - } - }); - } catch(error) { - console.info(`${tag} failed to start enrollIntelligentvoiceEngine: ${JSON.stringify(error)}`); - done(); - } - } - - function startThenStopEnrollEngine(enrollEngine, done) { - try { - enrollEngine.enrollForResult(false, (err, data) => { - if (err) { - console.log(`${tag} start enrollIntelligentvoiceEngine err: ${JSON.stringify(err)}`); - expect(false).assertTrue(); - done(); - } else { - console.log(`${tag} start enrollIntelligentvoiceEngine success`); - expect(data).not().assertUndefined(); - stopEnrollEngine(enrollEngine, done); - } - }); - } catch(error) { - console.info(`${tag} failed to start enrollIntelligentvoiceEngine: ${JSON.stringify(error)}`); - done(); - } - } - - function startEnrollEngine(enrollEngine, cnt, done) { - try { - enrollEngine.enrollForResult(false, (err, data) => { - if (err) { - console.log(`${tag} start enrollIntelligentvoiceEngine err: ${JSON.stringify(err)}`); - expect(false).assertTrue(); - done(); - } else { - console.log(`${tag} start enrollIntelligentvoiceEngine success, cnt: ${cnt}`); - expect(data).not().assertUndefined(); - if (cnt < 0) { - startEnrollEngine(enrollEngine, cnt + 1, done); - } else { - commit(enrollEngine, done); - } - } - }); - } catch(error) { - console.info(`${tag} failed to start enrollIntelligentvoiceEngine: ${JSON.stringify(error)}`); - done(); - } - } - - function initEnrollEngine(enrollEngine, needStop, done) { - let config = { - language: 'zh', - region: 'CN' - } - try { - enrollEngine.init(config, (err, data) => { - if (err) { - console.log(`${tag} init enrollIntelligentvoiceEngine err: ${JSON.stringify(err)}`); - expect(false).assertTrue(); - done(); - } else { - console.log(`${tag} init enrollIntelligentvoiceEngine success`); - if (needStop) { - startThenStopEnrollEngine(enrollEngine, done); - } else { - startEnrollEngine(enrollEngine, 0, done); - } - } - }); - } catch(error) { - console.info(`${tag} failed to init enrollIntelligentvoiceEngine: ${JSON.stringify(error)}`); - done(); - } - } - - function getSupportedRegions(enrollEngine, done) { - try { - enrollEngine.getSupportedRegions((err, data) => { - if (err) { - console.log(`${tag} get supported regions err: ${JSON.stringify(err)}`); - expect(false).assertTrue(); - done(); - } else { - console.log(`${tag} get supported regions success`); - let regions = data; - expect(regions.length).assertEqual(1); - for (let region in regions) { - console.info(`supported region: ${region}`); - } - initEnrollEngine(enrollEngine, false, done); - } - }); - } catch (error) { - console.info(`${tag} failed to createEnrollIntelligentVoiceEngine: ${JSON.stringify(error)}`); - done(); - } - } - - function enrollAsync(enrollEngine, done) { - try { - let descriptor = { - wakeupPhrase: '小艺小艺' - } - intelligentVoice.createEnrollIntelligentVoiceEngine(descriptor, (err, data) => { - if (err) { - console.log(`${tag} createEnrollIntelligentVoiceEngine err: ${JSON.stringify(err)}`); - expect(false).assertTrue(); - done(); - } else { - console.log(`${tag} createEnrollIntelligentVoiceEngine success`); - enrollEngine = data; - getSupportedRegions(enrollEngine, done); - } - }); - } catch (error) { - console.info(`${tag} failed to createEnrollIntelligentVoiceEngine: ${JSON.stringify(error)}`); - done(); - } - } - - function stopEnrollAsync(enrollEngine, done) { - try { - let descriptor = { - wakeupPhrase: '小艺小艺' - } - intelligentVoice.createEnrollIntelligentVoiceEngine(descriptor, (err, data) => { - if (err) { - console.log(`${tag} createEnrollIntelligentVoiceEngine err: ${JSON.stringify(err)}`); - expect(false).assertTrue(); - done(); - } else { - console.log(`${tag} createEnrollIntelligentVoiceEngine success`); - enrollEngine = data; - initEnrollEngine(enrollEngine, true, done) - } - }); - } catch (error) { - console.info(`${tag} failed to createEnrollIntelligentVoiceEngine: ${JSON.stringify(error)}`); - done(); - } - } - - async function enrollPromise(descriptor, done) { - let enrollEngine = null; - try { - enrollEngine = await intelligentVoice.createEnrollIntelligentVoiceEngine(descriptor); - console.log(`${tag} createEnrollIntelligentVoiceEngine success`); - } catch (error) { - console.info(`${tag} failed to createEnrollIntelligentVoiceEngine: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - let regions = await enrollEngine.getSupportedRegions(); - console.log(`${tag} get supported regions success`); - expect(regions.length).assertEqual(1); - for (let region in regions) { - console.info(`supported region: ${region}`); - } - } catch (error) { - console.info(`${tag} failed to get supported regions : ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - let config = { - language: 'zh', - region: 'CN' - } - - try { - let initRet = await enrollEngine.init(config); - console.log(`${tag} init EnrollIntelligentVoiceEngine success`); - } catch(error) { - console.info(`${tag} failed to init EnrollIntelligentVoiceEngine: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - let startRet = await enrollEngine.enrollForResult(false); - console.log(`${tag} start EnrollIntelligentVoiceEngine finish`); - expect(startRet).not().assertUndefined(); - } catch(error) { - console.info(`${tag} failed to start EnrollIntelligentVoiceEngine: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - let commitRet = await enrollEngine.commit(); - console.log(`${tag} commit enroll finish`); - } catch(error) { - console.info(`${tag} failed to commit enroll: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - let wakeupHapInfo = { - bundleName: 'example_bundle_name', - abilityName: 'example_ability_name' - } - await enrollEngine.setWakeupHapInfo(wakeupHapInfo); - console.log(`${tag} set wakeup hap info success`); - } catch(error) { - console.info(`${tag} failed to set wakeup hap info: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - await enrollEngine.setSensibility(intelligentVoice.SensibilityType.LOW_SENSIBILITY); - console.log(`${tag} set sensibility success`); - } catch(error) { - console.info(`${tag} failed to set sensibility: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - await enrollEngine.setParameter('scene', '0'); - console.log(`${tag} set parameter success`); - } catch(error) { - console.info(`${tag} failed to set parameter: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - let param = await enrollEngine.getParameter('key'); - console.log(`${tag} get parameter success`); - expect(param).assertEqual('value'); - } catch(error) { - console.info(`${tag} failed to get parameter: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - await enrollEngine.release(); - console.log(`${tag} release EnrollIntelligentVoiceEngine success`); - } catch(error) { - console.info(`${tag} failed to release EnrollIntelligentVoiceEngine: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - done(); - } - async function stopEnrollPromise(descriptor, done) { - let enrollEngine = null; - try { - enrollEngine = await intelligentVoice.createEnrollIntelligentVoiceEngine(descriptor); - console.log(`${tag} createEnrollIntelligentVoiceEngine success`); - } catch (error) { - console.info(`${tag} failed to createEnrollIntelligentVoiceEngine: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - let config = { - language: 'zh', - region: 'CN' - } - - try { - let initRet = await enrollEngine.init(config); - console.log(`${tag} init EnrollIntelligentVoiceEngine success`); - } catch(error) { - console.info(`${tag} failed to init EnrollIntelligentVoiceEngine: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - await enrollEngine.stop(); - console.log(`${tag} stop EnrollIntelligentVoiceEngine success`); - } catch(error) { - console.info(`${tag} failed to stop EnrollIntelligentVoiceEngine: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - await enrollEngine.release(); - console.log(`${tag} release EnrollIntelligentVoiceEngine success`); - } catch(error) { - console.info(`${tag} failed to release EnrollIntelligentVoiceEngine: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - done(); - } - - // Defines a test suite. Two parameters are supported: test suite name and test suite function. - beforeAll(async function () { - // Presets an action, which is performed only once before all test cases of the test suite start. - // This API supports only one parameter: preset action function. - console.info(`${tag}: beforeAll: Prerequisites at the test suite level`); - await sleep(100); - console.info(`${tag}: beforeAll: END`); - }) - beforeEach(async function () { - console.info(`${tag}: beforeEach: Prerequisites at the test case level`); - await sleep(100); - }) - afterEach(async function () { - console.info(`${tag}: afterEach: Test case-level clearance conditions`); - await sleep(100); - }) - afterAll(function () { - console.info(`${tag}: afterAll: Test suite-level cleanup condition`); - }) - - /** - *@tc.number : SUB_AI_INTELLIGENT_VOICE_ENROLL_PROCESS_ASYNC_0100 - *@tc.name : INTELLIGENT_VOICE_ENROLL_PROCESS_ASYNC - *@tc.desc : INTELLIGENT_VOICE_ENROLL_PROCESS_ASYNC - *@tc.size : MEDIUM - *@tc.type : Function - *@tc.level : Level 3 - */ - it('SUB_AI_INTELLIGENT_VOICE_ENROLL_PROCESS_ASYNC_0100', 3, async function (done) { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - let enrollEngine = null; - enrollAsync(enrollEngine, done); - }) - /** - *@tc.number : SUB_AI_INTELLIGENT_VOICE_STOP_ENROLL_PROCESS_ASYNC_0100 - *@tc.name : INTELLIGENT_VOICE_STOP_ENROLL_PROCESS_ASYNC - *@tc.desc : INTELLIGENT_VOICE_STOP_ENROLL_PROCESS_ASYNC - *@tc.size : MEDIUM - *@tc.type : Function - *@tc.level : Level 2 - */ - it('SUB_AI_INTELLIGENT_VOICE_STOP_ENROLL_PROCESS_ASYNC_0100', 2, async function (done) { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - let enrollEngine = null; - stopEnrollAsync(enrollEngine, done); - }) - /** - *@tc.number : SUB_AI_INTELLIGENT_VOICE_ENROLL_PROCESS_PROMISE_0100 - *@tc.name : INTELLIGENT_VOICE_ENROLL_PROCESS_PROMISE - *@tc.desc : INTELLIGENT_VOICE_ENROLL_PROCESS_PROMISE - *@tc.size : MEDIUM - *@tc.type : Function - *@tc.level : Level 3 - */ - it('SUB_AI_INTELLIGENT_VOICE_ENROLL_PROCESS_PROMISE_0100', 3, async function (done) { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - let descriptor = { - wakeupPhrase: '小艺小艺' - } - enrollPromise(descriptor, done); - }) - /** - *@tc.number : SUB_AI_INTELLIGENT_VOICE_STOP_ENROLL_PROCESS_PROMISE_0100 - *@tc.name : INTELLIGENT_VOICE_STOP_ENROLL_PROCESS_PROMISE - *@tc.desc : INTELLIGENT_VOICE_STOP_ENROLL_PROCESS_PROMISE - *@tc.size : MEDIUM - *@tc.type : Function - *@tc.level : Level 2 - */ - it('SUB_AI_INTELLIGENT_VOICE_STOP_ENROLL_PROCESS_PROMISE_0100', 2, async function (done) { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - let descriptor = { - wakeupPhrase: '小艺小艺' - } - stopEnrollPromise(descriptor, done); - }) -}) -} \ No newline at end of file diff --git a/ai/intelligent_voice_framework/src/main/ets/test/IntelligentVoiceManagerApi10.test.ets b/ai/intelligent_voice_framework/src/main/ets/test/IntelligentVoiceManagerApi10.test.ets deleted file mode 100644 index 4b5a67c4237d4f899977a6de6f64ab6886d369ec..0000000000000000000000000000000000000000 --- a/ai/intelligent_voice_framework/src/main/ets/test/IntelligentVoiceManagerApi10.test.ets +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2023 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 intelligentVoice from '@ohos.ai.intelligentVoice'; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' - -export default function intelligentVoiceManagerApi10Test() { -describe('ActsIntelligentVoiceManagerApi10Test', function () { - let tagFrmwk = "intelligentvoiceManagerApi10Test"; - console.info(`${tagFrmwk}: Create IntelligentvoiceManger Object JS Framework`); - let intelligentvoiceManager = null; - function getIntelligentvoiceManager() { - intelligentvoiceManager = intelligentVoice.getIntelligentVoiceManager(); - if (intelligentvoiceManager != null) { - console.info(`${tagFrmwk}: getIntelligentvoiceManger : PASS`); - } else { - console.info(`${tagFrmwk}: getIntelligentvoiceManger : FAIL`); - } - } - - // Defines a test suite. Two parameters are supported: test suite name and test suite function. - beforeAll(async function () { - // Presets an action, which is performed only once before all test cases of the test suite start. - // This API supports only one parameter: preset action function. - console.info(`${tagFrmwk}: beforeAll: Prerequisites at the test suite level`); - await getIntelligentvoiceManager(); - console.info(`${tagFrmwk}: beforeAll: END`); - }) - beforeEach(async function () { - // Presets an action, which is performed before each unit test case starts. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: preset action function. - console.info(`${tagFrmwk}: beforeEach: Prerequisites at the test case level`); - }) - afterEach(async function () { - // Presets a clear action, which is performed after each unit test case ends. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: clear action function. - console.info(`${tagFrmwk}: afterEach: Test case-level clearance conditions`); - }) - afterAll(function () { - // Presets a clear action, which is performed after all test cases of the test suite end. - // This API supports only one parameter: clear action function. - console.info(`${tagFrmwk}: afterAll: Test suite-level cleanup condition`); - }) - - /** - *@tc.number : SUB_AI_INTELLIGENT_VOICE_ENGINE_TYPE_0100 - *@tc.name : INTELLIGENT_VOICE_ENGINE_TYPE - *@tc.desc : INTELLIGENT_VOICE_ENGINE_TYPE - *@tc.size : MEDIUM - *@tc.type : Function - *@tc.level : Level 1 - */ - it('SUB_AI_INTELLIGENT_VOICE_ENGINE_TYPE_0100', 1, function (done) { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - expect(intelligentVoice.IntelligentVoiceEngineType.ENROLL_ENGINE_TYPE).assertEqual(0); - expect(intelligentVoice.IntelligentVoiceEngineType.WAKEUP_ENGINE_TYPE).assertEqual(1); - expect(intelligentVoice.IntelligentVoiceEngineType.UPDATE_ENGINE_TYPE).assertEqual(2); - done(); - }) - /** - *@tc.number : SUB_AI_INTELLIGENT_VOICE_ENROLL_RESULT_0100 - *@tc.name : INTELLIGENT_VOICE_ENROLL_RESULT - *@tc.desc : INTELLIGENT_VOICE_ENROLL_RESULT - *@tc.size : MEDIUM - *@tc.type : Function - *@tc.level : Level 1 - */ - it('SUB_AI_INTELLIGENT_VOICE_ENROLL_RESULT_0100', 1, function (done) { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - expect(intelligentVoice.EnrollResult.SUCCESS).assertEqual(0); - expect(intelligentVoice.EnrollResult.VPR_TRAIN_FAILED).assertEqual(-1); - expect(intelligentVoice.EnrollResult.WAKEUP_PHRASE_NOT_MATCH).assertEqual(-2); - expect(intelligentVoice.EnrollResult.TOO_NOISY).assertEqual(-3); - expect(intelligentVoice.EnrollResult.TOO_LOUD).assertEqual(-4); - expect(intelligentVoice.EnrollResult.INTERVAL_LARGE).assertEqual(-5); - expect(intelligentVoice.EnrollResult.DIFFERENT_PERSON).assertEqual(-6); - expect(intelligentVoice.EnrollResult.UNKNOWN_ERROR).assertEqual(-100); - done(); - }) - /** - *@tc.number : SUB_AI_INTELLIGENT_VOICE_WAKEUP_EVENT_0100 - *@tc.name : INTELLIGENT_VOICE_WAKEUP_EVENT - *@tc.desc : INTELLIGENT_VOICE_WAKEUP_EVENT - *@tc.size : MEDIUM - *@tc.type : Function - *@tc.level : Level 1 - */ - it('SUB_AI_INTELLIGENT_VOICE_WAKEUP_EVENT_0100', 1, function (done) { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - expect(intelligentVoice.WakeupIntelligentVoiceEventType.INTELLIGENT_VOICE_EVENT_WAKEUP_NONE).assertEqual(0); - expect(intelligentVoice.WakeupIntelligentVoiceEventType.INTELLIGENT_VOICE_EVENT_RECOGNIZE_COMPLETE).assertEqual(1); - done(); - }) - /** - *@tc.number : SUB_AI_INTELLIGENT_VOICE_ERROR_CODE_0100 - *@tc.name : INTELLIGENT_VOICE_ERROR_CODE - *@tc.desc : INTELLIGENT_VOICE_ERROR_CODE - *@tc.size : MEDIUM - *@tc.type : Function - *@tc.level : Level 1 - */ - it('SUB_AI_INTELLIGENT_VOICE_ERROR_CODE_0100', 1, function (done) { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - expect(intelligentVoice.IntelligentVoiceErrorCode.INTELLIGENT_VOICE_NO_MEMORY).assertEqual(22700101); - expect(intelligentVoice.IntelligentVoiceErrorCode.INTELLIGENT_VOICE_INVALID_PARAM).assertEqual(22700102); - expect(intelligentVoice.IntelligentVoiceErrorCode.INTELLIGENT_VOICE_INIT_FAILED).assertEqual(22700103); - expect(intelligentVoice.IntelligentVoiceErrorCode.INTELLIGENT_VOICE_COMMIT_ENROLL_FAILED).assertEqual(22700104); - done(); - }) - /** - *@tc.number : SUB_AI_INTELLIGENT_VOICE_ENGINE_MANAGER_0100 - *@tc.name : INTELLIGENT_VOICE_ENGINE_MANAGER - *@tc.desc : INTELLIGENT_VOICE_ENGINE_MANAGER - *@tc.size : MEDIUM - *@tc.type : Function - *@tc.level : Level 2 - */ - it('SUB_AI_INTELLIGENT_VOICE_ENGINE_MANAGER_0100', 2, function (done) { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - try { - let info = intelligentvoiceManager.getCapabilityInfo(); - expect(info.length).assertEqual(2); - for (let key in info) { - console.info(`supported intelligent voice engine type: ${key}`); - } - } catch (error) { - console.info(`failed to get supported intelligent voice engine type: ${JSON.stringify(error)}`); - done(); - return; - } - - intelligentvoiceManager.on('serviceChange', (serviceChangeType) => {}); - expect(true).assertTrue(); - intelligentvoiceManager.off('serviceChange'); - expect(true).assertTrue(); - - expect(intelligentVoice.ServiceChangeType.SERVICE_UNAVAILABLE).assertEqual(0); - // expect(intelligentVoice.IntelligentVoiceEngineType.WAKEUP_ENGINE_TYPE).assertEqual(1); - // expect(intelligentVoice.IntelligentVoiceEngineType.UPDATE_ENGINE_TYPE).assertEqual(2); - done(); - }) -}) -} \ No newline at end of file diff --git a/ai/intelligent_voice_framework/src/main/ets/test/List.test.ets b/ai/intelligent_voice_framework/src/main/ets/test/List.test.ets deleted file mode 100644 index e6c0816e075c2a2e2ca4bb8d26d0b3efaf5875bc..0000000000000000000000000000000000000000 --- a/ai/intelligent_voice_framework/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2023 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 intelligentVoiceManagerApi10Test from './IntelligentVoiceManagerApi10.test' -import enrollIntelligentVoiceEngineTest from './EnrollIntelligentVoiceEngine.test' -import wakeupIntelligentVoiceEngineTest from './WakeupIntelligentVoiceEngine.test' - -export default function testsuite() { - intelligentVoiceManagerApi10Test() - enrollIntelligentVoiceEngineTest() - wakeupIntelligentVoiceEngineTest() -} \ No newline at end of file diff --git a/ai/intelligent_voice_framework/src/main/ets/test/WakeupIntelligentVoiceEngine.test.ets b/ai/intelligent_voice_framework/src/main/ets/test/WakeupIntelligentVoiceEngine.test.ets deleted file mode 100644 index 81a50424edca8f329daa9f06f7c752b3d6d00dd5..0000000000000000000000000000000000000000 --- a/ai/intelligent_voice_framework/src/main/ets/test/WakeupIntelligentVoiceEngine.test.ets +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright (c) 2023 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 intelligentVoice from '@ohos.ai.intelligentVoice'; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' - -export default function wakeupIntelligentVoiceEngineTest() { -describe('ActsWakeupIntelligentVoiceEngineTest', function () { - let tag = "wakeupIntelligentvoiceEngineTest"; - console.info(`${tag}: Create WakeupIntelligentvoiceEngine Object JS Framework`); - function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } - - function releaseWakeupEngine(wakeupEngine, done) { - try { - wakeupEngine.release(err => { - if (err) { - console.info(`${tag} releaseWakeupEngine err: ${JSON.stringify(err)}`); - done(); - return; - } else { - console.log(`${tag} releaseWakeupEngine success`); - done(); - } - }); - } catch (error) { - console.info(`${tag} failed to releaseWakeupEngine: ${JSON.stringify(error)}`); - done(); - } - } - - function getParameter(wakeupEngine, key, done) { - try { - wakeupEngine.getParameter(key, (err, data) => { - if (err) { - console.info(`${tag} get parameter err: ${JSON.stringify(err)}`); - done(); - return; - } else { - console.log(`${tag} get parameter success`); - let param = data; - expect(param).assertEqual('value'); - releaseWakeupEngine(wakeupEngine, done); - } - }); - } catch (error) { - console.info(`${tag} failed to get parameter: ${JSON.stringify(error)}`); - done(); - } - } - - function setParameter(wakeupEngine, key, value, done) { - try { - wakeupEngine.setParameter(key, value, err => { - if (err) { - console.info(`${tag} set parameter err: ${JSON.stringify(err)}`); - done(); - return; - } else { - console.log(`${tag} set parameter success`); - getParameter(wakeupEngine, 'key', done); - } - }); - } catch (error) { - console.info(`${tag} failed to set parameter: ${JSON.stringify(error)}`); - done(); - } - } - - function setSensibility(wakeupEngine, sensibility, done) { - try { - wakeupEngine.setSensibility(sensibility, err => { - if (err) { - console.info(`${tag} set sensibility err: ${JSON.stringify(err)}`); - done(); - return; - } else { - console.log(`${tag} set sensibility success`); - setParameter(wakeupEngine, 'scene', '0', done); - } - }); - } catch (error) { - console.info(`${tag} failed to set sensibility: ${JSON.stringify(error)}`); - done(); - } - } - - function setWakeupHapInfo(wakeupEngine, wakeupHapInfo, done) { - try { - wakeupEngine.setWakeupHapInfo(wakeupHapInfo, err => { - if (err) { - console.info(`${tag} set wakeup hap info err: ${JSON.stringify(err)}`); - done(); - return; - } else { - console.log(`${tag} set wakeup hap info success`); - setSensibility(wakeupEngine, intelligentVoice.SensibilityType.MIDDLE_SENSIBILITY, done); - } - }); - } catch (error) { - console.info(`${tag} failed to set wakeup hap info: ${JSON.stringify(error)}`); - done(); - } - } - - function getSupportedRegions(wakeupEngine, done) { - try { - wakeupEngine.getSupportedRegions((err, data) => { - if (err) { - console.log(`${tag} get supported regions err: ${JSON.stringify(err)}`); - expect(false).assertTrue(); - done(); - } else { - console.log(`${tag} get supported regions success`); - let regions = data; - expect(regions.length).assertEqual(1); - for (let region in regions) { - console.info(`supported region: ${region}`); - } - let wakeupHapInfo = { - bundleName: 'example_bundle_name', - abilityName: 'example_ability_name' - } - setWakeupHapInfo(wakeupEngine, wakeupHapInfo, done); - } - }); - } catch (error) { - console.info(`${tag} failed to createEnrollIntelligentVoiceEngine: ${JSON.stringify(error)}`); - done(); - } - } - function wakeupAsync(wakeupEngine, done) { - try { - let descriptor = { - needReconfirm: true, - wakeupPhrase: '小艺小艺' - } - intelligentVoice.createWakeupIntelligentVoiceEngine(descriptor, (err, data) => { - if (err) { - console.log(`${tag} createWakeupIntelligentVoiceEngine err: ${JSON.stringify(err)}`); - expect(false).assertTrue(); - done(); - } else { - console.log(`${tag} createWakeupIntelligentVoiceEngine success`); - wakeupEngine = data; - getSupportedRegions(wakeupEngine, done); - } - }); - } catch (error) { - console.info(`${tag} failed to createWakeupIntelligentVoiceEngine: ${JSON.stringify(error)}`); - done(); - } - } - - async function wakeupPromise(descriptor, done) { - let wakeupEngine = null; - try { - wakeupEngine = await intelligentVoice.createWakeupIntelligentVoiceEngine(descriptor); - console.log(`${tag} createWakeupIntelligentVoiceEngine success`); - } catch (error) { - console.info(`${tag} failed to createWakeupIntelligentVoiceEngine: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - let regions = await wakeupEngine.getSupportedRegions(); - console.log(`${tag} get supported regions success`); - expect(regions.length).assertEqual(1); - for (let region in regions) { - console.info(`supported region: ${region}`); - } - } catch (error) { - console.info(`${tag} failed to get supported regions: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - let wakeupHapInfo = { - bundleName: 'example_bundle_name', - abilityName: 'example_ability_name' - } - await wakeupEngine.setWakeupHapInfo(wakeupHapInfo); - console.log(`${tag} set wakeup hap info success`); - } catch (error) { - console.info(`${tag} failed to set wakeup hap info: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - await wakeupEngine.setSensibility(intelligentVoice.SensibilityType.HIGH_SENSIBILITY); - console.log(`${tag} set sensibility success`); - } catch(error) { - console.info(`${tag} failed to set sensibility: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - await wakeupEngine.setParameter('scene', '0'); - console.log(`${tag} set parameter success`); - } catch(error) { - console.info(`${tag} failed to set parameter: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - let param = await wakeupEngine.getParameter('key'); - console.log(`${tag} get parameter success`); - expect(param).assertEqual('value'); - } catch(error) { - console.info(`${tag} failed to get parameter: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - wakeupEngine.on('wakeupIntelligentVoiceEvent', (callback) => { - console.info(`${tag}: wakeup intelligentvoice event`); - for (let prop in callback) { - console.info(`${tag}: intelligentvoice prop: ${prop}`); - } - }); - console.log(`${tag} register wakeup event success`); - wakeupEngine.off('wakeupIntelligentVoiceEvent'); - console.log(`${tag} unregister wakeup event success`); - expect(true).assertTrue(); - done(); - } catch(error) { - console.info(`${tag} failed to register wakeup event: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - - try { - await wakeupEngine.release(); - console.log(`${tag} release WakeupIntelligentVoiceEngine success`); - } catch(error) { - console.info(`${tag} failed to release WakeupIntelligentVoiceEngine: ${JSON.stringify(error)}`); - expect(false).assertTrue(); - done(); - return; - } - done(); - } - // Defines a test suite. Two parameters are supported: test suite name and test suite function. - beforeAll(async function () { - // Presets an action, which is performed only once before all test cases of the test suite start. - // This API supports only one parameter: preset action function. - console.info(`${tag}: beforeAll: Prerequisites at the test suite level`); - await sleep(100); - console.info(`${tag}: beforeAll: END`); - }) - beforeEach(async function () { - console.info(`${tag}: beforeEach: Prerequisites at the test case level`); - await sleep(100); - }) - afterEach(async function () { - console.info(`${tag}: afterEach: Test case-level clearance conditions`); - await sleep(100); - }) - afterAll(function () { - console.info(`${tag}: afterAll: Test suite-level cleanup condition`); - }) - - /** - *@tc.number : SUB_AI_INTELLIGENT_VOICE_WAKEUP_PROCESS_ASYNC_0100 - *@tc.name : INTELLIGENT_VOICE_WAKEUP_PROCESS_ASYNC - *@tc.desc : INTELLIGENT_VOICE_WAKEUP_PROCESS_ASYNC - *@tc.size : MEDIUM - *@tc.type : Function - *@tc.level : Level 3 - */ - it('SUB_AI_INTELLIGENT_VOICE_WAKEUP_PROCESS_ASYNC_0100', 3, async function (done) { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - let wakeupEngine = null; - - wakeupAsync(wakeupEngine, done); - }) - /** - *@tc.number : SUB_AI_INTELLIGENT_VOICE_WAKEUP_PROCESS_PROMISE_0100 - *@tc.name : INTELLIGENT_VOICE_WAKEUP_PROCESS_PROMISE - *@tc.desc : INTELLIGENT_VOICE_WAKEUP_PROCESS_PROMISE - *@tc.size : MEDIUM - *@tc.type : Function - *@tc.level : Level 3 - */ - it('SUB_AI_INTELLIGENT_VOICE_WAKEUP_PROCESS_PROMISE_0100', 3, async function (done) { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - let descriptor = { - needApAlgEngine: true, - wakeupPhrase: '小艺小艺' - } - wakeupPromise(descriptor, done); - }) -}) -} \ No newline at end of file diff --git a/ai/intelligent_voice_framework/src/main/module.json b/ai/intelligent_voice_framework/src/main/module.json deleted file mode 100644 index cf86f4bff8b1c8a6496f896a873fbc9d7b19803a..0000000000000000000000000000000000000000 --- a/ai/intelligent_voice_framework/src/main/module.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "default", - "tablet" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/ai/intelligent_voice_framework/src/main/resources/base/element/color.json b/ai/intelligent_voice_framework/src/main/resources/base/element/color.json deleted file mode 100644 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/ai/intelligent_voice_framework/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/ai/intelligent_voice_framework/src/main/resources/base/element/string.json b/ai/intelligent_voice_framework/src/main/resources/base/element/string.json deleted file mode 100644 index 1057d34da48309c00cfdb476e812ee9ab906a63e..0000000000000000000000000000000000000000 --- a/ai/intelligent_voice_framework/src/main/resources/base/element/string.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - }, - { - "name": "description_application", - "value": "demo for test" - }, - { - "name": "app_name", - "value": "Demo" - } - ] -} \ No newline at end of file diff --git a/ai/intelligent_voice_framework/src/main/resources/base/media/icon.png b/ai/intelligent_voice_framework/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/ai/intelligent_voice_framework/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/ai/intelligent_voice_framework/src/main/resources/base/profile/test_pages.json b/ai/intelligent_voice_framework/src/main/resources/base/profile/test_pages.json deleted file mode 100644 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/ai/intelligent_voice_framework/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -}